@fileverse-dev/formulajs 4.4.11-mod-89-patch-2 → 4.4.11-mod-89-patch-3

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.
@@ -1,4 +1,4 @@
1
- /* @fileverse-dev/formulajs v4.4.11-mod-89-patch-2 */
1
+ /* @fileverse-dev/formulajs v4.4.11-mod-89-patch-3 */
2
2
  var _excluded = [ "confirmations", "dataDecoded" ];
3
3
 
4
4
  function _objectWithoutProperties(e, t) {
@@ -18285,7 +18285,7 @@ function _typeof(o) {
18285
18285
  }
18286
18286
  function _GNOSISPAY() {
18287
18287
  _GNOSISPAY = _asyncToGenerator(_regeneratorRuntime().mark((function _callee28() {
18288
- var GNOSIS_PAY_ACCESS, access, url, res, json;
18288
+ var GNOSIS_PAY_ACCESS, access, url, res, json, result;
18289
18289
  return _regeneratorRuntime().wrap((function _callee28$(_context31) {
18290
18290
  while (1) switch (_context31.prev = _context31.next) {
18291
18291
  case 0:
@@ -18298,22 +18298,16 @@ function _typeof(o) {
18298
18298
  throw new MissingApiKeyError("GNOSIS_PAY_ACCESS");
18299
18299
 
18300
18300
  case 4:
18301
- console.log({
18302
- GNOSIS_PAY_ACCESS: GNOSIS_PAY_ACCESS
18303
- });
18304
18301
  access = JSON.parse(GNOSIS_PAY_ACCESS);
18305
- console.log({
18306
- access: access
18307
- });
18308
18302
  if (!(!(access !== null && access !== void 0 && access.token) || isExpired(access === null || access === void 0 ? void 0 : access.createdAt))) {
18309
- _context31.next = 9;
18303
+ _context31.next = 7;
18310
18304
  break;
18311
18305
  }
18312
18306
  throw new ValidationError("Expired or invalid access token");
18313
18307
 
18314
- case 9:
18308
+ case 7:
18315
18309
  url = new URL("https://api.gnosispay.com/api/v1/transactions");
18316
- _context31.next = 12;
18310
+ _context31.next = 10;
18317
18311
  return fetch(url.toString(), {
18318
18312
  headers: {
18319
18313
  Authorization: "Bearer ".concat(access.token),
@@ -18321,32 +18315,59 @@ function _typeof(o) {
18321
18315
  }
18322
18316
  });
18323
18317
 
18324
- case 12:
18318
+ case 10:
18325
18319
  res = _context31.sent;
18326
18320
  if (res.ok) {
18327
- _context31.next = 15;
18321
+ _context31.next = 13;
18328
18322
  break;
18329
18323
  }
18330
- throw new NetworkError("GNOSIS_PAY_ACCESS", res.status);
18324
+ throw new NetworkError("GNOSIS_PAY", res.status);
18331
18325
 
18332
- case 15:
18333
- _context31.next = 17;
18326
+ case 13:
18327
+ _context31.next = 15;
18334
18328
  return res.json();
18335
18329
 
18336
- case 17:
18330
+ case 15:
18337
18331
  json = _context31.sent;
18338
- return _context31.abrupt("return", json);
18332
+ if (Array.isArray(json)) {
18333
+ _context31.next = 18;
18334
+ break;
18335
+ }
18336
+ return _context31.abrupt("return", [ {
18337
+ message: "Unexpected response"
18338
+ } ]);
18339
18339
 
18340
- case 21:
18341
- _context31.prev = 21;
18340
+ case 18:
18341
+ result = json.map((function(transactions) {
18342
+ var _transactions$country, _transactions$merchan;
18343
+ return {
18344
+ createdAt: transactions.createdAt,
18345
+ clearedAt: transactions.clearedAt,
18346
+ country: ((_transactions$country = transactions.country) === null || _transactions$country === void 0 ? void 0 : _transactions$country.name) || "",
18347
+ isPending: transactions.isPending,
18348
+ mcc: transactions.mcc,
18349
+ merchant: ((_transactions$merchan = transactions.merchant) === null || _transactions$merchan === void 0 ? void 0 : _transactions$merchan.name) || "",
18350
+ billingAmount: transactions.billingAmount,
18351
+ billingCurrency: transactions.billingCurrency,
18352
+ transactionAmount: transactions.transactionAmount,
18353
+ transactionCurrency: transactions.transactionCurrency,
18354
+ transactionType: transactions.transactionType,
18355
+ kind: transactions.kind,
18356
+ status: transactions.status
18357
+ };
18358
+ }));
18359
+ return _context31.abrupt("return", result);
18360
+
18361
+ case 22:
18362
+ _context31.prev = 22;
18342
18363
  _context31.t0 = _context31["catch"](0);
18343
18364
  return _context31.abrupt("return", errorMessageHandler(_context31.t0, "GNOSISPAY"));
18344
18365
 
18345
- case 24:
18366
+ case 25:
18346
18367
  case "end":
18347
18368
  return _context31.stop();
18348
18369
  }
18349
- }), _callee28, null, [ [ 0, 21 ] ]);
18370
+ }), _callee28, null, [ [ 0, 22 ] ]);
18350
18371
  })));
18351
18372
  return _GNOSISPAY.apply(this, arguments);
18352
18373
  }