Skip to content

Commit 656a229

Browse files
author
Team Mobile Schorsch
committed
Release version 3.1.0
1 parent 6b7a512 commit 656a229

14 files changed

+82
-31
lines changed

Documentation/sections/Documentation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Further documentation with information about how install and integrate it can be
2020

2121
## Requirements
2222

23-
- iOS 11+
23+
- iOS 12+
2424
- Xcode 12+
2525

2626
## Author

Documentation/source/Getting started.md

+18-7
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,25 @@ If you want to use a transparent proxy with your own authentication you can spec
2222

2323
```swift
2424
let apiLib = GiniBankAPI.Builder(customApiDomain: "api.custom.net",
25-
alternativeTokenSource: MyAlternativeTokenSource)
25+
alternativeTokenSource: MyAlternativeTokenSource)
2626
.build()
2727
```
28-
The token your provide will be added as a bearer token to all api.custom.net requests.
28+
The token you provide will be added as a bearer token to all `api.custom.net` requests.
29+
30+
You can also specify a custom path segment, if your proxy url requires it:
31+
32+
```swift
33+
let giniBankAPI = GiniBankAPI
34+
.Builder(client: client,
35+
api: .custom(domain: "api.custom.net",
36+
path: "/custom/path",
37+
tokenSource: MyAlternativeTokenSource))
38+
.build()
39+
```
2940

3041
## Public Key Pinning
3142

