@stripe/stripe-react-native 0.69.0 → 0.71.0
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/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +9 -8
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +8 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampErrors.kt +22 -8
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampMappers.kt +48 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +62 -0
- package/android/src/test/java/com/reactnativestripesdk/OnrampErrorsTest.kt +103 -26
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +10 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/OnrampMappersTest.kt +37 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentMethodMappersTest.kt +110 -0
- package/ios/Mappers.swift +21 -0
- package/ios/OnrampErrors.swift +23 -8
- package/ios/PaymentMethodFactory.swift +9 -0
- package/ios/StripeOnrampSdk.mm +16 -0
- package/ios/StripeSdkImpl.swift +56 -0
- package/jest/setup.js +2 -0
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/hooks/useOnramp.js +1 -1
- package/lib/commonjs/hooks/useOnramp.js.map +1 -1
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -1
- package/lib/commonjs/types/Onramp.js +1 -1
- package/lib/commonjs/types/Onramp.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/hooks/useOnramp.js +1 -1
- package/lib/module/hooks/useOnramp.js.map +1 -1
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -1
- package/lib/module/types/Onramp.js +1 -1
- package/lib/module/types/Onramp.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +18 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +2 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +84 -10
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts +9 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/StripeProvider.tsx +0 -2
- package/src/hooks/useOnramp.tsx +50 -83
- package/src/specs/NativeOnrampSdkModule.ts +8 -0
- package/src/types/Onramp.ts +100 -9
- package/src/types/PaymentIntent.ts +11 -1
- package/src/types/PaymentMethod.ts +1 -0
- package/lib/commonjs/internal/stripeConfig.js +0 -2
- package/lib/commonjs/internal/stripeConfig.js.map +0 -1
- package/lib/module/internal/stripeConfig.js +0 -2
- package/lib/module/internal/stripeConfig.js.map +0 -1
- package/lib/typescript/src/internal/stripeConfig.d.ts +0 -3
- package/lib/typescript/src/internal/stripeConfig.d.ts.map +0 -1
- package/src/internal/stripeConfig.ts +0 -9
package/src/types/Onramp.ts
CHANGED
|
@@ -6,9 +6,9 @@ import type {
|
|
|
6
6
|
} from './PlatformPay';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Generic error
|
|
9
|
+
* Generic error statuses returned by Crypto Onramp APIs.
|
|
10
10
|
*/
|
|
11
|
-
export enum
|
|
11
|
+
export enum OnrampErrorStatus {
|
|
12
12
|
Failed = 'Failed',
|
|
13
13
|
Canceled = 'Canceled',
|
|
14
14
|
Unknown = 'Unknown',
|
|
@@ -175,8 +175,39 @@ export enum CryptoNetwork {
|
|
|
175
175
|
worldchain = 'worldchain',
|
|
176
176
|
xrpl = 'xrpl',
|
|
177
177
|
sui = 'sui',
|
|
178
|
+
arbitrum = 'arbitrum',
|
|
178
179
|
}
|
|
179
180
|
|
|
181
|
+
/**
|
|
182
|
+
* A short-lived server-issued challenge used to prove ownership of a registered wallet.
|
|
183
|
+
*/
|
|
184
|
+
export type WalletOwnershipChallenge = {
|
|
185
|
+
/** Opaque identifier for this challenge. */
|
|
186
|
+
challengeId: string;
|
|
187
|
+
/** The wallet address bound to this challenge. */
|
|
188
|
+
walletAddress: string;
|
|
189
|
+
/** The crypto network bound to this challenge. */
|
|
190
|
+
network: CryptoNetwork;
|
|
191
|
+
/** The exact opaque message the wallet must sign. */
|
|
192
|
+
message: string;
|
|
193
|
+
/** ISO 8601 timestamp indicating when this challenge expires. */
|
|
194
|
+
expiresAt: string;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A registered crypto consumer wallet.
|
|
199
|
+
*/
|
|
200
|
+
export type CryptoConsumerWallet = {
|
|
201
|
+
/** The consumer wallet's unique identifier. */
|
|
202
|
+
id: string;
|
|
203
|
+
/** The registered wallet address. */
|
|
204
|
+
walletAddress: string;
|
|
205
|
+
/** The crypto network for the registered wallet. */
|
|
206
|
+
network: CryptoNetwork;
|
|
207
|
+
/** Whether ownership of this wallet has been verified. */
|
|
208
|
+
verifiedOwnership: boolean;
|
|
209
|
+
};
|
|
210
|
+
|
|
180
211
|
/**
|
|
181
212
|
* Represents a calendar date using day, month, and year components.
|
|
182
213
|
* Example: March 31st, 1975 -> { day: 31, month: 3, year: 1975 }
|
|
@@ -268,23 +299,43 @@ export type ComplianceIdentifierRequirements = {
|
|
|
268
299
|
carfTinRequired: boolean;
|
|
269
300
|
};
|
|
270
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Typed Crypto Onramp API error discriminants.
|
|
304
|
+
*/
|
|
305
|
+
export type OnrampApiErrorType =
|
|
306
|
+
| 'AppAttestationError'
|
|
307
|
+
| 'UncategorizedApiError';
|
|
308
|
+
|
|
271
309
|
/**
|
|
272
310
|
* Typed Crypto Onramp error discriminants returned by newer native SDKs.
|
|
273
311
|
*/
|
|
274
|
-
export type OnrampErrorType =
|
|
312
|
+
export type OnrampErrorType =
|
|
313
|
+
| OnrampApiErrorType
|
|
314
|
+
| 'AppAttestationUnavailableError';
|
|
275
315
|
|
|
276
|
-
|
|
277
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Base rich error shape returned by native Crypto Onramp SDK errors.
|
|
318
|
+
*/
|
|
319
|
+
export type OnrampSdkError = StripeError<OnrampErrorStatus> & {
|
|
320
|
+
onrampErrorType: OnrampErrorType;
|
|
278
321
|
developerMessage: string;
|
|
279
322
|
userMessage: string;
|
|
323
|
+
docUrl?: string;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* API-context fields returned for Crypto Onramp API errors.
|
|
328
|
+
*/
|
|
329
|
+
export type OnrampApiError = OnrampSdkError & {
|
|
330
|
+
onrampErrorType: OnrampApiErrorType;
|
|
280
331
|
reason?: string;
|
|
281
332
|
requestId?: string;
|
|
282
333
|
apiErrorCode?: string;
|
|
283
334
|
apiErrorType?: string;
|
|
284
335
|
apiErrorMessage?: string;
|
|
285
336
|
apiUserMessage?: string;
|
|
286
|
-
docUrl?: string;
|
|
287
337
|
};
|
|
338
|
+
|
|
288
339
|
/**
|
|
289
340
|
* A typed Crypto Onramp app attestation failure.
|
|
290
341
|
*/
|
|
@@ -299,6 +350,13 @@ export type UncategorizedApiError = OnrampApiError & {
|
|
|
299
350
|
onrampErrorType: 'UncategorizedApiError';
|
|
300
351
|
};
|
|
301
352
|
|
|
353
|
+
/**
|
|
354
|
+
* A typed Crypto Onramp local SDK error for app attestation setup failures.
|
|
355
|
+
*/
|
|
356
|
+
export type AppAttestationUnavailableError = OnrampSdkError & {
|
|
357
|
+
onrampErrorType: 'AppAttestationUnavailableError';
|
|
358
|
+
};
|
|
359
|
+
|
|
302
360
|
/**
|
|
303
361
|
* Error returned by Crypto Onramp APIs.
|
|
304
362
|
*
|
|
@@ -307,11 +365,14 @@ export type UncategorizedApiError = OnrampApiError & {
|
|
|
307
365
|
* `onrampErrorType`.
|
|
308
366
|
*/
|
|
309
367
|
export type CryptoOnrampError =
|
|
310
|
-
| (StripeError<
|
|
311
|
-
onrampErrorType?:
|
|
368
|
+
| (StripeError<OnrampErrorStatus> & {
|
|
369
|
+
onrampErrorType?: never;
|
|
370
|
+
developerMessage?: never;
|
|
371
|
+
userMessage?: never;
|
|
312
372
|
})
|
|
313
373
|
| AppAttestationError
|
|
314
|
-
| UncategorizedApiError
|
|
374
|
+
| UncategorizedApiError
|
|
375
|
+
| AppAttestationUnavailableError;
|
|
315
376
|
|
|
316
377
|
/**
|
|
317
378
|
* Result of retrieving missing compliance identifiers.
|
|
@@ -456,6 +517,36 @@ export type RegisterLinkUserResult =
|
|
|
456
517
|
error: CryptoOnrampError;
|
|
457
518
|
};
|
|
458
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Result of creating a wallet ownership challenge.
|
|
522
|
+
*/
|
|
523
|
+
export type GetWalletOwnershipChallengeResult =
|
|
524
|
+
| {
|
|
525
|
+
/** The short-lived challenge whose message must be signed by the wallet. */
|
|
526
|
+
challenge: WalletOwnershipChallenge;
|
|
527
|
+
error?: undefined;
|
|
528
|
+
}
|
|
529
|
+
| {
|
|
530
|
+
challenge?: undefined;
|
|
531
|
+
/** Present if challenge creation failed with an error. */
|
|
532
|
+
error: CryptoOnrampError;
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Result of submitting a wallet ownership signature.
|
|
537
|
+
*/
|
|
538
|
+
export type SubmitWalletOwnershipSignatureResult =
|
|
539
|
+
| {
|
|
540
|
+
/** The registered wallet after ownership verification. */
|
|
541
|
+
consumerWallet: CryptoConsumerWallet;
|
|
542
|
+
error?: undefined;
|
|
543
|
+
}
|
|
544
|
+
| {
|
|
545
|
+
consumerWallet?: undefined;
|
|
546
|
+
/** Present if signature verification failed with an error. */
|
|
547
|
+
error: CryptoOnrampError;
|
|
548
|
+
};
|
|
549
|
+
|
|
459
550
|
/**
|
|
460
551
|
* Describes the payment method currently selected by the user.
|
|
461
552
|
*/
|
|
@@ -51,7 +51,8 @@ export type ConfirmParams =
|
|
|
51
51
|
| PayPalParams
|
|
52
52
|
| AffirmParams
|
|
53
53
|
| CashAppParams
|
|
54
|
-
| RevolutPayParams
|
|
54
|
+
| RevolutPayParams
|
|
55
|
+
| PayByBankParams;
|
|
55
56
|
|
|
56
57
|
export type ConfirmOptions = PaymentMethod.ConfirmOptions;
|
|
57
58
|
|
|
@@ -316,6 +317,15 @@ export type RevolutPayParams = {
|
|
|
316
317
|
};
|
|
317
318
|
};
|
|
318
319
|
|
|
320
|
+
export type PayByBankParams = {
|
|
321
|
+
paymentMethodType: 'PayByBank';
|
|
322
|
+
paymentMethodData?: {
|
|
323
|
+
billingDetails?: BillingDetails;
|
|
324
|
+
mandateData?: MandateData;
|
|
325
|
+
metadata?: MetaData;
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
319
329
|
export type CollectBankAccountParams = {
|
|
320
330
|
paymentMethodType: 'USBankAccount';
|
|
321
331
|
paymentMethodData: {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.getCurrentPublishableKey=getCurrentPublishableKey;exports.setCurrentPublishableKey=setCurrentPublishableKey;var currentPublishableKey;function setCurrentPublishableKey(publishableKey){currentPublishableKey=publishableKey;}function getCurrentPublishableKey(){return currentPublishableKey;}
|
|
2
|
-
//# sourceMappingURL=stripeConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["currentPublishableKey","setCurrentPublishableKey","publishableKey","getCurrentPublishableKey"],"sourceRoot":"../../../src","sources":["internal/stripeConfig.ts"],"mappings":"6KAAA,GAAI,CAAAA,qBAAyC,CAEtC,QAAS,CAAAC,wBAAwBA,CAACC,cAAsB,CAAQ,CACrEF,qBAAqB,CAAGE,cAAc,CACxC,CAEO,QAAS,CAAAC,wBAAwBA,CAAA,CAAuB,CAC7D,MAAO,CAAAH,qBAAqB,CAC9B","ignoreList":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.getCurrentPublishableKey=getCurrentPublishableKey;exports.setCurrentPublishableKey=setCurrentPublishableKey;var currentPublishableKey;function setCurrentPublishableKey(publishableKey){currentPublishableKey=publishableKey;}function getCurrentPublishableKey(){return currentPublishableKey;}
|
|
2
|
-
//# sourceMappingURL=stripeConfig.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["currentPublishableKey","setCurrentPublishableKey","publishableKey","getCurrentPublishableKey"],"sourceRoot":"../../../src","sources":["internal/stripeConfig.ts"],"mappings":"6KAAA,GAAI,CAAAA,qBAAyC,CAEtC,QAAS,CAAAC,wBAAwBA,CAACC,cAAsB,CAAQ,CACrEF,qBAAqB,CAAGE,cAAc,CACxC,CAEO,QAAS,CAAAC,wBAAwBA,CAAA,CAAuB,CAC7D,MAAO,CAAAH,qBAAqB,CAC9B","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripeConfig.d.ts","sourceRoot":"","sources":["../../../../src/internal/stripeConfig.ts"],"names":[],"mappings":"AAEA,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,SAAS,CAE7D"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
let currentPublishableKey: string | undefined;
|
|
2
|
-
|
|
3
|
-
export function setCurrentPublishableKey(publishableKey: string): void {
|
|
4
|
-
currentPublishableKey = publishableKey;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function getCurrentPublishableKey(): string | undefined {
|
|
8
|
-
return currentPublishableKey;
|
|
9
|
-
}
|