Giter Club home page Giter Club logo

cordova-apple-wallet's Introduction

Best way to integrate apple wallet into your mobile app. Cordova Apple Wallet let you add your credit/debit cards to Apple Wallet through your mobile app. It also can check if the credit/debit card exists in Wallet or any paired device e.g. Apple Watch ⌚

alt text

Table of contents

  1. Getting Started
  2. Supporting
  3. Installation instructions
  4. How to use
  5. API
  6. Demo
  7. Contributing
  8. License
  9. Credits

Getting Started

Attention Adding payment passes requires a special entitlement issued by Apple. Your app must include this entitlement before you can use this class. For more information on requesting this entitlement, see the Card Issuers section at here.

For more technical information, please check Apple Developer documentation from here and Here,

Supporting cordova-apple-wallet

cordova-apple-wallet is an Open Source (MIT Licensed) project, it's an independent project with ongoing development made possible thanks to the support of our awesome collaborators.

If you think that any information you obtained here is worth of some money and are willing to pay for it, you can give me a cup of coffee β˜• πŸ˜‰

paypal

Installation instructions

Ionic 3 and above

In order to use it with Ionic 3, please follow this instructions

Phonegap

cordova plugin add cordova-apple-wallet --save

Or the latest version:

  cordova plugin add --save https://github.com/tomavic/cordova-apple-wallet

How to use

(Ionic Framework)

  • For Ionic 3 full example check from πŸ‘‰ here

  • Ionic 4+ full example check from πŸ‘‰ here


(Vanilla JS)

πŸ‘‰ NOTE: In order to use it with normal cordova based project, please define a global variable, so that you can use it without lint errors var AppleWallet = AppleWallet || {};

API

  1. Availability
  2. Eligibility
  3. Card Addition
  4. Paired Devices (🎁 NEW)

βœ”οΈ Apple Wallet Availability

Simple call to determine if the current device supports Apple Pay and has a supported card installed.

cordova example

    AppleWallet.isAvailable()
    .then((res) => {
    /**
     * Expect res to be boolean
     */
    })
    .catch((err) => {
      // Catch {{err}} here
    });

Card Eligibility

1 - Check Card Eligibility

Simple call to check Card Eligibility

Parameters

primaryAccountIdentifier (String) Your card unique identifier that used in card in-app provisioning

    AppleWallet.checkCardEligibility(primaryAccountIdentifier)
    .then((res) => {
    /**
     * Expect res to be boolean
     */
    })
    .catch((err) => {
      // Catch {{err}} here
    });

2 - Check Card Eligibility By Suffix

Simple call to checkCardEligibilityBySuffix

Parameters:

cardSuffix (String) The card number suffix ex: last 4 or 6 digits

    AppleWallet.checkCardEligibilityBySuffix(cardSuffix)
    .then((res) => {
    /**
     * Expect res to be boolean
     */
    })
    .catch((err) => {
      // Catch {{err}} here
    });

Card Addition

Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.

This method provides the data needed to create a request to add your payment pass (credit/debit card). After a successful callback, pass the certificate chain to your issuer server-side using our callback delegate method AppleWallet.completeAddPaymentPass. The issuer server-side should returns an encrypted JSON payload containing the encrypted card data, which is required to be get the final response

    let data = {
      cardholderName: 'Test User',
      primaryAccountSuffix: '1234',
      localizedDescription: 'Description of payment card',
      paymentNetwork: 'VISA',
      encryptionScheme: 'RSA_V2' // This could be ECC_V2 or RSA_V2 - Default is RSA_V2
    }
    AppleWallet.startAddPaymentPass(data)
    .then((res) => {
    /**
     * User proceed and successfully asked to add card to his wallet
     * Use the callback response JSON payload to complete addition process
     * Expect
     * res = {
     *   "data": {
     *     "certificateSubCA":"Base64 string represents certificateSubCA",
     *     "certificateLeaf":"Base64 string represents certificateLeaf"
     *     "nonce":"Base64 string represents nonce",
     *     "nonceSignature":"Base64 string represents nonceSignature",
     *   }
     * }
     */
    })
    .catch((err) => {
      // Error or user cancelled.
    });

πŸ‘‰ NOTE: The encryption scheme, cardholder name, and primary account suffix are required for configuration. The configuration information is used for setup and display only. It should not contain any sensitive information.

In order to get testing data check this Apple Sandbox


Card Addition Callback Delegate

