authscape 1.0.288 → 1.0.291

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.
package/index.js CHANGED
@@ -460,7 +460,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
460
460
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
461
461
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
462
462
  // remove before merging back
463
- //import { FileUploader, apiService, NextImage } from 'authscape';
463
+ // import { FileUploader, apiService, NextImage } from 'authscape';
464
464
 
465
465
  var DocumentManager = function DocumentManager(_ref) {
466
466
  var loadedUser = _ref.loadedUser,
@@ -932,7 +932,7 @@ var DocumentManager = function DocumentManager(_ref) {
932
932
  fontSize: 11
933
933
  }
934
934
  }, file.lastUpdated)));
935
- })), files != null && files.documentAndFiles != null && zeroStateView != null && /*#__PURE__*/_react["default"].createElement(_material.Box, null, zeroStateView(segment)));
935
+ })), files != null && files.documentAndFiles != null && zeroStateView != null && /*#__PURE__*/_react["default"].createElement(_material.Box, null, zeroStateView(segment, files.documentAndFiles)));
936
936
  })), (files.documentSegments.length == 0 || folderParent != null) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
937
937
  container: true,
938
938
  spacing: 2
@@ -2826,22 +2826,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2826
2826
  Object.defineProperty(exports, "__esModule", {
2827
2827
  value: true
2828
2828
  });
2829
- exports.StripePayment = void 0;
2829
+ exports["default"] = StripePayment;
2830
2830
  var _react = _interopRequireWildcard(require("react"));
2831
2831
  var _reactStripeJs = require("@stripe/react-stripe-js");
2832
2832
  var _stripeJs = require("@stripe/stripe-js");
2833
- var _Box = _interopRequireDefault(require("@mui/material/Box"));
2834
- var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
2835
- var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
2836
- var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
2837
- var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
2838
- var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
2839
- var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
2840
- var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
2841
- var _Select = _interopRequireDefault(require("@mui/material/Select"));
2842
- var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
2843
- var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
2844
2833
  var _PaymentRounded = _interopRequireDefault(require("@mui/icons-material/PaymentRounded"));
2834
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
2835
+ var _material = require("@mui/material");
2845
2836
  var _excluded = ["children", "value", "index"];
