@medipass/web-sdk 11.40.4-chore-add-new-sdk-function-and-test.0 → 11.40.4-chore-add-new-sdk-function-and-test.1

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.
Files changed (83) hide show
  1. package/lib/index.js +1 -1
  2. package/lib/resources/accounts.js +1 -1
  3. package/lib/resources/actions.js +1 -1
  4. package/lib/resources/api-keys.js +1 -1
  5. package/lib/resources/applications.js +1 -1
  6. package/lib/resources/attachments.js +1 -1
  7. package/lib/resources/auth.js +1 -1
  8. package/lib/resources/bulk-submits.js +1 -1
  9. package/lib/resources/bulk-uploads.js +1 -1
  10. package/lib/resources/business-profiles.js +1 -1
  11. package/lib/resources/businesses.js +1 -1
  12. package/lib/resources/claim-items.js +1 -1
  13. package/lib/resources/devices.js +1 -1
  14. package/lib/resources/doc-accounts.js +1 -1
  15. package/lib/resources/documents.js +1 -1
  16. package/lib/resources/emails.js +1 -1
  17. package/lib/resources/form-application-templates.js +1 -1
  18. package/lib/resources/form-applications.js +1 -1
  19. package/lib/resources/forms.js +1 -1
  20. package/lib/resources/funder-services.js +1 -1
  21. package/lib/resources/funder-settings.js +1 -1
  22. package/lib/resources/funders.js +1 -1
  23. package/lib/resources/futures.js +1 -1
  24. package/lib/resources/health-fund-accounts.js +1 -1
  25. package/lib/resources/health-fund-settings.js +1 -1
  26. package/lib/resources/healthfunds.js +1 -1
  27. package/lib/resources/icditems.js +1 -1
  28. package/lib/resources/invoice-scans.js +1 -1
  29. package/lib/resources/jhcs.js +1 -1
  30. package/lib/resources/kyc.js +1 -1
  31. package/lib/resources/logs.js +1 -1
  32. package/lib/resources/members.js +1 -1
  33. package/lib/resources/message-mappings.js +1 -1
  34. package/lib/resources/minions.js +1 -1
  35. package/lib/resources/modalities.js +1 -1
  36. package/lib/resources/notes.js +1 -1
  37. package/lib/resources/onboarding-applications.js +1 -1
  38. package/lib/resources/onboarding-requests.js +1 -1
  39. package/lib/resources/ops.js +1 -1
  40. package/lib/resources/organisations.js +1 -1
  41. package/lib/resources/partners.js +1 -1
  42. package/lib/resources/patients.js +1 -1
  43. package/lib/resources/payments.d.ts +9 -1
  44. package/lib/resources/payments.js +2 -1
  45. package/lib/resources/pms.js +1 -1
  46. package/lib/resources/practice-profiles.js +1 -1
  47. package/lib/resources/practice-types.js +1 -1
  48. package/lib/resources/practices.js +1 -1
  49. package/lib/resources/products.js +1 -1
  50. package/lib/resources/professional-categories.js +1 -1
  51. package/lib/resources/provider-number-types.js +1 -1
  52. package/lib/resources/provider-registration-types.js +1 -1
  53. package/lib/resources/provider-requests.js +1 -1
  54. package/lib/resources/provider-types.js +1 -1
  55. package/lib/resources/ref-sources.js +1 -1
  56. package/lib/resources/risk.js +1 -1
  57. package/lib/resources/rnas.js +1 -1
  58. package/lib/resources/roles.js +1 -1
  59. package/lib/resources/self-checkout-sessions.js +1 -1
  60. package/lib/resources/services.js +1 -1
  61. package/lib/resources/settlements.js +1 -1
  62. package/lib/resources/sign-up.js +1 -1
  63. package/lib/resources/specialties.js +1 -1
  64. package/lib/resources/staff-profiles.js +1 -1
  65. package/lib/resources/staff.js +1 -1
  66. package/lib/resources/statistics.js +1 -1
  67. package/lib/resources/subscriptions.js +1 -1
  68. package/lib/resources/terminals.js +1 -1
  69. package/lib/resources/transaction-export.js +1 -1
  70. package/lib/resources/transactions.js +1 -1
  71. package/lib/resources/triggers.js +1 -1
  72. package/lib/resources/vendors.js +1 -1
  73. package/lib/resources/verify.js +1 -1
  74. package/lib/resources/workers.js +1 -1
  75. package/lib/resources/workflow-exceptions.js +1 -1
  76. package/lib/services/aws.js +1 -1
  77. package/lib/services/version.js +1 -1
  78. package/lib/{staff-853402f6.js → staff-69abfebe.js} +172 -108
  79. package/lib/utils/application.js +1 -1
  80. package/lib/utils/professions.js +1 -1
  81. package/lib/utils/request.js +1 -1
  82. package/lib/utils/staff.js +1 -1
  83. package/package.json +2 -2
