pa-sdk-react-native 3.0.0 → 3.0.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 +140 -73
- package/lib/api.d.ts +17 -8
- package/lib/api.js +35 -13
- package/lib/confirm.d.ts +32 -20
- package/lib/confirm.js +33 -22
- package/lib/errors.d.ts +9 -7
- package/lib/errors.generated.d.ts +2 -2
- package/lib/errors.generated.js +9 -2
- package/lib/errors.js +12 -19
- package/lib/index.d.ts +4 -4
- package/lib/index.js +11 -10
- package/lib/init.d.ts +8 -8
- package/lib/init.js +11 -8
- package/lib/locales.d.ts +20 -10
- package/lib/locales.generated.d.ts +3 -4
- package/lib/locales.generated.js +110 -27
- package/lib/locales.js +62 -14
- package/lib/poll.d.ts +3 -3
- package/lib/poll.js +4 -4
- package/lib/threeDs.d.ts +17 -6
- package/lib/threeDs.js +24 -2
- package/lib/threeDsHost.d.ts +2 -2
- package/lib/threeDsHost.js +3 -3
- package/lib/tokenize.d.ts +9 -4
- package/lib/tokenize.js +6 -4
- package/lib/types.d.ts +33 -26
- package/lib/types.js +4 -5
- package/lib/validator.d.ts +8 -8
- package/lib/validator.js +9 -10
- package/locales/en-US.json +21 -0
- package/locales/ms-MY.json +45 -24
- package/locales/zh-CN.json +21 -0
- package/locales/zh-TW.json +21 -0
- package/native/android/build.gradle +4 -4
- package/native/android/src/main/AndroidManifest.xml +12 -11
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdk3dsActivity.kt +9 -16
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdk3dsModule.kt +3 -3
- package/native/ios/PaSdk3ds.swift +64 -21
- package/native/ios/PaSdk3dsModule.m +16 -9
- package/package.json +3 -3
- package/scripts/generate-errors.js +2 -2
- package/scripts/generate-locales.js +24 -4
package/lib/types.d.ts
CHANGED
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
* PA SDK React Native — shared types.
|
|
3
3
|
*
|
|
4
4
|
* The result states are exactly the five states of the shared payment
|
|
5
|
-
* contract
|
|
6
|
-
* resolved value
|
|
5
|
+
* contract. `requires_action` must never be a
|
|
6
|
+
* resolved value — any 3DS is handled inside confirm.
|
|
7
7
|
*/
|
|
8
|
-
/** Environments
|
|
8
|
+
/** Environments — selected once at init. */
|
|
9
9
|
export type Environment = 'production' | 'sandbox';
|
|
10
|
-
/** SDK result states
|
|
10
|
+
/** SDK result states. */
|
|
11
11
|
export type ResultStatus = 'succeeded' | 'authorized' | 'processing' | 'cancelled' | 'failed';
|
|
12
|
-
/**
|
|
12
|
+
/** three_ds_action values accepted at confirm. */
|
|
13
|
+
export type ThreeDsAction = 'force' | 'skip';
|
|
14
|
+
/** Field codes reported by validation. */
|
|
13
15
|
export type FieldErrorCode = 'incomplete_number' | 'invalid_number' | 'incomplete_expiry' | 'invalid_expiry' | 'incomplete_cvc' | 'invalid_cvc' | 'unsupported_brand';
|
|
14
|
-
/** Published brand vocabulary
|
|
16
|
+
/** Published brand vocabulary. Scope is Visa + Mastercard; the
|
|
15
17
|
* other values exist so a non-scope scheme can be detected early and blocked. */
|
|
16
18
|
export type CardBrand = 'visa' | 'mastercard' | 'amex' | 'diners' | 'discover' | 'jcb' | 'unionpay' | 'maestro' | 'unknown';
|
|
17
|
-
/** Card input collected by
|
|
19
|
+
/** Card input collected by the app's own UI. */
|
|
18
20
|
export interface CardInput {
|
|
19
21
|
/** Full card number, spaces and dashes tolerated. */
|
|
20
22
|
cardNumber: string;
|
|
@@ -24,10 +26,13 @@ export interface CardInput {
|
|
|
24
26
|
expiryYear: number | string;
|
|
25
27
|
/** Security code. */
|
|
26
28
|
cvc: string;
|
|
27
|
-
/** Optional; never required
|
|
29
|
+
/** Optional; never required. */
|
|
28
30
|
cardHolderName?: string;
|
|
29
31
|
}
|
|
30
|
-
/**
|
|
32
|
+
/** Flow-supplied message overrides, keyed like the locale bundles
|
|
33
|
+
* ("error.card_declined", "threeds.title", "field.invalid_number", ...). */
|
|
34
|
+
export type SdkMessages = Record<string, string>;
|
|
35
|
+
/** Optional pass-through billing details.
|
|
31
36
|
* Postal address is optional and never required. */
|
|
32
37
|
export interface BillingDetails {
|
|
33
38
|
cardholderName?: string;
|
|
@@ -38,7 +43,7 @@ export interface BillingDetails {
|
|
|
38
43
|
phone?: string;
|
|
39
44
|
/** Optional separate dial code, e.g. "+852" (used when `phone` is national). */
|
|
40
45
|
phoneDialCode?: string;
|
|
41
|
-
/** Optional postal address — absent must never fail
|
|
46
|
+
/** Optional postal address — absent must never fail. */
|
|
42
47
|
address?: {
|
|
43
48
|
line1?: string;
|
|
44
49
|
line2?: string;
|
|
@@ -48,7 +53,7 @@ export interface BillingDetails {
|
|
|
48
53
|
countryCode?: string;
|
|
49
54
|
};
|
|
50
55
|
}
|
|
51
|
-
/** Init options
|
|
56
|
+
/** Init options: one initialisation serves multiple
|
|
52
57
|
* merchant accounts, keyed by market. Currency and country are per intent. */
|
|
53
58
|
export interface InitOptions {
|
|
54
59
|
environment: Environment;
|
|
@@ -58,39 +63,42 @@ export interface InitOptions {
|
|
|
58
63
|
};
|
|
59
64
|
/** Which market key to use when a call does not name one. */
|
|
60
65
|
defaultAccount: string;
|
|
61
|
-
/**
|
|
66
|
+
/** Locale tag; underscore/hyphen and case-insensitive. */
|
|
62
67
|
locale?: string;
|
|
68
|
+
/** Flow-supplied message overrides merged over the resolved locale bundle
|
|
69
|
+
* at lookup time, keyed like the bundles ("error.card_declined", ...). */
|
|
70
|
+
messages?: SdkMessages;
|
|
63
71
|
/** App origin sent with API calls where the gateway recommends one,
|
|
64
|
-
* e.g. "https://
|
|
72
|
+
* e.g. "https://links.yourapp.com". */
|
|
65
73
|
origin?: string;
|
|
66
|
-
/** 3DS return URL configuration
|
|
74
|
+
/** 3DS return URL configuration. */
|
|
67
75
|
threeDsReturnUrls?: {
|
|
68
|
-
/** Custom scheme, e.g. "
|
|
76
|
+
/** Custom scheme, e.g. "yourapp://" — no trailing slash. */
|
|
69
77
|
scheme?: string;
|
|
70
|
-
/** Universal-link host, e.g. "https://
|
|
78
|
+
/** Universal-link host, e.g. "https://links.yourapp.com". */
|
|
71
79
|
universalLinkHost?: string;
|
|
72
80
|
};
|
|
73
81
|
}
|
|
74
|
-
/** The single result object confirm resolves with, exactly once
|
|
82
|
+
/** The single result object confirm resolves with, exactly once. */
|
|
75
83
|
export interface PaymentResult {
|
|
76
84
|
status: ResultStatus;
|
|
77
85
|
intentToken?: string;
|
|
78
86
|
/** PA's reference for this transaction attempt. */
|
|
79
87
|
requestReference?: string | null;
|
|
80
|
-
/**
|
|
88
|
+
/** The app's own order number, echoed by the gateway when present. */
|
|
81
89
|
merchantReference?: string | null;
|
|
82
|
-
/** Saved-card token — set when a card was saved on any path
|
|
90
|
+
/** Saved-card token — set when a card was saved on any path. */
|
|
83
91
|
paToken?: string | null;
|
|
84
92
|
brand?: string | null;
|
|
85
93
|
last4?: string | null;
|
|
86
|
-
/** Shared-table error code for `failed
|
|
94
|
+
/** Shared-table error code for `failed`; null otherwise. */
|
|
87
95
|
errorCode?: string | null;
|
|
88
|
-
/** English developer message for `failed` (optional
|
|
96
|
+
/** English developer message for `failed` (optional). */
|
|
89
97
|
errorMessage?: string | null;
|
|
90
|
-
/** Localized user message for `failed
|
|
98
|
+
/** Localized user message for `failed`. */
|
|
91
99
|
userMessage?: string | null;
|
|
92
100
|
}
|
|
93
|
-
/** Tokenization result
|
|
101
|
+
/** Tokenization result. */
|
|
94
102
|
export interface TokenizeResult {
|
|
95
103
|
paToken: string;
|
|
96
104
|
last4: string;
|
|
@@ -102,9 +110,8 @@ export interface TokenizeOutput {
|
|
|
102
110
|
sessionToken: string;
|
|
103
111
|
result: TokenizeResult;
|
|
104
112
|
}
|
|
105
|
-
/** Polling schedule
|
|
106
|
-
* suspended time while the app is backgrounded does not count
|
|
107
|
-
* WEB-50 analog). */
|
|
113
|
+
/** Polling schedule: 2s x 15 then 5s x 12 —
|
|
114
|
+
* suspended time while the app is backgrounded does not count. */
|
|
108
115
|
export declare const POLL_FAST_INTERVAL_MS = 2000;
|
|
109
116
|
export declare const POLL_FAST_ATTEMPTS = 15;
|
|
110
117
|
export declare const POLL_SLOW_INTERVAL_MS = 5000;
|
package/lib/types.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* PA SDK React Native — shared types.
|
|
4
4
|
*
|
|
5
5
|
* The result states are exactly the five states of the shared payment
|
|
6
|
-
* contract
|
|
7
|
-
* resolved value
|
|
6
|
+
* contract. `requires_action` must never be a
|
|
7
|
+
* resolved value — any 3DS is handled inside confirm.
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.POLL_SLOW_ATTEMPTS = exports.POLL_SLOW_INTERVAL_MS = exports.POLL_FAST_ATTEMPTS = exports.POLL_FAST_INTERVAL_MS = void 0;
|
|
11
|
-
/** Polling schedule
|
|
12
|
-
* suspended time while the app is backgrounded does not count
|
|
13
|
-
* WEB-50 analog). */
|
|
11
|
+
/** Polling schedule: 2s x 15 then 5s x 12 —
|
|
12
|
+
* suspended time while the app is backgrounded does not count. */
|
|
14
13
|
exports.POLL_FAST_INTERVAL_MS = 2000;
|
|
15
14
|
exports.POLL_FAST_ATTEMPTS = 15;
|
|
16
15
|
exports.POLL_SLOW_INTERVAL_MS = 5000;
|
package/lib/validator.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Headless card validation
|
|
2
|
+
* Headless card validation.
|
|
3
3
|
*
|
|
4
4
|
* Follows Visa and Mastercard rules: current BIN ranges (including
|
|
5
5
|
* Mastercard's 2-series 2221-2720), valid lengths, Luhn, 3-digit CVC,
|
|
6
6
|
* expiry not in the past. Never blocks a valid Visa / Mastercard.
|
|
7
7
|
*
|
|
8
|
-
* Field codes are the shared per-field codes
|
|
8
|
+
* Field codes are the shared per-field codes:
|
|
9
9
|
* incomplete_number, invalid_number, incomplete_expiry, invalid_expiry,
|
|
10
10
|
* incomplete_cvc, invalid_cvc, unsupported_brand.
|
|
11
11
|
*/
|
|
@@ -20,21 +20,21 @@ export interface BrandInfo {
|
|
|
20
20
|
/** Strip spaces / dashes; keep digits only (a stray non-digit is preserved by
|
|
21
21
|
* the caller-level check but never crashes detection). */
|
|
22
22
|
export declare function sanitizeCardNumber(number: string): string;
|
|
23
|
-
/** Brand detection from the BIN while typing
|
|
23
|
+
/** Brand detection from the BIN while typing. Works from the first
|
|
24
24
|
* digit for Visa, the first two/four for the rest. */
|
|
25
25
|
export declare function detectBrand(cardNumber: string): BrandInfo;
|
|
26
|
-
/** Luhn checksum
|
|
26
|
+
/** Luhn checksum. */
|
|
27
27
|
export declare function luhnValid(cardNumber: string): boolean;
|
|
28
28
|
export interface NumberValidation {
|
|
29
29
|
brand: CardBrand;
|
|
30
|
-
/** null when valid; otherwise one of the
|
|
30
|
+
/** null when valid; otherwise one of the shared number codes. */
|
|
31
31
|
error: FieldErrorCode | null;
|
|
32
32
|
complete: boolean;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Validate a card number.
|
|
36
36
|
* @param allowedBrands when provided, a card whose brand is not in the list
|
|
37
|
-
* reports `unsupported_brand` (
|
|
37
|
+
* reports `unsupported_brand` (allowed-brands filter; your server
|
|
38
38
|
* supplies the list per merchant account).
|
|
39
39
|
*/
|
|
40
40
|
export declare function validateCardNumber(cardNumber: string, allowedBrands?: readonly string[] | null): NumberValidation;
|
|
@@ -53,7 +53,7 @@ export declare function cvcLengthsForBrand(brand?: CardBrand | string): number[]
|
|
|
53
53
|
/** Validate CVC for the (detected) brand — 3 digits for Visa / Mastercard. */
|
|
54
54
|
export declare function validateCvc(cvc: string, brand?: CardBrand | string): CvcValidation;
|
|
55
55
|
export interface CardValidation {
|
|
56
|
-
/** Detected brand from the BIN
|
|
56
|
+
/** Detected brand from the BIN — report while typing. */
|
|
57
57
|
brand: CardBrand;
|
|
58
58
|
/** True when every field passes and no brand filter rejects the card. */
|
|
59
59
|
complete: boolean;
|
|
@@ -65,7 +65,7 @@ export interface CardValidation {
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Validate a whole card input from
|
|
68
|
+
* Validate a whole card input from the app's UI. Runs without any network call.
|
|
69
69
|
* `allowedBrands` behaves as in validateCardNumber().
|
|
70
70
|
*/
|
|
71
71
|
export declare function validateCard(card: Partial<CardInput>, allowedBrands?: readonly string[] | null): CardValidation;
|
package/lib/validator.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Headless card validation
|
|
3
|
+
* Headless card validation.
|
|
4
4
|
*
|
|
5
5
|
* Follows Visa and Mastercard rules: current BIN ranges (including
|
|
6
6
|
* Mastercard's 2-series 2221-2720), valid lengths, Luhn, 3-digit CVC,
|
|
7
7
|
* expiry not in the past. Never blocks a valid Visa / Mastercard.
|
|
8
8
|
*
|
|
9
|
-
* Field codes are the shared per-field codes
|
|
9
|
+
* Field codes are the shared per-field codes:
|
|
10
10
|
* incomplete_number, invalid_number, incomplete_expiry, invalid_expiry,
|
|
11
11
|
* incomplete_cvc, invalid_cvc, unsupported_brand.
|
|
12
12
|
*/
|
|
@@ -21,13 +21,12 @@ exports.validateCvc = validateCvc;
|
|
|
21
21
|
exports.validateCard = validateCard;
|
|
22
22
|
/**
|
|
23
23
|
* BIN table. Order matters: the first match wins. Only Visa and Mastercard
|
|
24
|
-
* are in scope
|
|
25
|
-
* block a non-scope scheme early
|
|
24
|
+
* are in scope; the other entries exist so the app can detect and
|
|
25
|
+
* block a non-scope scheme early.
|
|
26
26
|
*/
|
|
27
27
|
const BRAND_RULES = [
|
|
28
28
|
{ brand: 'visa', prefixes: ['4'], lengths: [13, 16, 19], cvcLengths: [3] },
|
|
29
|
-
// Mastercard: 51-55 and the 2-series 2221-2720
|
|
30
|
-
// the 2-series out — it must be recognised).
|
|
29
|
+
// Mastercard: 51-55 and the 2-series 2221-2720 — it must be recognised.
|
|
31
30
|
{
|
|
32
31
|
brand: 'mastercard',
|
|
33
32
|
patterns: [/^5[1-5]/, /^(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)/],
|
|
@@ -47,7 +46,7 @@ const UNKNOWN_RULE = { brand: 'unknown', lengths: [16], cvcLengths: [3] };
|
|
|
47
46
|
function sanitizeCardNumber(number) {
|
|
48
47
|
return String(number || '').replace(/[\s-]/g, '');
|
|
49
48
|
}
|
|
50
|
-
/** Brand detection from the BIN while typing
|
|
49
|
+
/** Brand detection from the BIN while typing. Works from the first
|
|
51
50
|
* digit for Visa, the first two/four for the rest. */
|
|
52
51
|
function detectBrand(cardNumber) {
|
|
53
52
|
const n = sanitizeCardNumber(cardNumber);
|
|
@@ -63,7 +62,7 @@ function detectBrand(cardNumber) {
|
|
|
63
62
|
}
|
|
64
63
|
return { brand: 'unknown', lengths: UNKNOWN_RULE.lengths, cvcLengths: UNKNOWN_RULE.cvcLengths };
|
|
65
64
|
}
|
|
66
|
-
/** Luhn checksum
|
|
65
|
+
/** Luhn checksum. */
|
|
67
66
|
function luhnValid(cardNumber) {
|
|
68
67
|
const n = sanitizeCardNumber(cardNumber);
|
|
69
68
|
if (!/^\d+$/.test(n) || n.length < 2) {
|
|
@@ -87,7 +86,7 @@ function luhnValid(cardNumber) {
|
|
|
87
86
|
/**
|
|
88
87
|
* Validate a card number.
|
|
89
88
|
* @param allowedBrands when provided, a card whose brand is not in the list
|
|
90
|
-
* reports `unsupported_brand` (
|
|
89
|
+
* reports `unsupported_brand` (allowed-brands filter; your server
|
|
91
90
|
* supplies the list per merchant account).
|
|
92
91
|
*/
|
|
93
92
|
function validateCardNumber(cardNumber, allowedBrands) {
|
|
@@ -166,7 +165,7 @@ function validateCvc(cvc, brand) {
|
|
|
166
165
|
return { error: null, complete: true };
|
|
167
166
|
}
|
|
168
167
|
/**
|
|
169
|
-
* Validate a whole card input from
|
|
168
|
+
* Validate a whole card input from the app's UI. Runs without any network call.
|
|
170
169
|
* `allowedBrands` behaves as in validateCardNumber().
|
|
171
170
|
*/
|
|
172
171
|
function validateCard(card, allowedBrands) {
|
package/locales/en-US.json
CHANGED
|
@@ -20,6 +20,27 @@
|
|
|
20
20
|
"error.invalid_client_token": "The payment session has expired. Please try again.",
|
|
21
21
|
"error.origin_not_allowed": "This website is not authorised to use the payment component.",
|
|
22
22
|
"error.font_load_failed": "Font failed to load, a system font is used instead.",
|
|
23
|
+
"error.card_declined": "Your card was declined. Please try another card.",
|
|
24
|
+
"error.insufficient_funds": "Insufficient funds on this card.",
|
|
25
|
+
"error.expired_card": "This card has expired.",
|
|
26
|
+
"error.invalid_cvc": "The card security code is incorrect.",
|
|
27
|
+
"error.invalid_number": "The card number is incorrect.",
|
|
28
|
+
"error.unsupported_brand": "This card type is not accepted.",
|
|
29
|
+
"error.unsupported_currency": "This currency is not supported for this card.",
|
|
30
|
+
"error.threeds_failed": "Card authentication failed. Please try another card.",
|
|
31
|
+
"error.threeds_cancelled": "Card authentication was cancelled.",
|
|
32
|
+
"error.threeds_not_supported": "This card does not support 3D Secure authentication.",
|
|
33
|
+
"error.threeds_no_liability_shift": "Card authentication could not be completed.",
|
|
34
|
+
"error.amount_above_limit": "The amount exceeds the limit for this card.",
|
|
35
|
+
"error.amount_below_limit": "The amount is below the minimum allowed.",
|
|
36
|
+
"error.frequency_limit": "Too many attempts, please try again later.",
|
|
37
|
+
"error.risk_declined": "The payment was blocked. Please contact your bank or try another card.",
|
|
38
|
+
"error.issuer_unavailable": "Your card issuer is unavailable. Please try again later.",
|
|
39
|
+
"error.acquirer_unavailable": "Payment processing is temporarily unavailable. Please try again later.",
|
|
40
|
+
"error.refund_exceeds_paid": "The refund amount exceeds the amount paid.",
|
|
41
|
+
"error.duplicate_confirm": "This payment is already being processed.",
|
|
42
|
+
"error.intent_expired": "The payment session has expired. Please start again.",
|
|
43
|
+
"error.intent_already_final": "This payment has already been processed.",
|
|
23
44
|
"field.incomplete_number": "Enter your full card number",
|
|
24
45
|
"field.invalid_number": "Check your card number",
|
|
25
46
|
"field.incomplete_expiry": "Enter the full expiry date",
|
package/locales/ms-MY.json
CHANGED
|
@@ -1,30 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_meta": {
|
|
3
|
-
"name": "
|
|
3
|
+
"name": "Bahasa Melayu",
|
|
4
4
|
"canonical": "ms-MY",
|
|
5
5
|
"fallback": "en-US",
|
|
6
|
-
"complete":
|
|
6
|
+
"complete": true
|
|
7
7
|
},
|
|
8
|
-
"threeds.title": "",
|
|
9
|
-
"threeds.cancel": "",
|
|
10
|
-
"threeds.close": "",
|
|
11
|
-
"threeds.processing": "",
|
|
12
|
-
"threeds.redirecting": "",
|
|
13
|
-
"payment.processing": "",
|
|
14
|
-
"result.cancelled": "",
|
|
15
|
-
"error.generic": "",
|
|
16
|
-
"error.rate_limited": "",
|
|
17
|
-
"error.processing_timeout": "",
|
|
18
|
-
"error.sdk_load_failed": "",
|
|
19
|
-
"error.invalid_publishable_key": "",
|
|
20
|
-
"error.invalid_client_token": "",
|
|
21
|
-
"error.origin_not_allowed": "",
|
|
22
|
-
"error.font_load_failed": "",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
8
|
+
"threeds.title": "Pengesahan Selamat",
|
|
9
|
+
"threeds.cancel": "Batal",
|
|
10
|
+
"threeds.close": "Tutup",
|
|
11
|
+
"threeds.processing": "Memproses, sila tunggu...",
|
|
12
|
+
"threeds.redirecting": "Mengalihkan...",
|
|
13
|
+
"payment.processing": "Pembayaran sedang diproses...",
|
|
14
|
+
"result.cancelled": "Pembayaran dibatalkan",
|
|
15
|
+
"error.generic": "Pembayaran gagal, sila cuba lagi atau gunakan kad lain.",
|
|
16
|
+
"error.rate_limited": "Terlalu banyak percubaan, sila tunggu sebentar dan cuba lagi.",
|
|
17
|
+
"error.processing_timeout": "Pembayaran anda masih diproses. Kami akan mengesahkan keputusan tidak lama lagi.",
|
|
18
|
+
"error.sdk_load_failed": "Komponen pembayaran gagal dimuatkan, sila muat semula halaman.",
|
|
19
|
+
"error.invalid_publishable_key": "Konfigurasi peniaga tidak sah.",
|
|
20
|
+
"error.invalid_client_token": "Sesi pembayaran telah tamat. Sila cuba lagi.",
|
|
21
|
+
"error.origin_not_allowed": "Laman web ini tidak dibenarkan menggunakan komponen pembayaran.",
|
|
22
|
+
"error.font_load_failed": "Fon gagal dimuatkan, fon sistem digunakan sebagai gantian.",
|
|
23
|
+
"error.card_declined": "Kad anda ditolak. Sila gunakan kad lain.",
|
|
24
|
+
"error.insufficient_funds": "Baki kad tidak mencukupi.",
|
|
25
|
+
"error.expired_card": "Kad telah luput.",
|
|
26
|
+
"error.invalid_cvc": "Kod keselamatan tidak betul.",
|
|
27
|
+
"error.invalid_number": "Nombor kad tidak betul.",
|
|
28
|
+
"error.unsupported_brand": "Jenis kad ini tidak diterima.",
|
|
29
|
+
"error.unsupported_currency": "Mata wang ini tidak disokong untuk kad ini.",
|
|
30
|
+
"error.threeds_failed": "Pengesahan kad gagal. Sila gunakan kad lain.",
|
|
31
|
+
"error.threeds_cancelled": "Pengesahan telah dibatalkan.",
|
|
32
|
+
"error.threeds_not_supported": "Kad ini tidak menyokong pengesahan 3DS.",
|
|
33
|
+
"error.threeds_no_liability_shift": "Pengesahan kad tidak dapat diselesaikan.",
|
|
34
|
+
"error.amount_above_limit": "Amaun melebihi had untuk kad ini.",
|
|
35
|
+
"error.amount_below_limit": "Amaun kurang daripada jumlah minimum.",
|
|
36
|
+
"error.frequency_limit": "Terlalu banyak percubaan, sila cuba lagi kemudian.",
|
|
37
|
+
"error.risk_declined": "Pembayaran disekat. Sila hubungi bank anda atau gunakan kad lain.",
|
|
38
|
+
"error.issuer_unavailable": "Bank penerbit kad tidak tersedia. Sila cuba lagi kemudian.",
|
|
39
|
+
"error.acquirer_unavailable": "Perkhidmatan pembayaran tidak tersedia buat sementara waktu. Sila cuba lagi kemudian.",
|
|
40
|
+
"error.refund_exceeds_paid": "Amaun bayaran balik melebihi jumlah yang dibayar.",
|
|
41
|
+
"error.duplicate_confirm": "Pembayaran ini sedang diproses.",
|
|
42
|
+
"error.intent_expired": "Sesi pembayaran telah tamat. Sila mula semula.",
|
|
43
|
+
"error.intent_already_final": "Pembayaran ini telah selesai.",
|
|
44
|
+
"field.incomplete_number": "Masukkan nombor kad penuh anda",
|
|
45
|
+
"field.invalid_number": "Semak nombor kad anda",
|
|
46
|
+
"field.incomplete_expiry": "Masukkan tarikh luput penuh",
|
|
47
|
+
"field.invalid_expiry": "Semak tarikh luput",
|
|
48
|
+
"field.incomplete_cvc": "Masukkan kod keselamatan",
|
|
49
|
+
"field.invalid_cvc": "Semak kod keselamatan",
|
|
50
|
+
"field.unsupported_brand": "Jenis kad ini tidak diterima"
|
|
30
51
|
}
|
package/locales/zh-CN.json
CHANGED
|
@@ -20,6 +20,27 @@
|
|
|
20
20
|
"error.invalid_client_token": "付款会话已过期,请重试。",
|
|
21
21
|
"error.origin_not_allowed": "此网站未获授权使用付款组件。",
|
|
22
22
|
"error.font_load_failed": "字体加载失败,已改用系统字体。",
|
|
23
|
+
"error.card_declined": "银行卡被拒绝,请更换银行卡重试。",
|
|
24
|
+
"error.insufficient_funds": "银行卡余额不足。",
|
|
25
|
+
"error.expired_card": "银行卡已过期。",
|
|
26
|
+
"error.invalid_cvc": "安全码不正确。",
|
|
27
|
+
"error.invalid_number": "卡号不正确。",
|
|
28
|
+
"error.unsupported_brand": "不支持此银行卡类型。",
|
|
29
|
+
"error.unsupported_currency": "该银行卡不支持此币种。",
|
|
30
|
+
"error.threeds_failed": "安全验证失败,请更换银行卡重试。",
|
|
31
|
+
"error.threeds_cancelled": "你已取消安全验证。",
|
|
32
|
+
"error.threeds_not_supported": "该银行卡不支持 3DS 验证。",
|
|
33
|
+
"error.threeds_no_liability_shift": "安全验证未能完成。",
|
|
34
|
+
"error.amount_above_limit": "金额超过该银行卡的限额。",
|
|
35
|
+
"error.amount_below_limit": "金额低于最低要求。",
|
|
36
|
+
"error.frequency_limit": "操作过于频繁,请稍后再试。",
|
|
37
|
+
"error.risk_declined": "交易被拦截,请联系发卡银行或更换银行卡。",
|
|
38
|
+
"error.issuer_unavailable": "发卡银行暂时无法连接,请稍后再试。",
|
|
39
|
+
"error.acquirer_unavailable": "收单服务暂时不可用,请稍后再试。",
|
|
40
|
+
"error.refund_exceeds_paid": "退款金额超过可退款金额。",
|
|
41
|
+
"error.duplicate_confirm": "该笔付款正在处理中。",
|
|
42
|
+
"error.intent_expired": "付款已过期,请重新发起付款。",
|
|
43
|
+
"error.intent_already_final": "该笔付款已完成。",
|
|
23
44
|
"field.incomplete_number": "请输入完整卡号",
|
|
24
45
|
"field.invalid_number": "请检查卡号",
|
|
25
46
|
"field.incomplete_expiry": "请输入完整有效期",
|
package/locales/zh-TW.json
CHANGED
|
@@ -20,6 +20,27 @@
|
|
|
20
20
|
"error.invalid_client_token": "付款工作階段已過期,請重試。",
|
|
21
21
|
"error.origin_not_allowed": "此網站未獲授權使用付款元件。",
|
|
22
22
|
"error.font_load_failed": "字體載入失敗,已改用系統字體。",
|
|
23
|
+
"error.card_declined": "你的卡片被拒絕,請改用其他卡片。",
|
|
24
|
+
"error.insufficient_funds": "卡片餘額不足。",
|
|
25
|
+
"error.expired_card": "卡片已過期。",
|
|
26
|
+
"error.invalid_cvc": "安全碼不正確。",
|
|
27
|
+
"error.invalid_number": "卡號不正確。",
|
|
28
|
+
"error.unsupported_brand": "不接受此卡片類型。",
|
|
29
|
+
"error.unsupported_currency": "此卡片不支援該貨幣。",
|
|
30
|
+
"error.threeds_failed": "安全驗證失敗,請改用其他卡片。",
|
|
31
|
+
"error.threeds_cancelled": "你已取消安全驗證。",
|
|
32
|
+
"error.threeds_not_supported": "此卡片不支援 3DS 驗證。",
|
|
33
|
+
"error.threeds_no_liability_shift": "安全驗證未能完成。",
|
|
34
|
+
"error.amount_above_limit": "金額超過此卡片的限額。",
|
|
35
|
+
"error.amount_below_limit": "金額低於最低要求。",
|
|
36
|
+
"error.frequency_limit": "嘗試次數過多,請稍後再試。",
|
|
37
|
+
"error.risk_declined": "付款被攔截,請聯絡發卡銀行或改用其他卡片。",
|
|
38
|
+
"error.issuer_unavailable": "發卡銀行暫時無法連線,請稍後再試。",
|
|
39
|
+
"error.acquirer_unavailable": "收款服務暫時無法使用,請稍後再試。",
|
|
40
|
+
"error.refund_exceeds_paid": "退款金額超過可退款金額。",
|
|
41
|
+
"error.duplicate_confirm": "此付款正在處理中。",
|
|
42
|
+
"error.intent_expired": "付款已逾時,請重新發起付款。",
|
|
43
|
+
"error.intent_already_final": "此付款已完成。",
|
|
23
44
|
"field.incomplete_number": "請輸入完整卡號",
|
|
24
45
|
"field.invalid_number": "請檢查卡號",
|
|
25
46
|
"field.incomplete_expiry": "請輸入完整有效期",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// pa-sdk-react-native — Android library build (
|
|
2
|
-
//
|
|
1
|
+
// pa-sdk-react-native — Android library build (distributed via npm; the
|
|
2
|
+
// Android sources are picked up by React Native autolinking).
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
// app's React Native only. minSdk 24
|
|
4
|
+
// No transitive SDKs — WebView and the support of the host
|
|
5
|
+
// app's React Native only. minSdk 24.
|
|
6
6
|
|
|
7
7
|
// Built as part of the host app's Gradle build (see example/settings.gradle);
|
|
8
8
|
// AGP / Kotlin plugins resolve from the root project classpath.
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
<application>
|
|
4
4
|
<!--
|
|
5
|
-
SDK-presented 3DS challenge activity
|
|
6
|
-
The intent-filters below let the SDK CONSUME its own 3DS returns
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
SDK-presented 3DS challenge activity. Full-screen WebView.
|
|
6
|
+
The intent-filters below let the SDK CONSUME its own 3DS returns:
|
|
7
|
+
when the issuer/ACS redirects to the app's return URL (the custom
|
|
8
|
+
scheme and the universal-link host declared below) while a challenge
|
|
9
|
+
is pending, this activity receives the intent, marks it consumed and
|
|
10
|
+
resolves the pending present() promise — the app's own link handler
|
|
11
|
+
never sees it. The scheme/host come from manifest placeholders the
|
|
12
|
+
consuming app MUST define in its build.gradle (see README).
|
|
12
13
|
-->
|
|
13
14
|
<activity
|
|
14
15
|
android:name=".PaSdk3dsActivity"
|
|
@@ -18,22 +19,22 @@
|
|
|
18
19
|
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden|uiMode"
|
|
19
20
|
android:windowSoftInputMode="adjustResize">
|
|
20
21
|
|
|
21
|
-
<!--
|
|
22
|
+
<!-- Return custom scheme -->
|
|
22
23
|
<intent-filter>
|
|
23
24
|
<action android:name="android.intent.action.VIEW" />
|
|
24
25
|
<category android:name="android.intent.category.DEFAULT" />
|
|
25
26
|
<category android:name="android.intent.category.BROWSABLE" />
|
|
26
|
-
<data android:scheme="
|
|
27
|
+
<data android:scheme="${paSdk3dsReturnScheme}" />
|
|
27
28
|
</intent-filter>
|
|
28
29
|
|
|
29
|
-
<!--
|
|
30
|
+
<!-- Return universal-link host -->
|
|
30
31
|
<intent-filter android:autoVerify="false">
|
|
31
32
|
<action android:name="android.intent.action.VIEW" />
|
|
32
33
|
<category android:name="android.intent.category.DEFAULT" />
|
|
33
34
|
<category android:name="android.intent.category.BROWSABLE" />
|
|
34
35
|
<data
|
|
35
36
|
android:scheme="https"
|
|
36
|
-
android:host="
|
|
37
|
+
android:host="${paSdk3dsReturnHost}" />
|
|
37
38
|
</intent-filter>
|
|
38
39
|
</activity>
|
|
39
40
|
</application>
|
|
@@ -18,17 +18,17 @@ import android.widget.TextView
|
|
|
18
18
|
import java.io.Serializable
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* Full-screen WebView presenting the 3DS challenge
|
|
21
|
+
* Full-screen WebView presenting the 3DS challenge.
|
|
22
22
|
*
|
|
23
23
|
* Loads a tiny HTML document that auto-submits a POST form (Cardinal JWT or
|
|
24
24
|
* ACS creq) to the challenge URL — the same handshake as the iOS side.
|
|
25
25
|
*
|
|
26
|
-
* Return consumption
|
|
27
|
-
*
|
|
26
|
+
* Return consumption: the manifest routes the configured return URIs
|
|
27
|
+
* here. onCreate/onNewIntent hand the URI to
|
|
28
28
|
* PaSdk3dsModule.consumeReturnUri() while a challenge is pending, so the
|
|
29
29
|
* app's own link handler never sees the 3DS return. When no challenge is
|
|
30
30
|
* pending, the SDK does not swallow the URI — it re-dispatches it to the
|
|
31
|
-
* app's launch intent so
|
|
31
|
+
* app's launch intent so the app's normal deep-link handling proceeds.
|
|
32
32
|
*/
|
|
33
33
|
class PaSdk3dsActivity : android.app.Activity() {
|
|
34
34
|
|
|
@@ -121,7 +121,7 @@ class PaSdk3dsActivity : android.app.Activity() {
|
|
|
121
121
|
}
|
|
122
122
|
web.loadDataWithBaseURL(null, buildPostHtml(url, fields, str("redirecting", "Redirecting...")), "text/html", "utf-8", null)
|
|
123
123
|
|
|
124
|
-
//
|
|
124
|
+
// This activity may itself be the target of the 3DS return
|
|
125
125
|
// (cold start straight into the return URI).
|
|
126
126
|
handlePossibleReturn(intent)
|
|
127
127
|
}
|
|
@@ -136,7 +136,7 @@ class PaSdk3dsActivity : android.app.Activity() {
|
|
|
136
136
|
if (!isReturnUri(uri)) {
|
|
137
137
|
return
|
|
138
138
|
}
|
|
139
|
-
// Consume silently
|
|
139
|
+
// Consume silently: resolve the pending present() promise and
|
|
140
140
|
// finish. The gateway posts the challenge result server-side; the JS
|
|
141
141
|
// poller (/intent-status) observes the terminal state.
|
|
142
142
|
if (PaSdk3dsModule.consumeReturnUri(uri)) {
|
|
@@ -145,7 +145,7 @@ class PaSdk3dsActivity : android.app.Activity() {
|
|
|
145
145
|
return
|
|
146
146
|
}
|
|
147
147
|
// No challenge pending: this return is not the SDK's. Hand it on to
|
|
148
|
-
// the app's launch activity so
|
|
148
|
+
// the app's launch activity so the app's own deep-link handling proceeds.
|
|
149
149
|
reDispatchToApp(uri)
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -177,13 +177,6 @@ class PaSdk3dsActivity : android.app.Activity() {
|
|
|
177
177
|
return true
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
// Flow defaults, in case the JS layer did not pass them.
|
|
181
|
-
if (scheme == "flow") {
|
|
182
|
-
return true
|
|
183
|
-
}
|
|
184
|
-
if (scheme == "https" && uri.host?.lowercase() == "app.flowtheroom.com") {
|
|
185
|
-
return true
|
|
186
|
-
}
|
|
187
180
|
return false
|
|
188
181
|
}
|
|
189
182
|
|
|
@@ -195,7 +188,7 @@ class PaSdk3dsActivity : android.app.Activity() {
|
|
|
195
188
|
|
|
196
189
|
@Deprecated("Deprecated in Java")
|
|
197
190
|
override fun onBackPressed() {
|
|
198
|
-
// The challenge is not navigable; back means cancel
|
|
191
|
+
// The challenge is not navigable; back means cancel.
|
|
199
192
|
finishCancelled()
|
|
200
193
|
}
|
|
201
194
|
|
|
@@ -215,7 +208,7 @@ class PaSdk3dsActivity : android.app.Activity() {
|
|
|
215
208
|
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
|
|
216
209
|
val uri = request?.url ?: return false
|
|
217
210
|
if (isReturnUri(uri)) {
|
|
218
|
-
// Consume the 3DS return inside the SDK
|
|
211
|
+
// Consume the 3DS return inside the SDK instead of
|
|
219
212
|
// letting the WebView attempt a custom-scheme navigation.
|
|
220
213
|
if (PaSdk3dsModule.consumeReturnUri(uri)) {
|
|
221
214
|
finishedBySdk = true
|
|
@@ -10,7 +10,7 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
10
10
|
import com.facebook.react.bridge.WritableNativeMap
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* PaSdk3ds — SDK-presented 3DS challenge for Android
|
|
13
|
+
* PaSdk3ds — SDK-presented 3DS challenge for Android.
|
|
14
14
|
*
|
|
15
15
|
* present({url, fields, strings, returnUrlScheme, returnUrlUniversalHost})
|
|
16
16
|
* launches PaSdk3dsActivity full-screen; the promise resolves when the
|
|
@@ -29,8 +29,8 @@ class PaSdk3dsModule(private val reactContext: ReactApplicationContext) :
|
|
|
29
29
|
@Volatile
|
|
30
30
|
var pendingPromise: Promise? = null
|
|
31
31
|
|
|
32
|
-
/** Consume a 3DS return (
|
|
33
|
-
* landed on PaSdk3dsActivity
|
|
32
|
+
/** Consume a 3DS return (configured scheme / universal-link host) that
|
|
33
|
+
* landed on PaSdk3dsActivity. Returns true when a challenge
|
|
34
34
|
* was pending and the return was consumed by the SDK. */
|
|
35
35
|
fun consumeReturnUri(uri: Uri?): Boolean {
|
|
36
36
|
val promise = pendingPromise ?: return false
|