2846
2837
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
2847
2838
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -2861,6 +2852,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
2861
2852
  var CheckoutForm = function CheckoutForm(_ref) {
2862
2853
  var payButtonText = _ref.payButtonText,
2863
2854
  clientSecret = _ref.clientSecret,
2855
+ currentUser = _ref.currentUser,
2856
+ paymentMethodType = _ref.paymentMethodType,
2857
+ walletId = _ref.walletId,
2864
2858
  onResponse = _ref.onResponse,
2865
2859
  amount = _ref.amount;
2866
2860
  var _useState = (0, _react.useState)(false),
@@ -2875,7 +2869,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2875
2869
  setErrorMessage = _useState4[1];
2876
2870
  var handleSubmit = /*#__PURE__*/function () {
2877
2871
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
2878
- var _yield$stripe$confirm, error, response, setupIntent, _yield$stripe$confirm2, _error, _response, paymentIntent;
2872
+ var _yield$stripe$confirm, error, response, setupIntent, addPaymentMethodResponse, _response, _yield$stripe$confirm2, _error, _response2, paymentIntent;
2879
2873
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2880
2874
  while (1) switch (_context.prev = _context.next) {
2881
2875
  case 0:
@@ -2890,8 +2884,8 @@ var CheckoutForm = function CheckoutForm(_ref) {
2890
2884
  }
2891
2885
  return _context.abrupt("return");
2892
2886
  case 4:
2893
- if (!(amount == null)) {
2894
- _context.next = 35;
2887
+ if (!(amount == null || currentUser != null)) {
2888
+ _context.next = 47;
2895
2889
  break;
2896
2890
  }
2897
2891
  _context.next = 7;
@@ -2915,7 +2909,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
2915
2909
  // details incomplete)
2916
2910
  setIsPaymentProcessing(false);
2917
2911
  setErrorMessage(error.message);
2918
- _context.next = 33;
2912
+ _context.next = 45;
2919
2913
  break;
2920
2914
  case 14:
2921
2915
  // Your customer will be redirected to your `return_url`. For some payment
@@ -2929,29 +2923,63 @@ var CheckoutForm = function CheckoutForm(_ref) {
2929
2923
  response = _context.sent;
2930
2924
  setupIntent = response.setupIntent;
2931
2925
  _context.t0 = setupIntent.status;
2932
- _context.next = _context.t0 === 'succeeded' ? 22 : _context.t0 === 'processing' ? 24 : _context.t0 === 'requires_payment_method' ? 27 : 30;
2926
+ _context.next = _context.t0 === 'succeeded' ? 22 : _context.t0 === 'processing' ? 36 : _context.t0 === 'requires_payment_method' ? 39 : 42;
2933
2927
  break;
2934
2928
  case 22:
2935
- // need to store the payment intent with the customer if they are logged in... currentUser
2936
- onResponse("succeeded", setupIntent.id, setupIntent.payment_method);
2937
- return _context.abrupt("break", 33);
2929
+ _context.next = 24;
2930
+ return apiService().post("/Payment/AddPaymentMethod", {
2931
+ walletId: walletId,
2932
+ paymentMethodType: paymentMethodType,
2933
+ stripePaymentMethod: setupIntent.payment_method
2934
+ });
2938
2935
  case 24:
2936
+ addPaymentMethodResponse = _context.sent;
2937
+ if (!(addPaymentMethodResponse != null && addPaymentMethodResponse.status == 200)) {
2938
+ _context.next = 34;
2939
+ break;
2940
+ }
2941
+ onResponse("succeeded", setupIntent.id, setupIntent.payment_method);
2942
+ if (!(amount != null)) {
2943
+ _context.next = 32;
2944
+ break;
2945
+ }
2946
+ _context.next = 30;
2947
+ return apiService().post("/Payment/Charge", {
2948
+ paymentMethodType: paymentMethodType,
2949
+ walletPaymentMethodId: addPaymentMethodResponse.data,
2950
+ amount: amount
2951
+ });
2952
+ case 30:
2953
+ _response = _context.sent;
2954
+ if (_response != null && _response.status == 200) {
2955
+ onResponse("paid", _response.data.stripePaymentIntentId);
2956
+ } else {
2957
+ onResponse("failed", null);
2958
+ }
2959
+ case 32:
2960
+ _context.next = 35;
2961
+ break;
2962
+ case 34:
2963
+ onResponse("failed", null);
2964
+ case 35:
2965
+ return _context.abrupt("break", 45);
2966
+ case 36:
2939
2967
  onResponse("processing", setupIntent.id, setupIntent.payment_method);
2940
2968
  setIsPaymentProcessing(false);
2941
- return _context.abrupt("break", 33);
2942
- case 27:
2969
+ return _context.abrupt("break", 45);
2970
+ case 39:
2943
2971
  onResponse("requires_payment_method", null);
2944
2972
  setIsPaymentProcessing(false);
2945
- return _context.abrupt("break", 33);
2946
- case 30:
2973
+ return _context.abrupt("break", 45);
2974
+ case 42:
2947
2975
  onResponse("failed", null);
2948
2976
  setIsPaymentProcessing(false);
2949
- return _context.abrupt("break", 33);
2950
- case 33:
2951
- _context.next = 69;
2977
+ return _context.abrupt("break", 45);
2978
+ case 45:
2979
+ _context.next = 81;
2952
2980
  break;
2953
- case 35:
2954
- _context.next = 37;
2981
+ case 47:
2982
+ _context.next = 49;
2955
2983
  return stripe.confirmPayment({
2956
2984
  //`Elements` instance that was used to create the Payment Element
2957
2985
  elements: elements,
@@ -2960,11 +2988,11 @@ var CheckoutForm = function CheckoutForm(_ref) {
2960
2988
  return_url: process.env.websiteBaseUri + '/confirmPayment?redirectUrl=' + encodeURIComponent(window.location.search)
2961
2989
  }
2962
2990
  });
2963
- case 37:
2991
+ case 49:
2964
2992
  _yield$stripe$confirm2 = _context.sent;
2965
2993
  _error = _yield$stripe$confirm2.error;
2966
2994
  if (!_error) {
2967
- _context.next = 44;
2995
+ _context.next = 56;
2968
2996
  break;
2969
2997
  }
2970
2998
  // This point will only be reached if there is an immediate error when
@@ -2972,50 +3000,50 @@ var CheckoutForm = function CheckoutForm(_ref) {
2972
3000
  // details incomplete)
2973
3001
  setIsPaymentProcessing(false);
2974
3002
  setErrorMessage(_error.message);
2975
- _context.next = 69;
3003
+ _context.next = 81;
2976
3004
  break;
2977
- case 44:
3005
+ case 56:
2978
3006
  // Your customer will be redirected to your `return_url`. For some payment
2979
3007
  // methods like iDEAL, your customer will be redirected to an intermediate
2980
3008
  // site first to authorize the payment, then redirected to the `return_url`.
2981
- _response = null;
3009
+ _response2 = null;
2982
3010
  if (!(amount == null)) {
2983
- _context.next = 51;
3011
+ _context.next = 63;
2984
3012
  break;
2985
3013
  }
2986
- _context.next = 48;
3014
+ _context.next = 60;
2987
3015
  return stripe.retrieveSetupIntent(clientSecret);
2988
- case 48:
2989
- _response = _context.sent;
2990
- _context.next = 54;
3016
+ case 60:
3017
+ _response2 = _context.sent;
3018
+ _context.next = 66;
2991
3019
  break;
2992
- case 51:
2993
- _context.next = 53;
3020
+ case 63:
3021
+ _context.next = 65;
2994
3022
  return stripe.retrievePaymentIntent(clientSecret);
2995
- case 53:
2996
- _response = _context.sent;
2997
- case 54:
2998
- paymentIntent = _response.paymentIntent;
3023
+ case 65:
3024
+ _response2 = _context.sent;
3025
+ case 66:
3026
+ paymentIntent = _response2.paymentIntent;
2999
3027
  _context.t1 = paymentIntent.status;
3000
- _context.next = _context.t1 === 'succeeded' ? 58 : _context.t1 === 'processing' ? 60 : _context.t1 === 'requires_payment_method' ? 63 : 66;
3028
+ _context.next = _context.t1 === 'succeeded' ? 70 : _context.t1 === 'processing' ? 72 : _context.t1 === 'requires_payment_method' ? 75 : 78;
3001
3029
  break;
3002
- case 58:
3030
+ case 70:
3003
3031
  // need to store the payment intent with the customer if they are logged in... currentUser
3004
3032
  onResponse("succeeded", paymentIntent.id);
3005
- return _context.abrupt("break", 69);
3006
- case 60:
3033
+ return _context.abrupt("break", 81);
3034
+ case 72:
3007
3035
  onResponse("processing", paymentIntent.id);
3008
3036
  setIsPaymentProcessing(false);
3009
- return _context.abrupt("break", 69);
3010
- case 63:
3037
+ return _context.abrupt("break", 81);
3038
+ case 75:
3011
3039
  onResponse("requires_payment_method", null);
3012
3040
  setIsPaymentProcessing(false);
3013
- return _context.abrupt("break", 69);
3014
- case 66:
3041
+ return _context.abrupt("break", 81);
3042
+ case 78:
3015
3043
  onResponse("failed", null);
3016
3044
  setIsPaymentProcessing(false);
3017
- return _context.abrupt("break", 69);
3018
- case 69:
3045
+ return _context.abrupt("break", 81);
3046
+ case 81:
3019
3047
  case "end":
3020
3048
  return _context.stop();
3021
3049
  }
@@ -3027,7 +3055,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
3027
3055
  }();
3028
3056
  return /*#__PURE__*/_react["default"].createElement("form", {
3029
3057
  onSubmit: handleSubmit
3030
- }, /*#__PURE__*/_react["default"].createElement(_reactStripeJs.PaymentElement, null), /*#__PURE__*/_react["default"].createElement(Button, {
3058
+ }, /*#__PURE__*/_react["default"].createElement(_reactStripeJs.PaymentElement, null), /*#__PURE__*/_react["default"].createElement(_material.Button, {
3031
3059
  startIcon: /*#__PURE__*/_react["default"].createElement(_PaymentRounded["default"], null),
3032
3060
  type: "submit",
3033
3061
  fullWidth: true,
@@ -3037,28 +3065,49 @@ var CheckoutForm = function CheckoutForm(_ref) {
3037
3065
  marginTop: 2,
3038
3066
  padding: 2
3039
3067
  }
3040
- }, payButtonText), errorMessage && /*#__PURE__*/_react["default"].createElement("div", null, errorMessage));
3068
+ }, payButtonText != null ? payButtonText : amount != null ? "Pay Now" : "Add Payment Method"), errorMessage && /*#__PURE__*/_react["default"].createElement("div", null, errorMessage));
3041
3069
  };
3042
- var StripePayment = function StripePayment() {
3070
+ function StripePayment(_ref3) {
3071
+ var loadedUser = _ref3.loadedUser,
3072
+ _ref3$amount = _ref3.amount,
3073
+ amount = _ref3$amount === void 0 ? null : _ref3$amount,
3074
+ _ref3$priceId = _ref3.priceId,
3075
+ priceId = _ref3$priceId === void 0 ? null : _ref3$priceId,
3076
+ _ref3$stripeCustomerI = _ref3.stripeCustomerId,
3077
+ stripeCustomerId = _ref3$stripeCustomerI === void 0 ? null : _ref3$stripeCustomerI,
3078
+ logOffUserName = _ref3.logOffUserName,
3079
+ _ref3$invoiceId = _ref3.invoiceId,
3080
+ invoiceId = _ref3$invoiceId === void 0 ? null : _ref3$invoiceId,
3081
+ logOffEmail = _ref3.logOffEmail,
3082
+ _ref3$paymentMethodTy = _ref3.paymentMethodType,
3083
+ paymentMethodType = _ref3$paymentMethodTy === void 0 ? 3 : _ref3$paymentMethodTy,
3084
+ currentUser = _ref3.currentUser,
3085
+ onResponse = _ref3.onResponse,
3086
+ _ref3$payButtonText = _ref3.payButtonText,
3087
+ payButtonText = _ref3$payButtonText === void 0 ? null : _ref3$payButtonText;
3043
3088
  var stripePromise = (0, _stripeJs.loadStripe)(process.env.stripePublicKey);
3044
3089
  var _useState5 = (0, _react.useState)(null),
3045
3090
  _useState6 = _slicedToArray(_useState5, 2),
3046
3091
  options = _useState6[0],
3047
3092
  setOptions = _useState6[1];
3048
- var _useState7 = (0, _react.useState)(0),
3093
+ var _useState7 = (0, _react.useState)(null),
3049
3094
  _useState8 = _slicedToArray(_useState7, 2),
3050
- value = _useState8[0],
3051
- setValue = _useState8[1];
3052
- var _useState9 = (0, _react.useState)([]),
3095
+ walletId = _useState8[0],
3096
+ setWalletId = _useState8[1];
3097
+ var _useState9 = (0, _react.useState)(0),
3053
3098
  _useState10 = _slicedToArray(_useState9, 2),
3054
- paymentMethods = _useState10[0],
3055
- setPaymentMethods = _useState10[1];
3056
- var _useState11 = (0, _react.useState)(null),
3099
+ value = _useState10[0],
3100
+ setValue = _useState10[1];
3101
+ var _useState11 = (0, _react.useState)([]),
3057
3102
  _useState12 = _slicedToArray(_useState11, 2),
3058
- paymentMethod = _useState12[0],
3059
- setPaymentMethod = _useState12[1];
3103
+ paymentMethods = _useState12[0],
3104
+ setPaymentMethods = _useState12[1];
3105
+ var _useState13 = (0, _react.useState)(null),
3106
+ _useState14 = _slicedToArray(_useState13, 2),
3107
+ paymentMethod = _useState14[0],
3108
+ setPaymentMethod = _useState14[1];
3060
3109
  var paymentMethodOpened = /*#__PURE__*/function () {
3061
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3110
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3062
3111
  var response, responsePayments;
3063
3112
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3064
3113
  while (1) switch (_context2.prev = _context2.next) {
@@ -3070,11 +3119,10 @@ var StripePayment = function StripePayment() {
3070
3119
  }
3071
3120
  _context2.next = 4;
3072
3121
  return apiService().post("/Payment/ConnectCustomerNoAuth", {
3073
- paymentRequestType: paymentRequestType,
3122
+ paymentMethodType: paymentMethodType,
3074
3123
  amount: amount,
3075
3124
  priceId: priceId,
3076
3125
  name: logOffUserName,
3077
- typeOfPayment: 1,
3078
3126
  email: logOffEmail,
3079
3127
  stripeCustomerId: stripeCustomerId
3080
3128
  });
@@ -3085,25 +3133,25 @@ var StripePayment = function StripePayment() {
3085
3133
  case 7:
3086
3134
  _context2.next = 9;
3087
3135
  return apiService().post("/Payment/ConnectCustomer", {
3088
- paymentRequestType: paymentRequestType,
3136
+ paymentMethodType: paymentMethodType,
3089
3137
  amount: amount,
3090
3138
  priceId: priceId,
3091
- typeOfPayment: 1,
3092
3139
  stripeCustomerId: stripeCustomerId
3093
3140
  });
3094
3141
  case 9:
3095
3142
  response = _context2.sent;
3096
3143
  case 10:
3097
3144
  if (!(response != null && response.status == 200)) {
3098
- _context2.next = 16;
3145
+ _context2.next = 17;
3099
3146
  break;
3100
3147
  }
3101
3148
  setOptions({
3102
- clientSecret: response.data
3149
+ clientSecret: response.data.clientSecret
3103
3150
  });
3104
- _context2.next = 14;
3105
- return apiService().get("/Payment/GetPaymentMethods");
3106
- case 14:
3151
+ setWalletId(response.data.walletId);
3152
+ _context2.next = 15;
3153
+ return apiService().get("/Payment/GetPaymentMethods?paymentMethodType=" + paymentMethodType);
3154
+ case 15:
3107
3155
  responsePayments = _context2.sent;
3108
3156
  if (responsePayments != null && responsePayments.status == 200) {
3109
3157
  if (responsePayments.data.length > 0) {
@@ -3111,21 +3159,21 @@ var StripePayment = function StripePayment() {
3111
3159
  }
3112
3160
  setPaymentMethods(responsePayments.data);
3113
3161
  }
3114
- case 16:
3162
+ case 17:
3115
3163
  case "end":
3116
3164
  return _context2.stop();
3117
3165
  }
3118
3166
  }, _callee2);
3119
3167
  }));
3120
3168
  return function paymentMethodOpened() {
3121
- return _ref3.apply(this, arguments);
3169
+ return _ref4.apply(this, arguments);
3122
3170
  };
3123
3171
  }();
