Skip to content

Commit

Permalink
docs(GiniHealthSDK): Review suggestions for the Integrations and Test…
Browse files Browse the repository at this point in the history
…ing guides

IPC-218
  • Loading branch information
zladzeyka committed Mar 28, 2024
1 parent 702297a commit 7e0a29a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 23 deletions.
46 changes: 28 additions & 18 deletions HealthSDK/GiniHealthSDK/Documentation/source/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ The Gini Health SDK for iOS provides all the UI and functionality needed to use

The Gini Health API provides an information extraction service for analyzing health invoices. Specifically, it extracts information such as the document sender or the payment relevant information (amount to pay, IBAN, etc.). In addition it also provides a secure channel for sharing payment related information between clients.

**Note** For supporting each payment provider you need to specify `LSApplicationQueriesSchemes` in your `Info.plist` file. App schemes for specification will be provided by Gini.
> ⚠️ **Important:**
For supporting each payment provider you need to specify `LSApplicationQueriesSchemes` in your `Info.plist` file. App schemes for specification will be provided by Gini.


## GiniHealthAPI initialization

> ⚠️ **Important:**
You should have received Gini Health API client credentials from us. Please get in touch with us in case you don't have them.

You can easy initialize `GiniHealthAPI` with the client credentials:

```swift
let apiLib = GiniHealthAPI.Builder(client: client).build()
```

If you want to use a transparent proxy with your own authentication you can specify your own domain and add `AlternativeTokenSource` protocol implementation:

```swift
Expand All @@ -25,27 +33,25 @@ The token your provide will be added as a bearer token to all api.custom.net req

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)
```swift
let giniApiLib = GiniHealthAPI
let apiLib = GiniHealthAPI
.Builder(client: Client(id: "your-id",
secret: "your-secret",
domain: "your-domain"),
api: .default,
pinningConfig: yourPublicPinningConfig)
.build()
```
> ⚠️ **Important**
> - The document metadata for the upload process is intended to be used for reporting.

## GiniHealth initialization

Now that the `GiniHealthAPI` has been initialized, you can initialize `GiniHealth`
Now that the `GiniHealthAPI` has been initialized, you can initialize `GiniHealth`:

```swift
let healthSDK = GiniHealth(with: giniApiLib)
```
## Document upload

and upload your document if you plan to do it with `GiniHealth`. First you need get document service and create partial document.
For the document upload if you plan to do it with `GiniHealth`. First you need get document service and create partial document.

```swift
let documentService: DefaultDocumentService = healthSDK.documentService()
Expand All @@ -70,7 +76,7 @@ self.healthSDK.documentService

## Check which documents/invoices are payable

There is a method in GiniHealth:
GiniHealth provides a method for checking if the document is payable or not.

```swift
healthSDK.checkIfDocumentIsPayable(docId: String,
Expand Down Expand Up @@ -101,13 +107,15 @@ dispatchGroup.notify(queue: .main) {
We provide a custom payment component view to help users pay the invoice/document.
Please follow the steps below for the payment component integration.

### 1. Create an instance of the `PaymentComponentsController` class with a `GiniHealth` as parameter.
### 1. Create an instance of the `PaymentComponentsController`.

```swift
let paymentComponentsController = PaymentComponentsController(giniHealth: health)
```

### 2. Load the payment providers by calling the `loadPaymentProviders` function from the `PaymentComponentsController` and listen to the `PaymentComponentsControllerProtocol`.
### 2. Load the payment providers

You will load the list of the payment providers by calling the `loadPaymentProviders` function from the `PaymentComponentsController` and conform to the `PaymentComponentsControllerProtocol`.

```swift
paymentComponentsController.delegate = self // where self is your viewController
Expand All @@ -119,13 +127,15 @@ You can show/hide an `UIActivityIndicator` based on that.

* `PaymentComponentsControllerProtocol` provides completion handlers when `PaymentComponentsController` fetched successfully payment providers or when it failed with an error.

**Note:**
> **Note:**
It should be sufficient to call paymentComponentsController.loadPaymentProviderApps() only once when your app starts.

> - We effectively handle situations where there are no payment providers available.
> - Based on the payment provider's colors, the `UIView` will automatically change its color.
### 3. Show the Payment Component view and listen to the `PaymentComponentViewProtocol`.
### 3. Show the Payment Component view

In this step you will show a payment component view and conform to the `PaymentComponentViewProtocol`.

Depending on the value of `isPayable`, incorporate the corresponding payment component view into your cells using this function:

Expand All @@ -138,17 +148,17 @@ public func paymentView(documentId: String) -> UIView
* `PaymentComponentViewProtocol` is the view protocol and provides events handlers when the user tapped on various areas on the payment component view (more information icon, bank/payment provider picker, the pay invoice button and etc.).

> - Make sure you properly link these delegates to get notified.
> - Make sure you properly link `PaymentComponentsControllerProtocol` and `PaymentComponentViewProtocol` delegates to get notified.
## Show PaymentInfoViewController

The `PaymentInfoViewController` displays information and an FAQ section about the payment feature.
It requires a `PaymentComponentsController` instance (see `Integrate the Payment component` step 1).