Simple completion handler that takes encrypted card data returned from your server side, in order to get the final response from Apple to know if the card is added succesfully or not.

  • activationData: The request’s activation data.
  • encryptedPassData : An encrypted JSON file containing the sensitive information needed to add a card to Apple Pay.
  • ephemeralPublicKey The ephemeral public key used by elliptic curve cryptography (ECC). or wrappedKey if you are using RSA
    let encryptedData = {
        activationData: "encoded Base64 activationData from your server",
        encryptedPassData: "encoded Base64 encryptedPassData from your server",
        wrappedKey: "encoded Base64 wrappedKey from your server"
    }
    AppleWallet.completeAddPaymentPass(encryptedData)
    .then((res) => {
      /**
       * A success callback response means card has been added successfully,
       * PKAddPaymentPassViewController will be dismissed
       * Expect
       * res to be String value 'success' or 'error'
       */
    })
    .catch((err) => {
      // Error and can not add the card, or something wrong happend
      // PKAddPaymentPassViewController will be dismissed
    });

Paired Devices

1 - Check Paired Devices

Simple call to check out if there is any paired Watches so that you can toggle visibility of 'Add to Watch' button

    AppleWallet.checkPairedDevices()
    .then((res) => {
    /**
     * Expect
     * res = {
     *   isWatchPaired: boolean
     * }
     */
    })
    .catch((err) => {
      // Catch {{err}} here
    });

2 - Check Paired Devices By Suffix

Simple call to check paired devices with a card by its suffix

Parameters

cardSuffix (String) The card number suffix ex: last 4 or 6 digits

    AppleWallet.checkPairedDevicesBySuffix(cardSuffix)
    .then((res) => {
    /**
     * object contains boolean values that ensure that card is already exists in wallet or paired-watch
     * Expect
     * res = {
     *    isInWallet: boolean
     *    isInWatch: boolean
     *    FPANID: string
     * }
     * */
    })
    .catch((err) => {
      // Catch {{err}} here
    });

Demo

Soon..

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT

Credits

Made with ❀️❀️ .

I am always happy to hear your feedback @Twitter

Enjoy!

β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„β–„ 
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–€β–ˆβ–„β–€β–„β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‘β–‘β–‘β–€β–ˆβ–„β–€β–„β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 
β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–€β–ˆβ–„β–ˆβ–„β–ˆβ–ˆβ–ˆβ–€β–‘β–‘β–‘β–‘β–‘β–‘β–€β–ˆβ–„β–ˆβ–„β–ˆβ–ˆβ–ˆβ–€β–‘

All copyrights reserved | 2018-2020

cordova-apple-wallet's People

Contributors

anuskaleem avatar emad88 avatar pakyyy avatar rad12000 avatar sttraveller avatar tomavic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cordova-apple-wallet's Issues

How to check and add a card correctly?

I need to be able to check the availability of the card and, if necessary, add it. I am interested in both dbet cards and QR codes.

Example:

IMG_0037

I try:

   this.appleWallet.isAvailable()
            .then((res: boolean) => {
                console.log(res)
            })
            .catch((err) => {
                console.log(err)
            });

result:
false

I try:

        let data = {
            cardholderName: 'Test User',
            primaryAccountSuffix: '1234',
            localizedDescription: 'Description of payment card',
            paymentNetwork: 'VISA',
            encryptionScheme: 'RSA_V2',
            primaryAccountNumberSuffix: '1234',
        }
        this.appleWallet.startAddPaymentPass(data).then((res) => {
            console.log(res)
        }).catch((err) => {
                console.log(err)
        });

result:
"Can not init PKAddPaymentPassViewController"

What do I need to do to add an example card and a debit card?

Performed the following actions:

  1. ionic start testApp
  2. ionic cordova plugin add cordova-apple-wallet
  3. npm install @ionic-native/apple-wallet
  4. add plugin to app.module.ts (providers) and component
  5. use methods isAvailable and startAddPaymentPass
  6. ionic cordova platform add ios
  7. ionic cordova build ios
  8. add application id to xcode

MacBook-Pro:aw4 user$ ionic info

Ionic:

Ionic CLI : 6.11.8 (/Users/user/.npm-global/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.3
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : ios 6.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 5 other plugins)

Utility:

cordova-res (update available: 0.15.1) : 0.10.0
native-run (update available: 1.1.0) : 0.2.9

System:

Android SDK Tools : 26.1.1 (/Users/user/Library/Android/sdk)
ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v12.18.1 (/usr/local/bin/node)
npm : 6.14.8
OS : macOS Catalina
Xcode : Xcode 12.0 Build version 12A7209