3124
3172
  (0, _react.useEffect)(function () {
3125
- if (isOpen) {
3173
+ if (loadedUser) {
3126
3174
  paymentMethodOpened();
3127
3175
  }
3128
- }, [isOpen]);
3176
+ }, [loadedUser]);
3129
3177
  var handleChange = function handleChange(event, newValue) {
3130
3178
  setValue(newValue);
3131
3179
  };
@@ -3135,10 +3183,10 @@ var StripePayment = function StripePayment() {
3135
3183
  'aria-controls': "simple-tabpanel-".concat(index)
3136
3184
  };
3137
3185
  }
3138
- var PaymentMethod = function PaymentMethod(_ref4) {
3139
- var paymentMethod = _ref4.paymentMethod,
3140
- clicked = _ref4.clicked;
3141
- return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
3186
+ var PaymentMethod = function PaymentMethod(_ref5) {
3187
+ var paymentMethod = _ref5.paymentMethod,
3188
+ clicked = _ref5.clicked;
3189
+ return /*#__PURE__*/_react["default"].createElement(_material.Box, {
3142
3190
  fullWidth: true,
3143
3191
  sx: {
3144
3192
  height: 160,
@@ -3177,7 +3225,7 @@ var StripePayment = function StripePayment() {
3177
3225
  fontSize: 18,
3178
3226
  color: "white"
3179
3227
  }
3180
- }, "* * * * \xA0 * * * * \xA0 * * * * \xA0 ", paymentMethod.last4), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
3228
+ }, "* * * * \xA0 * * * * \xA0 * * * * \xA0 ", paymentMethod.last4), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
3181
3229
  container: true,
3182
3230
  spacing: 1,
3183
3231
  sx: {
@@ -3186,7 +3234,7 @@ var StripePayment = function StripePayment() {
3186
3234
  marginLeft: 0,
3187
3235
  width: "100%"
3188
3236
  }
3189
- }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
3237
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
3190
3238
  item: true,
3191
3239
  xs: 12,
3192
3240
  sx: {
@@ -3225,36 +3273,85 @@ var StripePayment = function StripePayment() {
3225
3273
  hidden: value !== index,
3226
3274
  id: "simple-tabpanel-".concat(index),
3227
3275
  "aria-labelledby": "simple-tab-".concat(index)
3228
- }, other), value === index && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
3276
+ }, other), value === index && /*#__PURE__*/_react["default"].createElement(_material.Box, {
3229
3277
  sx: {
3230
3278
  p: 3
3231
3279
  }
3232
3280
  }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, children)));
