Skip to content

Commit

Permalink
feat(apple-wallet): support plugin version 3.0 (#3053)
Browse files Browse the repository at this point in the history
BREAKING: Requires `cordova-apple-wallet@3.0`
  • Loading branch information
tomavic authored and danielsogl committed Jun 10, 2019
1 parent 12f2782 commit 43442ac
Showing 1 changed file with 59 additions and 19 deletions.
78 changes: 59 additions & 19 deletions src/@ionic-native/plugins/apple-wallet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface CardData {
paymentNetwork?: string;
}

export interface EligibilityData {
export interface PairedDevicesFlags {
isInWallet: boolean;
isInWatch: boolean;
FPANID: string;
Expand All @@ -31,10 +31,6 @@ export interface WatchExistData {
isWatchPaired: boolean;
}

export interface CardPrimarySuffixData {
primaryAccountSuffix: string;
}

/**
* @name Apple Wallet
* @description
Expand All @@ -60,14 +56,13 @@ export interface CardPrimarySuffixData {
* // Catch {{err}} here
* });
*
*
* ...
*
*
* // Simple call to check existence and ellibagility to add a card
* this.appleWallet.isCardExistInWalletOrWatch(data: CardPrimarySuffixData)
* .then((res: EligibilityData) => {
* // object contains boolean values that ensure that card is already exists in wallet or paired-watch
* // Simple call to check Card Eligibility
* this.appleWallet.checkCardEligibility(primaryAccountIdentifier: string)
* .then((res: boolean) => {
* // Expect res to be boolean
* })
* .catch((err) => {
* // Catch {{err}} here
Expand All @@ -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
* this.appleWallet.isPairedWatchExist()
* this.appleWallet.checkPairedDevices()
* .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}} here
Expand Down Expand Up @@ -121,9 +142,8 @@ export interface CardPrimarySuffixData {
* EncryptedCardData
* SignatureCertificatesData
* CardData
* EligibilityData
* PairedDevicesFlags
* WatchExistData
* CardPrimarySuffixData
*/
@Plugin({
pluginName: 'AppleWallet',
Expand All @@ -144,12 +164,22 @@ export class AppleWallet extends IonicNativePlugin {
}

/**
* Simple call to check existence and ellibagility to add a card
* @param {CardPrimarySuffixData} data
* @return {Promise<EligibilityData>}
* Simple call to check Card Eligibility
* @param {string} primaryAccountIdentifier
* @return {Promise<boolean>}
*/
@Cordova()
checkCardEligibility(primaryAccountIdentifier: string): Promise<boolean> {
return;
}

/**
* Simple call to checkCardEligibilityBySuffix
* @param {string} cardSuffix
* @return {Promise<PairedDevicesFlags>}
*/
@Cordova()
isCardExistInWalletOrWatch(data: CardPrimarySuffixData): Promise<EligibilityData> {
checkCardEligibilityBySuffix(cardSuffix: string): Promise<boolean> {
return;
}

Expand All @@ -158,7 +188,17 @@ export class AppleWallet extends IonicNativePlugin {
* @return {Promise<WatchExistData>}
*/
@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;
}

Expand Down

0 comments on commit 43442ac

Please sign in to comment.