> **Note:**
> - The `PaymentInfoViewController` can be presented modally, used in a container view or pushed to a navigation view controller. Make sure to add your own navigational elements around the provided views.
> - The `PaymentInfoViewController` can be presented modally, used in a container view or pushed to a navigation view controller. Make sure to add your own navigation around the provided views.
> **Important:**
> ⚠️ **Important:**
> - The `PaymentInfoViewController` presentation should happen in `func didTapOnMoreInformation(documentId: String?)` inside
`PaymentComponentViewProtocol` implementation.(`Integrate the Payment component` step 3).

Expand All @@ -167,9 +177,9 @@ If a banking app is not installed it will also display its AppStore link.
The `BankSelectionBottomSheet` presentation requires a `PaymentComponentsController` instance from the `Integrate the Payment component` step 1.

> **Note:**
> - The `BankSelectionBottomSheet` can be presented modally, used in a container view or pushed to a navigation view controller. Make sure to add your own navigational elements around the provided views.
> - The `BankSelectionBottomSheet` can be presented modally, used in a container view or pushed to a navigation view controller. Make sure to add your own navigation around the provided views.
> **Important:**
> ⚠️ **Important:**
> - The `BankSelectionBottomSheet` presentation should happen in `func didTapOnBankPicker(documentId: String?)` inside
`PaymentComponentViewProtocol` implementation (see `Integrate the Payment component` step 3).

Expand All @@ -189,9 +199,9 @@ The `PaymentReviewViewController` displays an invoice's pages and extractions. I
The `PaymentReviewViewController` presentation requires a `PaymentComponentsController` instance from the `Integrate the Payment component` step 1 and `documentId`.

> **Note:**
> - The `PaymentReviewViewController` can be presented modally, used in a container view or pushed to a navigation view controller. Make sure to add your own navigational elements around the provided views.
> - The `PaymentReviewViewController` can be presented modally, used in a container view or pushed to a navigation view controller. Make sure to add your own navigation around the provided views.
> **Important:**
> ⚠️ **Important:**
> - The `PaymentReviewViewController` presentation should happen in `func didTapOnBankPicker(documentId: String?)` inside
`PaymentComponentViewProtocol` implementation (see `Integrate the Payment component` step 3).

Expand Down
12 changes: 7 additions & 5 deletions HealthSDK/GiniHealthSDK/Documentation/source/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ Testing

In order for banking apps to be able to return the user to your app after the payment has been resolved you need register a scheme for your app to respond to a deep link scheme known by the Gini Bank API.

> **Info:**
You should already have a scheme and host from us. Please contact us in case you don't have them.

The following is an example for the deep link gini-pay://payment-requester:
The following is an example for the deep link `gini-pay://payment-requester`:

<br>
<center><img src="img/Integration guide/SchemeExample.png" width="600"/></center>
</br>
Expand All @@ -27,7 +29,7 @@ After you've set the client credentials in the example banking app and installed

#### Payment component

After following the integration steps above you'll arrive at the `Invoice list screen` which already has integrated the `Payment Component`.
After following the integration steps above you'll arrive at the `Payment Invoice list screen`, which already has integrated the `Payment Component`.
The following screenshot shows a sample list of invoices where the `PaymentComponent` is shown for each invoice.

<br>
Expand All @@ -36,23 +38,23 @@ The following screenshot shows a sample list of invoices where the `PaymentCompo

#### Bank Selection Bottom sheet

You should see the `Gini-Test-Payment-Provider` preselected in every payment component view. By clicking the picker you should see the `BankSelectionBottomSheet` with the list of available banking apps (including Gini-Test-Payment-Provider and other testing and production apps)
You should see the `Gini-Test-Payment-Provider` preselected in every payment component view. By clicking the picker you should see the `BankSelectionBottomSheet` with the list of available banking apps (including `Gini-Test-Payment-Provider` and other testing and production apps).

<br>
<center><img src="img/Integration guide/BankSelectionBottomSheet.png" height="500"/></center>
</br>

#### More information and FAQ

By clicking either the more information or the info icon on the payment component view you should see the Payment feature Info screen with information about the payment feature and an FAQ section.
By clicking either the more information or the info icon on the `Payment Component` view you should see the `Payment feature Info screen` with information about the payment feature and an FAQ section.

<br>
<center><img src="img/Integration guide/PaymentFeatureInformationScreen.png" height="500"/></center>
</br>

#### Payment Review

By clicking the `Pay the invoice` button on a payment component view you should see the ReviewFragment, which shows the invoice's pages and the payment information. It also allows editing the payment information. The `To the banking app` button should have the icon and colors of the banking app, which was selected in the payment component view.
By clicking the `Pay the invoice` button on a `Payment Component` view you should see the `Payment Review screen`, which shows the invoice's pages and the payment information. It also allows editing the payment information. The `To the banking app` button should have the icon and colors of the banking app, which was selected in the payment component view.

Check that the extractions and the document preview are shown and then press the `Pay` button:

Expand Down

0 comments on commit 7e0a29a

Please sign in to comment.