3233
3281
  }
3234
3282
  var PaymentContent = function PaymentContent() {
3235
- return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
3283
+ return /*#__PURE__*/_react["default"].createElement(_material.Box, {
3236
3284
  sx: {
3237
3285
  width: '100%'
3238
3286
  }
3239
- }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
3287
+ }, currentUser == null && /*#__PURE__*/_react["default"].createElement(_material.Box, {
3288
+ mt: 4
3289
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
3290
+ container: true,
3291
+ spacing: 2
3292
+ }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
3293
+ item: true,
3294
+ xs: 6
3295
+ }, /*#__PURE__*/_react["default"].createElement(_material.TextField, {
3296
+ id: "outlined-basic",
3297
+ label: "First Name",
3298
+ variant: "outlined",
3299
+ fullWidth: true
3300
+ })), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
3301
+ item: true,
3302
+ xs: 6
3303
+ }, /*#__PURE__*/_react["default"].createElement(_material.TextField, {
3304
+ id: "outlined-basic",
3305
+ label: "Last Name",
3306
+ variant: "outlined",
3307
+ fullWidth: true
3308
+ })), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
3309
+ item: true,
3310
+ xs: 12
3311
+ }, /*#__PURE__*/_react["default"].createElement(_material.TextField, {
3312
+ id: "outlined-basic",
3313
+ label: "Email",
3314
+ variant: "outlined",
3315
+ fullWidth: true
3316
+ }))), options != null && process.env.stripePublicKey != null && /*#__PURE__*/_react["default"].createElement(_reactStripeJs.Elements, {
3317
+ stripe: stripePromise,
3318
+ options: options
3319
+ }, /*#__PURE__*/_react["default"].createElement(CheckoutForm, {
3320
+ payButtonText: payButtonText,
3321
+ clientSecret: options != null ? options.clientSecret : null,
3322
+ onResponse: onResponse,
3323
+ paymentMethodType: paymentMethodType,
3324
+ currentUser: currentUser,
3325
+ walletId: walletId,
3326
+ amount: amount
3327
+ }))), currentUser != null && /*#__PURE__*/_react["default"].createElement(_material.Box, null, /*#__PURE__*/_react["default"].createElement(_material.Box, {
3240
3328
  sx: {
3241
3329
  borderBottom: 1,
3242
3330
  borderColor: 'divider'
3243
3331
  }
3244
- }), paymentMethods.length > 0 && /*#__PURE__*/_react["default"].createElement(TabPanel, {
3332
+ }, /*#__PURE__*/_react["default"].createElement(_material.Tabs, {
3333
+ value: value,
3334
+ onChange: handleChange,
3335
+ "aria-label": "basic tabs example"
3336
+ }, /*#__PURE__*/_react["default"].createElement(_material.Tab, _extends({
3337
+ label: "Add Payment Method"
3338
+ }, a11yProps(0))), paymentMethods.length > 0 && /*#__PURE__*/_react["default"].createElement(_material.Tab, _extends({
3339
+ label: "Existing Payment Method"
3340
+ }, a11yProps(1))))), paymentMethods.length > 0 && /*#__PURE__*/_react["default"].createElement(TabPanel, {
3245
3341
  value: value,
3246
3342
  index: 1
3247
- }, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
3343
+ }, /*#__PURE__*/_react["default"].createElement(_material.Select, {
3248
3344
  sx: {
3249
3345
  marginTop: 4
3250
3346
  },
3251
3347
  fullWidth: true,
3348
+ id: "demo-simple-select",
3252
3349
  value: paymentMethod,
3253
3350
  onChange: function onChange(val) {
3254
3351
  setPaymentMethod(val.target.value);
3255
3352
  }
3256
3353
  }, paymentMethods != null && paymentMethods.map(function (paymentMethod, index) {
3257
- return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
3354
+ return /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
3258
3355
  key: index,
3259
3356
  value: paymentMethod.id,
3260
3357
  fullWidth: true,
@@ -3265,10 +3362,49 @@ var StripePayment = function StripePayment() {
3265
3362
  paymentMethod: paymentMethod,
3266
3363
  clicked: function clicked() {}
3267
3364
  }));
3268
- }))), /*#__PURE__*/_react["default"].createElement(TabPanel, {
3365
+ })), amount != null && /*#__PURE__*/_react["default"].createElement(_material.Button, {
3366
+ startIcon: /*#__PURE__*/_react["default"].createElement(_PaymentRounded["default"], null),
3367
+ type: "submit",
3368
+ variant: "contained",
3369
+ disabled: paymentMethod == null,
3370
+ sx: {
3371
+ marginTop: 2
3372
+ },
3373
+ onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
3374
+ var response;
3375
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3376
+ while (1) switch (_context3.prev = _context3.next) {
3377
+ case 0:
3378
+ if (!(invoiceId != null)) {
3379
+ _context3.next = 3;
3380
+ break;
3381
+ }
3382
+ _context3.next = 7;
3383
+ break;
3384
+ case 3:
3385
+ _context3.next = 5;
3386
+ return apiService().post("/Payment/Charge", {
3387
+ paymentMethodType: paymentMethodType,
3388
+ walletPaymentMethodId: paymentMethod,
3389
+ amount: amount
3390
+ });
3391
+ case 5:
3392
+ response = _context3.sent;
3393
+ if (response != null && response.status == 200) {
3394
+ onResponse("paid", response.data.stripePaymentIntentId);
3395
+ }
3396
+
3397
+ // setIsLoading(false);
3398
+ case 7:
3399
+ case "end":
3400
+ return _context3.stop();
3401
+ }
3402
+ }, _callee3);
3403
+ }))
3404
+ }, payButtonText != null ? payButtonText : "Pay Now")), /*#__PURE__*/_react["default"].createElement(TabPanel, {
3269
3405
  value: value,
3270
3406
  index: 0
3271
- }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
3407
+ }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_material.Box, {
3272
3408
  mt: 4
3273
3409
  }, options != null && process.env.stripePublicKey != null && /*#__PURE__*/_react["default"].createElement(_reactStripeJs.Elements, {
3274
3410
  stripe: stripePromise,
@@ -3277,32 +3413,14 @@ var StripePayment = function StripePayment() {
3277
3413
  payButtonText: payButtonText,
3278
3414
  clientSecret: options != null ? options.clientSecret : null,
3279
3415
  onResponse: onResponse,
3416
+ paymentMethodType: paymentMethodType,
3417
+ walletId: walletId,
3418
+ currentUser: currentUser,
3280
3419
  amount: amount
3281
- }))))));
3420
+ })))))));
3282
3421
  };
