GiniHealth

public final class GiniHealth

GiniHealth is one of the main classes for interacting with the Gini Health SDK. It manages interaction with the Gini Health API.

documentFlow, paymentFlow, openBankState are used by the PaymentFragment to observe their state, but they are public so that they can be observed anywhere, the main purpose for this is to observe errors.

displayedScreen is a shared flow which forwards the DisplayedScreen that is currently visible in the PaymentFragment. It can be observed to update the activity title if needed.

trustMarkersFlow emits TrustMarkerResponse, containing the icons of two payment providers and how many other payment providers are integrating Gini. It can be observed to integrate the trust markers into custom UI.

Constructors

Link copied to clipboard
public GiniHealth GiniHealth(GiniHealthAPI giniHealthAPI, Context context)

Types

Link copied to clipboard
public class Companion
Link copied to clipboard
public class PaymentState
Link copied to clipboard
public final class TrustMarkerResponse

Functions

Link copied to clipboard

Checks whether the invoice contains multiple documents by fetching the invoice and its extractions from the Gini Pay API and verifying whether it has multiple documents or not.

Link copied to clipboard
public final Boolean checkIfDocumentIsPayable(String documentId)

Checks whether the document is payable by fetching the document and its extractions from the Gini Pay API and verifying that the extraction's payment state is "Payable".

Link copied to clipboard
public final SharedFlow<DisplayedScreen> getDisplayedScreen()

A flow for exposing the DisplayedScreen currently visible. It always starts with DisplayedScreen.Nothing. It can be observed to update the UI, such as the toolbar title.

Link copied to clipboard
public final StateFlow<ResultWrapper<Document>> getDocumentFlow()

A flow for getting the Document set for review setDocumentForReview.

Link copied to clipboard
public final HealthApiDocumentManager getDocumentManager()
Link copied to clipboard
public final StateFlow<GiniHealth.PaymentState> getOpenBankState()

A flow that exposes the state of opening the bank. You can collect this flow to get information about the errors of this action.

Link copied to clipboard
public final StateFlow<ResultWrapper<PaymentDetails>> getPaymentFlow()

A flow for getting extracted PaymentDetails for the document set for review (see setDocumentForReview).

Link copied to clipboard

Creates an instance of the PaymentFragment with the given documentId and configuration.

Link copied to clipboard

Creates an instance of PaymentFragment with the given payment details and configuration.

Link copied to clipboard
public final GiniLocalization getSDKLanguage(Context context)

Returns the localization set for the app.

Link copied to clipboard

A flow for getting information about trust markers.

Link copied to clipboard
public final Unit loadPaymentProviders()

Manually load payment provider apps, in case there was an error when trying to load them automatically.

Link copied to clipboard
public final Unit setDocumentForReview(Document document)
public final Unit setDocumentForReview(String documentId, PaymentDetails paymentDetails)

Sets a Document for review. Results can be collected from documentFlow and paymentFlow.

Link copied to clipboard
public final Unit setSavedStateRegistryOwner(SavedStateRegistryOwner registryOwner, CoroutineScope retryScope)

Sets a lifecycle observer to handle state restoration after the system kills the app.

Link copied to clipboard
public final Unit setSDKLanguage(GiniLocalization localization, Context context)

Sets the app language to the desired one from the languages the SDK is supporting. If not set then defaults to the system's language locale.

Properties

Link copied to clipboard
private final SharedFlow<DisplayedScreen> displayedScreen

A flow for exposing the DisplayedScreen currently visible. It always starts with DisplayedScreen.Nothing. It can be observed to update the UI, such as the toolbar title.

Link copied to clipboard
private final StateFlow<ResultWrapper<Document>> documentFlow

A flow for getting the Document set for review setDocumentForReview.

Link copied to clipboard
private final HealthApiDocumentManager documentManager
Link copied to clipboard
private final StateFlow<GiniHealth.PaymentState> openBankState

A flow that exposes the state of opening the bank. You can collect this flow to get information about the errors of this action.

Link copied to clipboard
private final StateFlow<ResultWrapper<PaymentDetails>> paymentFlow

A flow for getting extracted PaymentDetails for the document set for review (see setDocumentForReview).

Link copied to clipboard

A flow for getting information about trust markers.