32-
If you want to use _Certificate pinning_, provide metadata for the upload process, you can pass both your public key pinning configuration (see [TrustKit repo](https://github.com/datatheorem/TrustKit) for more information), the metadata information (the [Gini Bank API](https://developer.gini.net/gini-api/html/index.html) is used by default) as follows:
43+
If you want to use _Certificate pinning_, then pass your public key pinning configuration (see [TrustKit repo](https://github.com/datatheorem/TrustKit) for more information) as follows:
3344

3445
```swift
3546
let yourPublicPinningConfig = [
@@ -66,14 +77,12 @@ For customizing an API domain please, use the following snippet:
6677
.Builder(client: Client(id: "your-id",
6778
secret: "your-secret",
6879
domain: "your-domain"),
69-
api: .custom(domain: "custom-api.net"),
80+
api: .custom(domain: "custom-api.net",
81+
path:"/custom/path"),
7082
pinningConfig: yourPublicPinningConfig)
7183
.build()
7284
```
7385

74-
> ⚠️ **Important**
75-
> - The document metadata for the upload process is intended to be used for reporting.
76-
7786
## Extract Hash From gini.net
7887

7988
The current Gini Bank API public key SHA256 hash digest in Base64 encoding can be extracted with the following openssl commands:
@@ -126,6 +135,8 @@ documentService.createDocument(fileName: "myFirstDocument.jpg",
126135
}
127136
}
128137
```
138+
> ⚠️ **Important**
139+
> - The document metadata for the upload process is intended to be used for reporting. You can find out more about it in the [Gini Bank API](https://pay-api.gini.net/documentation) documentation.
129140
130141
Each page of a document needs to uploaded as a partial document. In addition documents consisting of one page also should be uploaded as a partial document.
131142

Documentation/source/Installation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ Once you have your Swift package set up, adding `GiniBankAPILibrary` as a depend
1010

1111
```swift
1212
dependencies: [
13-
.package(url: "https://github.com/gini/bank-api-library-ios.git", .exact("1.6.0"))
13+
.package(url: "https://github.com/gini/bank-api-library-ios.git", .exact("3.1.0"))
1414
]
1515
```
1616

1717
In case that you want to use the certificate pinning in the library, add `GiniBankAPILibraryPinning`:
1818
```swift
1919
dependencies: [
20-
.package(url: "https://github.com/gini/bank-api-library-pinning-ios.git", .exact("1.6.0"))
20+
.package(url: "https://github.com/gini/bank-api-library-pinning-ios.git", .exact("3.1.0"))
2121
]
2222
```
2323

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55

66
let package = Package(
77
name: "GiniBankAPILibrary",
8-
platforms: [.iOS(.v11)],
8+
platforms: [.iOS(.v12)],
99
products: [
1010
// Products define the executables and libraries a package produces, and make them visible to other packages.
1111
.library(

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Further documentation with information about how install and integrate it can be
1919

2020
## Requirements
2121

22-
- iOS 11+
22+
- iOS 12+
2323
- Xcode 12+
2424

2525
## Author

Sources/GiniBankAPILibrary/Documents/APIResource.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public enum APIDomain {
1616
case custom(domain: String, path: String? = nil, tokenSource: AlternativeTokenSource?)
1717

1818
var domainString: String {
19-
2019
switch self {
2120
case .default: return "pay-api.gini.net"
2221
case .gym: return "gym.gini.net"
@@ -26,9 +25,8 @@ public enum APIDomain {
2625

2726
var path: String {
2827
switch self {
29-
case .default: return ""
30-
case .gym: return ""
3128
case .custom(_, let path, _): return path ?? ""
29+
default: return ""
3230
}
3331
}
3432
}
@@ -72,7 +70,8 @@ struct APIResource<T: Decodable>: Resource {
7270
URLQueryItem(name: "doctype", itemValue: docType?.rawValue)
7371
]
7472
case .paymentRequests(let limit, let offset):
75-
return [URLQueryItem(name: "offset", itemValue: offset),URLQueryItem(name: "limit", itemValue: limit)]
73+
return [URLQueryItem(name: "offset", itemValue: offset),
74+
URLQueryItem(name: "limit", itemValue: limit)]
7675
default: return nil
7776
}
7877
}

Sources/GiniBankAPILibrary/Documents/Core/Auth/UserResource.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public enum UserDomain {
1414
case custom(domain: String, path: String? = nil)
1515

1616
var domainString: String {
17-
1817
switch self {
1918
case .default: return "user.gini.net"
2019
case .custom(let domain, _): return domain
@@ -23,8 +22,8 @@ public enum UserDomain {
2322

2423
var path: String {
2524
switch self {
26-
case .default: return ""
2725
case .custom(_, let path): return path ?? ""
26+
default: return ""
2827
}
2928
}
3029
}
@@ -46,8 +45,8 @@ struct UserResource<T: Decodable>: Resource {
4645
var path: String {
4746
return "\(domain.path)\(methodPath)"
4847
}
49-
50-
private var methodPath: String {
48+
49+
var methodPath: String {
5150
switch method {
5251
case .token:
5352
return "/oauth/token"

Sources/GiniBankAPILibrary/Documents/Core/GiniBankAPI.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ extension GiniBankAPI {
110110
case .custom(_, _, let tokenSource):
111111
var sessionManager : SessionManager
112112
if let tokenSource = tokenSource {
113-
sessionManager = SessionManager(alternativeTokenSource: tokenSource, sessionDelegate: self.sessionDelegate)
113+
sessionManager = SessionManager(alternativeTokenSource: tokenSource, sessionDelegate: self.sessionDelegate)
114114
} else {
115115
sessionManager = SessionManager(userDomain: userApi, sessionDelegate: self.sessionDelegate)
116116
}

Sources/GiniBankAPILibrary/Documents/Core/GiniError.swift

+23-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,37 @@
77

88
import Foundation
99

10+
/**
11+
Protocol representing errors that can occur while interacting with the Gini API.
12+
13+
The protocol defines three properties:
14+
- message: A message describing the error.
15+
- response: The HTTPURLResponse received in the error, if any.
16+
- data: The data received in the error, if any.
17+
*/
18+
1019
public protocol GiniErrorProtocol {
1120
var message: String { get }
1221
var response: HTTPURLResponse? { get }
1322
var data: Data? { get }
1423
}
1524

25+
/**
26+
Enum representing different types of errors that can occur while interacting with the Gini API.
27+
28+
- badRequest: Error indicating that the request was invalid.
29+
- notAcceptable: Error indicating that the request was not acceptable.
30+
- notFound: Error indicating that the requested resource was not found.
31+
- noResponse: Error indicating that no response was received.
32+
- parseError: Error indicating that there was an error parsing the response.
33+
- requestCancelled: Error indicating that the request was cancelled.
34+
- tooManyRequests: Error indicating that too many requests have been made.
35+
- unauthorized: Error indicating that the request was unauthorized.
36+
- unknown: An unknown error occurred.
37+
*/
38+
1639
public enum GiniError: Error, GiniErrorProtocol, Equatable {
1740
case badRequest(response: HTTPURLResponse? = nil, data: Data? = nil)
18-
case invalidCredentials
19-
case keychainError
2041
case notAcceptable(response: HTTPURLResponse? = nil, data: Data? = nil)
2142
case notFound(response: HTTPURLResponse? = nil, data: Data? = nil)
2243
case noResponse
@@ -30,10 +51,6 @@ public enum GiniError: Error, GiniErrorProtocol, Equatable {
3051
switch self {
3152
case .badRequest:
3253
return "Bad request"
33-
case .invalidCredentials:
34-
return "Invalid credentials"
35-
case .keychainError:
36-
return "Keychain error"
3754
case .notAcceptable:
3855
return "Not acceptable"
3956
case .notFound:

Sources/GiniBankAPILibrary/Documents/Payments/Payment.swift

+27
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,33 @@ import Foundation
1010
Struct for payment response
1111
*/
1212
public struct Payment {
13+
/**
14+
An initializer for a `Payment` structure
15+
16+
- parameter paidAt: ISO 8601 date string defining point in time when the payment request was resolved.
17+
- parameter recipient: the recipient of the payment.
18+
- parameter iban: the iban (international bank account number) of the payment recipient.
19+
- parameter bic: the bic (bank identifier code) for the payment.
20+
- parameter purpose: the purpose of the payment, e.g. the invoice or customer identifier.
21+
- parameter links: object with links to other resources e.g. document and paymentRequest.
22+
*/
23+
24+
public init(paidAt: String,
25+
recipient: String,
26+
iban: String,
27+
bic: String? = nil,
28+
amount: String,
29+
purpose: String,
30+
links: PaymentLinks? = nil) {
31+
self.paidAt = paidAt
32+
self.recipient = recipient
33+
self.iban = iban
34+
self.bic = bic
35+
self.amount = amount
36+
self.purpose = purpose
37+
self.links = links
38+
}
39+
1340
public var paidAt, recipient, iban: String
1441
public var bic: String?
1542
public var amount, purpose: String

Sources/GiniBankAPILibrary/GiniBankAPILibraryVersion.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
// Created by Nadya Karaban on 28.10.21.
66
//
77

8-
public let GiniBankAPILibraryVersion = "1.6.0"
8+
public let GiniBankAPILibraryVersion = "3.1.0"

Tests/GiniBankAPILibraryTests/APIResourceTests.swift

-1
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,4 @@ final class APIResourceTests: XCTestCase {
258258
let urlString = resource.url.absoluteString
259259
XCTAssertEqual(urlString, "https://custom.domain.com/custom/path/documents/", "path should match")
260260
}
261-
262261
}

Tests/GiniBankAPILibraryTests/DocumentServiceTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ final class DocumentServicesTests: XCTestCase {
179179
osName: UIDevice.current.systemName,
180180
osVersion: UIDevice.current.systemVersion,
181181
captureSdkVersion: "Not available",
182-
apiLibVersion: "1.6.0",
182+
apiLibVersion: "3.1.0",
183183
description: "Error logging test",
184184
documentId: "1234",
185185
originalRequestId: "5678")

Tests/GiniBankAPILibraryTests/UserResourceTests.swift

-1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,4 @@ class UserResourceTests: XCTestCase {
5454
let urlString = resource.url.absoluteString
5555
XCTAssertEqual(urlString, "https://custom.domain.com/custom/path/api/users")
5656
}
57-
5857
}

0 commit comments

Comments
 (0)