3283
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isModal && /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
3284
- fullWidth: true,
3285
- maxWidth: "sm",
3286
- open: isOpen,
3287
- onClose: function onClose() {
3288
- return onModalClose();
3289
- }
3290
- }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
3291
- "aria-label": "close",
3292
- onClick: function onClick() {
3293
- onModalClose();
3294
- },
3295
- sx: {
3296
- position: 'absolute',
3297
- right: 8,
3298
- top: 8,
3299
- color: function color(theme) {
3300
- return theme.palette.grey[500];
3301
- }
3302
- }
3303
- }, /*#__PURE__*/_react["default"].createElement(_Close["default"], null))), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, description, /*#__PURE__*/_react["default"].createElement(PaymentContent, null)), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null)), !isModal && /*#__PURE__*/_react["default"].createElement(PaymentContent, null));
3304
- };
3305
- exports.StripePayment = StripePayment;
3422
+ return /*#__PURE__*/_react["default"].createElement(PaymentContent, null);
3423
+ }
3306
3424
  "use strict";
3307
3425
 
3308
3426
  Object.defineProperty(exports, "__esModule", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.288",
3
+ "version": "1.0.291",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@ import LockRoundedIcon from '@mui/icons-material/LockRounded';
22
22
  import Tooltip from '@mui/material/Tooltip';
23
23
 
24
24
  // remove before merging back
25
- //import { FileUploader, apiService, NextImage } from 'authscape';
25
+ // import { FileUploader, apiService, NextImage } from 'authscape';
26
26
 
27
27
  export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1, disablePreview = false, openToFolderId = null, xs=12, sm=6, md=4, lg=2, overrideLockMessage = "The directory cannot be removed.", zeroStateView = null, fieldId1 = null, fieldId2 = null, fieldId3 = null}) => {
28
28
 
@@ -401,11 +401,12 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
401
401
  ))}
