From d59fc67e7c3598e348b2fc70827d3a49bbd6e680 Mon Sep 17 00:00:00 2001 From: Team Mobile Schorsch Date: Thu, 3 Mar 2022 17:48:07 +0000 Subject: [PATCH] Release version 1.4.0 --- Documentation/source/Installation.md | 4 +-- Documentation/source/Integration.md | 14 +++++++++-- .../GiniCaptureSDKVersion.swift | 2 +- .../Networking/AnalysisResult.swift | 25 ++++++++++++++----- .../GiniNetworkingScreenAPICoordinator.swift | 12 ++++----- 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/Documentation/source/Installation.md b/Documentation/source/Installation.md index 8a87021..6f360e2 100644 --- a/Documentation/source/Installation.md +++ b/Documentation/source/Installation.md @@ -10,14 +10,14 @@ Once you have your Swift package set up, adding `GiniCaptureSDK` as a dependency ```swift dependencies: [ - .package(url: "https://github.com/gini/capture-sdk-ios.git", .exact("1.3.1")) + .package(url: "https://github.com/gini/capture-sdk-ios.git", .exact("1.4.0")) ] ``` In case that you want to use the certificate pinning in the library, add `GiniCaptureSDKPinning`: ```swift dependencies: [ - .package(url: "https://github.com/gini/capture-sdk-pinning-ios.git", .exact("1.3.1")) + .package(url: "https://github.com/gini/capture-sdk-pinning-ios.git", .exact("1.4.0")) ] ``` diff --git a/Documentation/source/Integration.md b/Documentation/source/Integration.md index 3dd6483..02d3f93 100644 --- a/Documentation/source/Integration.md +++ b/Documentation/source/Integration.md @@ -10,7 +10,7 @@ The Gini Capture SDK provides two integration options. A [Screen API](#screen-ap The Screen API provides a custom `UIViewController` object, which can be presented modally. It handles the complete process from showing the onboarding until providing a UI for the analysis. The Screen API, in turn, offers two different ways of implementation: -#### UI with Default Networking (Recommended) +### UI with Default Networking (Recommended) Using this method you don't need to care about handling the analysis process with the [Gini Bank API Library](https://github.com/gini/bank-api-library-ios), you only need to provide your API credentials and a delegate to get the analysis results. ```swift @@ -21,6 +21,8 @@ let viewController = GiniCapture.viewController(withClient: client, present(viewController, animated: true, completion:nil) ``` +#### Certificate Pinning + Optionally 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 and the _API type_ (the [Gini Pay API](https://pay-api.gini.net/documentation/#gini-pay-api-documentation-v1-0) is used by default) as follows: ```swift @@ -59,7 +61,15 @@ present(viewController, animated: true, completion:nil) > - The document metadata for the upload process is intended to be used for reporting. > - The multipage is supported only by the `.default` api. -#### UI with Custom Networking +#### Retrieve the Analyzed Document + +The `AnalysisResult` returned in `GiniCaptureResultsDelegate.giniCaptureAnalysisDidFinishWith(result:, sendFeedbackBlock:)` +will return the analyzed Gini Bank API document in its `document` property. + +When extractions were retrieved without using the Gini Bank API, then the `AnalysisResult.document` will be `nil`. For example when the +extractions came from an EPS QR Code. + +### UI with Custom Networking You can also provide your own networking by implementing the `GiniCaptureNetworkService` and `GiniCaptureResultsDelegate` protocols. Pass your instances to the UIViewController initialiser of GiniCapture as shown below. ```swift diff --git a/Sources/GiniCaptureSDK/GiniCaptureSDKVersion.swift b/Sources/GiniCaptureSDK/GiniCaptureSDKVersion.swift index d102c8c..184db44 100644 --- a/Sources/GiniCaptureSDK/GiniCaptureSDKVersion.swift +++ b/Sources/GiniCaptureSDK/GiniCaptureSDKVersion.swift @@ -5,4 +5,4 @@ // Created by Nadya Karaban on 29.10.21. // -public let GiniCaptureSDKVersion = "1.3.1" +public let GiniCaptureSDKVersion = "1.4.0" diff --git a/Sources/GiniCaptureSDK/Networking/AnalysisResult.swift b/Sources/GiniCaptureSDK/Networking/AnalysisResult.swift index a719f8b..3c7f740 100644 --- a/Sources/GiniCaptureSDK/Networking/AnalysisResult.swift +++ b/Sources/GiniCaptureSDK/Networking/AnalysisResult.swift @@ -9,24 +9,37 @@ import UIKit import GiniBankAPILibrary @objcMembers public class AnalysisResult: NSObject { - /// Images processed in the analysis + /** + * Images processed in the analysis. + */ public let images: [UIImage] - /* + + /** * Specific extractions obtained in the analysis. - * Besides the list of extractions that can be found here - * (http://developer.gini.net/gini-api/html/document_extractions.html#available-specific-extractions), + * + * Besides the list of extractions that can be found + * [here](http://developer.gini.net/gini-api/html/document_extractions.html#available-specific-extractions), * it can also return the epsPaymentQRCodeUrl extraction, obtained from a EPS QR code. */ public let extractions: [String: Extraction] - /* + /** * Line item compound extractions obtained in the analysis. */ public let lineItems: [[Extraction]]? - public init(extractions: [String: Extraction], lineItems: [[Extraction]]? = nil, images: [UIImage]) { + /** + * The analyzed Gini Bank API document. + * + * It returns `nil` when extractions were retrieved without using the Gini Bank API. + * For example when the extractions came from an EPS QR code. + */ + public let document: Document? + + public init(extractions: [String: Extraction], lineItems: [[Extraction]]? = nil, images: [UIImage], document: Document? = nil) { self.images = images self.extractions = extractions self.lineItems = lineItems + self.document = document } } diff --git a/Sources/GiniCaptureSDK/Networking/GiniNetworkingScreenAPICoordinator.swift b/Sources/GiniCaptureSDK/Networking/GiniNetworkingScreenAPICoordinator.swift index c81f69a..9ea541f 100644 --- a/Sources/GiniCaptureSDK/Networking/GiniNetworkingScreenAPICoordinator.swift +++ b/Sources/GiniCaptureSDK/Networking/GiniNetworkingScreenAPICoordinator.swift @@ -112,7 +112,7 @@ import GiniBankAPILibrary } } - public func deliver(result: ExtractionResult, analysisDelegate: AnalysisDelegate) { + public func deliver(result: ExtractionResult, and document: Document? = nil, to analysisDelegate: AnalysisDelegate) { let hasExtactions = result.extractions.count > 0 DispatchQueue.main.async { [weak self] in @@ -126,13 +126,13 @@ import GiniBankAPILibrary }) - let result = AnalysisResult(extractions: extractions, lineItems: result.lineItems, images: images) + let result = AnalysisResult(extractions: extractions, lineItems: result.lineItems, images: images, document: document) let documentService = self.documentService self.resultsDelegate?.giniCaptureAnalysisDidFinishWith(result: result) { updatedExtractions in - documentService.sendFeedback(with: updatedExtractions.map { $0.value }) - documentService.resetToInitialState() + documentService.sendFeedback(with: updatedExtractions.map { $0.value }) + documentService.resetToInitialState() } } else { self.resultsDelegate? @@ -150,7 +150,7 @@ extension GiniNetworkingScreenAPICoordinator { self.documentService.startAnalysis { result in switch result { case .success(let extractions): - self.deliver(result: extractions, analysisDelegate: networkDelegate) + self.deliver(result: extractions, and: self.documentService.document, to: networkDelegate) case .failure(let error): guard error != .requestCancelled else { return } @@ -215,7 +215,7 @@ extension GiniNetworkingScreenAPICoordinator: GiniCaptureDelegate { } let extractionResult = ExtractionResult(extractions: extractions, lineItems: [], returnReasons: []) - self.deliver(result: extractionResult, analysisDelegate: networkDelegate) + self.deliver(result: extractionResult, to: networkDelegate) return }