@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.
@@ -140,6 +140,10 @@ function isPhilippinePayQr(payload) {
140
140
  if (!payload.startsWith("0002")) return false;
141
141
  return payload.includes("5802PH") && payload.includes("5303608");
142
142
  }
143
+ function isNepalFonepayQr(payload) {
144
+ if (!payload.startsWith("0002")) return false;
145
+ return payload.includes("fonepay.com") && payload.includes("5802NP");
146
+ }
143
147
  function isBolivianPayQr(payload) {
144
148
  if (!payload || payload.includes(PACKED_PAYMENT_ID_SEP)) return false;
145
149
  if (payload.startsWith("0002") && payload.includes("5802BO") && payload.includes("5303068")) {
@@ -336,7 +340,11 @@ var INR_COUNTRY_OPTION = {
336
340
  precision: 2,
337
341
  isAlpha: false,
338
342
  disabled: false,
339
- disabledPaymentTypes: []
343
+ disabledPaymentTypes: [],
344
+ getPayQrPayload: (paymentId) => {
345
+ const candidate = payQrCandidate(paymentId);
346
+ return isNepalFonepayQr(candidate) ? candidate : null;
347
+ }
340
348
  };
341
349
 
342
350
  // src/country/currencies/mex.ts
@@ -976,11 +984,20 @@ function parseQRIS(qrData, sellPrice) {
976
984
 
977
985
  // src/qr-parsers/parsers/inr.ts
978
986
  var UPI_ID_REGEX = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+$/;
987
+ var FONEPAY_COUNTRY_TAG = "58";
988
+ function isFonepayQr(payload) {
989
+ if (!payload.includes("fonepay.com")) return false;
990
+ if (!verifyCRC16(payload).valid) return false;
991
+ return extractTags(payload, [FONEPAY_COUNTRY_TAG])[FONEPAY_COUNTRY_TAG] === "NP";
992
+ }
979
993
  function parseUPI(qrData, sellPrice) {
980
994
  if (!qrData || typeof qrData !== "string" || qrData.trim().length === 0) {
981
995
  return failure("INVALID_QR", "QR data is empty or invalid");
982
996
  }
983
997
  const trimmed = qrData.trim();
998
+ if (isFonepayQr(trimmed)) {
999
+ return success({ paymentAddress: trimmed });
1000
+ }
984
1001
  let paramString;
985
1002
  if (trimmed.startsWith("upi://pay?")) {
986
1003
  paramString = trimmed.substring(10);