MacBook-Pro:aw4 user$ ionic cordova plugin

cordova plugin ls
cordova-apple-wallet 1.0.0 "AppleWallet"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

I ask for your help!

ID problems

I need to implement adding a store card to a wallet. After adding, I see multiple ID errors.
Β 
Π‘Π½ΠΈΠΌΠΎΠΊ экрана 2020-09-23 Π² 13 05 10

Application Information:

MacBook-Pro:aw4 user$ ionic info
Ionic:
Ionic CLI : 6.11.8 (/Users/user/.npm-global/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.3.3
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : ios 6.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 5 other plugins)
Utility:
cordova-res (update available: 0.15.1) : 0.10.0
native-run (update available: 1.1.0) : 0.2.9
System:
Android SDK Tools : 26.1.1 (/Users/user/Library/Android/sdk)
ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v12.18.1 (/usr/local/bin/node)
npm : 6.14.8
OS : macOS Catalina
Xcode : Xcode 11.3.1 Build version 11C505

MacBook-Pro:aw4 user$ ionic cordova plugin
cordova plugin ls
cordova-apple-wallet 1.0.0 "AppleWallet"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

Performed the following actions:

  1. ionic start testApp
  2. ionic cordova plugin add cordova-apple-wallet
  3. npm install @ionic-native/apple-wallet
  4. add plugin to app.module.ts (providers) and component
  5. ionic cordova platform add ios
  6. ionic cordova build ios
  7. add application id to xcode

Without this plugin, the application starts and runs without errors.

I ask for your help!
Β 

Problems with Cordova iOS 6.1

Hi

Since Apple is in the process of blocking all apps that are using the old UIWebView and forcing them to use WKWebView, we migrated our app to cordova-ios version 6.1. Now adding a card to the wallet is not working anymore, it fails when "Contacting the card issuer" with the message "Could Not Add Card". We are using version 3.4.0 of this plugin.

I am in the process of inserting logs and trying to figure out what is going on, but was wondering if other people had experienced this issue.

cheers
mg

Call to get encrypted card data hangs in iOS 12

Hi,

I noticed an issue while testing the Apple Pay Provisioning with the plugin.

With iOS 12, when firing encrypt card data call to the server, the request gets hanged. When I checked the log, the App somehow got suspended as it’s showing AddPaymentPass view and the app was running in background mode.

It’s working all good in iOS 11, the issue only seems to happen in iOS 12.

Just wondering if anyone experience the same issue and whether there’s a way to get around.

Documenting/adding an entitlement to Entitlements-Release.plist

Adding a card to Apple Wallet can be tested only via TestFlight (minimum supported iOS version for those builds also needs to be iOS 10.3 or higher), which requires a production build with a specific entitlement in both provisioning profile and in Entitlements-Release.plist.

The entitlement can be added using following code:

<config-file target="Entitlements-Release.plist" parent="com.apple.developer.payment-pass-provisioning" mode="add">
  <true />
</config-file>

Adding this entitlement to *-Debug.plist would cause build to fail, as the debug provisioning profile won't have the corresponding entitlement item (this item can be enabled only manually by Apple, and they do it only for App Store distirbution provisioning profile).

