Skip to content

Commit

Permalink
Release version 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Team Mobile Schorsch committed Sep 7, 2023
1 parent 656a229 commit dcc9cc0
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Documentation/sections/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Further documentation with information about how install and integrate it can be

## Requirements

- iOS 12+
- iOS 11+
- Xcode 12+

## Author
Expand Down
17 changes: 9 additions & 8 deletions Documentation/source/Getting started.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ To initialize the library, you just need to provide the API credentials:
If you want to use a transparent proxy with your own authentication you can specify your own domain and add `AlternativeTokenSource` protocol implementation:

```swift
let apiLib = GiniBankAPI.Builder(customApiDomain: "api.custom.net",
alternativeTokenSource: MyAlternativeTokenSource)
.build()
let giniBankAPI = GiniBankAPI
.Builder(customApiDomain: "api.custom.net",
alternativeTokenSource: MyAlternativeTokenSource)
.build()
```
The token you provide will be added as a bearer token to all `api.custom.net` requests.

Expand All @@ -32,9 +33,9 @@ You can also specify a custom path segment, if your proxy url requires it:
```swift
let giniBankAPI = GiniBankAPI
.Builder(client: client,
api: .custom(domain: "api.custom.net",
path: "/custom/path",
tokenSource: MyAlternativeTokenSource))
api: .custom(domain: "api.custom.net",
path: "/custom/path",
tokenSource: MyAlternativeTokenSource))
.build()
```

Expand Down Expand Up @@ -77,8 +78,7 @@ For customizing an API domain please, use the following snippet:
.Builder(client: Client(id: "your-id",
secret: "your-secret",
domain: "your-domain"),
api: .custom(domain: "custom-api.net",
path:"/custom/path"),
api: .custom(domain: "custom-api.net"),
pinningConfig: yourPublicPinningConfig)
.build()
```
Expand Down Expand Up @@ -135,6 +135,7 @@ documentService.createDocument(fileName: "myFirstDocument.jpg",
}
}
```

> ⚠️ **Important**
> - 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.
Expand Down
4 changes: 2 additions & 2 deletions Documentation/source/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Once you have your Swift package set up, adding `GiniBankAPILibrary` as a depend

```swift
dependencies: [
.package(url: "https://github.com/gini/bank-api-library-ios.git", .exact("3.1.0"))
.package(url: "https://github.com/gini/bank-api-library-ios.git", .exact("1.6.1"))
]
```

In case that you want to use the certificate pinning in the library, add `GiniBankAPILibraryPinning`:
```swift
dependencies: [
.package(url: "https://github.com/gini/bank-api-library-pinning-ios.git", .exact("3.1.0"))
.package(url: "https://github.com/gini/bank-api-library-pinning-ios.git", .exact("1.6.1"))
]
```

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PackageDescription

