@medipass/web-sdk 11.70.4-feature-add-base-google-pay-logic.4 → 11.70.4

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 (92) hide show
  1. package/jest.config.js +2 -1
  2. package/lib/index.js +2 -2
  3. package/lib/resources/abr.js +2 -2
  4. package/lib/resources/accounts.js +2 -2
  5. package/lib/resources/actions.js +2 -2
  6. package/lib/resources/api-keys.js +2 -2
  7. package/lib/resources/applications.js +2 -2
  8. package/lib/resources/attachments.js +2 -2
  9. package/lib/resources/auth.js +2 -2
  10. package/lib/resources/blacklist.js +2 -2
  11. package/lib/resources/bulk-submits.js +2 -2
  12. package/lib/resources/bulk-uploads.js +2 -2
  13. package/lib/resources/business-email-log.js +2 -2
  14. package/lib/resources/business-profiles.js +2 -2
  15. package/lib/resources/businesses.js +2 -2
  16. package/lib/resources/claim-items.js +2 -2
  17. package/lib/resources/devices.js +2 -2
  18. package/lib/resources/doc-accounts.js +2 -2
  19. package/lib/resources/documents.js +2 -2
  20. package/lib/resources/emails.js +2 -2
  21. package/lib/resources/filter-options.js +2 -2
  22. package/lib/resources/form-application-templates.js +2 -2
  23. package/lib/resources/form-applications.js +2 -2
  24. package/lib/resources/forms.js +2 -2
  25. package/lib/resources/funder-services.js +2 -2
  26. package/lib/resources/funder-settings.js +2 -2
  27. package/lib/resources/funder-values.js +2 -2
  28. package/lib/resources/funders.js +2 -2
  29. package/lib/resources/futures.js +2 -2
  30. package/lib/resources/health-fund-accounts.js +2 -2
  31. package/lib/resources/health-fund-settings.js +2 -2
  32. package/lib/resources/healthfunds.js +2 -2
  33. package/lib/resources/icare.js +2 -2
  34. package/lib/resources/icditems.js +2 -2
  35. package/lib/resources/invoice-scans.js +2 -2
  36. package/lib/resources/jhcs.js +2 -2
  37. package/lib/resources/kyc.js +2 -2
  38. package/lib/resources/logs.js +2 -2
  39. package/lib/resources/members.js +2 -2
  40. package/lib/resources/message-mappings.js +2 -2
  41. package/lib/resources/minions.js +2 -2
  42. package/lib/resources/modalities.js +2 -2
  43. package/lib/resources/notes.js +2 -2
  44. package/lib/resources/onboarding-applications.js +2 -2
  45. package/lib/resources/onboarding-requests.js +2 -2
  46. package/lib/resources/ops.js +2 -2
  47. package/lib/resources/organisations.js +2 -2
  48. package/lib/resources/partners.js +2 -2
  49. package/lib/resources/patients.js +2 -2
  50. package/lib/resources/payments.d.ts +11 -5
  51. package/lib/resources/payments.js +2 -2
  52. package/lib/resources/pms.js +2 -2
  53. package/lib/resources/practice-profiles.js +2 -2
  54. package/lib/resources/practice-types.js +2 -2
  55. package/lib/resources/practices.js +2 -2
  56. package/lib/resources/products.js +2 -2
  57. package/lib/resources/professional-categories.js +2 -2
  58. package/lib/resources/provider-number-types.js +2 -2
  59. package/lib/resources/provider-registration-types.js +2 -2
  60. package/lib/resources/provider-requests.js +2 -2
  61. package/lib/resources/provider-types.js +2 -2
  62. package/lib/resources/qbe.js +2 -2
  63. package/lib/resources/ref-sources.js +2 -2
  64. package/lib/resources/risk.js +2 -2
  65. package/lib/resources/rnas.js +2 -2
  66. package/lib/resources/roles.js +2 -2
  67. package/lib/resources/self-checkout-sessions.js +2 -2
  68. package/lib/resources/services.js +2 -2
  69. package/lib/resources/settlements.js +2 -2
  70. package/lib/resources/sign-up.js +2 -2
  71. package/lib/resources/specialties.js +2 -2
  72. package/lib/resources/staff-profiles.js +2 -2
  73. package/lib/resources/staff.js +2 -2
  74. package/lib/resources/statistics.js +2 -2
  75. package/lib/resources/subscriptions.js +2 -2
  76. package/lib/resources/terminals.js +2 -2
  77. package/lib/resources/transaction-export.js +2 -2
  78. package/lib/resources/transactions.js +2 -2
  79. package/lib/resources/triggers.js +2 -2
  80. package/lib/resources/vendors.js +2 -2
  81. package/lib/resources/verify.js +2 -2
  82. package/lib/resources/workers.js +2 -2
  83. package/lib/resources/workflow-exceptions.js +2 -2
  84. package/lib/services/aws.js +2 -2
  85. package/lib/services/version.js +2 -2
  86. package/lib/{staff-e84549ac.js → staff-fc3de96a.js} +55 -204
  87. package/lib/utils/application.js +2 -2
  88. package/lib/utils/professions.js +2 -2
  89. package/lib/utils/request.js +2 -2
  90. package/lib/utils/staff.js +2 -2
  91. package/package.json +4 -4
  92. package/types/globals.d.ts +58 -0
