diff --git a/src/@ionic-native/plugins/apple-pay/index.ts b/src/@ionic-native/plugins/apple-pay/index.ts index 1995cb49..59e2897c 100644 --- a/src/@ionic-native/plugins/apple-pay/index.ts +++ b/src/@ionic-native/plugins/apple-pay/index.ts @@ -1,17 +1,32 @@ -import {Injectable} from '@angular/core'; -import {Observable} from 'rxjs/Observable'; -import { - Plugin, - Cordova, - IonicNativePlugin -} from '@ionic-native/core'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; +import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; -export 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 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 type IShippingType = 'shipping' | 'delivery' | 'store' | 'service'; -export type IBillingRequirement = 'none' | 'all' | 'postcode' | 'name' | 'email' | 'phone'; -export type ITransactionStatus = 'success' | 'failure' | 'invalid-billing-address' | 'invalid-shipping-address' | 'invalid-shipping-contact' | 'require-pin' | 'incorrect-pin' | 'locked-pin'; +export type IBillingRequirement = + | 'none' + | 'all' + | 'postcode' + | 'name' + | 'email' + | 'phone'; +export type ITransactionStatus = + | 'success' + | 'failure' + | 'invalid-billing-address' + | 'invalid-shipping-address' + | 'invalid-shipping-contact' + | 'require-pin' + | 'incorrect-pin' + | 'locked-pin'; export type ICompleteTransaction = 'Payment status applied.'; -export type IUpdateItemsAndShippingStatus = 'Updated List Info' | 'Did you make a payment request?'; +export type IUpdateItemsAndShippingStatus = + | 'Updated List Info' + | 'Did you make a payment request?'; export interface IPaymentResponse { billingNameFirst?: string; @@ -50,7 +65,7 @@ export interface IOrderItem { label: string; amount: number; } -export interface IShippingMethod { +export interface IShippingMethod { identifier: string; label: string; detail: string; @@ -135,11 +150,10 @@ export interface ISelectedShippingContact { plugin: 'cordova-plugin-applepay', pluginRef: 'ApplePay', repo: 'https://github.com/samkelleher/cordova-plugin-applepay', - platforms: ['iOS'], + platforms: ['iOS'] }) @Injectable() export class ApplePay extends IonicNativePlugin { - /** * Detects if the current device supports Apple Pay and has any capable cards registered. * @return {Promise} Returns a promise @@ -174,7 +188,9 @@ export class ApplePay extends IonicNativePlugin { observable: true, clearFunction: 'stopListeningForShippingContactSelection' }) - startListeningForShippingContactSelection(): Observable { + startListeningForShippingContactSelection(): Observable< + ISelectedShippingContact + > { return; } @@ -196,9 +212,9 @@ export class ApplePay extends IonicNativePlugin { * any shipping contact selection event or else the user will not be able * to complete a transaction on the pay sheet. Do not call without * subscribing to shipping contact selection events first - * @returns {Promise} * - * @param {Object} including `items` and `shippingMethods` properties. + * @param {IOrderItemsAndShippingMethods} list `items` and `shippingMethods` properties. + * @returns {Promise} * * @usage * this.applePay.startListeningForShippingContactSelection().pluck('shippingAddressState').subscribe(shippingAddressState => { @@ -228,15 +244,17 @@ export class ApplePay extends IonicNativePlugin { @Cordova({ otherPromise: true }) - updateItemsAndShippingMethods(list: IOrderItemsAndShippingMethods): Promise { + updateItemsAndShippingMethods( + list: IOrderItemsAndShippingMethods + ): Promise { return; } /** * Request a payment with Apple Pay - * @return {Promise} Returns a promise that resolves when something happens * - * @param order {IOrder} + * @param {IOrder} order + * @return {Promise} Returns a promise that resolves when something happens * * @usage * try { @@ -311,17 +329,19 @@ export class ApplePay extends IonicNativePlugin { /** * Once the makePaymentRequest has been resolved successfully, the device will be waiting for a completion event. - * This means, that the application must proceed with the token authorisation and return a success, failure, + * This means, that the application must proceed with the token authorization and return a success, failure, * or other validation error. Once this has been passed back, the Apple Pay sheet will be dismissed via an animation. - * @return {Promise} Returns a promise that resolves after confirmation of payment authorization completion * - * @param complete {ITransactionStatus} + * @param {ITransactionStatus} complete + * @return {Promise} Returns a promise that resolves after confirmation of payment authorization completion * */ @Cordova({ otherPromise: true }) - completeLastTransaction(complete: ITransactionStatus): Promise { + completeLastTransaction( + complete: ITransactionStatus + ): Promise { return; } }