let package = Package(
name: "GiniBankAPILibrary",
platforms: [.iOS(.v12)],
platforms: [.iOS(.v11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Further documentation with information about how install and integrate it can be

## Requirements

- iOS 12+
- iOS 11+
- Xcode 12+

## Author
Expand Down
7 changes: 4 additions & 3 deletions Sources/GiniBankAPILibrary/Documents/APIResource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum APIDomain {
case custom(domain: String, path: String? = nil, tokenSource: AlternativeTokenSource?)

var domainString: String {

switch self {
case .default: return "pay-api.gini.net"
case .gym: return "gym.gini.net"
Expand All @@ -25,8 +26,9 @@ public enum APIDomain {

var path: String {
switch self {
case .default: return ""
case .gym: return ""
case .custom(_, let path, _): return path ?? ""
default: return ""
}
}
}
Expand Down Expand Up @@ -70,8 +72,7 @@ struct APIResource<T: Decodable>: Resource {
URLQueryItem(name: "doctype", itemValue: docType?.rawValue)
]
case .paymentRequests(let limit, let offset):
return [URLQueryItem(name: "offset", itemValue: offset),
URLQueryItem(name: "limit", itemValue: limit)]
return [URLQueryItem(name: "offset", itemValue: offset),URLQueryItem(name: "limit", itemValue: limit)]
default: return nil
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum UserDomain {
case custom(domain: String, path: String? = nil)

var domainString: String {

switch self {
case .default: return "user.gini.net"
case .custom(let domain, _): return domain
Expand All @@ -22,8 +23,8 @@ public enum UserDomain {

var path: String {
switch self {
case .default: return ""
case .custom(_, let path): return path ?? ""
default: return ""
}
}
}
Expand All @@ -45,8 +46,8 @@ struct UserResource<T: Decodable>: Resource {
var path: String {
return "\(domain.path)\(methodPath)"
}

var methodPath: String {
private var methodPath: String {
switch method {
case .token:
return "/oauth/token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ extension GiniBankAPI {
case .custom(_, _, let tokenSource):
var sessionManager : SessionManager
if let tokenSource = tokenSource {
sessionManager = SessionManager(alternativeTokenSource: tokenSource, sessionDelegate: self.sessionDelegate)
sessionManager = SessionManager(alternativeTokenSource: tokenSource, sessionDelegate: self.sessionDelegate)
} else {
sessionManager = SessionManager(userDomain: userApi, sessionDelegate: self.sessionDelegate)
}
Expand Down
29 changes: 6 additions & 23 deletions Sources/GiniBankAPILibrary/Documents/Core/GiniError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,16 @@

import Foundation

/**
Protocol representing errors that can occur while interacting with the Gini API.

The protocol defines three properties:
- message: A message describing the error.
- response: The HTTPURLResponse received in the error, if any.
- data: The data received in the error, if any.
*/

public protocol GiniErrorProtocol {
var message: String { get }
var response: HTTPURLResponse? { get }
var data: Data? { get }
}

/**
Enum representing different types of errors that can occur while interacting with the Gini API.

- badRequest: Error indicating that the request was invalid.
- notAcceptable: Error indicating that the request was not acceptable.
- notFound: Error indicating that the requested resource was not found.
- noResponse: Error indicating that no response was received.
- parseError: Error indicating that there was an error parsing the response.
- requestCancelled: Error indicating that the request was cancelled.
- tooManyRequests: Error indicating that too many requests have been made.
- unauthorized: Error indicating that the request was unauthorized.
- unknown: An unknown error occurred.
*/

public enum GiniError: Error, GiniErrorProtocol, Equatable {
case badRequest(response: HTTPURLResponse? = nil, data: Data? = nil)
case invalidCredentials
case keychainError
case notAcceptable(response: HTTPURLResponse? = nil, data: Data? = nil)
case notFound(response: HTTPURLResponse? = nil, data: Data? = nil)
case noResponse
Expand All @@ -51,6 +30,10 @@ public enum GiniError: Error, GiniErrorProtocol, Equatable {
switch self {
case .badRequest:
return "Bad request"
case .invalidCredentials:
return "Invalid credentials"
case .keychainError:
return "Keychain error"
case .notAcceptable:
return "Not acceptable"
case .notFound:
Expand Down
27 changes: 0 additions & 27 deletions Sources/GiniBankAPILibrary/Documents/Payments/Payment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,6 @@ import Foundation
Struct for payment response
*/
public struct Payment {
/**
An initializer for a `Payment` structure

- parameter paidAt: ISO 8601 date string defining point in time when the payment request was resolved.
- parameter recipient: the recipient of the payment.
- parameter iban: the iban (international bank account number) of the payment recipient.
- parameter bic: the bic (bank identifier code) for the payment.
- parameter purpose: the purpose of the payment, e.g. the invoice or customer identifier.
- parameter links: object with links to other resources e.g. document and paymentRequest.
*/

public init(paidAt: String,
recipient: String,
iban: String,
bic: String? = nil,
amount: String,
purpose: String,
links: PaymentLinks? = nil) {
self.paidAt = paidAt
self.recipient = recipient
self.iban = iban
self.bic = bic
self.amount = amount
self.purpose = purpose
self.links = links
}

public var paidAt, recipient, iban: String
public var bic: String?
public var amount, purpose: String
Expand Down
2 changes: 1 addition & 1 deletion Sources/GiniBankAPILibrary/GiniBankAPILibraryVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
// Created by Nadya Karaban on 28.10.21.
//

public let GiniBankAPILibraryVersion = "3.1.0"
public let GiniBankAPILibraryVersion = "1.6.1"
56 changes: 56 additions & 0 deletions Sources/GiniBankAPILibrary/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>3B52.1</string>
</array>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeOtherDiagnosticData</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<true/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePhotosorVideos</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePaymentInfo</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
</dict>
</plist>
1 change: 1 addition & 0 deletions Tests/GiniBankAPILibraryTests/APIResourceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,5 @@ final class APIResourceTests: XCTestCase {
let urlString = resource.url.absoluteString
XCTAssertEqual(urlString, "https://custom.domain.com/custom/path/documents/", "path should match")
}

}
2 changes: 1 addition & 1 deletion Tests/GiniBankAPILibraryTests/DocumentServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ final class DocumentServicesTests: XCTestCase {
osName: UIDevice.current.systemName,
osVersion: UIDevice.current.systemVersion,
captureSdkVersion: "Not available",
apiLibVersion: "3.1.0",
apiLibVersion: "1.6.1",
description: "Error logging test",
documentId: "1234",
originalRequestId: "5678")
Expand Down
1 change: 1 addition & 0 deletions Tests/GiniBankAPILibraryTests/UserResourceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ class UserResourceTests: XCTestCase {
let urlString = resource.url.absoluteString
XCTAssertEqual(urlString, "https://custom.domain.com/custom/path/api/users")
}

}

0 comments on commit dcc9cc0

Please sign in to comment.