-
- All Implemented Interfaces:
public class GiniBankApi for interacting with Capture and Payment features.
The Capture feature is a layer of abstraction above Gini Capture SDK and the Return Assistant feature. Capture feature can be used with:
the Screen API by calling startCaptureFlow or startCaptureFlowForIntent.
the Component API by building everything around the provided fragments. See example apps for more details about usage of Screen and Component APIs.
To use capture features, they need to be configured with setCaptureConfiguration. Note that configuration is immutable. releaseCapture needs to be called before passing a new configuration.
To use the pay feature, first setGiniApi needs to be called. The flow for this feature would be:
getRequestId to extract the id from the Intent
getPaymentRequest to get payment details set by the business app.
resolvePaymentRequest to mark the PaymentRequest as paid.
returnToPaymentInitiatorApp to return to the app that started the flow.
-
-
Field Summary
Fields Modifier and Type Field Description private BooleanenableReturnReasonspublic final static GiniBankINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitsetCaptureConfiguration(CaptureConfiguration captureConfiguration)Sets configuration for Capture feature. final UnitreleaseCapture(Context context)Frees up resources used by Capture. final RequirementsReportcheckCaptureRequirements(Context context)Checks hardware requirements for Capture feature. final UnitstartCaptureFlow(ActivityResultLauncher<Unit> resultLauncher)Screen API for starting the capture flow. final CancellationTokenstartCaptureFlowForIntent(ActivityResultLauncher<CaptureImportInput> resultLauncher, Context context, Intent intent)Screen API for starting the capture flow when a pdf or image document was shared from another app. final UnitcreateDocumentForImportedFiles(Intent intent, Context context, AsyncCallback<Document, ImportedFileValidationException> callback)Component APICreates an Document for a pdf or image that was shared from another app. final UnitsetGiniApi(GiniBankAPI giniApi)Set the GiniBankAPI instance to be used for the Pay feature. final UnitreleaseGiniApi()Clears the reference to giniApi set by setGiniApi. final PaymentRequestgetPaymentRequest(String id)Get the payment details for the request created by a business. final ResolvedPaymentresolvePaymentRequest(String requestId, ResolvePaymentInput resolvePaymentInput)Marks the a PaymentRequest as paid. final UnitreturnToPaymentInitiatorApp(Context context, ResolvedPayment resolvedPayment)Starts the app that started the payment flow. final BooleangetEnableReturnReasons()Shows the return reasons dialog in the return assistant, if enabled. final UnitsetEnableReturnReasons(Boolean enableReturnReasons)Shows the return reasons dialog in the return assistant, if enabled. -
-
Method Detail
-
setCaptureConfiguration
final Unit setCaptureConfiguration(CaptureConfiguration captureConfiguration)
Sets configuration for Capture feature. Note that configuration is immutable. releaseCapture needs to be called before passing a new configuration.
-
releaseCapture
final Unit releaseCapture(Context context)
Frees up resources used by Capture.
-
checkCaptureRequirements
final RequirementsReport checkCaptureRequirements(Context context)
Checks hardware requirements for Capture feature. Requirements are not enforced, but are recommended to be checked before using.
-
startCaptureFlow
final Unit startCaptureFlow(ActivityResultLauncher<Unit> resultLauncher)
Screen API for starting the capture flow.
-
startCaptureFlowForIntent
final CancellationToken startCaptureFlowForIntent(ActivityResultLauncher<CaptureImportInput> resultLauncher, Context context, Intent intent)
Screen API for starting the capture flow when a pdf or image document was shared from another app.
-
createDocumentForImportedFiles
final Unit createDocumentForImportedFiles(Intent intent, Context context, AsyncCallback<Document, ImportedFileValidationException> callback)
Component API
Creates an Document for a pdf or image that was shared from another app.
Importing the files is executed on a secondary thread as it can take several seconds for the process to complete. The callback methods are invoked on the main thread.
- Parameters:
intent- the Intent your app receivedcontext- Android contextcallback- A [AsyncCallback} implementation
-
setGiniApi
final Unit setGiniApi(GiniBankAPI giniApi)
Set the GiniBankAPI instance to be used for the Pay feature.
-
releaseGiniApi
final Unit releaseGiniApi()
Clears the reference to giniApi set by setGiniApi.
-
getPaymentRequest
final PaymentRequest getPaymentRequest(String id)
Get the payment details for the request created by a business. The id is sent in an Intent. Use getRequestId for extracting the id from the Intent.
- Parameters:
id- The id sent by the business.
-
resolvePaymentRequest
final ResolvedPayment resolvePaymentRequest(String requestId, ResolvePaymentInput resolvePaymentInput)
Marks the a PaymentRequest as paid.
Important: The amount string in the ResolvePaymentInput must be convertible to a Double. For ex. "12.39" is valid, but "12.39 €" or "12,39" are not valid.
- Parameters:
requestId- id of PaymentRequest to be resolved.resolvePaymentInput- the details used for the actual payment.
-
returnToPaymentInitiatorApp
final Unit returnToPaymentInitiatorApp(Context context, ResolvedPayment resolvedPayment)
Starts the app that started the payment flow.
- Parameters:
context- used to call startActivity.resolvedPayment- the object returned by resolvePaymentRequest
-
getEnableReturnReasons
final Boolean getEnableReturnReasons()
Shows the return reasons dialog in the return assistant, if enabled.
-
setEnableReturnReasons
final Unit setEnableReturnReasons(Boolean enableReturnReasons)
Shows the return reasons dialog in the return assistant, if enabled.
-
-
-
-