@@ -9624,6 +9624,10 @@ var pathBusinessPatientPaymentMethod = function pathBusinessPatientPaymentMethod
9624
9624
  var pathBusinessSalesClientToken = function pathBusinessSalesClientToken(businessId) {
9625
9625
  return "/businesses/" + businessId + "/sales/clienttoken";
9626
9626
  };
9627
+
9628
+ var pathBusinessPaymentClientToken = function pathBusinessPaymentClientToken(businessId, patientId) {
9629
+ return "/businesses/" + businessId + "/patients/" + patientId + "/sales/clienttoken";
9630
+ };
9627
9631
  /**
9628
9632
  * Create an account's payment method
9629
9633
  * @param {String} accountId - Account ID
@@ -10202,14 +10206,15 @@ var getBusinessClientToken = /*#__PURE__*/function () {
10202
10206
  };
10203
10207
  }();
10204
10208
  /**
10205
- * Get business sales client token
10209
+ * Get business payment client token
10206
10210
  * @param {String} businessId - Business ID
10211
+ * @param {String} patientId - Patient ID
10207
10212
  * @param {Object} opts - Additional options
10208
10213
  * @returns {Object} The device data
10209
10214
  */
10210
10215
 
10211
- var getBusinessSalesClientToken = /*#__PURE__*/function () {
10212
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(businessId, opts) {
10216
+ var getBusinessPaymentClientToken = /*#__PURE__*/function () {
10217
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(businessId, patientId, opts) {
10213
10218
  return _regeneratorRuntime.wrap(function _callee15$(_context15) {
10214
10219
  while (1) {
10215
10220
  switch (_context15.prev = _context15.next) {
@@ -10219,10 +10224,11 @@ var getBusinessSalesClientToken = /*#__PURE__*/function () {
10219
10224
  }
10220
10225
 
10221
10226
  doesParamExist.default({
10222
- businessId: businessId
10227
+ businessId: businessId,
10228
+ patientId: patientId
10223
10229
  }, opts.hyperMediaEndpoint);
10224
10230
  return _context15.abrupt("return", request(_objectSpread$G({}, opts, {
10225
- path: pathBusinessSalesClientToken(businessId)
10231
+ path: pathBusinessPaymentClientToken(businessId, patientId)
10226
10232
  }), {
10227
10233
  method: 'get'
10228
10234
  }));
@@ -10235,10 +10241,48 @@ var getBusinessSalesClientToken = /*#__PURE__*/function () {
10235
10241
  }, _callee15);
10236
10242
  }));
10237
10243
 
10238
- return function getBusinessSalesClientToken(_x47, _x48) {
10244
+ return function getBusinessPaymentClientToken(_x47, _x48, _x49) {
10239
10245
  return _ref15.apply(this, arguments);
10240
10246
  };
10241
10247
  }();
10248
+ /**
10249
+ * Get business sales client token
10250
+ * @param {String} businessId - Business ID
10251
+ * @param {Object} opts - Additional options
10252
+ * @returns {Object} The device data
10253
+ */
10254
+
10255
+ var getBusinessSalesClientToken = /*#__PURE__*/function () {
10256
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(businessId, opts) {
10257
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
10258
+ while (1) {
10259
+ switch (_context16.prev = _context16.next) {
10260
+ case 0:
10261
+ if (opts === void 0) {
10262
+ opts = {};
10263
+ }
10264
+
10265
+ doesParamExist.default({
10266
+ businessId: businessId
10267
+ }, opts.hyperMediaEndpoint);
10268
+ return _context16.abrupt("return", request(_objectSpread$G({}, opts, {
10269
+ path: pathBusinessSalesClientToken(businessId)
10270
+ }), {
10271
+ method: 'get'
10272
+ }));
10273
+
10274
+ case 3:
10275
+ case "end":
10276
+ return _context16.stop();
10277
+ }
10278
+ }
10279
+ }, _callee16);
10280
+ }));
10281
+
10282
+ return function getBusinessSalesClientToken(_x50, _x51) {
10283
+ return _ref16.apply(this, arguments);
10284
+ };
10285
+ }();
10242
10286
  /**
10243
10287
  * Get client token
10244
10288
  * @param {String} source - Source of payment
@@ -10247,10 +10291,10 @@ var getBusinessSalesClientToken = /*#__PURE__*/function () {
10247
10291
  */
10248
10292
 
10249
10293
  var getClientToken = /*#__PURE__*/function () {
10250
- var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(source, opts) {
10251
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
10294
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(source, opts) {
10295
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
10252
10296
  while (1) {
10253
- switch (_context16.prev = _context16.next) {
10297
+ switch (_context17.prev = _context17.next) {
10254
10298
  case 0:
10255
10299
  if (opts === void 0) {
10256
10300
  opts = {
@@ -10261,7 +10305,7 @@ var getClientToken = /*#__PURE__*/function () {
10261
10305
  doesParamExist.default({
10262
10306
  source: source
10263
10307
  }, opts.hyperMediaEndpoint);
10264
- return _context16.abrupt("return", request(_objectSpread$G({}, opts, {
10308
+ return _context17.abrupt("return", request(_objectSpread$G({}, opts, {
10265
10309
  path: PATH__PAYMENTS + "/clienttoken"
10266
10310
  }), {
10267
10311
  method: 'get',
@@ -10273,14 +10317,14 @@ var getClientToken = /*#__PURE__*/function () {
10273
10317
 
10274
10318
  case 3:
10275
10319
  case "end":
10276
- return _context16.stop();
10320
+ return _context17.stop();
10277
10321
  }
10278
10322
  }
10279
- }, _callee16);
10323
+ }, _callee17);
10280
10324
  }));
10281
10325
 
10282
- return function getClientToken(_x49, _x50) {
10283
- return _ref16.apply(this, arguments);
10326
+ return function getClientToken(_x52, _x53) {
10327
+ return _ref17.apply(this, arguments);
10284
10328
  };
10285
10329
  }();
10286
10330
  /**
@@ -10292,10 +10336,10 @@ var getClientToken = /*#__PURE__*/function () {
10292
10336
  */
10293
10337
 
10294
10338
  var updateAccountPaymentMethod = /*#__PURE__*/function () {
10295
- var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(accountId, paymentMethodId, body, opts) {
10296
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
10339
+ var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(accountId, paymentMethodId, body, opts) {
10340
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
10297
10341
  while (1) {
10298
- switch (_context17.prev = _context17.next) {
10342
+ switch (_context18.prev = _context18.next) {
10299
10343
  case 0:
10300
10344
  if (opts === void 0) {
10301
10345
  opts = {};
@@ -10305,7 +10349,7 @@ var updateAccountPaymentMethod = /*#__PURE__*/function () {
10305
10349
  accountId: accountId,
10306
10350
  paymentMethodId: paymentMethodId
10307
10351
  }, opts.hyperMediaEndpoint);
10308
- return _context17.abrupt("return", request(_objectSpread$G({}, opts, {
10352
+ return _context18.abrupt("return", request(_objectSpread$G({}, opts, {
10309
10353
  path: pathAccountPaymentMethod(accountId, paymentMethodId)
10310
10354
  }), {
10311
10355
  data: body,
@@ -10314,14 +10358,14 @@ var updateAccountPaymentMethod = /*#__PURE__*/function () {
10314
10358
 
10315
10359
  case 3:
10316
10360
  case "end":
10317
- return _context17.stop();
10361
+ return _context18.stop();
10318
10362
  }
10319
10363
  }
10320
- }, _callee17);
10364
+ }, _callee18);
10321
10365
  }));
10322
10366
 
10323
- return function updateAccountPaymentMethod(_x51, _x52, _x53, _x54) {
10324
- return _ref17.apply(this, arguments);
10367
+ return function updateAccountPaymentMethod(_x54, _x55, _x56, _x57) {
10368
+ return _ref18.apply(this, arguments);
10325
10369
  };
10326
10370
  }();
10327
10371
  /**
@@ -10333,10 +10377,10 @@ var updateAccountPaymentMethod = /*#__PURE__*/function () {
10333
10377
  */
10334
10378
 
10335
10379
  var updateBusinessPaymentMethod = /*#__PURE__*/function () {
10336
- var _ref18 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(businessId, paymentMethodId, body, opts) {
10337
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
10380
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(businessId, paymentMethodId, body, opts) {
10381
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
10338
10382
  while (1) {
10339
- switch (_context18.prev = _context18.next) {
10383
+ switch (_context19.prev = _context19.next) {
10340
10384
  case 0:
10341
10385
  if (opts === void 0) {
10342
10386
  opts = {};
@@ -10346,7 +10390,7 @@ var updateBusinessPaymentMethod = /*#__PURE__*/function () {
10346
10390
  businessId: businessId,
10347
10391
  paymentMethodId: paymentMethodId
10348
10392
  }, opts.hyperMediaEndpoint);
10349
- return _context18.abrupt("return", request(_objectSpread$G({}, opts, {
10393
+ return _context19.abrupt("return", request(_objectSpread$G({}, opts, {
10350
10394
  path: pathBusinessPaymentMethod(businessId, paymentMethodId)
10351
10395
  }), {
10352
10396
  data: body,
@@ -10355,14 +10399,14 @@ var updateBusinessPaymentMethod = /*#__PURE__*/function () {
10355
10399
 
10356
10400
  case 3:
10357
10401
  case "end":
10358
- return _context18.stop();
10402
+ return _context19.stop();
10359
10403
  }
10360
10404
  }
10361
- }, _callee18);
10405
+ }, _callee19);
10362
10406
  }));
10363
10407
 
10364
- return function updateBusinessPaymentMethod(_x55, _x56, _x57, _x58) {
10365
- return _ref18.apply(this, arguments);
10408
+ return function updateBusinessPaymentMethod(_x58, _x59, _x60, _x61) {
10409
+ return _ref19.apply(this, arguments);
10366
10410
  };
10367
10411
  }();
10368
10412
  /**
@@ -10374,10 +10418,10 @@ var updateBusinessPaymentMethod = /*#__PURE__*/function () {
10374
10418
  */
10375
10419
 
10376
10420
  var updateBusinessPatientPaymentMethod = /*#__PURE__*/function () {
10377
- var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(businessId, patientId, paymentMethodId, body, opts) {
10378
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
10421
+ var _ref20 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(businessId, patientId, paymentMethodId, body, opts) {
10422
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
10379
10423
  while (1) {
10380
- switch (_context19.prev = _context19.next) {
10424
+ switch (_context20.prev = _context20.next) {
10381
10425
  case 0:
10382
10426
  if (opts === void 0) {
10383
10427
  opts = {};
@@ -10388,7 +10432,7 @@ var updateBusinessPatientPaymentMethod = /*#__PURE__*/function () {
10388
10432
  patientId: patientId,
10389
10433
  paymentMethodId: paymentMethodId
10390
10434
  }, opts.hyperMediaEndpoint);
10391
- return _context19.abrupt("return", request(_objectSpread$G({}, opts, {
10435
+ return _context20.abrupt("return", request(_objectSpread$G({}, opts, {
10392
10436
  path: pathBusinessPatientPaymentMethod(businessId, patientId, paymentMethodId)
10393
10437
  }), {
10394
10438
  data: body,
@@ -10397,14 +10441,14 @@ var updateBusinessPatientPaymentMethod = /*#__PURE__*/function () {
10397
10441
 
10398
10442
  case 3:
10399
10443
  case "end":
10400
- return _context19.stop();
10444
+ return _context20.stop();
10401
10445
  }
10402
10446
  }
10403
- }, _callee19);
10447
+ }, _callee20);
10404
10448
  }));
10405
10449
 
10406
- return function updateBusinessPatientPaymentMethod(_x59, _x60, _x61, _x62, _x63) {
10407
- return _ref19.apply(this, arguments);
10450
+ return function updateBusinessPatientPaymentMethod(_x62, _x63, _x64, _x65, _x66) {
10451
+ return _ref20.apply(this, arguments);
10408
10452
  };
10409
10453
  }(); //////////////////////////////////////////////////////////////
10410
10454
 
@@ -10425,65 +10469,83 @@ var getPaymentGatewayError = function getPaymentGatewayError(sessionResponse) {
10425
10469
  */
10426
10470
 
10427
10471
  var getNonce = /*#__PURE__*/function () {
10428
- var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref20, opts) {
10429
- var amount, businessId, _cardNumber, expiry, cvc, _ref20$paymentProvide, paymentProvider, _ref20$isSales, isSales, isSelfCheckoutSession, _ref20$source, source, cardNumber, cardExpiryMonth, cardExpiryYear, cardSecurityCode, clientToken, paymentSession, updateSessionResponse, clientInstance, sourceResponse, paymentsClient, googlePaymentInstance, response, paymentDataRequest, cardPaymentMethod, paymentData, applePayInstance, paymentRequest, canMakeApplePayment;
10472
+ var _ref22 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref21, opts) {
10473
+ var amount, businessId, patientId, _cardNumber, expiry, cvc, _ref21$paymentProvide, paymentProvider, isUpdatePaymentOnly, _ref21$isSales, isSales, isSelfCheckoutSession, _ref21$source, source, cardNumber, cardExpiryMonth, cardExpiryYear, cardSecurityCode, clientToken, paymentSession, updateSessionResponse, clientInstance, sourceResponse, paymentsClient, googlePaymentInstance, response, paymentDataRequest, cardPaymentMethod, paymentData, applePayInstance, paymentRequest, canMakeApplePayment;
10430
10474
 
10431
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
10475
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
10432
10476
  while (1) {
10433
- switch (_context20.prev = _context20.next) {
10477
+ switch (_context21.prev = _context21.next) {
10434
10478
  case 0:
10435
- amount = _ref20.amount, businessId = _ref20.businessId, _cardNumber = _ref20.cardNumber, expiry = _ref20.expiry, cvc = _ref20.cvc, _ref20$paymentProvide = _ref20.paymentProvider, paymentProvider = _ref20$paymentProvide === void 0 ? constants.PAYMENT_PROVIDERS.PAYMENT_CARD : _ref20$paymentProvide, _ref20$isSales = _ref20.isSales, isSales = _ref20$isSales === void 0 ? true : _ref20$isSales, isSelfCheckoutSession = _ref20.isSelfCheckoutSession, _ref20$source = _ref20.source, source = _ref20$source === void 0 ? 'mastercard' : _ref20$source;
10479
+ amount = _ref21.amount, businessId = _ref21.businessId, patientId = _ref21.patientId, _cardNumber = _ref21.cardNumber, expiry = _ref21.expiry, cvc = _ref21.cvc, _ref21$paymentProvide = _ref21.paymentProvider, paymentProvider = _ref21$paymentProvide === void 0 ? constants.PAYMENT_PROVIDERS.PAYMENT_CARD : _ref21$paymentProvide, isUpdatePaymentOnly = _ref21.isUpdatePaymentOnly, _ref21$isSales = _ref21.isSales, isSales = _ref21$isSales === void 0 ? true : _ref21$isSales, isSelfCheckoutSession = _ref21.isSelfCheckoutSession, _ref21$source = _ref21.source, source = _ref21$source === void 0 ? 'mastercard' : _ref21$source;
10436
10480
 
10437
10481
  cardNumber = _cardNumber ? _cardNumber.replace(/\s/g, '') : '';
10438
10482
  cardExpiryMonth = expiry ? expiry.split('/')[0].trim() : '';
10439
10483
  cardExpiryYear = expiry ? expiry.split('/')[1].trim() : '';
10440
10484
  cardSecurityCode = cvc;
10441
10485
 
10442
- if (!(businessId && isSales)) {
10443
- _context20.next = 12;
10486
+ if (!(businessId && isSales && !isUpdatePaymentOnly)) {
10487
+ _context21.next = 12;
10444
10488
  break;
10445
10489
  }
10446
10490
 
10447
- _context20.next = 9;
10491
+ _context21.next = 9;
10448
10492
  return getBusinessSalesClientToken(businessId, isSelfCheckoutSession ? {
10449
10493
  tokenType: 'session'
10450
10494
  } : {});
10451
10495
 
10452
10496
  case 9:
10453
- clientToken = _context20.sent;
10454
- _context20.next = 21;
10497
+ clientToken = _context21.sent;
10498
+ _context21.next = 27;
10455
10499
  break;
10456
10500
 
10457
10501
  case 12:
10458
- if (!businessId) {
10459
- _context20.next = 18;
10502
+ if (!(businessId && !isUpdatePaymentOnly)) {
10503
+ _context21.next = 18;
10460
10504
  break;
10461
10505
  }
10462
10506
 
10463
- _context20.next = 15;
10507
+ _context21.next = 15;
10464
10508
  return getBusinessClientToken(businessId, source, isSelfCheckoutSession ? {
10465
10509
  tokenType: 'session'
10466
10510
  } : {});
10467
10511
 
10468
10512
  case 15:
10469
- clientToken = _context20.sent;
10470
- _context20.next = 21;
10513
+ clientToken = _context21.sent;
10514
+ _context21.next = 27;
10471
10515
  break;
10472
10516
 
10473
10517
  case 18:
10474
- _context20.next = 20;
10518
+ if (!(isUpdatePaymentOnly && businessId && patientId)) {
10519
+ _context21.next = 24;
10520
+ break;
10521
+ }
10522
+
10523
+ _context21.next = 21;
10524
+ return getBusinessPaymentClientToken(businessId, patientId, {
10525
+ requestConfig: {
10526
+ tokenType: 'session'
10527
+ }
10528
+ });
10529
+
10530
+ case 21:
10531
+ clientToken = _context21.sent;
10532
+ _context21.next = 27;
10533
+ break;
10534
+
10535
+ case 24:
10536
+ _context21.next = 26;
10475
10537
  return getClientToken(source, isSelfCheckoutSession ? {
10476
10538
  tokenType: 'session'
10477
10539
  } : {});
10478
10540
 
10479
- case 20:
10480
- clientToken = _context20.sent;
10541
+ case 26:
10542
+ clientToken = _context21.sent;
10481
10543
 
10482
- case 21:
10544
+ case 27:
10483
10545
  if (!clientToken.source) clientToken.source = source;
10484
10546
 
10485
10547
  if (!(clientToken.source === 'mastercard')) {
10486
- _context20.next = 33;
10548
+ _context21.next = 39;
10487
10549
  break;
10488
10550
  }
10489
10551
 
@@ -10491,15 +10553,15 @@ var getNonce = /*#__PURE__*/function () {
10491
10553
  paymentSession = HostedForm; // eslint-disable-line no-undef
10492
10554
 
10493
10555
  if (paymentSession) {
10494
- _context20.next = 26;
10556
+ _context21.next = 32;
10495
10557
  break;
10496
10558
  }
10497
10559
 
10498
10560
  throw new Error(constants.ERROR_MESSAGES.PAYMENT_GATEWAY_ERROR);
10499
10561
 
10500
- case 26:
10562
+ case 32:
10501
10563
  paymentSession.setMerchant(clientToken.merchantId);
10502
- _context20.next = 29;
10564
+ _context21.next = 35;
10503
10565
  return pify(paymentSession.updateSession, {
10504
10566
  errorFirst: false
10505
10567
  })(clientToken.clientToken, {
@@ -10509,43 +10571,43 @@ var getNonce = /*#__PURE__*/function () {
10509
10571
  cardSecurityCode: cardSecurityCode
10510
10572
  });
10511
10573
 
10512
- case 29:
10513
- updateSessionResponse = _context20.sent;
10574
+ case 35:
10575
+ updateSessionResponse = _context21.sent;
10514
10576
 
10515
10577
  if (!getPaymentGatewayError(updateSessionResponse)) {
10516
- _context20.next = 32;
10578
+ _context21.next = 38;
10517
10579
  break;
10518
10580
  }
10519
10581
 
10520
10582
  throw new Error(getPaymentGatewayError(updateSessionResponse));
10521
10583
 
10522
- case 32:
10523
- return _context20.abrupt("return", _objectSpread$G({}, clientToken, {
10584
+ case 38:
10585
+ return _context21.abrupt("return", _objectSpread$G({}, clientToken, {
10524
10586
  nonce: clientToken.clientToken,
10525
10587
  sourceResponse: updateSessionResponse
10526
10588
  }));
10527
10589
 
10528
- case 33:
10590
+ case 39:
10529
10591
  if (!(clientToken.source === 'braintree')) {
10530
- _context20.next = 71;
10592
+ _context21.next = 77;
10531
10593
  break;
10532
10594
  }
10533
10595
 
10534
- _context20.next = 36;
10596
+ _context21.next = 42;
10535
10597
  return braintreeClient.create({
10536
10598
  authorization: clientToken.clientToken
10537
10599
  });
10538
10600
 
10539
- case 36:
10540
- clientInstance = _context20.sent;
10601
+ case 42:
10602
+ clientInstance = _context21.sent;
10541
10603
  sourceResponse = {};
10542
10604
 
10543
10605
  if (!(paymentProvider === constants.PAYMENT_PROVIDERS.PAYMENT_CARD)) {
10544
- _context20.next = 43;
10606
+ _context21.next = 49;
10545
10607
  break;
10546
10608
  }
10547
10609
 
10548
- _context20.next = 41;
10610
+ _context21.next = 47;
10549
10611
  return clientInstance.request({
10550
10612
  endpoint: 'payment_methods/credit_cards',
10551
10613
  method: 'post',
@@ -10561,43 +10623,43 @@ var getNonce = /*#__PURE__*/function () {
10561
10623
  }
10562
10624
  });
10563
10625
 
10564
- case 41:
10565
- sourceResponse = _context20.sent;
10566
- return _context20.abrupt("return", _objectSpread$G({}, clientToken, {
10626
+ case 47:
10627
+ sourceResponse = _context21.sent;
10628
+ return _context21.abrupt("return", _objectSpread$G({}, clientToken, {
10567
10629
  nonce: _get(sourceResponse, 'creditCards[0].nonce'),
10568
10630
  sourceResponse: sourceResponse
10569
10631
  }));
10570
10632
 
10571
- case 43:
10633
+ case 49:
10572
10634
  if (!(paymentProvider === constants.PAYMENT_PROVIDERS.GOOGLE_PAY && amount && _get(window, 'google.payments.api'))) {
10573
- _context20.next = 62;
10635
+ _context21.next = 68;
10574
10636
  break;
10575
10637
  }
10576
10638
 
10577
10639
  paymentsClient = new window.google.payments.api.PaymentsClient({
10578
10640
  environment: env.ENV_NAME === 'prod' || env.ENV_NAME === 'pre-prod' ? 'PRODUCTION' : 'TEST'
10579
10641
  });
10580
- _context20.next = 47;
10642
+ _context21.next = 53;
10581
10643
  return braintreeGooglePayment.create({
10582
10644
  client: clientInstance,
10583
10645
  googlePayVersion: 2,
10584
10646
  googleMerchantId: env.GOOGLE_MERCHANT_ID
10585
10647
  });
10586
10648
 
10587
- case 47:
10588
- googlePaymentInstance = _context20.sent;
10589
- _context20.next = 50;
10649
+ case 53:
10650
+ googlePaymentInstance = _context21.sent;
10651
+ _context21.next = 56;
10590
10652
  return paymentsClient.isReadyToPay({
10591
10653
  apiVersion: 2,
10592
10654
  apiVersionMinor: 0,
10593
10655
  allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods
10594
10656
  });
10595
10657
 
10596
- case 50:
10597
- response = _context20.sent;
10658
+ case 56:
10659
+ response = _context21.sent;
10598
10660
 
10599
10661
  if (!response.result) {
10600
- _context20.next = 62;
10662
+ _context21.next = 68;
10601
10663
  break;
10602
10664
  }
10603
10665
 
@@ -10610,34 +10672,34 @@ var getNonce = /*#__PURE__*/function () {
10610
10672
  });
10611
10673
  cardPaymentMethod = paymentDataRequest.allowedPaymentMethods[0];
10612
10674
  cardPaymentMethod.parameters.billingAddressRequired = false;
10613
- _context20.next = 57;
10675
+ _context21.next = 63;
10614
10676
  return paymentsClient.loadPaymentData(paymentDataRequest);
10615
10677
 
10616
- case 57:
10617
- paymentData = _context20.sent;
10618
- _context20.next = 60;
10678
+ case 63:
10679
+ paymentData = _context21.sent;
10680
+ _context21.next = 66;
10619
10681
  return googlePaymentInstance.parseResponse(paymentData);
10620
10682
 
10621
- case 60:
10622
- sourceResponse = _context20.sent;
10623
- return _context20.abrupt("return", _objectSpread$G({}, clientToken, {
10683
+ case 66:
10684
+ sourceResponse = _context21.sent;
10685
+ return _context21.abrupt("return", _objectSpread$G({}, clientToken, {
10624
10686
  nonce: sourceResponse.nonce,
10625
10687
  sourceResponse: sourceResponse
10626
10688
  }));
10627
10689
 
10628
- case 62:
10690
+ case 68:
10629
10691
  if (!(paymentProvider === constants.PAYMENT_PROVIDERS.APPLE_PAY)) {
10630
- _context20.next = 71;
10692
+ _context21.next = 77;
10631
10693
  break;
10632
10694
  }
10633
10695
 
10634
- _context20.next = 65;
10696
+ _context21.next = 71;
10635
10697
  return braintreeApplePay.create({
10636
10698
  client: clientInstance
10637
10699
  });
10638
10700
 
10639
- case 65:
10640
- applePayInstance = _context20.sent;
10701
+ case 71:
10702
+ applePayInstance = _context21.sent;
10641
10703
  paymentRequest = applePayInstance.createPaymentRequest({
10642
10704
  total: {
10643
10705
  label: 'Medipass Payment',
@@ -10645,30 +10707,30 @@ var getNonce = /*#__PURE__*/function () {
10645
10707
  }
10646
10708
  }); // @ts-expect-error TS(2339): Property 'ApplePaySession' does not exist on type ... Remove this comment to see the full error message
10647
10709
 
10648
- _context20.next = 69;
10710
+ _context21.next = 75;
10649
10711
  return window.ApplePaySession.canMakePaymentsWithActiveCard(applePayInstance.merchantIdentifier);
10650
10712
 
10651
- case 69:
10652
- canMakeApplePayment = _context20.sent;
10653
- return _context20.abrupt("return", _objectSpread$G({}, clientToken, {
10713
+ case 75:
10714
+ canMakeApplePayment = _context21.sent;
10715
+ return _context21.abrupt("return", _objectSpread$G({}, clientToken, {
10654
10716
  applePayInstance: applePayInstance,
10655
10717
  canMakeApplePayment: canMakeApplePayment,
10656
10718
  paymentRequest: paymentRequest
10657
10719
  }));
10658
10720
 
10659
- case 71:
10660
- return _context20.abrupt("return", clientToken);
10721
+ case 77:
10722
+ return _context21.abrupt("return", clientToken);
10661
10723
 
10662
- case 72:
10724
+ case 78:
10663
10725
  case "end":
10664
- return _context20.stop();
10726
+ return _context21.stop();
10665
10727
  }
10666
10728
  }
10667
- }, _callee20);
10729
+ }, _callee21);
10668
10730
  }));
10669
10731
 
10670
- return function getNonce(_x64, _x65) {
10671
- return _ref21.apply(this, arguments);
10732
+ return function getNonce(_x67, _x68) {
10733
+ return _ref22.apply(this, arguments);
10672
10734
  };
10673
10735
  }();
10674
10736
 
@@ -10688,6 +10750,7 @@ var payments = /*#__PURE__*/Object.freeze({
10688
10750
  getBusinessPaymentMethod: getBusinessPaymentMethod,
10689
10751
  getBusinessPatientPaymentMethod: getBusinessPatientPaymentMethod,
10690
10752
  getBusinessClientToken: getBusinessClientToken,
10753
+ getBusinessPaymentClientToken: getBusinessPaymentClientToken,
10691
10754
  getBusinessSalesClientToken: getBusinessSalesClientToken,
10692
10755
  getClientToken: getClientToken,
10693
10756
  updateAccountPaymentMethod: updateAccountPaymentMethod,
@@ -21797,6 +21860,7 @@ exports.getBusinessPatientPaymentMethod = getBusinessPatientPaymentMethod;
21797
21860
  exports.getBusinessPatientPaymentMethods = getBusinessPatientPaymentMethods;
21798
21861
  exports.getBusinessPatientPaymentMethodsByRefId = getBusinessPatientPaymentMethodsByRefId;
21799
21862
  exports.getBusinessPatients = getBusinessPatients;
21863
+ exports.getBusinessPaymentClientToken = getBusinessPaymentClientToken;
21800
21864
  exports.getBusinessPaymentMethod = getBusinessPaymentMethod;
21801
21865
  exports.getBusinessPaymentMethods = getBusinessPaymentMethods;
21802
21866
  exports.getBusinessPractice = getBusinessPractice;
@@ -18,7 +18,7 @@ require('./param-error.js');
18
18
  require('./does-param-exist.js');
19
19
  require('@medipass/utils/sentry');
20
20
  require('./get-axios-error.js');
21
- var request = require('../staff-853402f6.js');
21
+ var request = require('../staff-69abfebe.js');
22
22
  require('lodash/omitBy');
23
23
  require('lodash/isEmpty');
24
24
  require('store/src/store-engine');
@@ -18,7 +18,7 @@ require('./param-error.js');
18
18
  require('./does-param-exist.js');
19
19
  require('@medipass/utils/sentry');
20
20
  require('./get-axios-error.js');
21
- var request = require('../staff-853402f6.js');
21
+ var request = require('../staff-69abfebe.js');
22
22
  require('lodash/omitBy');
23
23
  require('lodash/isEmpty');
24
24
  require('store/src/store-engine');
@@ -18,7 +18,7 @@ require('./param-error.js');
18
18
  require('./does-param-exist.js');
19
19
  require('@medipass/utils/sentry');
20
20
  require('./get-axios-error.js');
21
- var request = require('../staff-853402f6.js');
21
+ var request = require('../staff-69abfebe.js');
22
22
  require('lodash/omitBy');
23
23
  require('lodash/isEmpty');
24
24
  require('store/src/store-engine');
@@ -18,7 +18,7 @@ require('./param-error.js');
18
18
  require('./does-param-exist.js');
19
19
  require('@medipass/utils/sentry');
20
20
  require('./get-axios-error.js');
21
- var request = require('../staff-853402f6.js');
21
+ var request = require('../staff-69abfebe.js');
22
22
  require('lodash/omitBy');
23
23
  require('lodash/isEmpty');
24
24
  require('store/src/store-engine');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/web-sdk",
3
- "version": "11.40.4-chore-add-new-sdk-function-and-test.0",
3
+ "version": "11.40.4-chore-add-new-sdk-function-and-test.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -59,5 +59,5 @@
59
59
  "resolutions": {
60
60
  "react-scripts/**/@typescript-eslint/eslint-plugin": "5.32.0"
61
61
  },
62
- "gitHead": "ab78f87a6098de2f40226db3b850bc60ac8e99c9"
62
+ "gitHead": "ff521199ae7945c9b0d5b3cab326c89c3a9d83d8"
63
63
  }