This block of code can be added either to the plugin.xml (of the plugin) or to config.xml (of the project using this plugin; in this case the requirement for modification of config.xml needs to be added to the documentation.

Support for containsPass method

Hi and thank you for this plugin.

There is a problem with using checkPairedDevicesBySuffix to check if card is already in the wallet, and it is because those 4 numbers are not guaranteed to be unique. I for example have two different cards that share the same last 4 digits, and therefore this method will return true for a card that has not been added to the wallet if another card with the same suffix has previously been added to the wallet.

Apple provides a method to check if a Pass is in the wallet, the containsPass method. Sadly, my Objective C skills are somewhat lacking, and Apples documentation on how to use this method is even more lacking

https://developer.apple.com/documentation/passkit/pkpasslibrary/1617110-containspass?language=objc

Is it possible to add support for this method that accepts the params we have that uniquely identifies the card that we are adding, i.e. the primaryAccountIdentifier.

Sadly and for reasons I cannot understand, the primaryAccountIdentifier we supply when adding a pass, and primaryAccountIdentifier we get back when enumerating cards through passLib passesOfType:PKPassTypePayment are not the same number. If it was we could change the checkPairedDevicesBySuffix to work correctly (e.g. search for the primaryAccountIdentifier, not the primaryAccountSuffix).

Cheers and thanks again for this plugin.

primaryAccountSuffix clarification

Hello @tomavic.

I have a question about the startAddPaymentPass method.

If i am not wrong, the primaryAccountSuffix is the suffix of the card related account.
If I have two card related to the same account, how the server issuer will understand witch card i am trying to add in the wallet ?

Thank you very much for all the work on this plugin

Add pass to Apple Wallet

Hi @tomavic !

Is there a way to add a simple pass (not a payment card) to apple wallet? If not, is possible to implement that functionality?

Very thanks for sharing your code!!

Card Addition documentation error

The documentation says to pass primaryAccountNumberSuffix but the code looks for primaryAccountSuffix, so either the docs need to be corrected or the code needs to standardise the variable name since both names are used in different places.

primaryAccountNumberSuffix: '1234',

configuration.primaryAccountSuffix = [options objectForKey:@"primaryAccountSuffix"];

apple wallet

Hi, how to determine the credit card is exist in wallet

config.xml

Can you share the config.xml to support wallet provisioning?

App crashes when I tried to add card to wallet

Hi All,

I have integrated this Cordova in my OutSystems application, when trying to add a card to wallet then the app gets crashed with the below error

[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x281379860

Thanks in advance!

Regards,
Arun Kumar

Please provide esversion: 6 code.

Hello Hatem,

I'm using this plugin for outsystems, where the the esversion: 6 is only used,
I tried to change the script to esversion: 6 but it all fails and throws an error for all the parameter passing functions (i.e AppleWallet.checkCardEligibilityBySuffix is not a function. (In 'AppleWallet.checkCardEligibilityBySuffix(suffix, success, fail)', 'AppleWallet.checkCardEligibilityBySuffix' is undefined))

It will be helpful if you provide me the esversion: 6 code.

Thank you!

Checking if card is already in wallet

Hi,

Before checkCardEligibility and checkCardEligibilityBySuffix landed, the plugin had the method isCardExistInWalletOrWatch(), which we could use to check if the card had already been added to the users wallet. It seems that the eligibility methods do not answer that question. Should we use checkPairedDevicesBySuffix() to check for presence of card in wallet, and if so, what is the point of the eligibility methods?

cheers

checkPairedDevicesBySuffix use deprecated PKPassTypePayment

Hello,

I am having trouble to get the passes from the PKPassLibrary. I am having no pass even when i have a card in my wallet.

I use the checkPairedDevicesBySuffix to see if my card is in the wallet and this method is using PKPassTypePayment in order to get the passes from the PKPassLibrary.
PKPassTypePayment is deprecated since iOS 13.4. In other methods like checkCardEligibility, there is a check on the iOS version in order to decided what to use between PKPassTypePayment and PKPassTypeSecureElement.

Why there is no check on this method ? this may be why i don't catch any pass

Test checkCardEligibilityBySuffix

How can i check that the card has been added to the wallet?
I added the card to the wallet using a plugin, but checkCardEligibilityBySuffix always returns true.

fatal error: too many errors emitted, stopping now [-ferror-limit=]

Hello

I'm use the latest version of the plugin.
When building the application, I get a lot of errors:

   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:60:50: error: use of undeclared identifier 'PKPassTypeSecureElement'
        paymentPasses = [passLibrary passesOfType: PKPassTypeSecureElement];
                                                   ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:62:9: error: use of undeclared identifier 'PKSecureElementPass'
          PKSecureElementPass *paymentPass = [pass secureElementPass];
          ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:62:30: error: use of undeclared identifier 'paymentPass'; did you mean 'paymentPasses'?
          PKSecureElementPass *paymentPass = [pass secureElementPass];
                               ^~~~~~~~~~~
                               paymentPasses
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:58:14: note: 'paymentPasses' declared here
      NSArray *paymentPasses = [[NSArray alloc] init];
               ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:62:50: error: no visible @interface for 'PKPass' declares the selector 'secureElementPass'
          PKSecureElementPass *paymentPass = [pass secureElementPass];
                                              ~~~~ ^~~~~~~~~~~~~~~~~
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:63:15: error: unknown receiver 'paymentPass'; did you mean 'PKPaymentPass'?
          if ([[paymentPass primaryAccountIdentifier] isEqualToString:cardIdentifier]) {
                ^~~~~~~~~~~
                PKPaymentPass
  In module 'PassKit' imported from  /Plugins/cordova-apple-wallet/CDVAppleWallet.h:10:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/PassKit.framework/Headers/PKAddPaymentPassViewController.h:17:40: note: 'PKPaymentPass' declared here
  @class PKAddPaymentPassViewController, PKPaymentPass;
                                         ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:63:27: error: no known class method for selector 'primaryAccountIdentifier'
          if ([[paymentPass primaryAccountIdentifier] isEqualToString:cardIdentifier]) {
                            ^~~~~~~~~~~~~~~~~~~~~~~~
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:85:46: error: no visible @interface for 'PKPassLibrary' declares the selector 'remoteSecureElementPasses'
                  paymentPasses = [passLibrary remoteSecureElementPasses]; // remotePaymentPasses is deprecated in iOS13.5
                                   ~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:86:22: error: use of undeclared identifier 'PKSecureElementPass'
                  for (PKSecureElementPass *pass in paymentPasses) {
                       ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:86:43: error: use of undeclared identifier 'pass'
                  for (PKSecureElementPass *pass in paymentPasses) {
                                            ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:87:27: error: use of undeclared identifier 'pass'
                      if ([[pass primaryAccountIdentifier] isEqualToString:cardIdentifier]) {
                            ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:126:50: error: use of undeclared identifier 'PKPassTypeSecureElement'
        paymentPasses = [passLibrary passesOfType: PKPassTypeSecureElement];
                                                   ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:128:13: error: use of undeclared identifier 'PKSecureElementPass'
              PKSecureElementPass *paymentPass = [pass secureElementPass];
              ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:128:34: error: use of undeclared identifier 'paymentPass'; did you mean 'paymentPasses'?
              PKSecureElementPass *paymentPass = [pass secureElementPass];
                                   ^~~~~~~~~~~
                                   paymentPasses
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:124:14: note: 'paymentPasses' declared here
      NSArray *paymentPasses = [[NSArray alloc] init];
               ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:128:54: error: no visible @interface for 'PKPass' declares the selector 'secureElementPass'
              PKSecureElementPass *paymentPass = [pass secureElementPass];
                                                  ~~~~ ^~~~~~~~~~~~~~~~~
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:129:19: error: unknown receiver 'paymentPass'; did you mean 'PKPaymentPass'?
              if ([[paymentPass primaryAccountNumberSuffix] isEqualToString:cardSuffix]) {
                    ^~~~~~~~~~~
                    PKPaymentPass
  In module 'PassKit' imported from  /Plugins/cordova-apple-wallet/CDVAppleWallet.h:10:
  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/System/Library/Frameworks/PassKit.framework/Headers/PKAddPaymentPassViewController.h:17:40: note: 'PKPaymentPass' declared here
  @class PKAddPaymentPassViewController, PKPaymentPass;
                                         ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:129:31: error: no known class method for selector 'primaryAccountNumberSuffix'
              if ([[paymentPass primaryAccountNumberSuffix] isEqualToString:cardSuffix]) {
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:149:42: error: no visible @interface for 'PKPassLibrary' declares the selector 'remoteSecureElementPasses'
              paymentPasses = [passLibrary remoteSecureElementPasses];
                               ~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:150:18: error: use of undeclared identifier 'PKSecureElementPass'
              for (PKSecureElementPass *pass in paymentPasses) {
                   ^
   /Plugins/cordova-apple-wallet/CDVAppleWallet.m:150:39: error: use of undeclared identifier 'pass'
              for (PKSecureElementPass *pass in paymentPasses) {
                                        ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.

completeAddPaymentPass doesn't use ephemeralPublicKey

When using ECC ephemeralPublicKey should be passed instead of wrappedKey, but the code is only looking for wrappedKey.

PKAddPaymentPassRequest* request = [[PKAddPaymentPassRequest alloc] init];
NSDictionary* options = [arguments objectAtIndex:0];
NSString* activationData = [options objectForKey:@"activationData"];
NSString* encryptedPassData = [options objectForKey:@"encryptedPassData"];
NSString* wrappedKey = [options objectForKey:@"wrappedKey"];
request.activationData = [[NSData alloc] initWithBase64EncodedString:activationData options:0]; //[activationData dataUsingEncoding:NSUTF8StringEncoding];
request.encryptedPassData = [[NSData alloc] initWithBase64EncodedString:encryptedPassData options:0];
request.wrappedKey = [[NSData alloc] initWithBase64EncodedString:wrappedKey options:0];
// Issue request
self.completionHandler(request);
self.completionCallbackId = command.callbackId;
self.isRequestIssued = true;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.