import { paymentService } from '@oneblink/sdk-core'; import { SubmissionEventTypes, SubmissionTypes } from '@oneblink/types'; import { FormSubmission, FormSubmissionResult } from './types/submissions'; import { HandlePaymentResult, PaymentReceiptItem } from './types/payments'; import * as westpacQuickStream from './services/payment-providers/WestpacQuickStreamPaymentProvider'; import { getPaymentFormSession, getPaymentHandoff, paymentProviderRendersInApp, type InAppPaymentType, type PaymentFormSession } from './services/payment-handoff'; export { HandlePaymentResult, PaymentReceiptItem, westpacQuickStream }; export { paymentProviderRendersInApp, getPaymentHandoff, getPaymentFormSession }; export type { InAppPaymentType, PaymentFormSession }; /** * Get the receipt URL for a completed in-app payment. The receipt page verifies * the transaction from the query parameters on this URL. * * @param options * @returns */ export declare function getCompletedPaymentReceiptUrl(options: { formSubmissionResult: FormSubmissionResult; formSubmissionPayment: SubmissionTypes.FormSubmissionPayment; }): string; /** * Get the receipt URL for a cancelled in-app payment. * * @param formSubmissionResult * @param formSubmissionPaymentId * @returns */ export declare function getCancelledPaymentReceiptUrl(formSubmissionResult: FormSubmissionResult, formSubmissionPaymentId: string): string; /** * Pass in query string parameters after a redirect back to your app after a * payment is processed. This function will handle all payment submission events * supported by OneBlink. Will return a Transaction and the submission result * that was returned from `handlePaymentSubmissionEvent()` before redirecting to * `payment.hostedFormUrl`. * * #### Example * * ```js * import queryString from 'query-string' * * const query = queryString.parse(window.location.search) * const { transaction, submissionResult } = * await paymentService.handlePaymentQuerystring(query) * ``` * * @param query * @returns */ export declare function handlePaymentQuerystring(query: Record): Promise; export declare function checkForPaymentSubmissionEvent(formSubmission: FormSubmission, submissionTimestamp: string): SubmissionEventTypes.FormPaymentEvent | undefined; /** * Handle a submission result with a payment submission event. Will throw an * error if a transaction has already been made using this submission result. * Will return `undefined` if the submission does not have an amount. Will * return the submission result passed in with a `payment` property if the * submission requires processing. * * #### Example * * ```js * const formSubmissionResult = { * submissionId: '89c6e98e-f56f-45fc-84fe-c4fc62331d34', * submissionTimestamp: '2020-07-29T01:03:26.573Z' * formsAppId: 1, * submission: { * form: 'data', * goes: 'here', * amount: 1.50, * } * definition: OneBlinkForm, * payment: null, * } * const paymentSubmissionEvent = { * type: 'CP_PAY', * configuration: { * elementId: '12663efc-4c6a-4e72-8505-559edfe3e92e', * gatewayId: '6658c5c4-e0db-483b-8af7-6a6464fe772c', * }, * } * const paymentReceiptUrl = `${window.location.origin}/payment-receipt` * const paymentSubmissionResult = await paymentService.handlePaymentSubmissionEvent({ * formSubmissionResult, * paymentSubmissionEvent, * paymentReceiptUrl, * }) * if (paymentSubmissionResult) { * window.location.href = paymentSubmissionResult.payment.hostedFormUrl * } * ``` * * @param options * @returns */ export declare function handlePaymentSubmissionEvent({ formSubmissionResult, paymentReceiptUrl, paymentFormUrl, }: { formSubmissionResult: FormSubmissionResult; paymentReceiptUrl: string; paymentFormUrl: string | undefined; }): Promise; export declare function getFormSubmissionResultPayment(): Promise<{ formSubmissionResult: FormSubmissionResult; paymentSubmissionEvent: SubmissionEventTypes.FormPaymentEvent; }>; /** * Retrieve an array of detail items from a form submission payment. * * #### Example * * ```js * const detailItems = * paymentService.getDisplayDetailsFromFormSubmissionPayment( * formSubmissionPayment, * ) * ``` * * @param formSubmissionPayment * @returns */ export declare function getDisplayDetailsFromFormSubmissionPayment(formSubmissionPayment: SubmissionTypes.FormSubmissionPayment): paymentService.PaymentDisplayDetailsResult | undefined; /** * Retrieve the failure message and provider response fields for a form * submission payment. Returns an empty array unless the payment failed. * * #### Example * * ```js * const failureDetails = * paymentService.getFailureDetailsFromFormSubmissionPayment( * formSubmissionPayment, * ) * ``` * * @param formSubmissionPayment * @returns */ export declare function getFailureDetailsFromFormSubmissionPayment(formSubmissionPayment: SubmissionTypes.FormSubmissionPayment): paymentService.PaymentFailureDetail[];