import { ForkEffect } from 'redux-saga/effects'; import { Subject } from 'rxjs'; import { IStoreFetchableDataState, StoreFetchableData } from './base'; import { IAvailableGiftCardHandler } from './card-balance-check'; export declare type TCreatePaymentChainData = [EVA.Core.CreatePaymentResponse]; /** * The order payments stream emit format * NOTE: OpenAmount being 0 should not be used to determine paid status * There is an order requirement for that * * @export * @interface IOrderPayment */ export interface IOrderPayment { paymentMethod: string; success: boolean; order: EVA.Core.OrderDto; openAmount: number; openAmountForShipment?: number; change?: number; paymentTransactionId?: number; /** This will be returned by either `createPayment` or `createRefund` service and will represent the transactions relevant to the payment that was done. */ paymentTransactions: EVA.Core.PaymentTransactionDto[]; paymentProperties?: { [key: string]: any; }; } /** * Special additional payment properties * Certain payment methods require additional information * * The stationId parameter is mandatory for at least PIN and CASH * * The Adyen settings will be set from getApplicationConfiguration but you * can override them here which is not very likely. * * Giftcard and usercard make up the rest of the properties * * @export * @interface AdditionalPaymentData */ export interface IPaymentOptions { stationId?: number; /** When using the MethodModel this will indicate which type is used */ paymentTypeId?: number; cardNumber?: string; pinCode?: string; password?: string; userID?: number; adyenMerchantAccount?: string; adyenChannel?: 1 | 2 | 3; adyenToken?: string; /** The amount the user has given, only relevant in the case of cash payments */ amountGiven?: number; gatewayId?: string; sendEmail?: boolean; baseUrl?: string; returnUrl?: string; timeout?: number; partialShipment?: boolean; /** Customer details are used for BUCKAROO */ customer?: { gender?: string; email: string; firstname: string; lastname: string; }; refund?: { isRefund: boolean; paymentTransactionId?: number; currencyID?: string; }; elevationToken?: string; customFields?: { [key: string]: any; }; /** * This will be available on the selected gift card handler, which is available in GetApplicationConfiguration - AvailableGiftCardHandlers * @see https://n6k.atlassian.net/browse/OPTR-14043 */ selectedGiftCardHandler?: IAvailableGiftCardHandler; currencyID?: string; } /** * Implements CreatePayment fetch for the Redux store * * @export * @class CreatePayment * @extends {StoreFetchableData} */ export declare class CreatePayment extends StoreFetchableData { /** * Order payments stream * Will emit on both partial and full payment * Contains success state and remaining and change amounts * * @memberof EvaPaymentProvider */ orderPayments$: Subject; /** * Creates an instance of CreatePayment * * @memberof CreatePayment */ constructor(); /** * The saga listener for this store section * * @memberof CreatePayment */ saga(): Generator; /** * Start the payment process using the currently selected payment method * and the provided order * * @memberof EvaPaymentProvider */ performPayment(paymentMethod: EVA.Core.AvailablePaymentMethod | string, order: EVA.Core.OrderDto, amount?: number, options?: IPaymentOptions): Promise; /** * Helper method to update current cart and call get order for any pending * payments for user cards * * @private * @param {number} orderId * @returns * @memberof CreatePayment */ private fetchUpdatedCartAndOrder; private fetchAvailableRefundPaymentMethods; /** * Helper method that both waits for a transaction and keeps fetching * the transaction details * Will also handler PIN terminal specific requirements * * @private * @param {EVA.Payment.Core.StartTransaction} startTransactionPayload * @returns {Promise} * @memberof CreatePayment */ private waitForPinTransaction; /** * Helper method to fetch payment transaction details * * @private * @param {number} paymentTransactionId The payment transaction identifier * @param {number} [timeout=3000] The default timeout * @returns * @memberof CreatePayment */ private getPaymentTransactionDetails; /** * This method will check whether we need to add extra giftcard properties that are required by adyen in the case of * `ADYEN_CHECKOUT_API_GIFTCARD` payment method type model. * * @param paymentMethod the parent payment method, if its a string this method will return early. An object is needed here. * @param paymentTypeId the payment method type id, which points to one of the payment method `Types`. We will use this to check whether the selected payment method type is `ADYEN_CHECKOUT_API_GIFTCARD` * @returns whether the properties should be added or not */ private shouldAddAdyenCheckoutApiGiftCardProperties; } export interface ICreatePaymentState extends IStoreFetchableDataState { } export declare const createPayment: CreatePayment;