@p2pdotme/sdk 1.2.16 → 1.2.18
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 +1 -1
- package/dist/country.cjs +480 -62
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +144 -27
- package/dist/country.d.ts +144 -27
- package/dist/country.mjs +460 -62
- package/dist/country.mjs.map +1 -1
- package/dist/fraud-engine.cjs +1 -0
- package/dist/fraud-engine.cjs.map +1 -1
- package/dist/fraud-engine.mjs +1 -0
- package/dist/fraud-engine.mjs.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/orders.cjs +1 -0
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.d.cts +2 -0
- package/dist/orders.d.ts +2 -0
- package/dist/orders.mjs +1 -0
- package/dist/orders.mjs.map +1 -1
- package/dist/prices.cjs +1 -0
- package/dist/prices.cjs.map +1 -1
- package/dist/prices.d.cts +1 -0
- package/dist/prices.d.ts +1 -0
- package/dist/prices.mjs +1 -0
- package/dist/prices.mjs.map +1 -1
- package/dist/profile.cjs +1 -0
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.d.cts +2 -0
- package/dist/profile.d.ts +2 -0
- package/dist/profile.mjs +1 -0
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs +205 -11
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.d.cts +9 -1
- package/dist/qr-parsers.d.ts +9 -1
- package/dist/qr-parsers.mjs +204 -11
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +1 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -0
- package/dist/react.d.ts +6 -0
- package/dist/react.mjs +1 -0
- package/dist/react.mjs.map +1 -1
- package/dist/stake.cjs +1 -0
- package/dist/stake.cjs.map +1 -1
- package/dist/stake.d.cts +1 -0
- package/dist/stake.d.ts +1 -0
- package/dist/stake.mjs +1 -0
- package/dist/stake.mjs.map +1 -1
- package/dist/zkkyc.cjs +1 -0
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.mjs +1 -0
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +1 -1
package/dist/country.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ declare const CURRENCY: {
|
|
|
12
12
|
readonly ARS: "ARS";
|
|
13
13
|
readonly MEX: "MEX";
|
|
14
14
|
readonly VEN: "VEN";
|
|
15
|
+
readonly BOB: "BOB";
|
|
15
16
|
readonly EUR: "EUR";
|
|
16
17
|
readonly NGN: "NGN";
|
|
17
18
|
readonly USD: "USD";
|
|
@@ -29,6 +30,8 @@ type CurrencyCode = (typeof CURRENCY)[keyof typeof CURRENCY];
|
|
|
29
30
|
*/
|
|
30
31
|
declare const CURRENCY_CODES: [CurrencyCode, ...CurrencyCode[]];
|
|
31
32
|
|
|
33
|
+
/** Joins an optional QR payload with typed fields (`qr||phone|cci`). */
|
|
34
|
+
declare const PACKED_PAYMENT_ID_SEP = "||";
|
|
32
35
|
interface PaymentIdFieldConfig {
|
|
33
36
|
readonly key: string;
|
|
34
37
|
readonly label: string;
|
|
@@ -36,6 +39,11 @@ interface PaymentIdFieldConfig {
|
|
|
36
39
|
readonly displayLabel: string | null;
|
|
37
40
|
readonly validate: (value: string) => boolean;
|
|
38
41
|
readonly validationErrorMessage: string;
|
|
42
|
+
/**
|
|
43
|
+
* When true, an empty value is allowed. If every field is optional, at least
|
|
44
|
+
* one field must still be filled (see `validatePaymentIdFields`).
|
|
45
|
+
*/
|
|
46
|
+
readonly optional?: boolean;
|
|
39
47
|
}
|
|
40
48
|
interface CountryOption {
|
|
41
49
|
readonly country: string;
|
|
@@ -57,20 +65,116 @@ interface CountryOption {
|
|
|
57
65
|
readonly isAlpha: boolean;
|
|
58
66
|
readonly disabled: boolean;
|
|
59
67
|
readonly disabledPaymentTypes: readonly string[];
|
|
68
|
+
/**
|
|
69
|
+
* Merchant/seller provides payment details by uploading a QR image.
|
|
70
|
+
* Distinct from PAY, where the buyer scans a QR. Default: false.
|
|
71
|
+
*/
|
|
72
|
+
readonly uploadPaymentQR?: boolean;
|
|
73
|
+
/** Structural check for a standalone QR payload (no `||` pack). */
|
|
74
|
+
readonly validateQr?: (payload: string) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Fill catalog fields from a validated QR (e.g. Yape/Plin phone in EMVCo).
|
|
77
|
+
* Only used when the typed fallback did not already set the key.
|
|
78
|
+
*/
|
|
79
|
+
readonly hydrateFieldsFromQr?: (qr: string) => Partial<Record<string, string>>;
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
/** All supported countries with their currency metadata, payment methods, and display config. */
|
|
63
83
|
declare const COUNTRY_OPTIONS: readonly CountryOption[];
|
|
84
|
+
declare function getCountryOption(currency: CurrencyCode | null | undefined): CountryOption | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the merchant/seller provides payment details by uploading a QR image.
|
|
87
|
+
* Distinct from PAY (`disabledPaymentTypes`), where the buyer scans a QR.
|
|
88
|
+
*/
|
|
89
|
+
declare function uploadsPaymentQR(currency: CurrencyCode | null | undefined): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether a stored payment ID may include a QR payload (`qr||fields` or
|
|
92
|
+
* standalone QR). Derived from `validateQr` — no extra flag.
|
|
93
|
+
*/
|
|
94
|
+
declare function usesPackedPaymentId(currency: CurrencyCode | null | undefined): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Apps mount the catalog form (PackedPaymentInput): QR upload and/or
|
|
97
|
+
* more than one typed field.
|
|
98
|
+
*/
|
|
99
|
+
declare function usesCatalogPaymentForm(currency: CurrencyCode | null | undefined): boolean;
|
|
64
100
|
|
|
65
101
|
/** Payment ID field configuration for each supported currency. */
|
|
66
102
|
declare const PAYMENT_ID_FIELDS: Record<CurrencyCode, PaymentIdFieldConfig[]>;
|
|
67
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Yape/Plin EMVCo: country PE, currency 604, CRC-16/CCITT-FALSE.
|
|
106
|
+
* CRC is required on upload so we never persist a truncated screenshot.
|
|
107
|
+
* (PAY render in the merchant is looser; that path does not use this.)
|
|
108
|
+
*/
|
|
109
|
+
declare function validatePeruvianQr(payload: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Bolivia QR Simple. Accepts either the encrypted envelope (Yape Bs, BancoSol
|
|
112
|
+
* dynamic QR — `<base64>|<32-hex>`) or an EMVCo static QR (country BO, currency
|
|
113
|
+
* 068, CRC-16/CCITT-FALSE). CRC / envelope shape is required on upload so we
|
|
114
|
+
* never persist a truncated screenshot.
|
|
115
|
+
*/
|
|
116
|
+
declare function validateBolivianQr(payload: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Suiche 7B / Pago Móvil collection QR: `base64?merchantId=NNNN&…`.
|
|
119
|
+
* The base64 is bank AES — we cannot decode phone/RIF from it, only the
|
|
120
|
+
* envelope. Reject packed `||` IDs so a stored compound string is never
|
|
121
|
+
* treated as a QR. Scan & Pay uses the looser `isPagoMovilQr` envelope.
|
|
122
|
+
*/
|
|
123
|
+
declare function validateVenezuelanQr(payload: string): boolean;
|
|
124
|
+
|
|
125
|
+
/** Validates a 20-digit Peruvian CCI (spaces ignored). */
|
|
126
|
+
declare function validatePeruvianCci(value: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Validates a Yape/Plin phone: `9` + 8 digits, optional `+51` / `51` prefix.
|
|
129
|
+
*/
|
|
130
|
+
declare function validatePeruvianPhone(value: string): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Validates a Peruvian payment key for the legacy single-field path.
|
|
133
|
+
* Accepts either a 20-digit CCI or a Yape/Plin phone number.
|
|
134
|
+
*/
|
|
135
|
+
declare function validatePeruvianPaymentKey(value: string): boolean;
|
|
136
|
+
type PeruvianPaymentIdParts = {
|
|
137
|
+
qr: string | null;
|
|
138
|
+
phone: string | null;
|
|
139
|
+
cci: string | null;
|
|
140
|
+
};
|
|
141
|
+
/** QR payload and/or CCI and/or Yape/Plin phone. */
|
|
142
|
+
declare function validatePeruvianPaymentId(value: string): boolean;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Validates Venezuelan phone number for Pago Movil.
|
|
146
|
+
* Format: 04XX-XXXXXXX (11 digits starting with 04).
|
|
147
|
+
*/
|
|
148
|
+
declare function validateVenezuelanPhoneNumber(phoneNumber: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Validates Venezuelan Cédula/RIF for Pago Móvil.
|
|
151
|
+
* Format: prefix (V|E|J|G|R|P) followed by digits.
|
|
152
|
+
* Includes natural persons (V), foreigners (E), companies (J), government (G),
|
|
153
|
+
* residual (R), and passport-linked accounts (P).
|
|
154
|
+
*/
|
|
155
|
+
declare function validateVenezuelanRif(rif: string): boolean;
|
|
156
|
+
type VenezuelanPaymentIdParts = {
|
|
157
|
+
qr: string | null;
|
|
158
|
+
compound: string | null;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Accepts a Suiche 7B QR payload, the typed `phone|rif|bank` fallback,
|
|
162
|
+
* or both packed as `qr||phone|rif|bank`.
|
|
163
|
+
*/
|
|
164
|
+
declare function validateVenezuelanPaymentId(value: string): boolean;
|
|
165
|
+
|
|
68
166
|
/**
|
|
69
167
|
* Validates Argentine payment IDs (CBU, CVU, or Alias).
|
|
70
168
|
* CBU/CVU: 22 digits with checksum. Alias: 6-20 alphanumeric characters.
|
|
71
169
|
*/
|
|
72
170
|
declare function validateArgentinePaymentId(paymentId: string): boolean;
|
|
73
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Validates a Bolivian bank account number for QR Simple transfers.
|
|
174
|
+
* Accepts 8–20 digits; spaces and dashes are ignored.
|
|
175
|
+
*/
|
|
176
|
+
declare function validateBolivianAccount(account: string): boolean;
|
|
177
|
+
|
|
74
178
|
/**
|
|
75
179
|
* Validates PIX ID format.
|
|
76
180
|
* PIX can be: CPF (11 digits), CNPJ (14 digits), email, phone (10–11 digits or E.164),
|
|
@@ -139,18 +243,6 @@ declare function validateNigerianAccountNumber(accountNumber: string): boolean;
|
|
|
139
243
|
*/
|
|
140
244
|
declare function validateNigerianAccountName(accountName: string): boolean;
|
|
141
245
|
|
|
142
|
-
/**
|
|
143
|
-
* Validates a Peruvian payment key for the SELL text-key path.
|
|
144
|
-
* Accepts either a 20-digit CCI (Código de Cuenta Interbancario, spaces ignored)
|
|
145
|
-
* or a Yape/Plin phone number (optional `+51`/`51` prefix, then `9` + 8 digits).
|
|
146
|
-
*/
|
|
147
|
-
declare function validatePeruvianPaymentKey(value: string): boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Validates a Yape/Plin EMVCo QR payload: parseable TLV, country (tag 58) `PE`,
|
|
150
|
-
* currency (tag 53) `604` (PEN), and a matching CRC-16/CCITT-FALSE (tag 63).
|
|
151
|
-
*/
|
|
152
|
-
declare function validatePeruvianQr(payload: string): boolean;
|
|
153
|
-
|
|
154
246
|
/**
|
|
155
247
|
* Validates a Philippine mobile number for InstaPay (GCash / Maya).
|
|
156
248
|
* Mobile numbers are 10 digits starting with 9, and are commonly written
|
|
@@ -158,27 +250,52 @@ declare function validatePeruvianQr(payload: string): boolean;
|
|
|
158
250
|
*/
|
|
159
251
|
declare function validatePhilippinePhoneNumber(phoneNumber: string): boolean;
|
|
160
252
|
|
|
161
|
-
/**
|
|
162
|
-
* Validates Venezuelan phone number for Pago Movil.
|
|
163
|
-
* Format: 04XX-XXXXXXX (11 digits starting with 04).
|
|
164
|
-
*/
|
|
165
|
-
declare function validateVenezuelanPhoneNumber(phoneNumber: string): boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Validates Venezuelan Cédula/RIF for Pago Móvil.
|
|
168
|
-
* Format: prefix (V|E|J|G|R|P) followed by digits.
|
|
169
|
-
* Includes natural persons (V), foreigners (E), companies (J), government (G),
|
|
170
|
-
* residual (R), and passport-linked accounts (P).
|
|
171
|
-
*/
|
|
172
|
-
declare function validateVenezuelanRif(rif: string): boolean;
|
|
173
|
-
|
|
174
253
|
/** Serializes multiple fields into a pipe-separated string. */
|
|
175
254
|
declare function serializeCompoundPaymentId(...fields: string[]): string;
|
|
176
255
|
/** Deserializes a pipe-separated payment ID into its component fields. */
|
|
177
256
|
declare function deserializeCompoundPaymentId(paymentId: string): string[];
|
|
178
257
|
/**
|
|
179
258
|
* Formats a compound payment ID for display using optional labels.
|
|
180
|
-
*
|
|
259
|
+
* Empty parts (optional fields left blank) are omitted.
|
|
181
260
|
*/
|
|
182
261
|
declare function formatCompoundPaymentIdForDisplay(paymentId: string, labels: (string | null)[]): string;
|
|
262
|
+
/**
|
|
263
|
+
* Validates a stored payment ID against `PAYMENT_ID_FIELDS`.
|
|
264
|
+
* Optional fields may be empty; if every field is optional, at least one must
|
|
265
|
+
* be filled. A legacy single token (no `|`) matches any one field's validator.
|
|
266
|
+
*/
|
|
267
|
+
declare function validatePaymentIdFields(fields: readonly PaymentIdFieldConfig[], paymentId: string): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Splits a stored payment ID into per-field values for form hydration.
|
|
270
|
+
* A legacy single token is assigned to the first field whose validator matches.
|
|
271
|
+
*/
|
|
272
|
+
declare function assignPaymentIdToFieldValues(fields: readonly PaymentIdFieldConfig[], paymentId: string): Record<string, string>;
|
|
273
|
+
declare function unpackPackedPaymentId(paymentId: string): {
|
|
274
|
+
qr: string;
|
|
275
|
+
rest: string;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* QR blob from a stored payment ID, or `null` if none / invalid.
|
|
279
|
+
*/
|
|
280
|
+
declare function getStoredQrPayload(currency: CurrencyCode | null | undefined, paymentId: string | null | undefined): string | null;
|
|
281
|
+
/**
|
|
282
|
+
* Builds a stored payment ID: optional validated QR packed with catalog fields.
|
|
283
|
+
*/
|
|
284
|
+
declare function packStoredPaymentId(currency: CurrencyCode, qr: string | null | undefined, fieldValues: Record<string, string>): string;
|
|
285
|
+
/**
|
|
286
|
+
* Validates a stored payment ID: optional packed QR, then catalog fields.
|
|
287
|
+
* QR-only is valid when the country exposes `validateQr`.
|
|
288
|
+
*/
|
|
289
|
+
declare function validateStoredPaymentId(currency: CurrencyCode, paymentId: string): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Typed-field values for form hydration. Packed QR prefix is stripped.
|
|
292
|
+
* `hydrateFieldsFromQr` fills keys the typed fallback left empty (PEN phone).
|
|
293
|
+
*/
|
|
294
|
+
declare function assignStoredPaymentIdToFieldValues(currency: CurrencyCode, paymentId: string): Record<string, string>;
|
|
295
|
+
/**
|
|
296
|
+
* Human-readable stored ID: labeled typed fields, never the raw QR blob.
|
|
297
|
+
* QR-only returns an empty string so the caller can substitute a label.
|
|
298
|
+
*/
|
|
299
|
+
declare function formatStoredPaymentIdForDisplay(currency: CurrencyCode, paymentId: string): string;
|
|
183
300
|
|
|
184
|
-
export { COUNTRY_OPTIONS, CURRENCY, CURRENCY_CODES, type CountryOption, type CurrencyCode, PAYMENT_ID_FIELDS, type PaymentIdFieldConfig, deserializeCompoundPaymentId, formatCompoundPaymentIdForDisplay, serializeCompoundPaymentId, validateArgentinePaymentId, validateColombianPaymentId, validateCubanCardNumber, validateCubanPhoneNumber, validateEcuadorianAccountName, validateEcuadorianAccountNumber, validateEcuadorianCedula, validateIndonesianPhoneNumber, validateMexicanPaymentId, validateNigerianAccountName, validateNigerianAccountNumber, validatePIXId, validatePeruvianPaymentKey, validatePeruvianQr, validatePhilippinePhoneNumber, validateRevolutId, validateUPIId, validateVenezuelanPhoneNumber, validateVenezuelanRif };
|
|
301
|
+
export { COUNTRY_OPTIONS, CURRENCY, CURRENCY_CODES, type CountryOption, type CurrencyCode, PACKED_PAYMENT_ID_SEP, PAYMENT_ID_FIELDS, type PaymentIdFieldConfig, type PeruvianPaymentIdParts, type VenezuelanPaymentIdParts, assignPaymentIdToFieldValues, assignStoredPaymentIdToFieldValues, deserializeCompoundPaymentId, formatCompoundPaymentIdForDisplay, formatStoredPaymentIdForDisplay, getCountryOption, getStoredQrPayload, packStoredPaymentId, serializeCompoundPaymentId, unpackPackedPaymentId, uploadsPaymentQR, usesCatalogPaymentForm, usesPackedPaymentId, validateArgentinePaymentId, validateBolivianAccount, validateBolivianQr, validateColombianPaymentId, validateCubanCardNumber, validateCubanPhoneNumber, validateEcuadorianAccountName, validateEcuadorianAccountNumber, validateEcuadorianCedula, validateIndonesianPhoneNumber, validateMexicanPaymentId, validateNigerianAccountName, validateNigerianAccountNumber, validatePIXId, validatePaymentIdFields, validatePeruvianCci, validatePeruvianPaymentId, validatePeruvianPaymentKey, validatePeruvianPhone, validatePeruvianQr, validatePhilippinePhoneNumber, validateRevolutId, validateStoredPaymentId, validateUPIId, validateVenezuelanPaymentId, validateVenezuelanPhoneNumber, validateVenezuelanQr, validateVenezuelanRif };
|
package/dist/country.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ declare const CURRENCY: {
|
|
|
12
12
|
readonly ARS: "ARS";
|
|
13
13
|
readonly MEX: "MEX";
|
|
14
14
|
readonly VEN: "VEN";
|
|
15
|
+
readonly BOB: "BOB";
|
|
15
16
|
readonly EUR: "EUR";
|
|
16
17
|
readonly NGN: "NGN";
|
|
17
18
|
readonly USD: "USD";
|
|
@@ -29,6 +30,8 @@ type CurrencyCode = (typeof CURRENCY)[keyof typeof CURRENCY];
|
|
|
29
30
|
*/
|
|
30
31
|
declare const CURRENCY_CODES: [CurrencyCode, ...CurrencyCode[]];
|
|
31
32
|
|
|
33
|
+
/** Joins an optional QR payload with typed fields (`qr||phone|cci`). */
|
|
34
|
+
declare const PACKED_PAYMENT_ID_SEP = "||";
|
|
32
35
|
interface PaymentIdFieldConfig {
|
|
33
36
|
readonly key: string;
|
|
34
37
|
readonly label: string;
|
|
@@ -36,6 +39,11 @@ interface PaymentIdFieldConfig {
|
|
|
36
39
|
readonly displayLabel: string | null;
|
|
37
40
|
readonly validate: (value: string) => boolean;
|
|
38
41
|
readonly validationErrorMessage: string;
|
|
42
|
+
/**
|
|
43
|
+
* When true, an empty value is allowed. If every field is optional, at least
|
|
44
|
+
* one field must still be filled (see `validatePaymentIdFields`).
|
|
45
|
+
*/
|
|
46
|
+
readonly optional?: boolean;
|
|
39
47
|
}
|
|
40
48
|
interface CountryOption {
|
|
41
49
|
readonly country: string;
|
|
@@ -57,20 +65,116 @@ interface CountryOption {
|
|
|
57
65
|
readonly isAlpha: boolean;
|
|
58
66
|
readonly disabled: boolean;
|
|
59
67
|
readonly disabledPaymentTypes: readonly string[];
|
|
68
|
+
/**
|
|
69
|
+
* Merchant/seller provides payment details by uploading a QR image.
|
|
70
|
+
* Distinct from PAY, where the buyer scans a QR. Default: false.
|
|
71
|
+
*/
|
|
72
|
+
readonly uploadPaymentQR?: boolean;
|
|
73
|
+
/** Structural check for a standalone QR payload (no `||` pack). */
|
|
74
|
+
readonly validateQr?: (payload: string) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Fill catalog fields from a validated QR (e.g. Yape/Plin phone in EMVCo).
|
|
77
|
+
* Only used when the typed fallback did not already set the key.
|
|
78
|
+
*/
|
|
79
|
+
readonly hydrateFieldsFromQr?: (qr: string) => Partial<Record<string, string>>;
|
|
60
80
|
}
|
|
61
81
|
|
|
62
82
|
/** All supported countries with their currency metadata, payment methods, and display config. */
|
|
63
83
|
declare const COUNTRY_OPTIONS: readonly CountryOption[];
|
|
84
|
+
declare function getCountryOption(currency: CurrencyCode | null | undefined): CountryOption | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the merchant/seller provides payment details by uploading a QR image.
|
|
87
|
+
* Distinct from PAY (`disabledPaymentTypes`), where the buyer scans a QR.
|
|
88
|
+
*/
|
|
89
|
+
declare function uploadsPaymentQR(currency: CurrencyCode | null | undefined): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether a stored payment ID may include a QR payload (`qr||fields` or
|
|
92
|
+
* standalone QR). Derived from `validateQr` — no extra flag.
|
|
93
|
+
*/
|
|
94
|
+
declare function usesPackedPaymentId(currency: CurrencyCode | null | undefined): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Apps mount the catalog form (PackedPaymentInput): QR upload and/or
|
|
97
|
+
* more than one typed field.
|
|
98
|
+
*/
|
|
99
|
+
declare function usesCatalogPaymentForm(currency: CurrencyCode | null | undefined): boolean;
|
|
64
100
|
|
|
65
101
|
/** Payment ID field configuration for each supported currency. */
|
|
66
102
|
declare const PAYMENT_ID_FIELDS: Record<CurrencyCode, PaymentIdFieldConfig[]>;
|
|
67
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Yape/Plin EMVCo: country PE, currency 604, CRC-16/CCITT-FALSE.
|
|
106
|
+
* CRC is required on upload so we never persist a truncated screenshot.
|
|
107
|
+
* (PAY render in the merchant is looser; that path does not use this.)
|
|
108
|
+
*/
|
|
109
|
+
declare function validatePeruvianQr(payload: string): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Bolivia QR Simple. Accepts either the encrypted envelope (Yape Bs, BancoSol
|
|
112
|
+
* dynamic QR — `<base64>|<32-hex>`) or an EMVCo static QR (country BO, currency
|
|
113
|
+
* 068, CRC-16/CCITT-FALSE). CRC / envelope shape is required on upload so we
|
|
114
|
+
* never persist a truncated screenshot.
|
|
115
|
+
*/
|
|
116
|
+
declare function validateBolivianQr(payload: string): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Suiche 7B / Pago Móvil collection QR: `base64?merchantId=NNNN&…`.
|
|
119
|
+
* The base64 is bank AES — we cannot decode phone/RIF from it, only the
|
|
120
|
+
* envelope. Reject packed `||` IDs so a stored compound string is never
|
|
121
|
+
* treated as a QR. Scan & Pay uses the looser `isPagoMovilQr` envelope.
|
|
122
|
+
*/
|
|
123
|
+
declare function validateVenezuelanQr(payload: string): boolean;
|
|
124
|
+
|
|
125
|
+
/** Validates a 20-digit Peruvian CCI (spaces ignored). */
|
|
126
|
+
declare function validatePeruvianCci(value: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Validates a Yape/Plin phone: `9` + 8 digits, optional `+51` / `51` prefix.
|
|
129
|
+
*/
|
|
130
|
+
declare function validatePeruvianPhone(value: string): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Validates a Peruvian payment key for the legacy single-field path.
|
|
133
|
+
* Accepts either a 20-digit CCI or a Yape/Plin phone number.
|
|
134
|
+
*/
|
|
135
|
+
declare function validatePeruvianPaymentKey(value: string): boolean;
|
|
136
|
+
type PeruvianPaymentIdParts = {
|
|
137
|
+
qr: string | null;
|
|
138
|
+
phone: string | null;
|
|
139
|
+
cci: string | null;
|
|
140
|
+
};
|
|
141
|
+
/** QR payload and/or CCI and/or Yape/Plin phone. */
|
|
142
|
+
declare function validatePeruvianPaymentId(value: string): boolean;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Validates Venezuelan phone number for Pago Movil.
|
|
146
|
+
* Format: 04XX-XXXXXXX (11 digits starting with 04).
|
|
147
|
+
*/
|
|
148
|
+
declare function validateVenezuelanPhoneNumber(phoneNumber: string): boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Validates Venezuelan Cédula/RIF for Pago Móvil.
|
|
151
|
+
* Format: prefix (V|E|J|G|R|P) followed by digits.
|
|
152
|
+
* Includes natural persons (V), foreigners (E), companies (J), government (G),
|
|
153
|
+
* residual (R), and passport-linked accounts (P).
|
|
154
|
+
*/
|
|
155
|
+
declare function validateVenezuelanRif(rif: string): boolean;
|
|
156
|
+
type VenezuelanPaymentIdParts = {
|
|
157
|
+
qr: string | null;
|
|
158
|
+
compound: string | null;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Accepts a Suiche 7B QR payload, the typed `phone|rif|bank` fallback,
|
|
162
|
+
* or both packed as `qr||phone|rif|bank`.
|
|
163
|
+
*/
|
|
164
|
+
declare function validateVenezuelanPaymentId(value: string): boolean;
|
|
165
|
+
|
|
68
166
|
/**
|
|
69
167
|
* Validates Argentine payment IDs (CBU, CVU, or Alias).
|
|
70
168
|
* CBU/CVU: 22 digits with checksum. Alias: 6-20 alphanumeric characters.
|
|
71
169
|
*/
|
|
72
170
|
declare function validateArgentinePaymentId(paymentId: string): boolean;
|
|
73
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Validates a Bolivian bank account number for QR Simple transfers.
|
|
174
|
+
* Accepts 8–20 digits; spaces and dashes are ignored.
|
|
175
|
+
*/
|
|
176
|
+
declare function validateBolivianAccount(account: string): boolean;
|
|
177
|
+
|
|
74
178
|
/**
|
|
75
179
|
* Validates PIX ID format.
|
|
76
180
|
* PIX can be: CPF (11 digits), CNPJ (14 digits), email, phone (10–11 digits or E.164),
|
|
@@ -139,18 +243,6 @@ declare function validateNigerianAccountNumber(accountNumber: string): boolean;
|
|
|
139
243
|
*/
|
|
140
244
|
declare function validateNigerianAccountName(accountName: string): boolean;
|
|
141
245
|
|
|
142
|
-
/**
|
|
143
|
-
* Validates a Peruvian payment key for the SELL text-key path.
|
|
144
|
-
* Accepts either a 20-digit CCI (Código de Cuenta Interbancario, spaces ignored)
|
|
145
|
-
* or a Yape/Plin phone number (optional `+51`/`51` prefix, then `9` + 8 digits).
|
|
146
|
-
*/
|
|
147
|
-
declare function validatePeruvianPaymentKey(value: string): boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Validates a Yape/Plin EMVCo QR payload: parseable TLV, country (tag 58) `PE`,
|
|
150
|
-
* currency (tag 53) `604` (PEN), and a matching CRC-16/CCITT-FALSE (tag 63).
|
|
151
|
-
*/
|
|
152
|
-
declare function validatePeruvianQr(payload: string): boolean;
|
|
153
|
-
|
|
154
246
|
/**
|
|
155
247
|
* Validates a Philippine mobile number for InstaPay (GCash / Maya).
|
|
156
248
|
* Mobile numbers are 10 digits starting with 9, and are commonly written
|
|
@@ -158,27 +250,52 @@ declare function validatePeruvianQr(payload: string): boolean;
|
|
|
158
250
|
*/
|
|
159
251
|
declare function validatePhilippinePhoneNumber(phoneNumber: string): boolean;
|
|
160
252
|
|
|
161
|
-
/**
|
|
162
|
-
* Validates Venezuelan phone number for Pago Movil.
|
|
163
|
-
* Format: 04XX-XXXXXXX (11 digits starting with 04).
|
|
164
|
-
*/
|
|
165
|
-
declare function validateVenezuelanPhoneNumber(phoneNumber: string): boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Validates Venezuelan Cédula/RIF for Pago Móvil.
|
|
168
|
-
* Format: prefix (V|E|J|G|R|P) followed by digits.
|
|
169
|
-
* Includes natural persons (V), foreigners (E), companies (J), government (G),
|
|
170
|
-
* residual (R), and passport-linked accounts (P).
|
|
171
|
-
*/
|
|
172
|
-
declare function validateVenezuelanRif(rif: string): boolean;
|
|
173
|
-
|
|
174
253
|
/** Serializes multiple fields into a pipe-separated string. */
|
|
175
254
|
declare function serializeCompoundPaymentId(...fields: string[]): string;
|
|
176
255
|
/** Deserializes a pipe-separated payment ID into its component fields. */
|
|
177
256
|
declare function deserializeCompoundPaymentId(paymentId: string): string[];
|
|
178
257
|
/**
|
|
179
258
|
* Formats a compound payment ID for display using optional labels.
|
|
180
|
-
*
|
|
259
|
+
* Empty parts (optional fields left blank) are omitted.
|
|
181
260
|
*/
|
|
182
261
|
declare function formatCompoundPaymentIdForDisplay(paymentId: string, labels: (string | null)[]): string;
|
|
262
|
+
/**
|
|
263
|
+
* Validates a stored payment ID against `PAYMENT_ID_FIELDS`.
|
|
264
|
+
* Optional fields may be empty; if every field is optional, at least one must
|
|
265
|
+
* be filled. A legacy single token (no `|`) matches any one field's validator.
|
|
266
|
+
*/
|
|
267
|
+
declare function validatePaymentIdFields(fields: readonly PaymentIdFieldConfig[], paymentId: string): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Splits a stored payment ID into per-field values for form hydration.
|
|
270
|
+
* A legacy single token is assigned to the first field whose validator matches.
|
|
271
|
+
*/
|
|
272
|
+
declare function assignPaymentIdToFieldValues(fields: readonly PaymentIdFieldConfig[], paymentId: string): Record<string, string>;
|
|
273
|
+
declare function unpackPackedPaymentId(paymentId: string): {
|
|
274
|
+
qr: string;
|
|
275
|
+
rest: string;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* QR blob from a stored payment ID, or `null` if none / invalid.
|
|
279
|
+
*/
|
|
280
|
+
declare function getStoredQrPayload(currency: CurrencyCode | null | undefined, paymentId: string | null | undefined): string | null;
|
|
281
|
+
/**
|
|
282
|
+
* Builds a stored payment ID: optional validated QR packed with catalog fields.
|
|
283
|
+
*/
|
|
284
|
+
declare function packStoredPaymentId(currency: CurrencyCode, qr: string | null | undefined, fieldValues: Record<string, string>): string;
|
|
285
|
+
/**
|
|
286
|
+
* Validates a stored payment ID: optional packed QR, then catalog fields.
|
|
287
|
+
* QR-only is valid when the country exposes `validateQr`.
|
|
288
|
+
*/
|
|
289
|
+
declare function validateStoredPaymentId(currency: CurrencyCode, paymentId: string): boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Typed-field values for form hydration. Packed QR prefix is stripped.
|
|
292
|
+
* `hydrateFieldsFromQr` fills keys the typed fallback left empty (PEN phone).
|
|
293
|
+
*/
|
|
294
|
+
declare function assignStoredPaymentIdToFieldValues(currency: CurrencyCode, paymentId: string): Record<string, string>;
|
|
295
|
+
/**
|
|
296
|
+
* Human-readable stored ID: labeled typed fields, never the raw QR blob.
|
|
297
|
+
* QR-only returns an empty string so the caller can substitute a label.
|
|
298
|
+
*/
|
|
299
|
+
declare function formatStoredPaymentIdForDisplay(currency: CurrencyCode, paymentId: string): string;
|
|
183
300
|
|
|
184
|
-
export { COUNTRY_OPTIONS, CURRENCY, CURRENCY_CODES, type CountryOption, type CurrencyCode, PAYMENT_ID_FIELDS, type PaymentIdFieldConfig, deserializeCompoundPaymentId, formatCompoundPaymentIdForDisplay, serializeCompoundPaymentId, validateArgentinePaymentId, validateColombianPaymentId, validateCubanCardNumber, validateCubanPhoneNumber, validateEcuadorianAccountName, validateEcuadorianAccountNumber, validateEcuadorianCedula, validateIndonesianPhoneNumber, validateMexicanPaymentId, validateNigerianAccountName, validateNigerianAccountNumber, validatePIXId, validatePeruvianPaymentKey, validatePeruvianQr, validatePhilippinePhoneNumber, validateRevolutId, validateUPIId, validateVenezuelanPhoneNumber, validateVenezuelanRif };
|
|
301
|
+
export { COUNTRY_OPTIONS, CURRENCY, CURRENCY_CODES, type CountryOption, type CurrencyCode, PACKED_PAYMENT_ID_SEP, PAYMENT_ID_FIELDS, type PaymentIdFieldConfig, type PeruvianPaymentIdParts, type VenezuelanPaymentIdParts, assignPaymentIdToFieldValues, assignStoredPaymentIdToFieldValues, deserializeCompoundPaymentId, formatCompoundPaymentIdForDisplay, formatStoredPaymentIdForDisplay, getCountryOption, getStoredQrPayload, packStoredPaymentId, serializeCompoundPaymentId, unpackPackedPaymentId, uploadsPaymentQR, usesCatalogPaymentForm, usesPackedPaymentId, validateArgentinePaymentId, validateBolivianAccount, validateBolivianQr, validateColombianPaymentId, validateCubanCardNumber, validateCubanPhoneNumber, validateEcuadorianAccountName, validateEcuadorianAccountNumber, validateEcuadorianCedula, validateIndonesianPhoneNumber, validateMexicanPaymentId, validateNigerianAccountName, validateNigerianAccountNumber, validatePIXId, validatePaymentIdFields, validatePeruvianCci, validatePeruvianPaymentId, validatePeruvianPaymentKey, validatePeruvianPhone, validatePeruvianQr, validatePhilippinePhoneNumber, validateRevolutId, validateStoredPaymentId, validateUPIId, validateVenezuelanPaymentId, validateVenezuelanPhoneNumber, validateVenezuelanQr, validateVenezuelanRif };
|