@@ -21,7 +21,7 @@ var constants = require('@medipass/utils/constants');
21
21
  var braintreeClient = require('braintree-web/client');
22
22
  var braintreeGooglePayment = require('braintree-web/google-payment');
23
23
  var braintreeApplePay = require('braintree-web/apple-pay');
24
- var pify = require('@medipass/pify');
24
+ var pify = require('pify');
25
25
  var env = require('@medipass/utils/get-env');
26
26
  var funders$1 = require('@medipass/utils/funders');
27
27
  var utils_paramError = require('./utils/param-error.js');
@@ -10814,52 +10814,43 @@ var patients = /*#__PURE__*/Object.freeze({
10814
10814
  function ownKeys$A(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10815
10815
 
10816
10816
  function _objectSpread$A(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$A(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$A(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10817
- var PATH__PAYMENTS = '/payments'; // @ts-expect-error TS(7006): Parameter 'accountId' implicitly has an 'any' type... Remove this comment to see the full error message
10817
+ var PATH__PAYMENTS = '/payments';
10818
10818
 
10819
10819
  var pathAccountPaymentMethods = function pathAccountPaymentMethods(accountId) {
10820
10820
  return "/accounts/" + accountId + "/paymentmethods";
10821
- }; // @ts-expect-error TS(7006): Parameter 'accountId' implicitly has an 'any' type... Remove this comment to see the full error message
10822
-
10821
+ };
10823
10822
 
10824
10823
  var pathAccountPaymentMethod = function pathAccountPaymentMethod(accountId, paymentMethodId) {
10825
10824
  return "/accounts/" + accountId + "/paymentmethods/" + paymentMethodId;
10826
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10827
-
10825
+ };
10828
10826
 
10829
10827
  var pathBusinessPaymentsClientTokens = function pathBusinessPaymentsClientTokens(businessId) {
10830
10828
  return "/businesses/" + businessId + "/payments/clienttoken";
10831
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10832
-
10829
+ };
10833
10830
 
10834
10831
  var pathBusinessPaymentMethods = function pathBusinessPaymentMethods(businessId) {
10835
10832
  return "/businesses/" + businessId + "/paymentmethods";
10836
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10837
-
10833
+ };
10838
10834
 
10839
10835
  var pathBusinessPaymentMethod = function pathBusinessPaymentMethod(businessId, paymentMethodId) {
10840
10836
  return "/businesses/" + businessId + "/paymentmethods/" + paymentMethodId;
10841
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10842
-
10837
+ };
10843
10838
 
10844
10839
  var pathBusinessPatientPaymentMethods = function pathBusinessPatientPaymentMethods(businessId, patientId) {
10845
10840
  return "/businesses/" + businessId + "/patients/" + patientId + "/paymentmethods";
10846
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10847
-
10841
+ };
10848
10842
 
10849
10843
  var pathBusinessPatientPaymentMethodsByRefId = function pathBusinessPatientPaymentMethodsByRefId(businessId, refId) {
10850
10844
  return "/businesses/" + businessId + "/patients/refid/" + refId + "/paymentmethods";
10851
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10852
-
10845
+ };
10853
10846
 
10854
10847
  var pathBusinessPatientPaymentMethod = function pathBusinessPatientPaymentMethod(businessId, patientId, paymentMethodId) {
10855
10848
  return "/businesses/" + businessId + "/patients/" + patientId + "/paymentmethods/" + paymentMethodId;
10856
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10857
-
10849
+ };
10858
10850
 
10859
10851
  var pathBusinessSalesClientToken = function pathBusinessSalesClientToken(businessId) {
10860
10852
  return "/businesses/" + businessId + "/sales/clienttoken";
10861
- }; // @ts-expect-error TS(7006): Parameter 'businessId' implicitly has an 'any' typ... Remove this comment to see the full error message
10862
-
10853
+ };
10863
10854
 
10864
10855
  var pathBusinessPaymentClientToken = function pathBusinessPaymentClientToken(businessId, patientId) {
10865
10856
  return "/businesses/" + businessId + "/patients/" + patientId + "/sales/clienttoken";
@@ -11398,6 +11389,7 @@ var getBusinessPatientPaymentMethod = /*#__PURE__*/function () {
11398
11389
  return _ref13.apply(this, arguments);
11399
11390
  };
11400
11391
  }();
11392
+
11401
11393
  /**
11402
11394
  * Get business client token
11403
11395
  * @param {String} businessId - Business ID
@@ -11405,7 +11397,6 @@ var getBusinessPatientPaymentMethod = /*#__PURE__*/function () {
11405
11397
  * @param {Object} opts - Additional options
11406
11398
  * @returns {Object} The device data
11407
11399
  */
11408
-
11409
11400
  var getBusinessClientToken = /*#__PURE__*/function () {
11410
11401
  var _ref14 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee14(businessId, source, opts) {
11411
11402
  return _regeneratorRuntime__default["default"].wrap(function _callee14$(_context14) {
@@ -11706,7 +11697,7 @@ var getPaymentGatewayError = function getPaymentGatewayError(sessionResponse) {
11706
11697
 
11707
11698
  var getNonce = /*#__PURE__*/function () {
11708
11699
  var _ref22 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee21(_ref21, opts) {
11709
- var amount, businessId, patientId, _cardNumber, expiry, cvc, _ref21$paymentProvide, paymentProvider, _ref21$isSales, isSales, _ref21$isSelfCheckout, isSelfCheckoutSession, _ref21$source, source, cardNumber, cardExpiryMonth, cardExpiryYear, cardSecurityCode, clientToken, _window, _window$google, _window$google$paymen, paymentSession, updateSessionResponse, error, paymentsClient, tokenizationSpecification, baseCardPaymentMethod, cardPaymentMethod, response, paymentDataRequest, paymentData, googlePaySessionResponse, clientInstance, sourceResponse, _paymentsClient, googlePaymentInstance, _response, _paymentDataRequest, _cardPaymentMethod, _paymentData, applePayInstance, paymentRequest, canMakeApplePayment;
11700
+ var amount, businessId, patientId, _cardNumber, expiry, cvc, _ref21$paymentProvide, paymentProvider, _ref21$isSales, isSales, _ref21$isSelfCheckout, isSelfCheckoutSession, _ref21$source, source, cardNumber, cardExpiryMonth, cardExpiryYear, cardSecurityCode, clientToken, _window, _window$google, _window$google$paymen, paymentSession, updateSessionResponse, error, clientInstance, sourceResponse, _sourceResponse, _sourceResponse$credi, _sourceResponse$credi2, paymentsClient, googlePaymentInstance, response, paymentDataRequest, cardPaymentMethod, paymentData, applePayInstance, paymentRequest, canMakeApplePayment;
11710
11701
 
11711
11702
  return _regeneratorRuntime__default["default"].wrap(function _callee21$(_context21) {
11712
11703
  while (1) {
@@ -11781,11 +11772,10 @@ var getNonce = /*#__PURE__*/function () {
11781
11772
  if (!clientToken.source) clientToken.source = source;
11782
11773
 
11783
11774
  if (!(clientToken.source === 'mastercard')) {
11784
- _context21.next = 67;
11775
+ _context21.next = 45;
11785
11776
  break;
11786
11777
  }
11787
11778
 
11788
- // @ts-expect-error TS(2304): Cannot find name 'HostedForm'.
11789
11779
  paymentSession = HostedForm;
11790
11780
 
11791
11781
  if (paymentSession) {
@@ -11836,169 +11826,33 @@ var getNonce = /*#__PURE__*/function () {
11836
11826
  }));
11837
11827
 
11838
11828
  case 42:
11839
- if (!(paymentProvider === constants.PAYMENT_PROVIDERS.GOOGLE_PAY && amount && (_window = window) != null && (_window$google = _window.google) != null && (_window$google$paymen = _window$google.payments) != null && _window$google$paymen.api)) {
11840
- _context21.next = 62;
11841
- break;
11842
- }
11843
-
11844
- paymentsClient = new window.google.payments.api.PaymentsClient({
11845
- environment: env__default["default"].ENV_NAME === 'prod' || env__default["default"].ENV_NAME === 'pre-prod' ? 'PRODUCTION' : 'TEST'
11846
- });
11847
- /*
11848
- TODO:
11849
- ERROR: OR_BIBED_06 Unknown gateway
11850
- The gateway property value you specified in tokenizationSpecification isn't currently supported by the Google
11851
- Probably have to wait till backend is ready to support this
11852
- */
11853
- // const tokenizationSpecification = {
11854
- // type: 'PAYMENT_GATEWAY',
11855
- // parameters: {
11856
- // gateway: 'mpgs',
11857
- // gatewayMerchantId: env.GOOGLE_MERCHANT_ID
11858
- // }
11859
- // };
11860
-
11861
- tokenizationSpecification = {
11862
- type: 'PAYMENT_GATEWAY',
11863
- parameters: {
11864
- gateway: 'example',
11865
- gatewayMerchantId: 'exampleGatewayMerchantId'
11866
- }
11867
- };
11868
- baseCardPaymentMethod = {
11869
- type: 'CARD',
11870
- parameters: {
11871
- allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
11872
- allowedCardNetworks: ['VISA', 'MASTERCARD', 'AMEX', 'DISCOVER'],
11873
- billingAddressRequired: false
11874
- }
11875
- };
11876
- cardPaymentMethod = Object.assign({
11877
- tokenizationSpecification: tokenizationSpecification
11878
- }, baseCardPaymentMethod);
11879
- _context21.next = 49;
11880
- return paymentsClient.isReadyToPay({
11881
- apiVersion: 2,
11882
- apiVersionMinor: 0,
11883
- allowedPaymentMethods: [baseCardPaymentMethod]
11884
- });
11885
-
11886
- case 49:
11887
- response = _context21.sent;
11888
-
11889
- if (!response.result) {
11890
- _context21.next = 62;
11891
- break;
11892
- }
11893
-
11894
- console.log('JOSH: NEW response', response);
11895
- paymentDataRequest = {
11896
- apiVersion: 2,
11897
- apiVersionMinor: 0,
11898
- allowedPaymentMethods: [cardPaymentMethod],
11899
- transactionInfo: {
11900
- currencyCode: 'AUD',
11901
- totalPriceStatus: 'FINAL',
11902
- totalPrice: amount.replace('$', '')
11903
- },
11904
- merchantInfo: {
11905
- merchantName: 'Tyro Health',
11906
- merchantId: env__default["default"].GOOGLE_MERCHANT_ID
11907
- }
11908
- };
11909
- _context21.next = 55;
11910
- return paymentsClient.loadPaymentData(paymentDataRequest);
11911
-
11912
- case 55:
11913
- paymentData = _context21.sent;
11914
- console.log('JOSH: NEW loadPaymentData', paymentData);
11915
- _context21.next = 59;
11916
- return pify__default["default"](paymentSession.updateSession, {
11917
- errorFirst: false
11918
- })(clientToken.clientToken, {
11919
- order: {
11920
- walletProvider: 'GOOGLE_PAY',
11921
- amount: amount,
11922
- currency: 'AUD',
11923
- sourceOfFunds: {
11924
- provided: {
11925
- card: {
11926
- devicePayment: {
11927
- paymentToken: paymentData.paymentMethodData.tokenizationData.token
11928
- }
11929
- }
11930
- },
11931
- transaction: {
11932
- source: 'INTERNET'
11933
- }
11934
- }
11935
- }
11936
- });
11937
-
11938
- case 59:
11939
- googlePaySessionResponse = _context21.sent;
11940
- console.log('JOSH: NEW googlePaySessionResponse', googlePaySessionResponse);
11941
- return _context21.abrupt("return", _objectSpread$A({}, clientToken, {
11942
- nonce: paymentData.paymentMethodData.tokenizationData.token,
11943
- sourceResponse: paymentData
11944
- }));
11829
+ if (paymentProvider === constants.PAYMENT_PROVIDERS.GOOGLE_PAY && amount && (_window = window) != null && (_window$google = _window.google) != null && (_window$google$paymen = _window$google.payments) != null && _window$google$paymen.api) ;
11945
11830
 
11946
- case 62:
11947
- if (!(paymentProvider === constants.PAYMENT_PROVIDERS.APPLE_PAY)) {
11948
- _context21.next = 66;
11949
- break;
11950
- }
11831
+ if (paymentProvider === constants.PAYMENT_PROVIDERS.APPLE_PAY) ;
11951
11832
 
11952
- _context21.next = 65;
11953
- return pify__default["default"](paymentSession.updateSession, {
11954
- errorFirst: false
11955
- })(clientToken.clientToken, {
11956
- order: {
11957
- walletProvider: 'APPLE_PAY',
11958
- amount: amount,
11959
- currency: 'AUD',
11960
- sourceOfFunds: {
11961
- provided: {
11962
- card: {
11963
- devicePayment: {
11964
- paymentToken: 'The encrypted payment token obtained from the Apple Pay SDK'
11965
- }
11966
- }
11967
- },
11968
- transaction: {
11969
- source: 'INTERNET'
11970
- }
11971
- }
11972
- }
11973
- });
11974
-
11975
- case 65:
11976
- _context21.sent;
11977
-
11978
- case 66:
11979
11833
  return _context21.abrupt("return", clientToken);
11980
11834
 
11981
- case 67:
11835
+ case 45:
11982
11836
  if (!(clientToken.source === 'braintree')) {
11983
- _context21.next = 108;
11837
+ _context21.next = 83;
11984
11838
  break;
11985
11839
  }
11986
11840
 
11987
- _context21.next = 70;
11841
+ _context21.next = 48;
11988
11842
  return braintreeClient__default["default"].create({
11989
11843
  authorization: clientToken.clientToken
11990
11844
  });
11991
11845
 
11992
- case 70:
11846
+ case 48:
11993
11847
  clientInstance = _context21.sent;
11994
11848
  sourceResponse = {};
11995
11849
 
11996
11850
  if (!(paymentProvider === constants.PAYMENT_PROVIDERS.PAYMENT_CARD)) {
11997
- _context21.next = 77;
11851
+ _context21.next = 55;
11998
11852
  break;
11999
11853
  }
12000
11854
 
12001
- _context21.next = 75;
11855
+ _context21.next = 53;
12002
11856
  return clientInstance.request({
12003
11857
  endpoint: 'payment_methods/credit_cards',
12004
11858
  method: 'post',
@@ -12014,85 +11868,82 @@ var getNonce = /*#__PURE__*/function () {
12014
11868
  }
12015
11869
  });
12016
11870
 
12017
- case 75:
11871
+ case 53:
12018
11872
  sourceResponse = _context21.sent;
12019
11873
  return _context21.abrupt("return", _objectSpread$A({}, clientToken, {
12020
- nonce: _get__default["default"](sourceResponse, 'creditCards[0].nonce'),
11874
+ nonce: (_sourceResponse = sourceResponse) == null ? void 0 : (_sourceResponse$credi = _sourceResponse.creditCards) == null ? void 0 : (_sourceResponse$credi2 = _sourceResponse$credi[0]) == null ? void 0 : _sourceResponse$credi2.nonce,
12021
11875
  sourceResponse: sourceResponse
12022
11876
  }));
12023
11877
 
12024
- case 77:
11878
+ case 55:
12025
11879
  if (!(paymentProvider === constants.PAYMENT_PROVIDERS.GOOGLE_PAY && amount && _get__default["default"](window, 'google.payments.api'))) {
12026
- _context21.next = 99;
11880
+ _context21.next = 74;
12027
11881
  break;
12028
11882
  }
12029
11883
 
12030
- _paymentsClient = new window.google.payments.api.PaymentsClient({
11884
+ paymentsClient = new window.google.payments.api.PaymentsClient({
12031
11885
  environment: env__default["default"].ENV_NAME === 'prod' || env__default["default"].ENV_NAME === 'pre-prod' ? 'PRODUCTION' : 'TEST'
12032
11886
  });
12033
- _context21.next = 81;
11887
+ _context21.next = 59;
12034
11888
  return braintreeGooglePayment__default["default"].create({
12035
11889
  client: clientInstance,
12036
11890
  googlePayVersion: 2,
12037
11891
  googleMerchantId: env__default["default"].GOOGLE_MERCHANT_ID
12038
11892
  });
12039
11893
 
12040
- case 81:
11894
+ case 59:
12041
11895
  googlePaymentInstance = _context21.sent;
12042
- _context21.next = 84;
12043
- return _paymentsClient.isReadyToPay({
11896
+ _context21.next = 62;
11897
+ return paymentsClient.isReadyToPay({
12044
11898
  apiVersion: 2,
12045
11899
  apiVersionMinor: 0,
12046
11900
  allowedPaymentMethods: googlePaymentInstance.createPaymentDataRequest().allowedPaymentMethods
12047
11901
  });
12048
11902
 
12049
- case 84:
12050
- _response = _context21.sent;
11903
+ case 62:
11904
+ response = _context21.sent;
12051
11905
 
12052
- if (!_response.result) {
12053
- _context21.next = 99;
11906
+ if (!response.result) {
11907
+ _context21.next = 74;
12054
11908
  break;
12055
11909
  }
12056
11910
 
12057
- console.log('JOSH OLD CODE: RESPONSE', _response);
12058
- _paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
11911
+ paymentDataRequest = googlePaymentInstance.createPaymentDataRequest({
12059
11912
  transactionInfo: {
12060
11913
  currencyCode: 'AUD',
12061
11914
  totalPriceStatus: 'FINAL',
12062
11915
  totalPrice: amount.replace('$', '')
12063
11916
  }
12064
11917
  });
12065
- _cardPaymentMethod = _paymentDataRequest.allowedPaymentMethods[0];
12066
- console.log('JOSH OLD CODE: cardPaymentMethod', _cardPaymentMethod);
12067
- _cardPaymentMethod.parameters.billingAddressRequired = false;
12068
- _context21.next = 93;
12069
- return _paymentsClient.loadPaymentData(_paymentDataRequest);
12070
-
12071
- case 93:
12072
- _paymentData = _context21.sent;
12073
- console.log('JOSH OLD CODE: paymentData', _paymentData);
12074
- _context21.next = 97;
12075
- return googlePaymentInstance.parseResponse(_paymentData);
12076
-
12077
- case 97:
11918
+ cardPaymentMethod = paymentDataRequest.allowedPaymentMethods[0];
11919
+ cardPaymentMethod.parameters.billingAddressRequired = false;
11920
+ _context21.next = 69;
11921
+ return paymentsClient.loadPaymentData(paymentDataRequest);
11922
+
11923
+ case 69:
11924
+ paymentData = _context21.sent;
11925
+ _context21.next = 72;
11926
+ return googlePaymentInstance.parseResponse(paymentData);
11927
+
11928
+ case 72:
12078
11929
  sourceResponse = _context21.sent;
12079
11930
  return _context21.abrupt("return", _objectSpread$A({}, clientToken, {
12080
11931
  nonce: sourceResponse.nonce,
12081
11932
  sourceResponse: sourceResponse
12082
11933
  }));
12083
11934
 
12084
- case 99:
11935
+ case 74:
12085
11936
  if (!(paymentProvider === constants.PAYMENT_PROVIDERS.APPLE_PAY)) {
12086
- _context21.next = 108;
11937
+ _context21.next = 83;
12087
11938
  break;
12088
11939
  }
12089
11940
 
12090
- _context21.next = 102;
11941
+ _context21.next = 77;
12091
11942
  return braintreeApplePay__default["default"].create({
12092
11943
  client: clientInstance
12093
11944
  });
12094
11945
 
12095
- case 102:
11946
+ case 77:
12096
11947
  applePayInstance = _context21.sent;
12097
11948
  paymentRequest = applePayInstance.createPaymentRequest({
12098
11949
  total: {
@@ -12100,10 +11951,10 @@ var getNonce = /*#__PURE__*/function () {
12100
11951
  amount: amount == null ? void 0 : amount.replace('$', '')
12101
11952
  }
12102
11953
  });
12103
- _context21.next = 106;
11954
+ _context21.next = 81;
12104
11955
  return window.ApplePaySession.canMakePaymentsWithActiveCard(applePayInstance.merchantIdentifier);
12105
11956
 
12106
- case 106:
11957
+ case 81:
12107
11958
  canMakeApplePayment = _context21.sent;
12108
11959
  return _context21.abrupt("return", _objectSpread$A({}, clientToken, {
12109
11960
  applePayInstance: applePayInstance,
@@ -12111,10 +11962,10 @@ var getNonce = /*#__PURE__*/function () {
12111
11962
  paymentRequest: paymentRequest
12112
11963
  }));
12113
11964
 
12114
- case 108:
11965
+ case 83:
12115
11966
  return _context21.abrupt("return", clientToken);
12116
11967
 
12117
- case 109:
11968
+ case 84:
12118
11969
  case "end":
12119
11970
  return _context21.stop();
12120
11971
  }
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('@babel/runtime/helpers/asyncToGenerator');
6
6
  require('@babel/runtime/regenerator');
7
- var utils_request = require('../staff-e84549ac.js');
7
+ var utils_request = require('../staff-fc3de96a.js');
8
8
  require('@babel/runtime/helpers/defineProperty');
9
9
  require('lodash/merge');
10
10
  require('lodash/uniq');
@@ -32,7 +32,7 @@ require('@medipass/utils/constants');
32
32
  require('braintree-web/client');
33
33
  require('braintree-web/google-payment');
34
34
  require('braintree-web/apple-pay');
35
- require('@medipass/pify');
35
+ require('pify');
36
36
  require('@medipass/utils/get-env');
37
37
  require('@medipass/utils/funders');
38
38
  require('compare-versions');
@@ -7,7 +7,7 @@ require('@babel/runtime/helpers/asyncToGenerator');
7
7
  require('@babel/runtime/regenerator');
8
8
  require('lodash/uniq');
9
9
  require('lodash/flatten');
10
- var utils_request = require('../staff-e84549ac.js');
10
+ var utils_request = require('../staff-fc3de96a.js');
11
11
  require('lodash/merge');
12
12
  require('axios');
13
13
  require('date-fns/differenceInSeconds');
@@ -33,7 +33,7 @@ require('@medipass/utils/constants');
33
33
  require('braintree-web/client');
34
34
  require('braintree-web/google-payment');
35
35
  require('braintree-web/apple-pay');
36
- require('@medipass/pify');
36
+ require('pify');
37
37
  require('@medipass/utils/get-env');
38
38
  require('@medipass/utils/funders');
39
39
  require('compare-versions');
@@ -7,7 +7,7 @@ require('@babel/runtime/helpers/defineProperty');
7
7
  require('@babel/runtime/regenerator');
8
8
  require('@medipass/utils/sentry');
9
9
  require('lodash/get');
10
- var utils_request = require('../staff-e84549ac.js');
10
+ var utils_request = require('../staff-fc3de96a.js');
11
11
  require('./get-axios-error.js');
12
12
  require('lodash/merge');
13
13
  require('lodash/uniq');
@@ -32,7 +32,7 @@ require('@medipass/utils/constants');
32
32
  require('braintree-web/client');
33
33
  require('braintree-web/google-payment');
34
34
  require('braintree-web/apple-pay');
35
- require('@medipass/pify');
35
+ require('pify');
36
36
  require('@medipass/utils/get-env');
37
37
  require('@medipass/utils/funders');
38
38
  require('compare-versions');
@@ -7,7 +7,7 @@ require('@babel/runtime/helpers/asyncToGenerator');
7
7
  require('@babel/runtime/regenerator');
8
8
  require('lodash/merge');
9
9
  require('lodash/uniq');
10
- var utils_request = require('../staff-e84549ac.js');
10
+ var utils_request = require('../staff-fc3de96a.js');
11
11
  require('axios');
12
12
  require('date-fns/differenceInSeconds');
13
13
  require('jwt-decode');
@@ -32,7 +32,7 @@ require('@medipass/utils/constants');
32
32
  require('braintree-web/client');
33
33
  require('braintree-web/google-payment');
34
34
  require('braintree-web/apple-pay');
35
- require('@medipass/pify');
35
+ require('pify');
36
36
  require('@medipass/utils/get-env');
37
37
  require('@medipass/utils/funders');
38
38
  require('compare-versions');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medipass/web-sdk",
3
- "version": "11.70.4-feature-add-base-google-pay-logic.4",
3
+ "version": "11.70.4",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -32,19 +32,19 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@babel/runtime": "7.8.4",
35
- "@medipass/pify": "3.0.0-3",
36
35
  "axios": "0.21.1",
37
36
  "braintree-web": "3.58.0",
38
37
  "compare-versions": "3.4.0",
39
38
  "date-fns": "2.16.1",
40
39
  "jwt-decode": "2.2.0",
41
40
  "lodash": "4.17.21",
41
+ "pify": "6.1.0",
42
42
  "platform": "1.3.5",
43
43
  "store": "2.0.12"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@babel/plugin-transform-runtime": "7.8.3",
47
- "@medipass/utils": "^11.84.7",
47
+ "@medipass/utils": "^11.84.8",
48
48
  "@types/applepayjs": "14.0.8",
49
49
  "@types/googlepay": "0.7.6",
50
50
  "@types/jest": "28.1.6",
@@ -58,5 +58,5 @@
58
58
  "resolutions": {
59
59
  "react-scripts/**/@typescript-eslint/eslint-plugin": "5.32.0"
60
60
  },
61
- "gitHead": "b23e602cb93c17e71c6f1aa685e0265818c801d9"
61
+ "gitHead": "efa4f79b05115a1173f22f7e3a24613de1b850be"
62
62
  }
@@ -5,6 +5,64 @@ declare global {
5
5
  google: typeof google;
6
6
  ApplePaySession: typeof ApplePaySession;
7
7
  }
8
+
9
+ // HostedForm comes from the HPF script we load. API reference is here: https://network.gateway.mastercard.com/api/documentation/apiDocumentation/session/version/74/hs-function/api/documentation/integrationGuidelines/hostedPaymentForm/HPFJS/paymentFormFieldsReference.html?locale=en_US
10
+ interface SessionDetails {
11
+ cardNumber?: string;
12
+ cardSecurityCode?: string;
13
+ cardExpiryMonth: string;
14
+ cardExpiryYear: string;
15
+ }
16
+
17
+ type FieldInErrorValue = 'invalid' | 'missing';
18
+ interface CreateUpdateSessionResponse {
19
+ status: string;
20
+ session: string;
21
+ cardBrand: string;
22
+ cardScheme: string;
23
+ cardFundingMethod: string;
24
+ cardLocalBrand: string;
25
+ fieldsInError: {
26
+ cardNumber: FieldInErrorValue;
27
+ cardSecurityCode: FieldInErrorValue;
28
+ cardExpiryMonth: FieldInErrorValue;
29
+ cardExpiryYear: FieldInErrorValue;
30
+ };
31
+ }
32
+ interface HostedForm {
33
+ callback(): void;
34
+ createSession(
35
+ sessionDetails: SessionDetails,
36
+ createSessionCallback: (createSessionResponse: CreateUpdateSessionResponse) => void
37
+ ): void;
38
+ setMerchant(merchantId: string): void;
39
+ showVisaCheckout(
40
+ sessionId?: string,
41
+ options: {
42
+ acceptedCards: 'MASTERCARD' | 'AMEX' | 'DISCOVER' | 'VISA';
43
+ paymentConfirmation: 'CONFIRM_AT_PROVIDER' | 'CONFIRM_AT_MERCHANT';
44
+ paymentConfirmationMessage: string;
45
+ merchant: {
46
+ logo: URL;
47
+ displayName: string;
48
+ };
49
+ locale: string;
50
+ country: 'AUS';
51
+ order: {
52
+ amount: number;
53
+ currency: 'AUD';
54
+ };
55
+ },
56
+ callback: () => void
57
+ ): void;
58
+ updateSession(
59
+ sessionId: string,
60
+ sessionDetails: SessionDetails,
61
+ updateSessionCallback: (updateSessionResponse: CreateUpdateSessionResponse) => void
62
+ ): void;
63
+ }
64
+
65
+ const HostedForm: HostedForm;
8
66
  }
9
67
 
10
68
  export {};