/**
 * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
 * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
 */
export type Version = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
export declare const APPLE_PAY_VERSION = 2;
export declare const APPLE_PAY_RECURRING_VERSION = 14;
export interface IApplePayValidateMerchantEvent {
    validationURL: string;
}
export type ApplePayMerchantCapability = 'supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit';
export type PaymentNetwork = 'amex' | 'cartesBancaires' | 'chinaUnionPay' | 'discover' | 'eftpos' | 'electron' | 'elo' | 'interac' | 'jcb' | 'mada' | 'maestro' | 'masterCard' | 'privateLabel' | 'visa' | 'vPay';
export interface IApplePayContactField {
    email: string;
    name: string;
    phone: string;
    postalAddress: string;
    phoneticName: string;
}
export interface IApplePayPaymentContact {
    phoneNumber: string;
    emailAddress: string;
    givenName: string;
    familyName: string;
    phoneticGivenName: string;
    phoneticFamilyName: string;
    addressLines: string;
    subLocality: string;
    locality: string;
    postalCode: string;
    subAdministrativeArea: string;
    administrativeArea: string;
    country: string;
    countryCode: string;
}
export type IApplePayLineItemType = 'final' | 'pending';
export type ApplePayPaymentTiming = 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
export type ApplePayRecurringPaymentDateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute';
/**
 *
{
    "label": "Subscription",
    "amount": "20.00",
    "type": "final",
    "paymentTiming": "recurring",
    "recurringPaymentStartDate": new Date("2022-01-01T00:00:00"),
    "recurringPaymentIntervalUnit": "month",
    "recurringPaymentIntervalCount": 6,
    "recurringPaymentEndDate": new Date("2024-01-01T00:00:00"),
}
 */
export interface IApplePayLineItem {
    /**
     * A value that indicates whether the line item is final or pending.
     */
    type: IApplePayLineItemType;
    /**
     * A required value that’s a short, localized description of the line item.
     */
    label: string;
    /**
     * A required value that’s the monetary amount of the line item.
     */
    amount: string;
    paymentTiming?: ApplePayPaymentTiming;
    recurringPaymentStartDate?: Date;
    recurringPaymentEndDate?: Date;
    recurringPaymentIntervalUnit?: ApplePayRecurringPaymentDateUnit;
    recurringPaymentIntervalCount?: number;
    deferredPaymentDate?: Date;
    automaticReloadPaymentThresholdAmount?: string;
}
export type applePayShippingType = 'shipping' | 'delivery' | 'storePickup' | 'servicePickup';
export interface IApplePayShippingMethod {
    label: string;
    detail: string;
    amount: string;
    identifier: string;
}
export interface IApplePayPayment {
    token: any;
    billingContact?: IApplePayPaymentContact;
    shippingContact?: IApplePayPaymentContact;
}
export interface IApplePayPaymentAuthorizedEvent {
    payment: IApplePayPayment;
}
export type status = 'STATUS_SUCCESS' | 'STATUS_FAILURE' | 'STATUS_INVALID_BILLING_POSTAL_ADDRESS' | 'STATUS_INVALID_SHIPPING_POSTAL_ADDRESS' | 'STATUS_INVALID_SHIPPING_CONTACT' | 'STATUS_PIN_INCORRECT' | 'STATUS_PIN_LOCKOUT' | 'STATUS_PIN_REQUIRED';
export interface IApplePayPaymentAuthorizationResult {
    status: any;
    errors?: string[];
}
export interface IApplePayPaymentRequest {
    merchantCapabilities: ApplePayMerchantCapability[];
    supportedNetworks: PaymentNetwork[];
    countryCode: string;
    requiredBillingContactFields?: IApplePayContactField[];
    billingContact?: IApplePayPaymentContact;
    requiredShippingContactFields?: IApplePayContactField[];
    shippingContact?: IApplePayPaymentContact;
    applicationData?: string;
    supportedCountries?: string[];
    total: IApplePayLineItem;
    lineItems?: IApplePayLineItem[];
    currencyCode: string;
    shippingType?: applePayShippingType;
    shippingMethods?: IApplePayShippingMethod[];
    recurringPaymentRequest?: IApplePayRecurringPaymentRequest;
}
export interface IApplePayRecurringPaymentRequest {
    /**
     * A description of the recurring payment that Apple Pay displays to the user in the payment sheet.
     */
    paymentDescription: string;
    /**
     * A localized billing agreement that the payment sheet displays to the user before the user authorizes the payment.
     */
    billingAgreement?: string;
    /**
     * The regular billing cycle for the recurring payment, including start and end dates, an interval, and an interval count.
     */
    regularBilling: IApplePayLineItem;
    /**
     * 订阅试用的周期控制，暂时不需要
     * The trial billing cycle for the recurring payment.
     */
    trialBilling?: IApplePayLineItem;
    /**
     * A URL to a web page where the user can update or delete the payment method for the recurring payment.
     */
    managementURL: string;
    /**
     * A URL you provide for receiving life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
     */
    tokenNotificationURL?: string;
}
export interface IApplePaySession {
    supportsVersion?: (version: Version) => boolean;
    canMakePayments?: () => boolean;
    canMakePaymentsWithActiveCard?: (merchantIdentifier: string) => Promise<boolean>;
    begin: () => void;
    onvalidatemerchant: (event: IApplePayValidateMerchantEvent) => void;
    completeMerchantValidation: (merchantSession: any) => void;
    onpaymentauthorized: (event: IApplePayPaymentAuthorizedEvent) => void;
    completePayment: (result: IApplePayPaymentAuthorizationResult) => void;
    oncancel?: () => void;
    abort?: () => void;
}
export type IGetMerchantSession = (params: {
    displayName?: string;
    merchantIdentifier?: string;
    validationUrl: string;
}) => Promise<any>;
export type ICompletePaymentAuthorized = (params: {
    paymentToken?: string;
}) => Promise<any>;
export type ICompleteApplePay = (data: any) => void;
export type ILogError = (code: string, msg: string, error?: any) => void;
