feat(apple-wallet): support plugin version 3.0 (#3053)

BREAKING: Requires `cordova-apple-wallet@3.0`
This commit is contained in:
Hatem 2019-06-10 20:00:44 +02:00 committed by Daniel Sogl
parent 12f2782fef
commit 43442ac4ea

View File

@ -21,7 +21,7 @@ export interface CardData {
paymentNetwork?: string; paymentNetwork?: string;
} }
export interface EligibilityData { export interface PairedDevicesFlags {
isInWallet: boolean; isInWallet: boolean;
isInWatch: boolean; isInWatch: boolean;
FPANID: string; FPANID: string;
@ -31,10 +31,6 @@ export interface WatchExistData {
isWatchPaired: boolean; isWatchPaired: boolean;
} }
export interface CardPrimarySuffixData {
primaryAccountSuffix: string;
}
/** /**
* @name Apple Wallet * @name Apple Wallet
* @description * @description
@ -60,14 +56,13 @@ export interface CardPrimarySuffixData {
* // Catch {{err}} here * // Catch {{err}} here
* }); * });
* *
*
* ... * ...
* *
* *
* // Simple call to check existence and ellibagility to add a card * // Simple call to check Card Eligibility
* this.appleWallet.isCardExistInWalletOrWatch(data: CardPrimarySuffixData) * this.appleWallet.checkCardEligibility(primaryAccountIdentifier: string)
* .then((res: EligibilityData) => { * .then((res: boolean) => {
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch * // Expect res to be boolean
* }) * })
* .catch((err) => { * .catch((err) => {
* // Catch {{err}} here * // Catch {{err}} here
@ -77,10 +72,36 @@ export interface CardPrimarySuffixData {
* ... * ...
* *
* *
* // Simple call to checkCardEligibilityBySuffix
* this.appleWallet.checkCardEligibilityBySuffix(cardSuffix: string)
* .then((res: boolean) => {
* // Expect res to be boolean
* })
* .catch((err) => {
* // Catch {{err}} here
* });
*
*
* ...
*
* // Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button * // Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button
* this.appleWallet.isPairedWatchExist() * this.appleWallet.checkPairedDevices()
* .then((res: WatchExistData) => { * .then((res: WatchExistData) => {
* // object contains boolean value that ensure that there is already a paired Watch * // object contains boolean flags showing paired devices
* })
* .catch((err) => {
* // Catch {{err}} here
* });
*
*
* ...
*
*
*
* // Simple call to check paired devices with a card by its suffix
* this.appleWallet.checkPairedDevicesBySuffix(cardSuffix: string)
* .then((res: PairedDevicesFlags) => {
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch
* }) * })
* .catch((err) => { * .catch((err) => {
* // Catch {{err}} here * // Catch {{err}} here
@ -121,9 +142,8 @@ export interface CardPrimarySuffixData {
* EncryptedCardData * EncryptedCardData
* SignatureCertificatesData * SignatureCertificatesData
* CardData * CardData
* EligibilityData * PairedDevicesFlags
* WatchExistData * WatchExistData
* CardPrimarySuffixData
*/ */
@Plugin({ @Plugin({
pluginName: 'AppleWallet', pluginName: 'AppleWallet',
@ -144,12 +164,22 @@ export class AppleWallet extends IonicNativePlugin {
} }
/** /**
* Simple call to check existence and ellibagility to add a card * Simple call to check Card Eligibility
* @param {CardPrimarySuffixData} data * @param {string} primaryAccountIdentifier
* @return {Promise<EligibilityData>} * @return {Promise<boolean>}
*/ */
@Cordova() @Cordova()
isCardExistInWalletOrWatch(data: CardPrimarySuffixData): Promise<EligibilityData> { checkCardEligibility(primaryAccountIdentifier: string): Promise<boolean> {
return;
}
/**
* Simple call to checkCardEligibilityBySuffix
* @param {string} cardSuffix
* @return {Promise<PairedDevicesFlags>}
*/
@Cordova()
checkCardEligibilityBySuffix(cardSuffix: string): Promise<boolean> {
return; return;
} }
@ -158,7 +188,17 @@ export class AppleWallet extends IonicNativePlugin {
* @return {Promise<WatchExistData>} * @return {Promise<WatchExistData>}
*/ */
@Cordova() @Cordova()
isPairedWatchExist(): Promise<WatchExistData> { checkPairedDevices(): Promise<WatchExistData> {
return;
}
/**
* Simple call to check paired devices with a card by its suffix
* @param {string} cardSuffix
* @return {Promise<PairedDevicesFlags>}
*/
@Cordova()
checkPairedDevicesBySuffix(cardSuffix: string): Promise<PairedDevicesFlags> {
return; return;
} }