import { ApplePay } from '@ionic-native/apple-pay' ; import { Observable } from 'rxjs/Observable' ; import { Observer } from 'rxjs/Observer' ; export declare type IMakePayments = 'This device can make payments and has a supported card' | 'This device cannot make payments.' | 'This device can make payments but has no supported cards' ; export declare type IShippingType = 'shipping' | 'delivery' | 'store' | 'service' ; export declare type IBillingRequirement = 'none' | 'all' | 'postcode' | 'name' | 'email' | 'phone' ; export declare type ITransactionStatus = 'success' | 'failure' | 'invalid-billing-address' | 'invalid-shipping-address' | 'invalid-shipping-contact' | 'require-pin' | 'incorrect-pin' | 'locked-pin' ; export declare type ICompleteTransaction = 'Payment status applied.' ; export declare type IUpdateItemsAndShippingStatus = 'Updated List Info' | 'Did you make a payment request?' ; export interface IPaymentResponse { billingNameFirst ? : string ; billingNameMiddle ? : string ; billingNameLast ? : string ; billingEmailAddress ? : string ; billingSupplementarySubLocality ? : string ; billingAddressStreet ? : string ; billingAddressCity ? : string ; billingAddressState ? : string ; billingPostalCode ? : string ; billingCountry ? : string ; billingISOCountryCode ? : string ; shippingNameFirst ? : string ; shippingNameMiddle ? : string ; shippingNameLast ? : string ; shippingEmailAddress ? : string ; shippingPhoneNumber ? : string ; shippingSupplementarySubLocality ? : string ; shippingAddressStreet ? : string ; shippingAddressCity ? : string ; shippingAddressState ? : string ; shippingPostalCode ? : string ; shippingCountry ? : string ; shippingISOCountryCode ? : string ; paymentData : string ; transactionIdentifier : string ; paymentMethodDisplayName ? : string ; paymentMethodNetwork ? : string ; paymentMethodTypeCard ? : string ; } export interface IOrderItem { label : string ; amount : number ; } export interface IShippingMethod { identifier : string ; label : string ; detail : string ; amount : number ; } export interface IOrderItemsAndShippingMethods { items : IOrderItem [ ] ; shippingMethods ? : IShippingMethod [ ] ; } export interface IOrder extends IOrderItemsAndShippingMethods { merchantIdentifier : string ; currencyCode : string ; countryCode : string ; billingAddressRequirement ? : IBillingRequirement | IBillingRequirement [ ] ; shippingAddressRequirement ? : IBillingRequirement | IBillingRequirement [ ] ; shippingType ? : IShippingType ; } export interface ISelectedShippingContact { shippingAddressCity : string ; shippingAddressState : string ; shippingPostalCode : string ; shippingISOCountryCode : string ; } export class ApplePayMock extends ApplePay { return { Promise < IMakePayments > } usage canMakePayments ( ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; return { Observable < ISelectedShippingContact > } startListeningForShippingContactSelection ( ) { let response ; return Observable . create ( ( observer ) => { observer . next ( response ) ; observer . complete ( ) ; } ) ; } ; return { Promise } stopListeningForShippingContactSelection ( ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; returns { Promise } param { Object } including usage updateItemsAndShippingMethods ( list ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; return { Promise < IPaymentResponse > } param order { IOrder } usage makePaymentRequest ( order ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; return { Promise < ICompleteTransaction > } param complete { ITransactionStatus } completeLastTransaction ( complete ) { let response ; return new Promise ( ( resolve , reject ) => { resolve ( response ) ; } ) ; } ; }