mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-21 00:23:00 +08:00
docs(apple-wallet): update example (#2755)
* Add AppleWallet class interface * Update index.ts * Update index.ts * update readme
This commit is contained in:
parent
4468b520ad
commit
fb4d2640c1
@ -11,7 +11,7 @@ export interface CardData {
|
||||
cardholderName: string;
|
||||
primaryAccountNumberSuffix: string;
|
||||
localizedDescription?: string;
|
||||
paymentNetwork: string;
|
||||
paymentNetwork?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,20 +26,28 @@ export interface CardData {
|
||||
*
|
||||
* constructor(private appleWallet: AppleWallet) { }
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call to check whether the app can add cards to Apple Pay.
|
||||
* this.appleWallet.available()
|
||||
* .then((res) => {
|
||||
* // res is a boolean value, either true or false
|
||||
* console.log("Is Apple Wallet available? ", res);
|
||||
* // Apple Wallet is enabled and a supported card is setup. Expect:
|
||||
* // boolean value, true or false
|
||||
* })
|
||||
* .catch((message) => {
|
||||
* console.error("ERROR AVAILBLE>> ", message);
|
||||
* // Error message while trying to know if device is able to add to wallet
|
||||
* });
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* // Simple call with the configuration data needed to instantiate a new PKAddPaymentPassViewController object.
|
||||
* // 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.
|
||||
*
|
||||
* let data: cardData = {
|
||||
* cardholderName: 'Test User',
|
||||
* primaryAccountNumberSuffix: '1234',
|
||||
@ -49,14 +57,32 @@ export interface CardData {
|
||||
*
|
||||
* this.appleWallet.startAddPaymentPass(data: cardData)
|
||||
* .then((res) => {
|
||||
* console.log("startAddPaymentPass success response ", res);
|
||||
* // User proceed and successfully asked to add card to his wallet
|
||||
* // Use the callback response JSON payload to complete addition process
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* console.error("startAddPaymentPass ERROR response", err);
|
||||
* // Error or user cancelled.
|
||||
* });
|
||||
*
|
||||
* // You should expect the callback success response to be as follow
|
||||
*
|
||||
* // {
|
||||
* // data: {
|
||||
* // "certificateSubCA": "Base64 string represents certificateSubCA",
|
||||
* // "certificateLeaf":" Base64 string represents certificateLeaf"
|
||||
* // "nonce": "Base64 string represents nonce",
|
||||
* // "nonceSignature": "Base64 string represents nonceSignature",
|
||||
* // }
|
||||
* // }
|
||||
*
|
||||
* // This method provides the data needed to create an add payment request.
|
||||
* // Pass the certificate chain to the issuer server. The server returns an encrypted JSON file containing the card data.
|
||||
* // After you receive the encrypted data, pass it to completeAddPaymentPass method
|
||||
*
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* let data: encryptedCardData = {
|
||||
* activationData: 'encoded Base64 activationData from your server',
|
||||
* encryptedPassData: 'encoded Base64 encryptedPassData from your server',
|
||||
@ -65,10 +91,12 @@ export interface CardData {
|
||||
*
|
||||
* this.appleWallet.encryptedCardData(data: encryptedCardData)
|
||||
* .then((res) => {
|
||||
* console.log("completeAddCardToAppleWallet success response ", res);
|
||||
* // callback success response means card has been added successfully,
|
||||
* // PKAddPaymentPassViewController will be dismissed
|
||||
* })
|
||||
* .catch((err) => {
|
||||
* console.error("completeAddCardToAppleWallet ERROR response", err);
|
||||
* // Error and can not add the card, or something wrong happend
|
||||
* // PKAddPaymentPassViewController will be dismissed
|
||||
* });
|
||||
*
|
||||
* ```
|
||||
|
Loading…
Reference in New Issue
Block a user