@p2pdotme/sdk 1.2.21 → 1.2.22

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.
@@ -168,6 +168,10 @@ function isPhilippinePayQr(payload) {
168
168
  if (!payload.startsWith("0002")) return false;
169
169
  return payload.includes("5802PH") && payload.includes("5303608");
170
170
  }
171
+ function isNepalFonepayQr(payload) {
172
+ if (!payload.startsWith("0002")) return false;
173
+ return payload.includes("fonepay.com") && payload.includes("5802NP");
174
+ }
171
175
  function isBolivianPayQr(payload) {
172
176
  if (!payload || payload.includes(PACKED_PAYMENT_ID_SEP)) return false;
173
177
  if (payload.startsWith("0002") && payload.includes("5802BO") && payload.includes("5303068")) {
@@ -364,7 +368,11 @@ var INR_COUNTRY_OPTION = {
364
368
  precision: 2,
365
369
  isAlpha: false,
366
370
  disabled: false,
367
- disabledPaymentTypes: []
371
+ disabledPaymentTypes: [],
372
+ getPayQrPayload: (paymentId) => {
373
+ const candidate = payQrCandidate(paymentId);
374
+ return isNepalFonepayQr(candidate) ? candidate : null;
375
+ }
368
376
  };
369
377
 
370
378
  // src/country/currencies/mex.ts
@@ -1004,11 +1012,20 @@ function parseQRIS(qrData, sellPrice) {
1004
1012
 
1005
1013
  // src/qr-parsers/parsers/inr.ts
1006
1014
  var UPI_ID_REGEX = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+$/;
1015
+ var FONEPAY_COUNTRY_TAG = "58";
1016
+ function isFonepayQr(payload) {
1017
+ if (!payload.includes("fonepay.com")) return false;
1018
+ if (!verifyCRC16(payload).valid) return false;
1019
+ return extractTags(payload, [FONEPAY_COUNTRY_TAG])[FONEPAY_COUNTRY_TAG] === "NP";
1020
+ }
1007
1021
  function parseUPI(qrData, sellPrice) {
1008
1022
  if (!qrData || typeof qrData !== "string" || qrData.trim().length === 0) {
1009
1023
  return failure("INVALID_QR", "QR data is empty or invalid");
1010
1024
  }
1011
1025
  const trimmed = qrData.trim();
1026
+ if (isFonepayQr(trimmed)) {
1027
+ return success({ paymentAddress: trimmed });
1028
+ }
1012
1029
  let paramString;
1013
1030
  if (trimmed.startsWith("upi://pay?")) {
1014
1031
  paramString = trimmed.substring(10);