authscape 1.0.48 → 1.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,12 @@
1
1
  import React, {useEffect, useState} from 'react';
2
2
  import {Elements} from '@stripe/react-stripe-js';
3
3
  import {loadStripe} from '@stripe/stripe-js';
4
- import Box from '@material-ui/core/Box';
4
+ import Box from '@mui/material/Box';
5
5
  import Dialog from '@mui/material/Dialog';
6
6
  import DialogActions from '@mui/material/DialogActions';
7
7
  import DialogContent from '@mui/material/DialogContent';
8
8
  import DialogTitle from '@mui/material/DialogTitle';
9
- import CheckoutForm from '../pricing/CheckoutForm';
10
- import ApiService from '../../services/apiService';
9
+ import CheckoutForm from './CheckoutForm';
11
10
  import IconButton from '@mui/material/IconButton';
12
11
  import CloseIcon from '@mui/icons-material/Close';
13
12
  import Tabs from '@mui/material/Tabs';
@@ -17,7 +16,7 @@ import Select from '@mui/material/Select';
17
16
  import MenuItem from '@mui/material/MenuItem';
18
17
  import Button from '@mui/material/Button';
19
18
  import PaymentRoundedIcon from '@mui/icons-material/PaymentRounded';
20
- import apiService from '../../services/apiService';
19
+ import ApiService from 'authscape/services/apiService';
21
20
  import Grid from '@mui/material/Grid';
22
21
 
23
22
  export default function PaymentModal({title, description, amount, priceId, setIsLoading, isOpen, invoiceId, onModalClose}) {
@@ -28,25 +27,29 @@ export default function PaymentModal({title, description, amount, priceId, setIs
28
27
  const [paymentMethods, setPaymentMethods] = React.useState([]);
29
28
  const [paymentMethod, setPaymentMethod] = React.useState(null);
30
29
 
31
- useEffect(async () => {
30
+ const paymentMethodOpen = async () => {
31
+ let response = await ApiService().post("/StripePayment/ConnectCustomer", {
32
+ paymentRequestType: 3,
33
+ amount: amount,
34
+ priceId: priceId
35
+ });
36
+
37
+ setOptions({
38
+ clientSecret: response.data,
39
+ });
40
+
41
+ let responsePayments = await ApiService().get("/NCAInvoices/GetPaymentMethods");
42
+ if (responsePayments != null && responsePayments.status == 200)
43
+ {
44
+ setPaymentMethods(responsePayments.data);
45
+ }
46
+ }
47
+
48
+ useEffect(() => {
32
49
 
33
50
  if (isOpen)
34
51
  {
35
- let response = await ApiService().post("/StripePayment/ConnectCustomer", {
36
- paymentRequestType: 3,
37
- amount: amount,
38
- priceId: priceId
39
- });
40
-
41
- setOptions({
42
- clientSecret: response.data,
43
- });
44
-
45
- let responsePayments = await ApiService().get("/NCAInvoices/GetPaymentMethods");
46
- if (responsePayments != null && responsePayments.status == 200)
47
- {
48
- setPaymentMethods(responsePayments.data);
49
- }
52
+ paymentMethodOpen();
50
53
  }
51
54
 
52
55
  }, [isOpen]);
@@ -175,7 +178,7 @@ export default function PaymentModal({title, description, amount, priceId, setIs
175
178
  <Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={paymentMethod == null} sx={{marginTop:2}} onClick={async () => {
176
179
 
177
180
  setIsLoading(true);
178
- let response = await apiService().post("/NCAInvoices/PayInvoice", {
181
+ let response = await ApiService().post("/NCAInvoices/PayInvoice", {
179
182
  InvoiceId: invoiceId,
180
183
  WalletId: paymentMethod
181
184
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.48",
3
+ "version": "1.0.54",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,6 +12,7 @@
12
12
  "dependencies": {
13
13
  "@emotion/react": "^11.9.3",
14
14
  "@emotion/styled": "^11.9.3",
15
+ "@mui/icons-material": "^5.8.4",
15
16
  "@mui/material": "^5.8.6",
16
17
  "@stripe/react-stripe-js": "^1.9.0",
17
18
  "@stripe/stripe-js": "^1.32.0",