@capgo/capacitor-pay 7.0.9 → 7.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -2
- package/android/src/main/java/app/capgo/pay/PayPlugin.java +13 -0
- package/dist/docs.json +19 -0
- package/dist/esm/definitions.d.ts +9 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/web.d.ts +3 -0
- package/dist/esm/web.js +3 -0
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +3 -0
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +3 -0
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/PayPlugin/PayPlugin.swift +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
<a href="https://capgo.app/"><img src='https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png' alt='Capgo - Instant updates for capacitor'/></a>
|
|
3
3
|
|
|
4
4
|
<div align="center">
|
|
5
|
-
<h2><a href="https://capgo.app/?ref=
|
|
6
|
-
<h2><a href="https://capgo.app/consulting/?ref=
|
|
5
|
+
<h2><a href="https://capgo.app/?ref=plugin_pay"> ➡️ Get Instant updates for your App with Capgo</a></h2>
|
|
6
|
+
<h2><a href="https://capgo.app/consulting/?ref=plugin_pay"> Missing a feature? We’ll build the plugin for you 💪</a></h2>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
Capacitor plugin to trigger native payments with Apple Pay and Google Pay using a unified JavaScript API.
|
|
10
10
|
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
The most complete doc is available here: https://capgo.app/docs/plugins/pay/
|
|
14
|
+
|
|
11
15
|
## Install
|
|
12
16
|
|
|
13
17
|
```bash
|
|
@@ -121,6 +125,7 @@ if (availability.platform === 'ios') {
|
|
|
121
125
|
|
|
122
126
|
* [`isPayAvailable(...)`](#ispayavailable)
|
|
123
127
|
* [`requestPayment(...)`](#requestpayment)
|
|
128
|
+
* [`getPluginVersion()`](#getpluginversion)
|
|
124
129
|
* [Interfaces](#interfaces)
|
|
125
130
|
* [Type Aliases](#type-aliases)
|
|
126
131
|
|
|
@@ -165,6 +170,19 @@ Provide the Apple Pay configuration on iOS and the Google Pay configuration on A
|
|
|
165
170
|
--------------------
|
|
166
171
|
|
|
167
172
|
|
|
173
|
+
### getPluginVersion()
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
getPluginVersion() => Promise<{ version: string; }>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Get the native Capacitor plugin version
|
|
180
|
+
|
|
181
|
+
**Returns:** <code>Promise<{ version: string; }></code>
|
|
182
|
+
|
|
183
|
+
--------------------
|
|
184
|
+
|
|
185
|
+
|
|
168
186
|
### Interfaces
|
|
169
187
|
|
|
170
188
|
|
|
@@ -26,6 +26,8 @@ import org.json.JSONObject;
|
|
|
26
26
|
@CapacitorPlugin(name = "Pay")
|
|
27
27
|
public class PayPlugin extends Plugin {
|
|
28
28
|
|
|
29
|
+
private final String pluginVersion = "7.1.7";
|
|
30
|
+
|
|
29
31
|
private static final int LOAD_PAYMENT_DATA_REQUEST_CODE = 8001;
|
|
30
32
|
|
|
31
33
|
private PluginCall pendingPaymentCall;
|
|
@@ -235,4 +237,15 @@ public class PayPlugin extends Plugin {
|
|
|
235
237
|
return request;
|
|
236
238
|
}
|
|
237
239
|
}
|
|
240
|
+
|
|
241
|
+
@PluginMethod
|
|
242
|
+
public void getPluginVersion(final PluginCall call) {
|
|
243
|
+
try {
|
|
244
|
+
final JSObject ret = new JSObject();
|
|
245
|
+
ret.put("version", this.pluginVersion);
|
|
246
|
+
call.resolve(ret);
|
|
247
|
+
} catch (final Exception e) {
|
|
248
|
+
call.reject("Could not get plugin version", e);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
238
251
|
}
|
package/dist/docs.json
CHANGED
|
@@ -42,6 +42,25 @@
|
|
|
42
42
|
"PayPaymentOptions"
|
|
43
43
|
],
|
|
44
44
|
"slug": "requestpayment"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "getPluginVersion",
|
|
48
|
+
"signature": "() => Promise<{ version: string; }>",
|
|
49
|
+
"parameters": [],
|
|
50
|
+
"returns": "Promise<{ version: string; }>",
|
|
51
|
+
"tags": [
|
|
52
|
+
{
|
|
53
|
+
"name": "returns",
|
|
54
|
+
"text": "an Promise with version for this device"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "throws",
|
|
58
|
+
"text": "An error if the something went wrong"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"docs": "Get the native Capacitor plugin version",
|
|
62
|
+
"complexTypes": [],
|
|
63
|
+
"slug": "getpluginversion"
|
|
45
64
|
}
|
|
46
65
|
],
|
|
47
66
|
"properties": []
|
|
@@ -180,4 +180,13 @@ export interface PayPlugin {
|
|
|
180
180
|
* Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.
|
|
181
181
|
*/
|
|
182
182
|
requestPayment(options: PayPaymentOptions): Promise<PayPaymentResult>;
|
|
183
|
+
/**
|
|
184
|
+
* Get the native Capacitor plugin version
|
|
185
|
+
*
|
|
186
|
+
* @returns {Promise<{ id: string }>} an Promise with version for this device
|
|
187
|
+
* @throws An error if the something went wrong
|
|
188
|
+
*/
|
|
189
|
+
getPluginVersion(): Promise<{
|
|
190
|
+
version: string;
|
|
191
|
+
}>;
|
|
183
192
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type PayPlatform = 'ios' | 'android' | 'web';\n\nexport type ApplePayNetwork =\n | 'amex'\n | 'chinaUnionPay'\n | 'discover'\n | 'eftpos'\n | 'electron'\n | 'girocard'\n | 'interac'\n | 'jcb'\n | 'mada'\n | 'maestro'\n | 'masterCard'\n | 'privateLabel'\n | 'quicPay'\n | 'suica'\n | 'visa'\n | 'vPay'\n | 'id'\n | 'cartesBancaires';\n\nexport type ApplePayMerchantCapability = '3DS' | 'credit' | 'debit' | 'emv';\n\nexport type ApplePaySummaryItemType = 'final' | 'pending';\n\nexport type ApplePayContactField = 'emailAddress' | 'name' | 'phoneNumber' | 'postalAddress';\n\nexport type ApplePayShippingType = 'shipping' | 'delivery' | 'servicePickup' | 'storePickup';\n\nexport interface ApplePaySummaryItem {\n label: string;\n amount: string;\n type?: ApplePaySummaryItemType;\n}\n\nexport interface ApplePayAvailabilityOptions {\n /**\n * Optional list of payment networks you intend to use.\n * Passing networks determines the return value of `canMakePaymentsUsingNetworks`.\n */\n supportedNetworks?: ApplePayNetwork[];\n}\n\nexport interface ApplePayAvailabilityResult {\n /**\n * Indicates whether the device can make Apple Pay payments in general.\n */\n canMakePayments: boolean;\n /**\n * Indicates whether the device can make Apple Pay payments with the supplied networks.\n */\n canMakePaymentsUsingNetworks: boolean;\n}\n\nexport interface ApplePayPaymentOptions {\n /**\n * Merchant identifier created in the Apple Developer portal.\n */\n merchantIdentifier: string;\n /**\n * Two-letter ISO 3166 country code.\n */\n countryCode: string;\n /**\n * Three-letter ISO 4217 currency code.\n */\n currencyCode: string;\n /**\n * Payment summary items displayed in the Apple Pay sheet.\n */\n paymentSummaryItems: ApplePaySummaryItem[];\n /**\n * Card networks to support.\n */\n supportedNetworks: ApplePayNetwork[];\n /**\n * Merchant payment capabilities. Defaults to ['3DS'] when omitted.\n */\n merchantCapabilities?: ApplePayMerchantCapability[];\n /**\n * Contact fields that must be supplied for shipping.\n */\n requiredShippingContactFields?: ApplePayContactField[];\n /**\n * Contact fields that must be supplied for billing.\n */\n requiredBillingContactFields?: ApplePayContactField[];\n /**\n * Controls the shipping flow presented to the user.\n */\n shippingType?: ApplePayShippingType;\n /**\n * Optional ISO 3166 country codes where the merchant is supported.\n */\n supportedCountries?: string[];\n /**\n * Optional opaque application data passed back in the payment token.\n */\n applicationData?: string;\n}\n\nexport interface ApplePayContact {\n name?: {\n givenName?: string;\n familyName?: string;\n middleName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n nickname?: string;\n };\n emailAddress?: string;\n phoneNumber?: string;\n postalAddress?: {\n street?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n isoCountryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n };\n}\n\nexport interface ApplePayPaymentResult {\n /**\n * Raw payment token encoded as base64 string.\n */\n paymentData: string;\n /**\n * Raw payment token JSON string, useful for debugging.\n */\n paymentString: string;\n /**\n * Payment transaction identifier.\n */\n transactionIdentifier: string;\n paymentMethod: {\n displayName?: string;\n network?: ApplePayNetwork;\n type: 'debit' | 'credit' | 'prepaid' | 'store';\n };\n shippingContact?: ApplePayContact;\n billingContact?: ApplePayContact;\n}\n\nexport type GooglePayEnvironment = 'test' | 'production';\n\nexport interface GooglePayAvailabilityOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `IsReadyToPayRequest` JSON as defined by the Google Pay API.\n * Supply the card networks and auth methods you intend to support at runtime.\n */\n isReadyToPayRequest?: Record<string, unknown>;\n}\n\nexport interface GooglePayAvailabilityResult {\n /**\n * Indicates whether the Google Pay API is available for the supplied parameters.\n */\n isReady: boolean;\n}\n\nexport interface GooglePayPaymentOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `PaymentDataRequest` JSON as defined by the Google Pay API.\n * Provide transaction details, merchant info, and tokenization parameters.\n */\n paymentDataRequest: Record<string, unknown>;\n}\n\nexport interface GooglePayPaymentResult {\n /**\n * Payment data returned by Google Pay.\n */\n paymentData: Record<string, unknown>;\n}\n\nexport interface PayAvailabilityOptions {\n apple?: ApplePayAvailabilityOptions;\n google?: GooglePayAvailabilityOptions;\n}\n\nexport interface PayAvailabilityResult {\n available: boolean;\n platform: PayPlatform;\n apple?: ApplePayAvailabilityResult;\n google?: GooglePayAvailabilityResult;\n}\n\nexport interface PayPaymentOptions {\n apple?: ApplePayPaymentOptions;\n google?: GooglePayPaymentOptions;\n}\n\nexport interface PayPaymentResult {\n platform: Exclude<PayPlatform, 'web'>;\n apple?: ApplePayPaymentResult;\n google?: GooglePayPaymentResult;\n}\n\nexport interface PayPlugin {\n /**\n * Checks whether native pay is available on the current platform.\n * On iOS this evaluates Apple Pay, on Android it evaluates Google Pay.\n */\n isPayAvailable(options?: PayAvailabilityOptions): Promise<PayAvailabilityResult>;\n /**\n * Presents the native pay sheet for the current platform.\n * Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.\n */\n requestPayment(options: PayPaymentOptions): Promise<PayPaymentResult>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type PayPlatform = 'ios' | 'android' | 'web';\n\nexport type ApplePayNetwork =\n | 'amex'\n | 'chinaUnionPay'\n | 'discover'\n | 'eftpos'\n | 'electron'\n | 'girocard'\n | 'interac'\n | 'jcb'\n | 'mada'\n | 'maestro'\n | 'masterCard'\n | 'privateLabel'\n | 'quicPay'\n | 'suica'\n | 'visa'\n | 'vPay'\n | 'id'\n | 'cartesBancaires';\n\nexport type ApplePayMerchantCapability = '3DS' | 'credit' | 'debit' | 'emv';\n\nexport type ApplePaySummaryItemType = 'final' | 'pending';\n\nexport type ApplePayContactField = 'emailAddress' | 'name' | 'phoneNumber' | 'postalAddress';\n\nexport type ApplePayShippingType = 'shipping' | 'delivery' | 'servicePickup' | 'storePickup';\n\nexport interface ApplePaySummaryItem {\n label: string;\n amount: string;\n type?: ApplePaySummaryItemType;\n}\n\nexport interface ApplePayAvailabilityOptions {\n /**\n * Optional list of payment networks you intend to use.\n * Passing networks determines the return value of `canMakePaymentsUsingNetworks`.\n */\n supportedNetworks?: ApplePayNetwork[];\n}\n\nexport interface ApplePayAvailabilityResult {\n /**\n * Indicates whether the device can make Apple Pay payments in general.\n */\n canMakePayments: boolean;\n /**\n * Indicates whether the device can make Apple Pay payments with the supplied networks.\n */\n canMakePaymentsUsingNetworks: boolean;\n}\n\nexport interface ApplePayPaymentOptions {\n /**\n * Merchant identifier created in the Apple Developer portal.\n */\n merchantIdentifier: string;\n /**\n * Two-letter ISO 3166 country code.\n */\n countryCode: string;\n /**\n * Three-letter ISO 4217 currency code.\n */\n currencyCode: string;\n /**\n * Payment summary items displayed in the Apple Pay sheet.\n */\n paymentSummaryItems: ApplePaySummaryItem[];\n /**\n * Card networks to support.\n */\n supportedNetworks: ApplePayNetwork[];\n /**\n * Merchant payment capabilities. Defaults to ['3DS'] when omitted.\n */\n merchantCapabilities?: ApplePayMerchantCapability[];\n /**\n * Contact fields that must be supplied for shipping.\n */\n requiredShippingContactFields?: ApplePayContactField[];\n /**\n * Contact fields that must be supplied for billing.\n */\n requiredBillingContactFields?: ApplePayContactField[];\n /**\n * Controls the shipping flow presented to the user.\n */\n shippingType?: ApplePayShippingType;\n /**\n * Optional ISO 3166 country codes where the merchant is supported.\n */\n supportedCountries?: string[];\n /**\n * Optional opaque application data passed back in the payment token.\n */\n applicationData?: string;\n}\n\nexport interface ApplePayContact {\n name?: {\n givenName?: string;\n familyName?: string;\n middleName?: string;\n namePrefix?: string;\n nameSuffix?: string;\n nickname?: string;\n };\n emailAddress?: string;\n phoneNumber?: string;\n postalAddress?: {\n street?: string;\n city?: string;\n state?: string;\n postalCode?: string;\n country?: string;\n isoCountryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n };\n}\n\nexport interface ApplePayPaymentResult {\n /**\n * Raw payment token encoded as base64 string.\n */\n paymentData: string;\n /**\n * Raw payment token JSON string, useful for debugging.\n */\n paymentString: string;\n /**\n * Payment transaction identifier.\n */\n transactionIdentifier: string;\n paymentMethod: {\n displayName?: string;\n network?: ApplePayNetwork;\n type: 'debit' | 'credit' | 'prepaid' | 'store';\n };\n shippingContact?: ApplePayContact;\n billingContact?: ApplePayContact;\n}\n\nexport type GooglePayEnvironment = 'test' | 'production';\n\nexport interface GooglePayAvailabilityOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `IsReadyToPayRequest` JSON as defined by the Google Pay API.\n * Supply the card networks and auth methods you intend to support at runtime.\n */\n isReadyToPayRequest?: Record<string, unknown>;\n}\n\nexport interface GooglePayAvailabilityResult {\n /**\n * Indicates whether the Google Pay API is available for the supplied parameters.\n */\n isReady: boolean;\n}\n\nexport interface GooglePayPaymentOptions {\n /**\n * Environment used to construct the Google Payments client. Defaults to `'test'`.\n */\n environment?: GooglePayEnvironment;\n /**\n * Raw `PaymentDataRequest` JSON as defined by the Google Pay API.\n * Provide transaction details, merchant info, and tokenization parameters.\n */\n paymentDataRequest: Record<string, unknown>;\n}\n\nexport interface GooglePayPaymentResult {\n /**\n * Payment data returned by Google Pay.\n */\n paymentData: Record<string, unknown>;\n}\n\nexport interface PayAvailabilityOptions {\n apple?: ApplePayAvailabilityOptions;\n google?: GooglePayAvailabilityOptions;\n}\n\nexport interface PayAvailabilityResult {\n available: boolean;\n platform: PayPlatform;\n apple?: ApplePayAvailabilityResult;\n google?: GooglePayAvailabilityResult;\n}\n\nexport interface PayPaymentOptions {\n apple?: ApplePayPaymentOptions;\n google?: GooglePayPaymentOptions;\n}\n\nexport interface PayPaymentResult {\n platform: Exclude<PayPlatform, 'web'>;\n apple?: ApplePayPaymentResult;\n google?: GooglePayPaymentResult;\n}\n\nexport interface PayPlugin {\n /**\n * Checks whether native pay is available on the current platform.\n * On iOS this evaluates Apple Pay, on Android it evaluates Google Pay.\n */\n isPayAvailable(options?: PayAvailabilityOptions): Promise<PayAvailabilityResult>;\n /**\n * Presents the native pay sheet for the current platform.\n * Provide the Apple Pay configuration on iOS and the Google Pay configuration on Android.\n */\n requestPayment(options: PayPaymentOptions): Promise<PayPaymentResult>;\n\n /**\n * Get the native Capacitor plugin version\n *\n * @returns {Promise<{ id: string }>} an Promise with version for this device\n * @throws An error if the something went wrong\n */\n getPluginVersion(): Promise<{ version: string }>;\n}\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ import type { PayAvailabilityOptions, PayAvailabilityResult, PayPaymentOptions,
|
|
|
3
3
|
export declare class PayWeb extends WebPlugin implements PayPlugin {
|
|
4
4
|
isPayAvailable(_options?: PayAvailabilityOptions): Promise<PayAvailabilityResult>;
|
|
5
5
|
requestPayment(_options: PayPaymentOptions): Promise<PayPaymentResult>;
|
|
6
|
+
getPluginVersion(): Promise<{
|
|
7
|
+
version: string;
|
|
8
|
+
}>;
|
|
6
9
|
}
|
package/dist/esm/web.js
CHANGED
|
@@ -16,5 +16,8 @@ export class PayWeb extends WebPlugin {
|
|
|
16
16
|
async requestPayment(_options) {
|
|
17
17
|
throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');
|
|
18
18
|
}
|
|
19
|
+
async getPluginVersion() {
|
|
20
|
+
return { version: 'web' };
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC,KAAK,CAAC,cAAc,CAAC,QAAiC;QACpD,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE;gBACL,eAAe,EAAE,KAAK;gBACtB,4BAA4B,EAAE,KAAK;aACpC;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;aACf;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAA2B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC,CAAC;IACrG,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n PayAvailabilityOptions,\n PayAvailabilityResult,\n PayPaymentOptions,\n PayPaymentResult,\n PayPlugin,\n} from './definitions';\n\nexport class PayWeb extends WebPlugin implements PayPlugin {\n async isPayAvailable(_options?: PayAvailabilityOptions): Promise<PayAvailabilityResult> {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n\n async requestPayment(_options: PayPaymentOptions): Promise<PayPaymentResult> {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,OAAO,MAAO,SAAQ,SAAS;IACnC,KAAK,CAAC,cAAc,CAAC,QAAiC;QACpD,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE;gBACL,eAAe,EAAE,KAAK;gBACtB,4BAA4B,EAAE,KAAK;aACpC;YACD,MAAM,EAAE;gBACN,OAAO,EAAE,KAAK;aACf;SACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAA2B;QAC9C,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC,CAAC;IACrG,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n PayAvailabilityOptions,\n PayAvailabilityResult,\n PayPaymentOptions,\n PayPaymentResult,\n PayPlugin,\n} from './definitions';\n\nexport class PayWeb extends WebPlugin implements PayPlugin {\n async isPayAvailable(_options?: PayAvailabilityOptions): Promise<PayAvailabilityResult> {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n\n async requestPayment(_options: PayPaymentOptions): Promise<PayPaymentResult> {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -23,6 +23,9 @@ class PayWeb extends core.WebPlugin {
|
|
|
23
23
|
async requestPayment(_options) {
|
|
24
24
|
throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');
|
|
25
25
|
}
|
|
26
|
+
async getPluginVersion() {
|
|
27
|
+
return { version: 'web' };
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,KAAK;AAC5B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,KAAK,EAAE;AACnB,gBAAgB,eAAe,EAAE,KAAK;AACtC,gBAAgB,4BAA4B,EAAE,KAAK;AACnD,aAAa;AACb,YAAY,MAAM,EAAE;AACpB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;AAC1G,IAAI;AACJ;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;AAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC1D,CAAC;;ACFM,MAAM,MAAM,SAASC,cAAS,CAAC;AACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,OAAO;AACf,YAAY,SAAS,EAAE,KAAK;AAC5B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,KAAK,EAAE;AACnB,gBAAgB,eAAe,EAAE,KAAK;AACtC,gBAAgB,4BAA4B,EAAE,KAAK;AACnD,aAAa;AACb,YAAY,MAAM,EAAE;AACpB,gBAAgB,OAAO,EAAE,KAAK;AAC9B,aAAa;AACb,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;AAC1G,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -22,6 +22,9 @@ var capacitorPay = (function (exports, core) {
|
|
|
22
22
|
async requestPayment(_options) {
|
|
23
23
|
throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');
|
|
24
24
|
}
|
|
25
|
+
async getPluginVersion() {
|
|
26
|
+
return { version: 'web' };
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
var web = /*#__PURE__*/Object.freeze({
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,OAAO;IACf,YAAY,SAAS,EAAE,KAAK;IAC5B,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,KAAK,EAAE;IACnB,gBAAgB,eAAe,EAAE,KAAK;IACtC,gBAAgB,4BAA4B,EAAE,KAAK;IACnD,aAAa;IACb,YAAY,MAAM,EAAE;IACpB,gBAAgB,OAAO,EAAE,KAAK;IAC9B,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;IAC1G,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst Pay = registerPlugin('Pay', {\n web: () => import('./web').then((m) => new m.PayWeb()),\n});\nexport * from './definitions';\nexport { Pay };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class PayWeb extends WebPlugin {\n async isPayAvailable(_options) {\n return {\n available: false,\n platform: 'web',\n apple: {\n canMakePayments: false,\n canMakePaymentsUsingNetworks: false,\n },\n google: {\n isReady: false,\n },\n };\n }\n async requestPayment(_options) {\n throw this.unimplemented('Native payments are not implemented on the web. Use a native platform.');\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,GAAG,GAAGA,mBAAc,CAAC,KAAK,EAAE;IAClC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;;ICFM,MAAM,MAAM,SAASC,cAAS,CAAC;IACtC,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,OAAO;IACf,YAAY,SAAS,EAAE,KAAK;IAC5B,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,KAAK,EAAE;IACnB,gBAAgB,eAAe,EAAE,KAAK;IACtC,gBAAgB,4BAA4B,EAAE,KAAK;IACnD,aAAa;IACb,YAAY,MAAM,EAAE;IACpB,gBAAgB,OAAO,EAAE,KAAK;IAC9B,aAAa;IACb,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,wEAAwE,CAAC;IAC1G,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -5,11 +5,13 @@ import PassKit
|
|
|
5
5
|
|
|
6
6
|
@objc(PayPlugin)
|
|
7
7
|
public class PayPlugin: CAPPlugin, CAPBridgedPlugin, PKPaymentAuthorizationControllerDelegate {
|
|
8
|
+
private let pluginVersion: String = "7.1.7"
|
|
8
9
|
public let identifier = "PayPlugin"
|
|
9
10
|
public let jsName = "Pay"
|
|
10
11
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
11
12
|
CAPPluginMethod(name: "isPayAvailable", returnType: CAPPluginReturnPromise),
|
|
12
|
-
CAPPluginMethod(name: "requestPayment", returnType: CAPPluginReturnPromise)
|
|
13
|
+
CAPPluginMethod(name: "requestPayment", returnType: CAPPluginReturnPromise),
|
|
14
|
+
CAPPluginMethod(name: "getPluginVersion", returnType: CAPPluginReturnPromise)
|
|
13
15
|
]
|
|
14
16
|
|
|
15
17
|
private var pendingApplePayCall: CAPPluginCall?
|
|
@@ -440,6 +442,10 @@ public class PayPlugin: CAPPlugin, CAPBridgedPlugin, PKPaymentAuthorizationContr
|
|
|
440
442
|
applePayController?.delegate = nil
|
|
441
443
|
applePayController = nil
|
|
442
444
|
}
|
|
445
|
+
|
|
446
|
+
@objc func getPluginVersion(_ call: CAPPluginCall) {
|
|
447
|
+
call.resolve(["version": self.pluginVersion])
|
|
448
|
+
}
|
|
443
449
|
}
|
|
444
450
|
|
|
445
451
|
private enum PayPluginError: LocalizedError {
|
package/package.json
CHANGED