import { SubmissionEventTypes } from '@oneblink/types'; import { FormSubmissionResult } from '../types/submissions'; /** * Payment providers whose payment form is rendered by the application itself * (e.g. Westpac QuickStream). Every other provider redirects the user to a * payment form hosted by the provider. */ export type InAppPaymentType = 'WESTPAC_QUICK_STREAM'; /** * Everything an in-app payment form needs to take a payment. It is passed * between the application that creates the payment and the page that renders * the payment form as URL search parameters, so the page does not need to read * the submission from local storage. */ export type PaymentFormSession = { paymentType: InAppPaymentType; formId: number; formSubmissionPaymentId: string; integrationEnvironmentId: string; amount: number; customerReferenceNumber: string; }; /** * `true` if the payment provider renders its payment form inside the * application instead of redirecting to a provider hosted form. */ export declare function paymentProviderRendersInApp(type: string): type is InAppPaymentType; /** * Get the URL the user should be sent to in order to pay. Hosted providers * return the provider's hosted form URL. In-app providers return the * application's payment form URL with the payment session appended. */ export declare function getPaymentHandoff({ hostedFormUrl, paymentSubmissionEvent, formId, amount, customerReferenceNumber, }: { hostedFormUrl: string; paymentSubmissionEvent: SubmissionEventTypes.FormPaymentEvent; formId: number; amount: number; /** The resolved customer reference number. Falls back to the configured value. */ customerReferenceNumber?: string; }): string; /** Get the payment handoff URL for a form submission that requires a payment. */ export declare function getFormSubmissionPaymentHandoff(formSubmissionResult: FormSubmissionResult): string; /** * Read the payment session from the search parameters of an in-app payment form * URL. Throws if the URL does not contain a complete session. */ export declare function getPaymentFormSession(search: string | URLSearchParams): PaymentFormSession;