pa-sdk-react-native 0.0.0-stage → 3.0.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/LICENSE +21 -0
- package/README.md +268 -2
- package/lib/api.d.ts +88 -0
- package/lib/api.js +163 -0
- package/lib/confirm.d.ts +66 -0
- package/lib/confirm.js +359 -0
- package/lib/errors.d.ts +38 -0
- package/lib/errors.generated.d.ts +13 -0
- package/lib/errors.generated.js +63 -0
- package/lib/errors.js +80 -0
- package/lib/index.d.ts +43 -0
- package/lib/index.js +94 -0
- package/lib/init.d.ts +47 -0
- package/lib/init.js +96 -0
- package/lib/locales.d.ts +36 -0
- package/lib/locales.generated.d.ts +22 -0
- package/lib/locales.generated.js +134 -0
- package/lib/locales.js +100 -0
- package/lib/poll.d.ts +61 -0
- package/lib/poll.js +172 -0
- package/lib/threeDs.d.ts +59 -0
- package/lib/threeDs.js +64 -0
- package/lib/threeDsHost.d.ts +17 -0
- package/lib/threeDsHost.js +159 -0
- package/lib/tokenize.d.ts +22 -0
- package/lib/tokenize.js +50 -0
- package/lib/types.d.ts +128 -0
- package/lib/types.js +17 -0
- package/lib/validator.d.ts +71 -0
- package/lib/validator.js +191 -0
- package/locales/en-US.json +30 -0
- package/locales/ms-MY.json +30 -0
- package/locales/zh-CN.json +30 -0
- package/locales/zh-TW.json +30 -0
- package/native/android/build.gradle +49 -0
- package/native/android/src/main/AndroidManifest.xml +41 -0
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdk3dsActivity.kt +250 -0
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdk3dsModule.kt +110 -0
- package/native/android/src/main/java/com/pasdk/reactnative/PaSdkReactNativePackage.kt +27 -0
- package/native/ios/PaSdk3ds.swift +311 -0
- package/native/ios/PaSdk3dsModule.m +47 -0
- package/pa-sdk-react-native.podspec +23 -0
- package/package.json +46 -3
- package/scripts/generate-errors.js +86 -0
- package/scripts/generate-locales.js +95 -0
package/lib/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PA SDK React Native — shared types.
|
|
4
|
+
*
|
|
5
|
+
* The result states are exactly the five states of the shared payment
|
|
6
|
+
* contract (requirement A3 / RN-28). `requires_action` must never be a
|
|
7
|
+
* resolved value (COM-05) — any 3DS is handled inside confirm.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.POLL_SLOW_ATTEMPTS = exports.POLL_SLOW_INTERVAL_MS = exports.POLL_FAST_ATTEMPTS = exports.POLL_FAST_INTERVAL_MS = void 0;
|
|
11
|
+
/** Polling schedule (WEB-51 analog / CONF-08): 2s x 15 then 5s x 12 —
|
|
12
|
+
* suspended time while the app is backgrounded does not count (RN-20,
|
|
13
|
+
* WEB-50 analog). */
|
|
14
|
+
exports.POLL_FAST_INTERVAL_MS = 2000;
|
|
15
|
+
exports.POLL_FAST_ATTEMPTS = 15;
|
|
16
|
+
exports.POLL_SLOW_INTERVAL_MS = 5000;
|
|
17
|
+
exports.POLL_SLOW_ATTEMPTS = 12;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless card validation (COM-31 / COM-32 / RN-12).
|
|
3
|
+
*
|
|
4
|
+
* Follows Visa and Mastercard rules: current BIN ranges (including
|
|
5
|
+
* Mastercard's 2-series 2221-2720), valid lengths, Luhn, 3-digit CVC,
|
|
6
|
+
* expiry not in the past. Never blocks a valid Visa / Mastercard.
|
|
7
|
+
*
|
|
8
|
+
* Field codes are the shared per-field codes (COM-26):
|
|
9
|
+
* incomplete_number, invalid_number, incomplete_expiry, invalid_expiry,
|
|
10
|
+
* incomplete_cvc, invalid_cvc, unsupported_brand.
|
|
11
|
+
*/
|
|
12
|
+
import type { CardBrand, CardInput, FieldErrorCode } from './types';
|
|
13
|
+
export interface BrandInfo {
|
|
14
|
+
brand: CardBrand;
|
|
15
|
+
/** Valid lengths for the detected brand. */
|
|
16
|
+
lengths: number[];
|
|
17
|
+
/** Accepted CVC lengths. */
|
|
18
|
+
cvcLengths: number[];
|
|
19
|
+
}
|
|
20
|
+
/** Strip spaces / dashes; keep digits only (a stray non-digit is preserved by
|
|
21
|
+
* the caller-level check but never crashes detection). */
|
|
22
|
+
export declare function sanitizeCardNumber(number: string): string;
|
|
23
|
+
/** Brand detection from the BIN while typing (COM-32). Works from the first
|
|
24
|
+
* digit for Visa, the first two/four for the rest. */
|
|
25
|
+
export declare function detectBrand(cardNumber: string): BrandInfo;
|
|
26
|
+
/** Luhn checksum (COM-31). */
|
|
27
|
+
export declare function luhnValid(cardNumber: string): boolean;
|
|
28
|
+
export interface NumberValidation {
|
|
29
|
+
brand: CardBrand;
|
|
30
|
+
/** null when valid; otherwise one of the COM-26 number codes. */
|
|
31
|
+
error: FieldErrorCode | null;
|
|
32
|
+
complete: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate a card number.
|
|
36
|
+
* @param allowedBrands when provided, a card whose brand is not in the list
|
|
37
|
+
* reports `unsupported_brand` (RN-12 allowed-brands filter; Flow's server
|
|
38
|
+
* supplies the list per merchant account).
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateCardNumber(cardNumber: string, allowedBrands?: readonly string[] | null): NumberValidation;
|
|
41
|
+
export interface ExpiryValidation {
|
|
42
|
+
error: FieldErrorCode | null;
|
|
43
|
+
complete: boolean;
|
|
44
|
+
}
|
|
45
|
+
/** Validate expiry: both parts present, month 1-12, not in the past. */
|
|
46
|
+
export declare function validateExpiry(month: number | string, year: number | string): ExpiryValidation;
|
|
47
|
+
export interface CvcValidation {
|
|
48
|
+
error: FieldErrorCode | null;
|
|
49
|
+
complete: boolean;
|
|
50
|
+
}
|
|
51
|
+
/** Accepted CVC lengths for a brand; [3, 4] when the brand is unknown. */
|
|
52
|
+
export declare function cvcLengthsForBrand(brand?: CardBrand | string): number[];
|
|
53
|
+
/** Validate CVC for the (detected) brand — 3 digits for Visa / Mastercard. */
|
|
54
|
+
export declare function validateCvc(cvc: string, brand?: CardBrand | string): CvcValidation;
|
|
55
|
+
export interface CardValidation {
|
|
56
|
+
/** Detected brand from the BIN (COM-32) — report while typing. */
|
|
57
|
+
brand: CardBrand;
|
|
58
|
+
/** True when every field passes and no brand filter rejects the card. */
|
|
59
|
+
complete: boolean;
|
|
60
|
+
/** Per-field error codes; a field absent from the map is valid. */
|
|
61
|
+
fields: {
|
|
62
|
+
cardNumber?: FieldErrorCode;
|
|
63
|
+
expiry?: FieldErrorCode;
|
|
64
|
+
cvc?: FieldErrorCode;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Validate a whole card input from Flow's UI. Runs without any network call.
|
|
69
|
+
* `allowedBrands` behaves as in validateCardNumber().
|
|
70
|
+
*/
|
|
71
|
+
export declare function validateCard(card: Partial<CardInput>, allowedBrands?: readonly string[] | null): CardValidation;
|
package/lib/validator.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Headless card validation (COM-31 / COM-32 / RN-12).
|
|
4
|
+
*
|
|
5
|
+
* Follows Visa and Mastercard rules: current BIN ranges (including
|
|
6
|
+
* Mastercard's 2-series 2221-2720), valid lengths, Luhn, 3-digit CVC,
|
|
7
|
+
* expiry not in the past. Never blocks a valid Visa / Mastercard.
|
|
8
|
+
*
|
|
9
|
+
* Field codes are the shared per-field codes (COM-26):
|
|
10
|
+
* incomplete_number, invalid_number, incomplete_expiry, invalid_expiry,
|
|
11
|
+
* incomplete_cvc, invalid_cvc, unsupported_brand.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.sanitizeCardNumber = sanitizeCardNumber;
|
|
15
|
+
exports.detectBrand = detectBrand;
|
|
16
|
+
exports.luhnValid = luhnValid;
|
|
17
|
+
exports.validateCardNumber = validateCardNumber;
|
|
18
|
+
exports.validateExpiry = validateExpiry;
|
|
19
|
+
exports.cvcLengthsForBrand = cvcLengthsForBrand;
|
|
20
|
+
exports.validateCvc = validateCvc;
|
|
21
|
+
exports.validateCard = validateCard;
|
|
22
|
+
/**
|
|
23
|
+
* BIN table. Order matters: the first match wins. Only Visa and Mastercard
|
|
24
|
+
* are in scope (COM-30); the other entries exist so Flow can detect and
|
|
25
|
+
* block a non-scope scheme early (COM-32 / out-of-scope note in section 0).
|
|
26
|
+
*/
|
|
27
|
+
const BRAND_RULES = [
|
|
28
|
+
{ brand: 'visa', prefixes: ['4'], lengths: [13, 16, 19], cvcLengths: [3] },
|
|
29
|
+
// Mastercard: 51-55 and the 2-series 2221-2720 (COM-31 explicitly calls
|
|
30
|
+
// the 2-series out — it must be recognised).
|
|
31
|
+
{
|
|
32
|
+
brand: 'mastercard',
|
|
33
|
+
patterns: [/^5[1-5]/, /^(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)/],
|
|
34
|
+
lengths: [16],
|
|
35
|
+
cvcLengths: [3],
|
|
36
|
+
},
|
|
37
|
+
{ brand: 'amex', prefixes: ['34', '37'], lengths: [15], cvcLengths: [4] },
|
|
38
|
+
{ brand: 'diners', prefixes: ['300', '301', '302', '303', '304', '305', '36', '38'], lengths: [14, 16, 19], cvcLengths: [3] },
|
|
39
|
+
{ brand: 'discover', prefixes: ['6011', '644', '645', '646', '647', '648', '649', '65'], lengths: [16, 19], cvcLengths: [3] },
|
|
40
|
+
{ brand: 'jcb', prefixes: ['352', '353', '354', '355', '356', '357', '358'], lengths: [16, 17, 18, 19], cvcLengths: [3] },
|
|
41
|
+
{ brand: 'unionpay', prefixes: ['62'], lengths: [14, 15, 16, 17, 18, 19], cvcLengths: [3] },
|
|
42
|
+
{ brand: 'maestro', prefixes: ['5018', '5020', '5038', '5893', '6304', '6759', '6761', '6762', '6763'], lengths: [12, 13, 14, 15, 16, 17, 18, 19], cvcLengths: [3] },
|
|
43
|
+
];
|
|
44
|
+
const UNKNOWN_RULE = { brand: 'unknown', lengths: [16], cvcLengths: [3] };
|
|
45
|
+
/** Strip spaces / dashes; keep digits only (a stray non-digit is preserved by
|
|
46
|
+
* the caller-level check but never crashes detection). */
|
|
47
|
+
function sanitizeCardNumber(number) {
|
|
48
|
+
return String(number || '').replace(/[\s-]/g, '');
|
|
49
|
+
}
|
|
50
|
+
/** Brand detection from the BIN while typing (COM-32). Works from the first
|
|
51
|
+
* digit for Visa, the first two/four for the rest. */
|
|
52
|
+
function detectBrand(cardNumber) {
|
|
53
|
+
const n = sanitizeCardNumber(cardNumber);
|
|
54
|
+
if (!n) {
|
|
55
|
+
return { brand: UNKNOWN_RULE.brand, lengths: UNKNOWN_RULE.lengths, cvcLengths: UNKNOWN_RULE.cvcLengths };
|
|
56
|
+
}
|
|
57
|
+
for (const rule of BRAND_RULES) {
|
|
58
|
+
const matched = (rule.prefixes && rule.prefixes.some((p) => n.startsWith(p))) ||
|
|
59
|
+
(rule.patterns && rule.patterns.some((re) => re.test(n)));
|
|
60
|
+
if (matched) {
|
|
61
|
+
return { brand: rule.brand, lengths: rule.lengths, cvcLengths: rule.cvcLengths };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return { brand: 'unknown', lengths: UNKNOWN_RULE.lengths, cvcLengths: UNKNOWN_RULE.cvcLengths };
|
|
65
|
+
}
|
|
66
|
+
/** Luhn checksum (COM-31). */
|
|
67
|
+
function luhnValid(cardNumber) {
|
|
68
|
+
const n = sanitizeCardNumber(cardNumber);
|
|
69
|
+
if (!/^\d+$/.test(n) || n.length < 2) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
let sum = 0;
|
|
73
|
+
let double = false;
|
|
74
|
+
for (let i = n.length - 1; i >= 0; i--) {
|
|
75
|
+
let digit = n.charCodeAt(i) - 48;
|
|
76
|
+
if (double) {
|
|
77
|
+
digit *= 2;
|
|
78
|
+
if (digit > 9) {
|
|
79
|
+
digit -= 9;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
sum += digit;
|
|
83
|
+
double = !double;
|
|
84
|
+
}
|
|
85
|
+
return sum % 10 === 0;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Validate a card number.
|
|
89
|
+
* @param allowedBrands when provided, a card whose brand is not in the list
|
|
90
|
+
* reports `unsupported_brand` (RN-12 allowed-brands filter; Flow's server
|
|
91
|
+
* supplies the list per merchant account).
|
|
92
|
+
*/
|
|
93
|
+
function validateCardNumber(cardNumber, allowedBrands) {
|
|
94
|
+
const info = detectBrand(cardNumber);
|
|
95
|
+
const n = sanitizeCardNumber(cardNumber);
|
|
96
|
+
if (n.length === 0) {
|
|
97
|
+
return { brand: info.brand, error: 'incomplete_number', complete: false };
|
|
98
|
+
}
|
|
99
|
+
if (!/^\d+$/.test(n)) {
|
|
100
|
+
return { brand: info.brand, error: 'invalid_number', complete: false };
|
|
101
|
+
}
|
|
102
|
+
const minLength = Math.min(...info.lengths);
|
|
103
|
+
if (n.length < minLength) {
|
|
104
|
+
return { brand: info.brand, error: 'incomplete_number', complete: false };
|
|
105
|
+
}
|
|
106
|
+
if (!info.lengths.includes(n.length)) {
|
|
107
|
+
return { brand: info.brand, error: 'invalid_number', complete: false };
|
|
108
|
+
}
|
|
109
|
+
// Length is plausible for the brand — only now is Luhn conclusive.
|
|
110
|
+
if (!luhnValid(n)) {
|
|
111
|
+
return { brand: info.brand, error: 'invalid_number', complete: false };
|
|
112
|
+
}
|
|
113
|
+
if (allowedBrands && allowedBrands.length > 0 && !allowedBrands.includes(info.brand)) {
|
|
114
|
+
return { brand: info.brand, error: 'unsupported_brand', complete: false };
|
|
115
|
+
}
|
|
116
|
+
return { brand: info.brand, error: null, complete: true };
|
|
117
|
+
}
|
|
118
|
+
/** Parse month/year into (month, fullYear); null when unparseable. */
|
|
119
|
+
function parseExpiry(month, year) {
|
|
120
|
+
const m = typeof month === 'number' ? month : parseInt(String(month).trim(), 10);
|
|
121
|
+
let y = typeof year === 'number' ? year : parseInt(String(year).trim(), 10);
|
|
122
|
+
if (!Number.isFinite(m) || !Number.isFinite(y)) {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (y < 100) {
|
|
126
|
+
y += 2000; // "29" -> 2029
|
|
127
|
+
}
|
|
128
|
+
return { month: m, year: y };
|
|
129
|
+
}
|
|
130
|
+
/** Validate expiry: both parts present, month 1-12, not in the past. */
|
|
131
|
+
function validateExpiry(month, year) {
|
|
132
|
+
const mRaw = String(month == null ? '' : month).trim();
|
|
133
|
+
const yRaw = String(year == null ? '' : year).trim();
|
|
134
|
+
if (mRaw.length === 0 || yRaw.length === 0) {
|
|
135
|
+
return { error: 'incomplete_expiry', complete: false };
|
|
136
|
+
}
|
|
137
|
+
const parsed = parseExpiry(month, year);
|
|
138
|
+
if (!parsed || parsed.month < 1 || parsed.month > 12 || parsed.year < 2000 || parsed.year > 2100) {
|
|
139
|
+
return { error: 'invalid_expiry', complete: false };
|
|
140
|
+
}
|
|
141
|
+
// Expiry is valid through the last day of its month.
|
|
142
|
+
const endOfMonth = new Date(parsed.year, parsed.month, 1); // first day after expiry month
|
|
143
|
+
if (endOfMonth.getTime() <= Date.now()) {
|
|
144
|
+
return { error: 'invalid_expiry', complete: false };
|
|
145
|
+
}
|
|
146
|
+
return { error: null, complete: true };
|
|
147
|
+
}
|
|
148
|
+
/** Accepted CVC lengths for a brand; [3, 4] when the brand is unknown. */
|
|
149
|
+
function cvcLengthsForBrand(brand) {
|
|
150
|
+
if (!brand || brand === 'unknown') {
|
|
151
|
+
return [3, 4];
|
|
152
|
+
}
|
|
153
|
+
const rule = BRAND_RULES.find((r) => r.brand === brand);
|
|
154
|
+
return rule ? rule.cvcLengths : [3, 4];
|
|
155
|
+
}
|
|
156
|
+
/** Validate CVC for the (detected) brand — 3 digits for Visa / Mastercard. */
|
|
157
|
+
function validateCvc(cvc, brand) {
|
|
158
|
+
const value = String(cvc == null ? '' : cvc).trim();
|
|
159
|
+
if (value.length === 0) {
|
|
160
|
+
return { error: 'incomplete_cvc', complete: false };
|
|
161
|
+
}
|
|
162
|
+
const lengths = cvcLengthsForBrand(brand);
|
|
163
|
+
if (!/^\d+$/.test(value) || !lengths.includes(value.length)) {
|
|
164
|
+
return { error: 'invalid_cvc', complete: false };
|
|
165
|
+
}
|
|
166
|
+
return { error: null, complete: true };
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Validate a whole card input from Flow's UI. Runs without any network call.
|
|
170
|
+
* `allowedBrands` behaves as in validateCardNumber().
|
|
171
|
+
*/
|
|
172
|
+
function validateCard(card, allowedBrands) {
|
|
173
|
+
const numberResult = validateCardNumber(card.cardNumber || '', allowedBrands);
|
|
174
|
+
const expiryResult = validateExpiry(card.expiryMonth == null ? '' : card.expiryMonth, card.expiryYear == null ? '' : card.expiryYear);
|
|
175
|
+
const cvcResult = validateCvc(card.cvc == null ? '' : card.cvc, numberResult.brand);
|
|
176
|
+
const fields = {};
|
|
177
|
+
if (numberResult.error) {
|
|
178
|
+
fields.cardNumber = numberResult.error;
|
|
179
|
+
}
|
|
180
|
+
if (expiryResult.error) {
|
|
181
|
+
fields.expiry = expiryResult.error;
|
|
182
|
+
}
|
|
183
|
+
if (cvcResult.error) {
|
|
184
|
+
fields.cvc = cvcResult.error;
|
|
185
|
+
}
|
|
186
|
+
return {
|
|
187
|
+
brand: numberResult.brand,
|
|
188
|
+
complete: numberResult.error === null && expiryResult.error === null && cvcResult.error === null,
|
|
189
|
+
fields,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_meta": {
|
|
3
|
+
"name": "English",
|
|
4
|
+
"canonical": "en-US",
|
|
5
|
+
"fallback": null,
|
|
6
|
+
"complete": true
|
|
7
|
+
},
|
|
8
|
+
"threeds.title": "Secure Authentication",
|
|
9
|
+
"threeds.cancel": "Cancel",
|
|
10
|
+
"threeds.close": "Close",
|
|
11
|
+
"threeds.processing": "Processing, please wait...",
|
|
12
|
+
"threeds.redirecting": "Redirecting...",
|
|
13
|
+
"payment.processing": "Payment in progress...",
|
|
14
|
+
"result.cancelled": "Payment cancelled",
|
|
15
|
+
"error.generic": "Payment failed, please try again or use another card.",
|
|
16
|
+
"error.rate_limited": "Too many attempts, please wait a moment and try again.",
|
|
17
|
+
"error.processing_timeout": "Your payment is still being processed. We will confirm the result shortly.",
|
|
18
|
+
"error.sdk_load_failed": "Failed to load the payment component, please refresh the page.",
|
|
19
|
+
"error.invalid_publishable_key": "The merchant configuration is invalid.",
|
|
20
|
+
"error.invalid_client_token": "The payment session has expired. Please try again.",
|
|
21
|
+
"error.origin_not_allowed": "This website is not authorised to use the payment component.",
|
|
22
|
+
"error.font_load_failed": "Font failed to load, a system font is used instead.",
|
|
23
|
+
"field.incomplete_number": "Enter your full card number",
|
|
24
|
+
"field.invalid_number": "Check your card number",
|
|
25
|
+
"field.incomplete_expiry": "Enter the full expiry date",
|
|
26
|
+
"field.invalid_expiry": "Check the expiry date",
|
|
27
|
+
"field.incomplete_cvc": "Enter the security code",
|
|
28
|
+
"field.invalid_cvc": "Check the security code",
|
|
29
|
+
"field.unsupported_brand": "This card type is not accepted"
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_meta": {
|
|
3
|
+
"name": "Malay",
|
|
4
|
+
"canonical": "ms-MY",
|
|
5
|
+
"fallback": "en-US",
|
|
6
|
+
"complete": false
|
|
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
|
+
"field.incomplete_number": "",
|
|
24
|
+
"field.invalid_number": "",
|
|
25
|
+
"field.incomplete_expiry": "",
|
|
26
|
+
"field.invalid_expiry": "",
|
|
27
|
+
"field.incomplete_cvc": "",
|
|
28
|
+
"field.invalid_cvc": "",
|
|
29
|
+
"field.unsupported_brand": ""
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_meta": {
|
|
3
|
+
"name": "Simplified Chinese",
|
|
4
|
+
"canonical": "zh-CN",
|
|
5
|
+
"fallback": "en-US",
|
|
6
|
+
"complete": true
|
|
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
|
+
"field.incomplete_number": "请输入完整卡号",
|
|
24
|
+
"field.invalid_number": "请检查卡号",
|
|
25
|
+
"field.incomplete_expiry": "请输入完整有效期",
|
|
26
|
+
"field.invalid_expiry": "请检查有效期",
|
|
27
|
+
"field.incomplete_cvc": "请输入安全码",
|
|
28
|
+
"field.invalid_cvc": "请检查安全码",
|
|
29
|
+
"field.unsupported_brand": "不支持此卡片类型"
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_meta": {
|
|
3
|
+
"name": "Traditional Chinese (Hong Kong / Taiwan)",
|
|
4
|
+
"canonical": "zh-TW",
|
|
5
|
+
"fallback": "en-US",
|
|
6
|
+
"complete": true
|
|
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
|
+
"field.incomplete_number": "請輸入完整卡號",
|
|
24
|
+
"field.invalid_number": "請檢查卡號",
|
|
25
|
+
"field.incomplete_expiry": "請輸入完整有效期",
|
|
26
|
+
"field.invalid_expiry": "請檢查有效期",
|
|
27
|
+
"field.incomplete_cvc": "請輸入安全碼",
|
|
28
|
+
"field.invalid_cvc": "請檢查安全碼",
|
|
29
|
+
"field.unsupported_brand": "不支援此卡片類型"
|
|
30
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// pa-sdk-react-native — Android library build (RN-04: distributed via
|
|
2
|
+
// npm; the Android sources are picked up by React Native autolinking).
|
|
3
|
+
//
|
|
4
|
+
// RN-03/RN-05: no transitive SDKs — WebView and the support of the host
|
|
5
|
+
// app's React Native only. minSdk 24 (Flow's floor; RN-03).
|
|
6
|
+
|
|
7
|
+
// Built as part of the host app's Gradle build (see example/settings.gradle);
|
|
8
|
+
// AGP / Kotlin plugins resolve from the root project classpath.
|
|
9
|
+
apply plugin: 'com.android.library'
|
|
10
|
+
apply plugin: 'org.jetbrains.kotlin.android'
|
|
11
|
+
|
|
12
|
+
def safeExtGet(prop, fallback) {
|
|
13
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
android {
|
|
17
|
+
namespace "com.pasdk.reactnative"
|
|
18
|
+
compileSdkVersion safeExtGet('compileSdkVersion', 35)
|
|
19
|
+
|
|
20
|
+
defaultConfig {
|
|
21
|
+
minSdkVersion safeExtGet('minSdkVersion', 24)
|
|
22
|
+
targetSdkVersion safeExtGet('targetSdkVersion', 35)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
buildTypes {
|
|
26
|
+
release {
|
|
27
|
+
minifyEnabled false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
compileOptions {
|
|
32
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
33
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
kotlinOptions {
|
|
37
|
+
jvmTarget = '17'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
repositories {
|
|
42
|
+
google()
|
|
43
|
+
mavenCentral()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
dependencies {
|
|
47
|
+
// Provided by the host app through React Native autolinking.
|
|
48
|
+
implementation 'com.facebook.react:react-native:+'
|
|
49
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
|
+
|
|
3
|
+
<application>
|
|
4
|
+
<!--
|
|
5
|
+
SDK-presented 3DS challenge activity (RN-19). Full-screen WebView.
|
|
6
|
+
The intent-filters below let the SDK CONSUME its own 3DS returns
|
|
7
|
+
(RN-20): when the issuer/ACS redirects to the app's return URL
|
|
8
|
+
(flow:// custom scheme or the https://app.flowtheroom.com
|
|
9
|
+
universal-link host) while a challenge is pending, this activity
|
|
10
|
+
receives the intent, marks it consumed and resolves the pending
|
|
11
|
+
present() promise — the app's own link handler never sees it.
|
|
12
|
+
-->
|
|
13
|
+
<activity
|
|
14
|
+
android:name=".PaSdk3dsActivity"
|
|
15
|
+
android:exported="true"
|
|
16
|
+
android:launchMode="singleTask"
|
|
17
|
+
android:theme="@android:style/Theme.Material.Light.NoActionBar"
|
|
18
|
+
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden|uiMode"
|
|
19
|
+
android:windowSoftInputMode="adjustResize">
|
|
20
|
+
|
|
21
|
+
<!-- Flow custom scheme: flow://... -->
|
|
22
|
+
<intent-filter>
|
|
23
|
+
<action android:name="android.intent.action.VIEW" />
|
|
24
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
25
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
26
|
+
<data android:scheme="flow" />
|
|
27
|
+
</intent-filter>
|
|
28
|
+
|
|
29
|
+
<!-- Flow universal link host: https://app.flowtheroom.com -->
|
|
30
|
+
<intent-filter android:autoVerify="false">
|
|
31
|
+
<action android:name="android.intent.action.VIEW" />
|
|
32
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
33
|
+
<category android:name="android.intent.category.BROWSABLE" />
|
|
34
|
+
<data
|
|
35
|
+
android:scheme="https"
|
|
36
|
+
android:host="app.flowtheroom.com" />
|
|
37
|
+
</intent-filter>
|
|
38
|
+
</activity>
|
|
39
|
+
</application>
|
|
40
|
+
|
|
41
|
+
</manifest>
|