Skip to content

Commit

Permalink
Merge branch 'main' into PP-732-IPC-320-EC-128-release-candidates-for…
Browse files Browse the repository at this point in the history
…-bank-capture-health-merchant
  • Loading branch information
danicretu committed Aug 20, 2024
2 parents 64c72b6 + 38cbce3 commit 6ec97f7
Show file tree
Hide file tree
Showing 39 changed files with 228 additions and 777 deletions.
4 changes: 1 addition & 3 deletions merchant-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ The Gini Merchant SDK for Android provides all the UI and functionality needed t
method in Android apps. The payment information can be reviewed and paid using any available payment provider app (e.g.,
banking app).

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

Documentation
-------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class OrdersActivity : AppCompatActivity() {
is GiniMerchant.MerchantSDKEvents.OnScreenDisplayed -> {
when (event.displayedScreen) {
DisplayedScreen.MoreInformationFragment -> setActivityTitle(net.gini.android.merchant.sdk.R.string.gms_more_information_fragment_title)
DisplayedScreen.ReviewFragment -> setActivityTitle(R.string.title_fragment_order_details)
else -> { setActivityTitle(R.string.title_activity_orders) }
}
}
Expand Down
Binary file modified merchant-sdk/sdk/src/doc/source/_static/logo_flat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 6 additions & 10 deletions merchant-sdk/sdk/src/doc/source/authentication.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
Authentication
==============

The entry point for the Gini Merchant SDK is ``GiniMerchant`` class which depends
on ``GiniHealthAPI`` from the Gini Health API Library to interact with the Gini Health API.
The entry point for the Gini Merchant SDK is the ``GiniMerchant`` class.

The ``GiniHealthAPI`` class can be built either with client credentials (clientId and clientSecret)
or with a ``SessionManager`` if you have a token. For these two cases there are helper methods:
The ``GiniMerchant`` class can be built either with client credentials (clientId and clientSecret)
or with a ``SessionManager`` if you have a token:

- ``getGiniApi(context: Context, clientId: String, clientSecret: String, emailDomain: String)``
- ``getGiniApi(context: Context, sessionManager: SessionManager)``
- ``GiniMerchant(context: Context, clientId: String, clientSecret: String, emailDomain: String)``
- ``GiniMerchant(context: Context, sessionManager: SessionManager)``

``SessionManager`` is an interface which you need to implement to send the token.

For more details about ``GiniHealthAPI`` see the `Gini Health API Library
<https://github.com/gini/gini-mobile-android/tree/main/health-api-library/>`_.
``SessionManager`` is an interface which you need to implement to send the token.
31 changes: 14 additions & 17 deletions merchant-sdk/sdk/src/doc/source/customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ the following snippet to one of your resources XML file (e.g, ``colors.xml``):
If you overridde the ``GiniMerchantTheme``, the theme colors you set there override the color palette customization.

Find the names of the color resources in the color palette (you can also view it in Figma `here
<https://www.figma.com/file/AJTss4k0M6R2OxH0VQepdP/Android-Gini-Health-SDK-3.0.0-UI-Customisation?type=design&node-id=8502%3A357&mode=design&t=A1pTQWjJWSBUR6Zi-1>`_):
<https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4709&t=SIAN8JzXJ0GIPfwg-0>`_):

.. raw:: html

<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="600" height="450"
src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FAJTss4k0M6R2OxH0VQepdP%2FAndroid-Gini-Health-SDK-3.0.0-UI-Customisation%3Ftype%3Ddesign%26node-id%3D8502%253A357%26mode%3Ddesign%26t%3DA1pTQWjJWSBUR6Zi-1"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-5745&t=SIAN8JzXJ0GIPfwg-0"
allowfullscreen></iframe>

|
Expand Down Expand Up @@ -128,12 +128,12 @@ application, use the root style as the parent, for example:
We use ``android:lineSpacingMultiplier`` in combination with ``android:textSize`` to support resizing text for accessibility and avoid overlapping text.

Preview our typography and find the names of the style resources (you can also view it in Figma `here
<https://www.figma.com/file/AJTss4k0M6R2OxH0VQepdP/Android-Gini-Health-SDK-3.0.0-UI-Customisation?type=design&node-id=8503%3A491&mode=design&t=zZkiuvx3neNm8Tmv-1>`_):
<https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-5837&t=SIAN8JzXJ0GIPfwg-0>`_):

.. raw:: html

<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="600" height="450"
src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FAJTss4k0M6R2OxH0VQepdP%2FAndroid-Gini-Health-SDK-3.0.0-UI-Customisation%3Ftype%3Ddesign%26node-id%3D8503%253A491%26mode%3Ddesign%26t%3DzZkiuvx3neNm8Tmv-1"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-5837&t=SIAN8JzXJ0GIPfwg-0"
allowfullscreen></iframe>

|
Expand All @@ -157,7 +157,7 @@ Payment Component
~~~~~~~~~~~~~~~~~

You can also view the UI customisation guide in Figma `here
<https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8663-1324&mode=design&t=OX3i9T5ItG0jIln0-4>`_.
<https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4843&t=SIAN8JzXJ0GIPfwg-0>`_.

.. note::

Expand All @@ -166,7 +166,7 @@ You can also view the UI customisation guide in Figma `here
.. raw:: html

<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="600" height="450"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8663-1324&mode=design&t=OX3i9T5ItG0jIln0-4"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4843&t=SIAN8JzXJ0GIPfwg-0"
allowfullscreen></iframe>

|
Expand All @@ -175,7 +175,7 @@ Bank Selection Bottom Sheet
~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also view the UI customisation guide in Figma `here
<https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8794-1437&mode=design&t=OX3i9T5ItG0jIln0-4>`_.
<https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4904&t=SIAN8JzXJ0GIPfwg-0>`_.

.. note::

Expand All @@ -184,7 +184,7 @@ You can also view the UI customisation guide in Figma `here
.. raw:: html

<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="600" height="450"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8794-1437&mode=design&t=OX3i9T5ItG0jIln0-4"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4904&t=SIAN8JzXJ0GIPfwg-0"
allowfullscreen></iframe>

|
Expand All @@ -193,7 +193,7 @@ Payment Feature Info Screen
~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also view the UI customisation guide in Figma `here
<https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8865-1784&mode=design&t=OX3i9T5ItG0jIln0-4>`_.
<https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4931&t=SIAN8JzXJ0GIPfwg-0>`_.

.. warning::

Expand All @@ -207,19 +207,16 @@ You can also view the UI customisation guide in Figma `here
.. raw:: html

<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="600" height="450"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8865-1784&mode=design&t=OX3i9T5ItG0jIln0-4"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-4931&t=SIAN8JzXJ0GIPfwg-0"
allowfullscreen></iframe>

|
Payment Review Screen
~~~~~~~~~~~~~~~~~~~~~

You can also view the UI customisation guide in Figma `here
<https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8856-2345&mode=design&t=OX3i9T5ItG0jIln0-4>`_.

.. note::

The close button in the top right corner is disabled by default. You can enable it by setting the
``showCloseButton`` to ``true`` when creating a ``ReviewConfiguration``.
<https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-5024&t=SIAN8JzXJ0GIPfwg-0>`_.

.. note::

Expand All @@ -228,6 +225,6 @@ You can also view the UI customisation guide in Figma `here
.. raw:: html

<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="600" height="450"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/file/kI24VceZD7WzNpEkE6f0fX/Android-Gini-Health-SDK-4.1-UI-Customisation?type=design&node-id=8856-2345&mode=design&t=OX3i9T5ItG0jIln0-4"
src="https://www.figma.com/embed?embed_host=share&url=https://www.figma.com/design/L4VkRRCLQcUR6pvSe0axtE/Android-Gini-Merchant-SDK-1.0-UI-Customisation?node-id=12530-5024&t=SIAN8JzXJ0GIPfwg-0"
allowfullscreen></iframe>

67 changes: 10 additions & 57 deletions merchant-sdk/sdk/src/doc/source/event-tracking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,16 @@ Event Tracking
GiniMerchant
----------

The ``GiniMerchant`` class exposes kotlin flows which you can collect to track events. The following flows are available:
The ``GiniMerchant`` class exposes a kotlin flow which you can collect to track events:

* ``documentFlow`` is a ``StateFlow`` of ``ResultWrapper<Document>`` which emits the Gini Health API's document used by
the ``ReviewFragment``. It emits the following states:
* ``ResultWrapper.Loading()`` when the document is being loaded.
* ``ResultWrapper.Success(document)`` when the document is available.
* ``ResultWrapper.Error(throwable)`` when there was an error loading the document.
* ``paymentFlow`` is a ``StateFlow`` of ``ResultWrapper<PaymentDetails>`` which emits the payment information shown in
the ``ReviewFragment``.
* ``ResultWrapper.Loading()`` when the payment details are being loaded.
* ``ResultWrapper.Success(paymentDetails)`` when the payment details are available.
* ``ResultWrapper.Error(throwable)`` when there was an error loading the payment details.
* ``openBankState`` is a ``StateFlow`` of ``PaymentState`` which emits the state of opening the banking app. It emits
the following states:
* ``PaymentState.NoAction()`` is the idle state.
* ``PaymentState.Loading()`` when the user requested to open the banking app and the Merchant SDK started creating a
payment request.
* ``PaymentState.Success(paymentRequest)`` when the payment request is ready and the banking app will be opened.
* ``PaymentState.Error(throwable)`` when there was an error creating the payment request or opening the banking app.
* ``eventsFlow`` is a ``SharedFlow`` of ``MerchantSDKEvents``. It emits the following events:
* ``NoAction`` is the idle state
* ``OnLoading`` when communicating with the Gini Merchant API (e.g., creating a payment request).
* ``OnScreenDisplayed(displayedScreen)`` when there is a change in the screens displayed within the payment flow.
* ``OnFinishedWithPaymentRequestCreated(paymentRequestId, paymentProviderName)`` when the payment request is ready and the user is redirected to the bank.
* ``OnFinishedWithCancellation`` when the payment flow was cancelled. Can be either from an internal error, or from exiting the payment flow without finalising it.
* ``OnErrorOccurred(throwable)`` when there was an error within the payment flow.

PaymentComponent
----------------
.. note::

The ``PaymentComponent`` class also exposes kotlin flows which you can collect to track events. The following flows are available:

* ``paymentProviderAppsFlow`` is a ``StateFlow`` of ``PaymentProviderAppsState`` which emits the available payment provider apps used by
the ``PaymentComponentView`` and related screens. It emits the following states:
* ``PaymentProviderAppsState.Loading()`` when the payment provider apps are being loaded.
* ``PaymentProviderAppsState.Success(paymentProviderApps)`` when the list of payment provider apps is available.
* ``PaymentProviderAppsState.Error(throwable)`` when there was an error loading the payment provider apps.
* ``selectedPaymentProviderAppFlow`` is a ``StateFlow`` of ``SelectedPaymentProviderAppState`` which emits selected payment provider app shown in
the ``PaymentComponentView`` and related screens. It emits the following states:
* ``SelectedPaymentProviderAppState.NothingSelected()`` when there is no selection.
* ``SelectedPaymentProviderAppState.AppSelected(paymentProviderApp)`` when a payment provider app has been selected.

ReviewFragment
--------------

To get informed of ``ReviewFragment`` events (like the user clicking the "close" or "next" button) you can implement
the ``ReviewFragmentListener`` and set it on the fragment.

.. code-block:: kotlin
val reviewConfiguration = ReviewConfiguration(...)
val paymentReviewFragment = paymentComponent.getPaymentReviewFragment(
documentId, reviewConfiguration
)
paymentReviewFragment.listener = object : ReviewFragmentListener {
override fun onCloseReview() {
// Called only when the ``ReviewConfiguration.showCloseButton`` was set to ``true``.
// Dismiss the ReviewFragment.
}
override fun onToTheBankButtonClicked(paymentProviderName: String) {
// Log or track the used payment provider name.
// No action required, the payment process is handled by the Gini Merchant SDK.
}
}
``OnFinishedWithPaymentRequestCreated`` and ``OnFinishedWithCancellation`` can be checked for to remove the ``PaymentFragment`` from the hierarchy.
Loading

0 comments on commit 6ec97f7

Please sign in to comment.