import { PagingInfo } from "./Pagination"; export declare enum ApplePaySessionStatus { STATUS_SUCCESS = "STATUS_SUCCESS", STATUS_FAILURE = "STATUS_FAILURE" } export declare enum ApplePayButtonType { PLAIN = "plain", BUY = "buy", SET_UP = "set-up", DONATE = "donate", CHECK_OUT = "check-out", BOOK = "book", SUBSCRIBE = "subscribe" } export declare enum ApplePayButtonStyle { BLACK = "black", WHITE = "white", WHITE_OUTLINE = "white-outline" } export declare enum ApplePayMerchantCapability { SUPPORTS_3DS = "supports3DS", SUPPORTS_EMV = "supportsEMV", SUPPORTS_CREDIT = "supportsCredit", SUPPORTS_DEBIT = "supportsDebit" } export interface IApplePayLineItem { label: string; amount: string; type?: 'final' | 'pending'; } export interface IApplePayShippingMethod { label: string; amount: string; identifier: string; detail?: string; } export interface IApplePayPaymentRequest { countryCode: string; currencyCode: string; merchantCapabilities: ApplePayMerchantCapability[]; supportedNetworks: string[]; total: IApplePayLineItem; lineItems?: IApplePayLineItem[]; shippingMethods?: IApplePayShippingMethod[]; applicationData?: string; supportedCountries?: string[]; } export interface IApplePaySession { canMakePayments(): boolean; canMakePaymentsWithActiveCard(merchantIdentifier: string): Promise; supportsVersion(version: number): boolean; begin(): void; abort(): void; completeMerchantValidation(merchantSession: IMerchantSession): void; completePayment(result: { status: ApplePaySessionStatus; }): void; completeShippingMethodSelection(update: any): void; completePaymentMethodSelection(update: any): void; onvalidatemerchant?: (event: IApplePayValidateEvent) => void; onpaymentmethodselected?: (event: IApplePayMethodSelectedEvent) => void; onshippingmethodselected?: () => void; onpaymentauthorized?: (event: any) => void; oncancel?: (event: IApplePayCancelEvent) => void; } export interface IApplePayConfig { merchantIdentifier: string; displayName: string; initiative: string; initiativeContext: string; buttonType?: ApplePayButtonType; buttonStyle?: ApplePayButtonStyle; buttonLocale?: string; } export interface IApplePayError { code: string; message: string; } export interface IMerchantSession { displayName: string; domainName: string; epochTimestamp: number; expiresAt: number; merchantIdentifier: string; merchantSessionIdentifier: string; nonce: string; operationalAnalyticsIdentifier: string; pspId: string; retries: number; signature: string; } export interface IApplePayTokenData { data: string; header: { publicKeyHash: string; ephemeralPublicKey: string; transactionId: string; }; signature: string; version: string; } export interface IApplePayTokenPaymentMethod { displayName: string; network: string; type: string; } export interface IApplePayToken { paymentData: IApplePayTokenData; paymentMethod: IApplePayTokenPaymentMethod; transactionIdentifier: string; } export interface IApplePayValidateEvent { validationURL: string; } export interface IApplePayCancelEvent { sessionError?: { code: 'unknown' | 'invalidMerchantSession' | 'userCancel' | string; info?: string; }; } export interface IApplePayMethodSelectedEvent { paymentMethod: IApplePayTokenPaymentMethod; } export interface IApplePayPaymentProcessRequest { paymentData: IApplePayTokenData; paymentMethod: IApplePayTokenPaymentMethod; transactionIdentifier: string; product_details?: { name: string; price: number; description: string; }; description?: string; } export interface IApplePayPaymentResponse { id: string; type: string; page_info: PagingInfo | null; data: { account_id: string; token: string; }; } export interface IApplePayService { validateMerchant(authToken: string, accountId: string): Promise; processPayment(authToken: string, accountId: string, payload: IApplePayPaymentProcessRequest): Promise<{ success: boolean; data: IApplePayPaymentResponse; }>; } export declare class ApplePayConfig implements IApplePayConfig { merchantIdentifier: string; displayName: string; initiative: string; initiativeContext: string; buttonType?: ApplePayButtonType; buttonStyle?: ApplePayButtonStyle; buttonLocale?: string; constructor(data: IApplePayConfig); get isValid(): boolean; } export declare class ApplePayPaymentRequest implements IApplePayPaymentRequest { countryCode: string; currencyCode: string; merchantCapabilities: ApplePayMerchantCapability[]; supportedNetworks: string[]; total: IApplePayLineItem; lineItems?: IApplePayLineItem[]; shippingMethods?: IApplePayShippingMethod[]; applicationData?: string; supportedCountries?: string[]; constructor(data: IApplePayPaymentRequest); get isValid(): boolean; } export declare class ApplePayHelpers { static isApplePaySupported(): boolean; static canMakePayments(): boolean; static canMakePaymentsWithActiveCard(merchantIdentifier: string): Promise; static formatAmount(amount: number): string; static parseAmount(amount: string): number; static createLineItem(label: string, amount: number, type?: 'final' | 'pending'): IApplePayLineItem; static getDefaultSupportedNetworks(): string[]; static getDefaultMerchantCapabilities(): ApplePayMerchantCapability[]; } declare global { interface Window { ApplePaySession?: { new (version: number, paymentRequest: IApplePayPaymentRequest): IApplePaySession; canMakePayments(): boolean; canMakePaymentsWithActiveCard(merchantIdentifier: string): Promise; supportsVersion(version: number): boolean; STATUS_SUCCESS: number; STATUS_FAILURE: number; }; } }