402
402
  </Grid>
403
403
 
404
-
405
- {(files != null && files.documentAndFiles != null && zeroStateView != null) &&
404
+ {(files != null &&
405
+ files.documentAndFiles != null &&
406
+ zeroStateView != null) &&
406
407
 
407
408
  <Box>
408
- {zeroStateView(segment)}
409
+ {zeroStateView(segment, files.documentAndFiles)}
409
410
  </Box>
410
411
  }
411
412
 
@@ -463,6 +464,7 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
463
464
 
464
465
  ))}
465
466
  </Grid>
467
+
466
468
 
467
469
  {(files != null && files.documentAndFiles != null && zeroStateView != null) &&
468
470
 
@@ -1,47 +1,37 @@
1
1
  import React, {useEffect, useState} from 'react';
2
2
  import {Elements, useStripe, useElements, PaymentElement} from '@stripe/react-stripe-js';
3
3
  import {loadStripe} from '@stripe/stripe-js';
4
- import Box from '@mui/material/Box';
5
- import Dialog from '@mui/material/Dialog';
6
- import DialogActions from '@mui/material/DialogActions';
7
- import DialogContent from '@mui/material/DialogContent';
8
- import DialogTitle from '@mui/material/DialogTitle';
9
- import IconButton from '@mui/material/IconButton';
10
- import CloseIcon from '@mui/icons-material/Close';
11
- import Typography from '@mui/material/Typography';
12
- import Select from '@mui/material/Select';
13
- import MenuItem from '@mui/material/MenuItem';
14
- import Grid from '@mui/material/Grid';
15
4
  import PaymentRoundedIcon from '@mui/icons-material/PaymentRounded';
5
+ import Typography from '@mui/material/Typography';
6
+ import { Select, Grid, MenuItem, Box, Button, Tab, Tabs, TextField } from '@mui/material';
16
7
 
17
-
18
- const CheckoutForm = ({payButtonText, clientSecret, onResponse, amount}) => {
8
+ const CheckoutForm = ({payButtonText, clientSecret, currentUser, paymentMethodType, walletId, onResponse, amount}) => {
19
9
 
20
10
  const [isPaymentProcessing, setIsPaymentProcessing] = useState(false);
21
-
11
+
22
12
  const stripe = useStripe();
23
13
  const elements = useElements();
24
-
14
+
25
15
  const [errorMessage, setErrorMessage] = useState(null);
26
-
16
+
27
17
  const handleSubmit = async (event) => {
28
-
18
+
29
19
  setIsPaymentProcessing(true);
30
-
20
+
31
21
  // We don't want to let default form submission happen here,
32
22
  // which would refresh the page.
33
23
  event.preventDefault();
34
-
24
+
35
25
  if (!stripe || !elements) {
36
26
  // Stripe.js has not yet loaded.
37
27
  // Make sure to disable form submission until Stripe.js has loaded.
38
-
28
+
39
29
  //setIsPaymentProcessing(false);
40
30
  return;
41
31
  }
42
-
43
-
44
- if (amount == null)
32
+
33
+
34
+ if (amount == null || currentUser != null)
45
35
  {
46
36
  const {error} = await stripe.confirmSetup({
47
37
  //`Elements` instance that was used to create the Payment Element
@@ -68,14 +58,51 @@ const CheckoutForm = ({payButtonText, clientSecret, onResponse, amount}) => {
68
58
  let response = null;
69
59
 
70
60
  response = await stripe.retrieveSetupIntent(clientSecret);
71
-
61
+
72
62
  let setupIntent = response.setupIntent;
73
63
 
74
64
  switch (setupIntent.status) {
75
65
  case 'succeeded':
76
66
 
77
67
  // need to store the payment intent with the customer if they are logged in... currentUser
78
- onResponse("succeeded", setupIntent.id, setupIntent.payment_method);
68
+
69
+ let addPaymentMethodResponse = await apiService().post("/Payment/AddPaymentMethod", {
70
+ walletId: walletId,
71
+ paymentMethodType: paymentMethodType,
72
+ stripePaymentMethod: setupIntent.payment_method
73
+ });
74
+
75
+ if (addPaymentMethodResponse != null && addPaymentMethodResponse.status == 200)
76
+ {
77
+ onResponse("succeeded", setupIntent.id, setupIntent.payment_method);
78
+
79
+
80
+ if (amount != null)
81
+ {
82
+ // charge the customer
83
+ let response = await apiService().post("/Payment/Charge", {
84
+
85
+ paymentMethodType: paymentMethodType,
86
+ walletPaymentMethodId: addPaymentMethodResponse.data,
87
+ amount: amount
88
+ });
89
+
90
+ if (response != null && response.status == 200)
91
+ {
92
+ onResponse("paid", response.data.stripePaymentIntentId);
93
+ }
94
+ else
95
+ {
96
+ onResponse("failed", null);
97
+ }
98
+ }
99
+
100
+ }
101
+ else
102
+ {
103
+ onResponse("failed", null);
104
+ }
105
+
79
106
  break;
80
107
 
81
108
  case 'processing':
@@ -94,7 +121,7 @@ const CheckoutForm = ({payButtonText, clientSecret, onResponse, amount}) => {
94
121
  break;
95
122
  }
96
123
  }
97
-
124
+
98
125
  }
99
126
  else
100
127
  {
@@ -153,25 +180,26 @@ const CheckoutForm = ({payButtonText, clientSecret, onResponse, amount}) => {
153
180
  setIsPaymentProcessing(false);
154
181
  break;
155
182
  }
156
-
183
+
157
184
 
158
185
  }
159
186
  }
160
187
  };
161
-
188
+
162
189
  return (
163
190
  <form onSubmit={handleSubmit}>
164
191
  <PaymentElement />
165
- <Button startIcon={<PaymentRoundedIcon/>} type="submit" fullWidth={true} variant="contained" disabled={(!stripe || isPaymentProcessing)} sx={{marginTop:2, padding:2}}>{payButtonText}</Button>
192
+ <Button startIcon={<PaymentRoundedIcon/>} type="submit" fullWidth={true} variant="contained" disabled={(!stripe || isPaymentProcessing)} sx={{marginTop:2, padding:2}}>{payButtonText != null ? payButtonText : (amount != null ? "Pay Now" : "Add Payment Method")}</Button>
166
193
  {errorMessage && <div>{errorMessage}</div>}
167
194
  </form>
168
195
  )
169
196
  };
170
197
 
171
- export const StripePayment = () => {
198
+ export default function StripePayment({loadedUser, amount = null, priceId = null, stripeCustomerId = null, logOffUserName, invoiceId = null, logOffEmail, paymentMethodType = 3, currentUser, onResponse, payButtonText = null}) {
172
199
 
173
200
  const stripePromise = loadStripe(process.env.stripePublicKey);
174
201
  const [options, setOptions] = useState(null);
202
+ const [walletId, setWalletId] = useState(null);
175
203
  const [value, setValue] = useState(0);
176
204
  const [paymentMethods, setPaymentMethods] = useState([]);
177
205
  const [paymentMethod, setPaymentMethod] = useState(null);
@@ -182,11 +210,10 @@ export const StripePayment = () => {
182
210
  if (currentUser == null)
183
211
  {
184
212
  response = await apiService().post("/Payment/ConnectCustomerNoAuth", {
185
- paymentRequestType: paymentRequestType,
213
+ paymentMethodType: paymentMethodType,
186
214
  amount: amount,
187
215
  priceId: priceId,
188
216
  name: logOffUserName,
189
- typeOfPayment: 1,
190
217
  email: logOffEmail,
191
218
  stripeCustomerId: stripeCustomerId
192
219
  });
@@ -194,10 +221,9 @@ export const StripePayment = () => {
194
221
  else
195
222
  {
196
223
  response = await apiService().post("/Payment/ConnectCustomer", {
197
- paymentRequestType: paymentRequestType,
224
+ paymentMethodType: paymentMethodType,
198
225
  amount: amount,
199
226
  priceId: priceId,
200
- typeOfPayment: 1,
201
227
  stripeCustomerId: stripeCustomerId
202
228
  });
203
229
  }
@@ -206,10 +232,13 @@ export const StripePayment = () => {
206
232
  if (response != null && response.status == 200)
207
233
  {
208
234
  setOptions({
209
- clientSecret: response.data,
235
+ clientSecret: response.data.clientSecret
210
236
  });
211
237
 
212
- let responsePayments = await apiService().get("/Payment/GetPaymentMethods");
238
+ setWalletId(response.data.walletId);
239
+
240
+ let responsePayments = await apiService().get("/Payment/GetPaymentMethods?paymentMethodType=" + paymentMethodType);
241
+
213
242
  if (responsePayments != null && responsePayments.status == 200)
214
243
  {
215
244
  if (responsePayments.data.length > 0)
@@ -223,12 +252,12 @@ export const StripePayment = () => {
223
252
 
224
253
  useEffect(() => {
225
254
 
226
- if (isOpen)
255
+ if (loadedUser)
227
256
  {
228
257
  paymentMethodOpened();
229
258
  }
230
259
 
231
- }, [isOpen]);
260
+ }, [loadedUser]);
232
261
 
233
262
  const handleChange = (event, newValue) => {
234
263
  setValue(newValue);
@@ -292,114 +321,126 @@ export const StripePayment = () => {
292
321
  const PaymentContent = () => {
293
322
  return (
294
323
  <Box sx={{ width: '100%' }}>
295
- <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
296
- {/* <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
297
- <Tab label="Add Payment Method" {...a11yProps(0)} />
298
- {paymentMethods.length > 0 &&
299
- <Tab label="Existing Payment Method" {...a11yProps(1)} />
324
+
325
+ {currentUser == null &&
326
+
327
+ <Box mt={4}>
328
+
329
+ <Grid container spacing={2}>
330
+ <Grid item xs={6}>
331
+ <TextField id="outlined-basic" label="First Name" variant="outlined" fullWidth={true} />
332
+ </Grid>
333
+ <Grid item xs={6}>
334
+ <TextField id="outlined-basic" label="Last Name" variant="outlined" fullWidth={true} />
335
+ </Grid>
336
+
337
+ <Grid item xs={12}>
338
+ <TextField id="outlined-basic" label="Email" variant="outlined" fullWidth={true} />
339
+ </Grid>
340
+ </Grid>
341
+
342
+ {(options != null && process.env.stripePublicKey != null) &&
343
+ <Elements stripe={stripePromise} options={options}>
344
+ <CheckoutForm payButtonText={payButtonText} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} paymentMethodType={paymentMethodType} currentUser={currentUser} walletId={walletId} amount={amount} />
345
+ </Elements>
300
346
  }
301
- </Tabs> */}
302
- </Box>
303
- {paymentMethods.length > 0 &&
304
- <TabPanel value={value} index={1}>
305
-
306
- <Select
307
- sx={{marginTop:4}}
308
- fullWidth={true}
309
- value={paymentMethod}
310
- onChange={(val) => {
311
- setPaymentMethod(val.target.value);
312
- }}>
313
- {paymentMethods != null && paymentMethods.map((paymentMethod, index) => {
314
- return (
315
- <MenuItem key={index} value={paymentMethod.id} fullWidth={true} sx={{width:"100%"}}>
316
- <PaymentMethod paymentMethod={paymentMethod} clicked={() => {
317
- }} />
318
- </MenuItem>)
319
- })}
320
- </Select>
321
-
322
- {/* <Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={paymentMethod == null} sx={{marginTop:2}} onClick={async () => {
323
-
324
- if (invoiceId != null)
325
- {
326
- setIsLoading(true);
327
- let response = await apiService().post("/Invoices/PayInvoice", {
328
- InvoiceId: invoiceId,
329
- WalletId: paymentMethod
330
- });
331
- setIsLoading(false);
332
-
333
- if (response != null && response.status == 200)
334
- {
335
- window.location.reload();
347
+ </Box>
348
+ }
349
+
350
+ {currentUser != null &&
351
+ <Box>
352
+ <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
353
+ <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
354
+ <Tab label="Add Payment Method" {...a11yProps(0)} />
355
+ {paymentMethods.length > 0 &&
356
+ <Tab label="Existing Payment Method" {...a11yProps(1)} />
336
357
  }
337
- else
358
+ </Tabs>
359
+ </Box>
360
+ {paymentMethods.length > 0 &&
361
+ <TabPanel value={value} index={1}>
362
+
363
+ <Select
364
+ sx={{marginTop:4}}
365
+ fullWidth={true}
366
+ id="demo-simple-select"
367
+ value={paymentMethod}
368
+ onChange={(val) => {
369
+ setPaymentMethod(val.target.value);
370
+ }}>
371
+ {paymentMethods != null && paymentMethods.map((paymentMethod, index) => {
372
+ return (
373
+ <MenuItem key={index} value={paymentMethod.id} fullWidth={true} sx={{width:"100%"}}>
374
+ <PaymentMethod paymentMethod={paymentMethod} clicked={() => {
375
+ }} />
376
+ </MenuItem>)
377
+ })}
378
+ </Select>
379
+
380
+ {amount != null &&
381
+ <Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={paymentMethod == null} sx={{marginTop:2}} onClick={async () => {
382
+
383
+ if (invoiceId != null)
338
384
  {
339
- alert("We had an issue with the payment method");
385
+ // setIsLoading(true);
386
+ // let response = await apiService().post("/Invoices/PayInvoice", {
387
+ // InvoiceId: invoiceId,
388
+ // WalletId: walletId
389
+ // });
390
+ // setIsLoading(false);
391
+
392
+ // if (response != null && response.status == 200)
393
+ // {
394
+ // window.location.reload();
395
+ // }
396
+ // else
397
+ // {
398
+ // alert("We had an issue with the payment method");
399
+ // }
340
400
  }
341
- }
401
+ else {
402
+ // setIsLoading(true);
342
403
 
343
- }}>{payButtonText}</Button> */}
404
+ let response = await apiService().post("/Payment/Charge", {
344
405
 
345
- </TabPanel>
346
- }
406
+ paymentMethodType: paymentMethodType,
407
+ walletPaymentMethodId: paymentMethod,
408
+ amount: amount
409
+ });
410
+
411
+ if (response != null && response.status == 200)
412
+ {
413
+ onResponse("paid", response.data.stripePaymentIntentId);
414
+ }
347
415
 
348
- <TabPanel value={value} index={0}>
349
- <div>
350
- <Box mt={4} >
351
- {(options != null && process.env.stripePublicKey != null) &&
352
- <Elements stripe={stripePromise} options={options}>
353
- <CheckoutForm payButtonText={payButtonText} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} amount={amount} />
354
- </Elements>
416
+ // setIsLoading(false);
355
417
  }
356
- </Box>
357
- </div>
358
- </TabPanel>
418
+
419
+ }}>{payButtonText != null ? payButtonText : "Pay Now"}</Button>
420
+ }
421
+
422
+ </TabPanel>
423
+ }
424
+
425
+ <TabPanel value={value} index={0}>
426
+ <div>
427
+ <Box mt={4}>
428
+
429
+ {(options != null && process.env.stripePublicKey != null) &&
430
+ <Elements stripe={stripePromise} options={options}>
431
+ <CheckoutForm payButtonText={payButtonText} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} paymentMethodType={paymentMethodType} walletId={walletId} currentUser={currentUser} amount={amount} />
432
+ </Elements>
433
+ }
434
+ </Box>
435
+ </div>
436
+ </TabPanel>
437
+ </Box>
438
+ }
359
439
  </Box>
360
440
  )
361
441
  }
362
442
 
363
443
  return (
364
- <>
365
- {isModal &&
366
- <Dialog
367
- fullWidth={true}
368
- maxWidth={"sm"}
369
- open={isOpen}
370
- onClose={() => onModalClose()}>
371
- <DialogTitle>{title}
372
-
373
- <IconButton
374
- aria-label="close"
375
- onClick={() => {
376
-
377
- onModalClose();
378
- }}
379
- sx={{
380
- position: 'absolute',
381
- right: 8,
382
- top: 8,
383
- color: (theme) => theme.palette.grey[500],
384
- }}>
385
- <CloseIcon />
386
- </IconButton>
387
- </DialogTitle>
388
- <DialogContent>
389
- {description}
390
- <PaymentContent />
391
- </DialogContent>
392
- <DialogActions>
393
- </DialogActions>
394
- </Dialog>
395
- }
396
-
397
- {!isModal &&
398
- <PaymentContent />
399
- }
400
-
401
- </>
444
+ <PaymentContent />
402
445
  )
403
-
404
-
405
- }
446
+ }