PaymentComponentsController
public final class PaymentComponentsController : BottomSheetsProviderProtocol, GiniHealthTrackingDelegate
extension PaymentComponentsController: BanksSelectionProtocol
extension PaymentComponentsController: PaymentComponentViewProtocol
extension PaymentComponentsController: ShareInvoiceBottomViewProtocol
extension PaymentComponentsController: InstallAppBottomViewProtocol
extension PaymentComponentsController: PaymentReviewProtocol
The PaymentComponentsController
class allows control over the payment components.
-
handling the Payment Component Controller delegate
Declaration
Swift
public weak var delegate: PaymentComponentsControllerProtocol?
-
storing the current selected payment provider
Declaration
Swift
public var selectedPaymentProvider: PaymentProvider?
-
Initializer of the Payment Component Controller class.
Declaration
Swift
public init(giniHealth: GiniHealth & PaymentComponentsConfigurationProvider & PaymentComponentsStringsProvider)
Parameters
giniHealth
An instance of GiniHealth initialized with GiniHealthAPI.
Return Value
- instance of the payment component controller class
-
Initiates the payment flow for a specified document and payment information.
This method sets up the payment flow by storing the provided document ID, payment information, and navigation controller. If a
selectedPaymentProvider
is available, it either presents the payment review screen or the payment view bottom sheet, depending on the configuration. If no payment provider is selected, it directly presents the payment view bottom sheet.Declaration
Swift
public func startPaymentFlow(documentId: String?, paymentInfo: GiniHealthSDK.PaymentInfo?, navigationController: UINavigationController, trackingDelegate: GiniHealthTrackingDelegate?)
Parameters
documentId
An optional identifier for the document associated id with the payment flow.
paymentInfo
An optional
PaymentInfo
object containing the payment details.navigationController
The
UINavigationController
used to present subsequent view controllers in the payment flow. -
Checks if the document is payable by extracting the IBAN.
Declaration
Swift
public func checkIfDocumentIsPayable(docId: String, completion: @escaping (Result<Bool, GiniHealthError>) -> Void)
Parameters
docId
The ID of the uploaded document.
completion
A closure for processing asynchronous data received from the service. It has a Result type parameter, representing either success or failure. The completion block is called on the main thread. In the case of success, it includes a boolean value indicating whether the IBAN was extracted successfully. In case of failure, it returns an error from the server side.
-
Provides a custom Gini view for the payment view that is going to be presented as a bottom sheet.
Declaration
Swift
public func paymentViewBottomSheet(documentId: String?) -> UIViewController
Parameters
documentId
An optional identifier for the document associated id with the payment.
Return Value
A configured
UIViewController
for displaying the payment bottom view. -
Provides a custom Gini view for the bank selection bottom sheet.
Declaration
Swift
public func bankSelectionBottomSheet() -> UIViewController
Return Value
A configured
UIViewController
for displaying the bank selection options. -
Provides a custom Gini view for installing the app if not present.
This method initializes an
InstallAppBottomViewModel
with the necessary configurations and localized strings, and returns anInstallAppBottomView
configured with the view model.Declaration
Swift
public func installAppBottomSheet() -> BottomSheetViewController
Return Value
A configured
BottomSheetViewController
for the app installation process. -
Provides a custom Gini view to onboard the user about the sharing invoices flow.
This method initializes a
ShareInvoiceBottomViewModel
with the necessary configurations and localized strings, and returns aShareInvoiceBottomView
configured with the view model. It also increments the onboarding count for the selected payment provider.Declaration
Swift
public func shareInvoiceBottomSheet(qrCodeData: Data) -> BottomSheetViewController
Parameters
qrCodeData
A qrCode data information for the document associated payment request generated by the payment details.
Return Value
A configured
BottomSheetViewController
for sharing invoices. -
Updates the selected payment provider with the given payment provider. This method is used when updating the payment provider from Payment Review Screen
Declaration
Swift
public func updatedPaymentProvider(_ paymentProvider: GiniHealthAPILibrary.PaymentProvider)
Parameters
paymentProvider
The new payment provider to be set.
-
Notifies the controller that the Payment Review Screen has closed, enabling the cleanup of stored data used to manage various flows.
Declaration
Swift
public func paymentReviewClosed(with previousPresentedView: PaymentComponentScreenType?)
-
Opens the more information view controller by notifying the view delegate. This method is used when opening the More Information screen inside the bank selection bottom sheet that’s presented in the Payment Review Screen.
This method triggers the delegate’s action for displaying more information.
Declaration
Swift
public func openMoreInformationViewController()
-
Checks if the payment provider app can be opened based on the selected payment provider and GPC(Gini Pay Connect) support.
Declaration
Swift
public func canOpenPaymentProviderApp() -> Bool
-
Checks if the selected payment provider supports the “Open With” feature on iOS.
Declaration
Swift
public func supportsOpenWith() -> Bool
-
Checks if the selected payment provider supports GPC(Gini Pay Connect) on iOS.
Declaration
Swift
public func supportsGPC() -> Bool
-
Creates a payment request and obtains the PDF URL using the provided payment information.
Declaration
Swift
public func obtainPDFURLFromPaymentRequest(paymentInfo: GiniInternalPaymentSDK.PaymentInfo, viewController: UIViewController)
Parameters
paymentInfo
The payment information for the request.
viewController
The view controller used to present any necessary UI related to the request.
-
Creates a payment request using the provided payment information.
Declaration
Swift
public func createPaymentRequest(paymentInfo: GiniInternalPaymentSDK.PaymentInfo, completion: @escaping (Result<String, GiniHealthAPILibrary.GiniError>) -> Void)
Parameters
paymentInfo
The payment information to be used for the request.
completion
A closure to be executed once the request is completed, containing the result of the operation.
-
Submits feedback for the specified document and its updated extractions. Method used to update the information extracted from a document.
Declaration
Swift
public func submitFeedback(for document: GiniHealthAPILibrary.Document, updatedExtractions: [GiniHealthAPILibrary.Extraction], completion: ((Result<Void, GiniHealthAPILibrary.GiniError>) -> Void)?)
Parameters
document
The document for which feedback is being submitted.
updatedExtractions
The updated extractions related to the document.
completion
An optional closure to be executed upon completion, containing the result of the submission.
-
Retrieves a preview for the specified document and page number.
Declaration
Swift
public func preview(for documentId: String, pageNumber: Int, completion: @escaping (Result<Data, GiniHealthAPILibrary.GiniError>) -> Void)
Parameters
documentId
The ID of the document to preview.
pageNumber
The page number of the document to retrieve.
completion
A closure that gets called with the result containing either the preview data or an error.
-
Opens the payment provider app using the specified request ID and universal link.
Declaration
Swift
public func openPaymentProviderApp(requestId: String, universalLink: String)
Parameters
requestId
The ID of the payment request.
universalLink
The universal link to open the payment provider app.
-
Retrieves a payment request using the provided payment request ID.
Declaration
Swift
public func getPaymentRequest(by id: String, completion: @escaping (Result<PaymentRequest, GiniHealthAPILibrary.GiniError>) -> Void)
Parameters
id
The ID of the payment request to retrieve.
completion
A closure to be executed once the retrieval is completed, containing the result of the operation as a
PaymentRequest
object on success or aGiniError
on failure. -
Updates the selected payment provider and notifies the delegate with the provider and optional document ID.
Declaration
Swift
public func didSelectPaymentProvider(paymentProvider: GiniHealthAPILibrary.PaymentProvider)
-
Handles the action when the continue button is tapped on the share bottom sheet.
Declaration
Swift
public func didTapOnContinueOnShareBottomSheet()
-
Handles the action when the forward button is tapped on the install bottom sheet.
Declaration
Swift
public func didTapForwardOnInstallBottomSheet()
-
Handles the action when the pay button is tapped on install bottom sheet.
Declaration
Swift
public func didTapOnPayButton()
-
Handles the action when the more information button is tapped on the payment component view, using the provided document ID.
Declaration
Swift
public func didTapOnMoreInformation(documentId: String?)
-
Handles the action when the bank picker button is tapped on the payment component view, using the provided document ID.
Declaration
Swift
public func didTapOnBankPicker(documentId: String?)
-
Handles the action when the pay invoice button is tapped on the payment component view, using the provided document ID.
Declaration
Swift
public func didTapOnPayInvoice(documentId: String?)
-
Undocumented
Declaration
Swift
public func presentShareInvoiceBottomSheet(paymentRequestId: String, paymentInfo: GiniInternalPaymentSDK.PaymentInfo)
-
Updates the selected payment provider from the bank selection bottom view and notifies the delegate with the selected provider and document ID.
Declaration
Swift
public func didSelectPaymentProvider(paymentProvider: PaymentProvider)
-
Notifies the delegate when the close button is tapped on bank selection bottom view
Declaration
Swift
public func didTapOnClose()
-
Notifies the delegate when the more information button is tapped on the bank selection bottom view
Declaration
Swift
public func didTapOnMoreInformation()
-
Notifies the delegate to continue sharing the invoice with the provided document ID.
Declaration
Swift
public func didTapOnContinueToShareInvoice()
-
Undocumented
Declaration
Swift
public func didTapOnContinue()
-
Submits feedback for the specified document and its updated extractions. Method used to update the information extracted from a document.
Declaration
Swift
public func submitFeedback(for documentId: String, updatedExtractions: [GiniHealthAPILibrary.Extraction], completion: ((Result<Void, GiniHealthAPILibrary.GiniError>) -> Void)?)
Parameters
document
The document for which feedback is being submitted.
updatedExtractions
The updated extractions related to the document.
completion
An optional closure to be executed upon completion, containing the result of the submission.
-
Determines if the specified error should be handled internally by the SDK.
Declaration
Swift
public func shouldHandleErrorInternally(error: GiniHealthAPILibrary.GiniError) -> Bool
Parameters
error
The Gini error to evaluate.
Return Value
A Boolean value indicating whether the error should be handled internally.
-
Tracks the event when the keyboard is closed on the payment review screen.
This method informs the tracking delegate about the keyboard close event.
Declaration
Swift
public func trackOnPaymentReviewCloseKeyboardClicked()
-
Tracks the event when the close button is clicked on the payment review screen.
This method notifies the tracking delegate about the close button click event.
Declaration
Swift
public func trackOnPaymentReviewCloseButtonClicked()
-
Tracks the event when the bank button is clicked on the payment review screen.
Declaration
Swift
public func trackOnPaymentReviewBankButtonClicked(providerName: String)
Parameters
providerName
The name of the payment provider associated with the button click.
-
Notifies the tracking delegate of an event occurring on the payment review screen.
This method forwards the event to the
trackingDelegate
, which can handle it based on the event type and any associated data.Declaration
Swift
public func onPaymentReviewScreenEvent(event: TrackingEvent<PaymentReviewScreenEventType>)
Parameters
event
A
TrackingEvent
of typePaymentReviewScreenEventType
that describes the specific event that occurred on the payment review screen.