framepayments-react-native 2.1.1 → 2.1.2
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 +81 -59
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameCheckoutActivity$Companion.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameCheckoutActivity$tryShowCheckout$1.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameCheckoutActivity.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameFlowActivity$CartItemDto.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameFlowActivity$Companion.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameFlowActivity$parseCartItems$type$1.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameFlowActivity.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameGooglePayActivity$Companion.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameGooglePayActivity.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameOnboardingActivity$Companion.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameOnboardingActivity$parseCapabilities$type$1.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameOnboardingActivity.dex +0 -0
- package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/framepayments/reactnativeframe/FrameSDKModule.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameCheckoutActivity$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameCheckoutActivity$tryShowCheckout$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameCheckoutActivity.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameFlowActivity$CartItemDto.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameFlowActivity$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameFlowActivity$parseCartItems$type$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameFlowActivity.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameGooglePayActivity$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameGooglePayActivity.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameOnboardingActivity$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameOnboardingActivity$parseCapabilities$type$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameOnboardingActivity.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/framepayments/reactnativeframe/FrameSDKModule.class +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameCheckoutActivity$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameCheckoutActivity$tryShowCheckout$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameCheckoutActivity.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameFlowActivity$CartItemDto.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameFlowActivity$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameFlowActivity$parseCartItems$type$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameFlowActivity.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameGooglePayActivity$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameGooglePayActivity.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameOnboardingActivity$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameOnboardingActivity$parseCapabilities$type$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameOnboardingActivity.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/framepayments/reactnativeframe/FrameSDKModule.class +0 -0
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/framepayments/reactnativeframe/FrameCheckoutActivity.kt +17 -13
- package/android/src/main/java/com/framepayments/reactnativeframe/FrameFlowActivity.kt +18 -11
- package/android/src/main/java/com/framepayments/reactnativeframe/FrameGooglePayActivity.kt +31 -8
- package/android/src/main/java/com/framepayments/reactnativeframe/FrameSDKModule.kt +28 -35
- package/ios/ApplePayPresenter.swift +53 -28
- package/ios/FrameSDKBridge.m +7 -7
- package/ios/FrameSDKBridge.swift +61 -27
- package/lib/errors.d.ts +9 -1
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +9 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/native.d.ts +37 -7
- package/lib/native.d.ts.map +1 -1
- package/lib/native.js +61 -9
- package/lib/types.d.ts +18 -45
- package/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/native.test.ts +179 -25
- package/src/errors.ts +9 -1
- package/src/index.ts +1 -3
- package/src/native.ts +69 -17
- package/src/types.ts +19 -58
- /package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_global-synthetics/com/framepayments/reactnativeframe/{FrameSDKModule$$InternalSyntheticLambda$2$984ab30558bc904ed37602fa6e3ebf28f1ed69df6712b31b00c4f26fc26d3b70$0.globals → FrameSDKModule$$InternalSyntheticLambda$2$7347ff5b95d03cf5be9ee5177309c1bf4be5faabda2bbedb79f5f4c91917c2b1$0.globals} +0 -0
- /package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_global-synthetics/com/framepayments/reactnativeframe/{FrameSDKModule$$InternalSyntheticLambda$2$f8d46f7169c404d37a1d505f19439b83090fbed62b5bdaf1e86717fdddebf622$0.globals → FrameSDKModule$$InternalSyntheticLambda$2$7347ff5b95d03cf5be9ee5177309c1bf4be5faabda2bbedb79f5f4c91917c2b1$1.globals} +0 -0
- /package/android/build/.transforms/5a2061641b1fc5518a336681809507bc/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_global-synthetics/com/framepayments/reactnativeframe/{FrameSDKModule$$InternalSyntheticLambda$2$f8d46f7169c404d37a1d505f19439b83090fbed62b5bdaf1e86717fdddebf622$1.globals → FrameSDKModule$$InternalSyntheticLambda$2$9816d2cb3db63bf5efb3411b62dbb57847dd7ef82f88bae5f375baced7880f11$0.globals} +0 -0
package/src/native.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { NativeModules, Platform } from 'react-native';
|
|
6
6
|
import type {
|
|
7
|
-
ChargeIntent,
|
|
8
7
|
FrameCartItem,
|
|
9
8
|
FrameTheme,
|
|
10
9
|
OnboardingCapability,
|
|
@@ -14,6 +13,17 @@ import type {
|
|
|
14
13
|
} from './types';
|
|
15
14
|
import { ErrorCodes } from './errors';
|
|
16
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Throw a coded error from synchronous JS validation. Mirrors the `code`/`message`
|
|
18
|
+
* shape that native rejections produce so consumers can catch `e.code === 'INVALID_*'`
|
|
19
|
+
* uniformly.
|
|
20
|
+
*/
|
|
21
|
+
function throwCoded(code: string, message: string): never {
|
|
22
|
+
const err = new Error(message) as Error & { code: string };
|
|
23
|
+
err.code = code;
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
// theme is iOS-only today: frame-android does not yet have a matching theme API,
|
|
18
28
|
// so the field is accepted on both platforms but ignored on Android until it does.
|
|
19
29
|
|
|
@@ -46,13 +56,13 @@ export function initialize(options: {
|
|
|
46
56
|
theme?: FrameTheme;
|
|
47
57
|
}): Promise<void> {
|
|
48
58
|
if (!options?.secretKey) {
|
|
49
|
-
|
|
59
|
+
throwCoded(ErrorCodes.INIT_FAILED, 'Frame.initialize requires secretKey');
|
|
50
60
|
}
|
|
51
61
|
if (!options?.publishableKey) {
|
|
52
|
-
|
|
62
|
+
throwCoded(ErrorCodes.INIT_FAILED, 'Frame.initialize requires publishableKey');
|
|
53
63
|
}
|
|
54
64
|
if (options.theme !== undefined && (typeof options.theme !== 'object' || Array.isArray(options.theme))) {
|
|
55
|
-
|
|
65
|
+
throwCoded(ErrorCodes.INIT_FAILED, 'Frame.initialize: theme must be an object');
|
|
56
66
|
}
|
|
57
67
|
return wrapPromise(
|
|
58
68
|
FrameSDK.initialize(
|
|
@@ -88,25 +98,46 @@ function wrapPromise<T>(p: Promise<T>): Promise<T> {
|
|
|
88
98
|
});
|
|
89
99
|
}
|
|
90
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Presents the Frame checkout sheet for the given account. Resolves with the
|
|
103
|
+
* created Transfer's id string on success, or rejects with `USER_CANCELED` if
|
|
104
|
+
* the user dismisses the sheet.
|
|
105
|
+
*
|
|
106
|
+
* `accountId` is required: the bundled checkout creates a `Transfer`, which is
|
|
107
|
+
* account-scoped. Callers needing a customer/ChargeIntent flow should use
|
|
108
|
+
* `presentApplePay` / `presentGooglePay` directly with a customer owner.
|
|
109
|
+
*/
|
|
91
110
|
export function presentCheckout(options: {
|
|
92
|
-
|
|
111
|
+
accountId: string;
|
|
93
112
|
amount: number;
|
|
94
|
-
}): Promise<
|
|
113
|
+
}): Promise<string> {
|
|
95
114
|
guardInitialized();
|
|
115
|
+
if (!options?.accountId) {
|
|
116
|
+
throwCoded(ErrorCodes.INVALID_ACCOUNT, 'Frame.presentCheckout requires accountId');
|
|
117
|
+
}
|
|
96
118
|
return wrapPromise(
|
|
97
|
-
FrameSDK.presentCheckout(options.
|
|
119
|
+
FrameSDK.presentCheckout(options.accountId, options.amount)
|
|
98
120
|
);
|
|
99
121
|
}
|
|
100
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Presents the Frame cart UI; tapping checkout routes through the same flow
|
|
125
|
+
* as `presentCheckout` and resolves with the created Transfer's id string.
|
|
126
|
+
*
|
|
127
|
+
* `accountId` is required for the same reason as `presentCheckout`.
|
|
128
|
+
*/
|
|
101
129
|
export function presentCart(options: {
|
|
102
|
-
|
|
130
|
+
accountId: string;
|
|
103
131
|
items: FrameCartItem[];
|
|
104
132
|
shippingAmountInCents: number;
|
|
105
|
-
}): Promise<
|
|
133
|
+
}): Promise<string> {
|
|
106
134
|
guardInitialized();
|
|
135
|
+
if (!options?.accountId) {
|
|
136
|
+
throwCoded(ErrorCodes.INVALID_ACCOUNT, 'Frame.presentCart requires accountId');
|
|
137
|
+
}
|
|
107
138
|
return wrapPromise(
|
|
108
139
|
FrameSDK.presentCart(
|
|
109
|
-
options.
|
|
140
|
+
options.accountId,
|
|
110
141
|
options.items,
|
|
111
142
|
options.shippingAmountInCents
|
|
112
143
|
)
|
|
@@ -138,16 +169,24 @@ export function presentOnboarding(options: {
|
|
|
138
169
|
);
|
|
139
170
|
}
|
|
140
171
|
|
|
141
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Presents the Apple Pay sheet and creates a charge from the resulting wallet
|
|
174
|
+
* payment method. Resolves with the created resource's id string on success,
|
|
175
|
+
* or rejects with `USER_CANCELED` if the sheet is dismissed.
|
|
176
|
+
*
|
|
177
|
+
* - `owner.type === 'customer'` → creates a `ChargeIntent`; resolves with its id.
|
|
178
|
+
* - `owner.type === 'account'` → creates a `Transfer`; resolves with its id.
|
|
179
|
+
*/
|
|
180
|
+
export function presentApplePay(options: PresentApplePayOptions): Promise<string> {
|
|
142
181
|
guardInitialized();
|
|
143
182
|
if (!options?.owner || (options.owner.type !== 'customer' && options.owner.type !== 'account')) {
|
|
144
|
-
|
|
183
|
+
throwCoded(ErrorCodes.INVALID_OWNER, 'Frame.presentApplePay requires owner: { type: "customer" | "account", id: string }');
|
|
145
184
|
}
|
|
146
185
|
if (!options.owner.id) {
|
|
147
|
-
|
|
186
|
+
throwCoded(ErrorCodes.INVALID_OWNER, 'Frame.presentApplePay requires owner.id');
|
|
148
187
|
}
|
|
149
188
|
if (!options.merchantId) {
|
|
150
|
-
|
|
189
|
+
throwCoded(ErrorCodes.INVALID_MERCHANT_ID, 'Frame.presentApplePay requires merchantId');
|
|
151
190
|
}
|
|
152
191
|
return wrapPromise(
|
|
153
192
|
FrameSDK.presentApplePay(
|
|
@@ -160,15 +199,28 @@ export function presentApplePay(options: PresentApplePayOptions): Promise<Charge
|
|
|
160
199
|
);
|
|
161
200
|
}
|
|
162
201
|
|
|
163
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Presents Google Pay and creates a charge from the resulting wallet payment method.
|
|
204
|
+
* Resolves with the created resource's id string on success.
|
|
205
|
+
*
|
|
206
|
+
* - `owner.type === 'customer'` → creates a `ChargeIntent`; resolves with its id.
|
|
207
|
+
* - `owner.type === 'account'` → creates a `Transfer`; resolves with its id.
|
|
208
|
+
*/
|
|
209
|
+
export function presentGooglePay(options: PresentGooglePayOptions): Promise<string> {
|
|
164
210
|
guardInitialized();
|
|
211
|
+
if (!options?.owner || (options.owner.type !== 'customer' && options.owner.type !== 'account')) {
|
|
212
|
+
throwCoded(ErrorCodes.INVALID_OWNER, 'Frame.presentGooglePay requires owner: { type: "customer" | "account", id: string }');
|
|
213
|
+
}
|
|
214
|
+
if (!options.owner.id) {
|
|
215
|
+
throwCoded(ErrorCodes.INVALID_OWNER, 'Frame.presentGooglePay requires owner.id');
|
|
216
|
+
}
|
|
165
217
|
return wrapPromise(
|
|
166
218
|
FrameSDK.presentGooglePay(
|
|
167
219
|
options.amountCents,
|
|
168
|
-
options.
|
|
220
|
+
options.owner.type,
|
|
221
|
+
options.owner.id,
|
|
169
222
|
options.currencyCode ?? 'USD',
|
|
170
223
|
options.googlePayMerchantId ?? null
|
|
171
224
|
)
|
|
172
225
|
);
|
|
173
226
|
}
|
|
174
|
-
|
package/src/types.ts
CHANGED
|
@@ -11,18 +11,6 @@ export interface FrameCartItem {
|
|
|
11
11
|
imageUrl: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export type ChargeIntentStatus =
|
|
15
|
-
| 'canceled'
|
|
16
|
-
| 'disputed'
|
|
17
|
-
| 'failed'
|
|
18
|
-
| 'incomplete'
|
|
19
|
-
| 'pending'
|
|
20
|
-
| 'refunded'
|
|
21
|
-
| 'reversed'
|
|
22
|
-
| 'succeeded';
|
|
23
|
-
|
|
24
|
-
export type AuthorizationMode = 'automatic' | 'manual';
|
|
25
|
-
|
|
26
14
|
export interface BillingAddress {
|
|
27
15
|
city?: string;
|
|
28
16
|
country?: string;
|
|
@@ -62,46 +50,6 @@ export interface PaymentMethod {
|
|
|
62
50
|
billing?: BillingAddress;
|
|
63
51
|
}
|
|
64
52
|
|
|
65
|
-
export interface Customer {
|
|
66
|
-
id: string;
|
|
67
|
-
object: string;
|
|
68
|
-
created: number;
|
|
69
|
-
updated: number;
|
|
70
|
-
livemode: boolean;
|
|
71
|
-
name?: string;
|
|
72
|
-
email?: string;
|
|
73
|
-
phone?: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface Charge {
|
|
77
|
-
id: string;
|
|
78
|
-
object: string;
|
|
79
|
-
amount: number;
|
|
80
|
-
currency: string;
|
|
81
|
-
status: string;
|
|
82
|
-
created: number;
|
|
83
|
-
livemode: boolean;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** Charge intent returned from presentCheckout / presentCart */
|
|
87
|
-
export interface ChargeIntent {
|
|
88
|
-
id: string;
|
|
89
|
-
currency: string;
|
|
90
|
-
amount: number;
|
|
91
|
-
status: ChargeIntentStatus;
|
|
92
|
-
created: number;
|
|
93
|
-
updated: number;
|
|
94
|
-
livemode: boolean;
|
|
95
|
-
object: string;
|
|
96
|
-
description?: string;
|
|
97
|
-
authorizationMode?: AuthorizationMode;
|
|
98
|
-
failureDescription?: string;
|
|
99
|
-
customer?: Customer;
|
|
100
|
-
paymentMethod?: PaymentMethod;
|
|
101
|
-
latestCharge?: Charge;
|
|
102
|
-
shipping?: BillingAddress;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
53
|
/** Error shape when native module rejects (same as FrameErrorShape from errors.ts) */
|
|
106
54
|
export interface FrameError {
|
|
107
55
|
code: string;
|
|
@@ -134,19 +82,32 @@ export interface OnboardingResult {
|
|
|
134
82
|
paymentMethodId?: string;
|
|
135
83
|
}
|
|
136
84
|
|
|
137
|
-
/**
|
|
138
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Identifies who the wallet payment method belongs to and which downstream
|
|
87
|
+
* resource is created when the user authorizes payment. Used by both
|
|
88
|
+
* `presentApplePay` and `presentGooglePay`.
|
|
89
|
+
*
|
|
90
|
+
* - `{ type: 'customer', id }` → creates a `ChargeIntent`; promise resolves with the ChargeIntent id.
|
|
91
|
+
* - `{ type: 'account', id }` → creates a `Transfer`; promise resolves with the Transfer id.
|
|
92
|
+
*
|
|
93
|
+
* The promise always resolves with a string id; the caller knows which resource
|
|
94
|
+
* it refers to based on the owner type they passed in.
|
|
95
|
+
*/
|
|
96
|
+
export type WalletOwner =
|
|
139
97
|
| { type: 'customer'; id: string }
|
|
140
98
|
| { type: 'account'; id: string };
|
|
141
99
|
|
|
100
|
+
/** @deprecated Use {@link WalletOwner}. Retained as an alias for source compatibility. */
|
|
101
|
+
export type ApplePayOwner = WalletOwner;
|
|
102
|
+
|
|
142
103
|
/** Options for Frame.presentApplePay. */
|
|
143
104
|
export interface PresentApplePayOptions {
|
|
144
105
|
/** Payment amount in cents. */
|
|
145
106
|
amount: number;
|
|
146
107
|
/** ISO 4217 currency code. Defaults to 'usd'. */
|
|
147
108
|
currency?: string;
|
|
148
|
-
/** Customer or account that owns the resulting payment method. */
|
|
149
|
-
owner:
|
|
109
|
+
/** Customer or account that owns the resulting payment method and charge. */
|
|
110
|
+
owner: WalletOwner;
|
|
150
111
|
/** Apple Pay merchant ID configured in your Apple Developer account. */
|
|
151
112
|
merchantId: string;
|
|
152
113
|
}
|
|
@@ -155,8 +116,8 @@ export interface PresentApplePayOptions {
|
|
|
155
116
|
export interface PresentGooglePayOptions {
|
|
156
117
|
/** Payment amount in cents. */
|
|
157
118
|
amountCents: number;
|
|
158
|
-
/**
|
|
159
|
-
|
|
119
|
+
/** Customer or account that owns the resulting payment method and charge. */
|
|
120
|
+
owner: WalletOwner;
|
|
160
121
|
/** ISO 4217 currency code. Defaults to 'USD'. */
|
|
161
122
|
currencyCode?: string;
|
|
162
123
|
/** Optional override for the Google Pay merchant ID. */
|