authscape 1.0.52 → 1.0.60
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/.babelrc +3 -0
- package/index.js +51 -6
- package/package.json +24 -28
- package/readme.md +13 -0
- package/src/index.js +13 -0
- package/{services → src/services}/BaseUri.js +0 -0
- package/{services → src/services}/apiService.js +0 -0
- package/{services → src/services}/authService.js +0 -0
- package/{services → src/services}/authorizationComponent.js +0 -0
- package/{services → src/services}/helper.js +0 -0
- package/{services → src/services}/signInValidator.js +0 -0
- package/{services → src/services}/slug.js +0 -0
- package/{services → src/services}/storeWithExpiry.js +0 -0
- package/components/Datatable.js +0 -118
- package/components/modals/confirmationModal.js +0 -32
- package/components/modals/paymentModal.js +0 -215
- package/components/pricing/checkoutForm.js +0 -55
package/.babelrc
ADDED
package/index.js
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
|
11
|
+
|
|
12
|
+
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
13
|
+
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
+
|
|
16
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
+
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
19
|
+
|
|
20
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
21
|
+
|
|
22
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
+
|
|
24
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
+
|
|
26
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
27
|
+
|
|
28
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
29
|
+
|
|
30
|
+
var DummyComponent =
|
|
31
|
+
/*#__PURE__*/
|
|
32
|
+
function (_Component) {
|
|
33
|
+
_inherits(DummyComponent, _Component);
|
|
34
|
+
|
|
35
|
+
function DummyComponent() {
|
|
36
|
+
_classCallCheck(this, DummyComponent);
|
|
37
|
+
|
|
38
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(DummyComponent).apply(this, arguments));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_createClass(DummyComponent, [{
|
|
42
|
+
key: "render",
|
|
43
|
+
value: function render() {
|
|
44
|
+
return _react.default.createElement("div", null, "I am a dummy react npm module");
|
|
45
|
+
}
|
|
46
|
+
}]);
|
|
47
|
+
|
|
48
|
+
return DummyComponent;
|
|
49
|
+
}(_react.Component);
|
|
50
|
+
|
|
51
|
+
exports.default = DummyComponent;
|
package/package.json
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
},
|
|
10
|
-
"author": "zuechb",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"@
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"react-data-table-component": "^7.5.2",
|
|
26
|
-
"react-dom": "^18.2.0"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "authscape",
|
|
3
|
+
"version": "1.0.60",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"build": "./node_modules/.bin/babel src --out-file index.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "zuechb",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"react": "^16.6.1",
|
|
14
|
+
"react-dom": "^16.6.3"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@babel/cli": "^7.1.5",
|
|
18
|
+
"@babel/core": "^7.1.6",
|
|
19
|
+
"@babel/preset-env": "^7.1.6",
|
|
20
|
+
"@babel/preset-react": "^7.0.0",
|
|
21
|
+
"react": "^16.6.1",
|
|
22
|
+
"react-dom": "^16.6.3"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/readme.md
ADDED
package/src/index.js
ADDED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/components/Datatable.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import apiService from '../services/apiService';
|
|
3
|
-
import DataTable, {createTheme} from "react-data-table-component";
|
|
4
|
-
|
|
5
|
-
export default class Datatable extends Component {
|
|
6
|
-
|
|
7
|
-
static defaultProps = {
|
|
8
|
-
options: {}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
constructor(props) {
|
|
12
|
-
super(props);
|
|
13
|
-
|
|
14
|
-
this.state = {
|
|
15
|
-
pageNumber : 1,
|
|
16
|
-
pageLength : props.pageLength ? props.pageLength : 10,
|
|
17
|
-
data: [],
|
|
18
|
-
loading: false,
|
|
19
|
-
totalRows: 0
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
componentDidMount = async () => {
|
|
24
|
-
await this.GetDataFromUrl(this.state.pageNumber, this.state.pageLength, this.props.params);
|
|
25
|
-
createTheme('dataTable', {
|
|
26
|
-
text:{
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
reload = async (reset = false) => {
|
|
33
|
-
|
|
34
|
-
if (reset === true)
|
|
35
|
-
{
|
|
36
|
-
this.setState({pageNumber: 1}, async () => {
|
|
37
|
-
await this.GetDataFromUrl(this.state.pageNumber, this.state.pageLength, this.props.params);
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
else
|
|
41
|
-
{
|
|
42
|
-
await this.GetDataFromUrl(this.state.pageNumber, this.state.pageLength, this.props.params);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
GetDataFromUrl = (page, length, postData = {}) => {
|
|
49
|
-
|
|
50
|
-
this.setState({
|
|
51
|
-
loading: true
|
|
52
|
-
}, async function () {
|
|
53
|
-
|
|
54
|
-
let data = postData;
|
|
55
|
-
|
|
56
|
-
data.offset = page;
|
|
57
|
-
data.length = length;
|
|
58
|
-
|
|
59
|
-
let response = null;
|
|
60
|
-
if (this.props.methodType == "get")
|
|
61
|
-
{
|
|
62
|
-
response = await apiService().get(this.props.url);
|
|
63
|
-
}
|
|
64
|
-
else
|
|
65
|
-
{
|
|
66
|
-
response = await apiService().post(this.props.url, postData);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (response != null && response.status === 200)
|
|
70
|
-
{
|
|
71
|
-
if (this.props.returnResult != null)
|
|
72
|
-
{
|
|
73
|
-
this.props.returnResult(response.data.data);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
this.setState({
|
|
77
|
-
totalRows: response.data.recordsTotal,
|
|
78
|
-
data: response.data.data,
|
|
79
|
-
loading: false
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
else
|
|
83
|
-
{
|
|
84
|
-
//console.error(response.status + " - " + response.data);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
handlePageChange = async page => {
|
|
92
|
-
const { pageLength } = this.state;
|
|
93
|
-
this.setState({pageNumber: page});
|
|
94
|
-
await this.GetDataFromUrl(page, pageLength, this.props.params);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
render() {
|
|
98
|
-
|
|
99
|
-
return (
|
|
100
|
-
<div>
|
|
101
|
-
<DataTable
|
|
102
|
-
title={this.props.title}
|
|
103
|
-
columns={this.props.columns}
|
|
104
|
-
data={this.state.data}
|
|
105
|
-
paginationRowsPerPageOptions={this.props.pageLength ? [this.props.pageLength] : [10]}
|
|
106
|
-
progressPending={this.state.loading}
|
|
107
|
-
customStyles={this.props.customStyles}
|
|
108
|
-
paginationPerPage={this.props.pageLength ? this.props.pageLength : 10}
|
|
109
|
-
paginationServer
|
|
110
|
-
pagination
|
|
111
|
-
paginationTotalRows={this.state.totalRows}
|
|
112
|
-
// onChangeRowsPerPage={this.handlePerRowsChange}
|
|
113
|
-
onChangePage={this.handlePageChange}
|
|
114
|
-
noDataComponent={this.props.noDataComponent}
|
|
115
|
-
/>
|
|
116
|
-
</div>);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from '@mui/material/Button';
|
|
3
|
-
import Dialog from '@mui/material/Dialog';
|
|
4
|
-
import DialogActions from '@mui/material/DialogActions';
|
|
5
|
-
import DialogContent from '@mui/material/DialogContent';
|
|
6
|
-
import DialogContentText from '@mui/material/DialogContentText';
|
|
7
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
|
8
|
-
|
|
9
|
-
export default function confirmationModal({title, description, cancelClicked, okClicked, open = false, cancelTitle = "Cancel", okTitle = "OK"}) {
|
|
10
|
-
return (
|
|
11
|
-
<Dialog
|
|
12
|
-
open={open}
|
|
13
|
-
onClose={cancelClicked}
|
|
14
|
-
aria-labelledby="alert-dialog-title"
|
|
15
|
-
aria-describedby="alert-dialog-description">
|
|
16
|
-
<DialogTitle id="alert-dialog-title">
|
|
17
|
-
{title}
|
|
18
|
-
</DialogTitle>
|
|
19
|
-
<DialogContent>
|
|
20
|
-
<DialogContentText id="alert-dialog-description">
|
|
21
|
-
{description}
|
|
22
|
-
</DialogContentText>
|
|
23
|
-
</DialogContent>
|
|
24
|
-
<DialogActions>
|
|
25
|
-
<Button onClick={cancelClicked}>{cancelTitle}</Button>
|
|
26
|
-
<Button onClick={okClicked}>
|
|
27
|
-
{okTitle}
|
|
28
|
-
</Button>
|
|
29
|
-
</DialogActions>
|
|
30
|
-
</Dialog>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import React, {useEffect, useState} from 'react';
|
|
2
|
-
import {Elements} from '@stripe/react-stripe-js';
|
|
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 CheckoutForm from '../pricing/CheckoutForm';
|
|
10
|
-
import ApiService from '../../services/apiService';
|
|
11
|
-
import IconButton from '@mui/material/IconButton';
|
|
12
|
-
import CloseIcon from '@mui/icons-material/Close';
|
|
13
|
-
import Tabs from '@mui/material/Tabs';
|
|
14
|
-
import Tab from '@mui/material/Tab';
|
|
15
|
-
import Typography from '@mui/material/Typography';
|
|
16
|
-
import Select from '@mui/material/Select';
|
|
17
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
18
|
-
import Button from '@mui/material/Button';
|
|
19
|
-
import PaymentRoundedIcon from '@mui/icons-material/PaymentRounded';
|
|
20
|
-
import apiService from '../../services/apiService';
|
|
21
|
-
import Grid from '@mui/material/Grid';
|
|
22
|
-
|
|
23
|
-
export default function PaymentModal({title, description, amount, priceId, setIsLoading, isOpen, invoiceId, onModalClose}) {
|
|
24
|
-
|
|
25
|
-
const stripePromise = loadStripe(process.env.stripePublicKey);
|
|
26
|
-
const [options, setOptions] = useState(null);
|
|
27
|
-
const [value, setValue] = React.useState(0);
|
|
28
|
-
const [paymentMethods, setPaymentMethods] = React.useState([]);
|
|
29
|
-
const [paymentMethod, setPaymentMethod] = React.useState(null);
|
|
30
|
-
|
|
31
|
-
useEffect(async () => {
|
|
32
|
-
|
|
33
|
-
if (isOpen)
|
|
34
|
-
{
|
|
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
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}, [isOpen]);
|
|
53
|
-
|
|
54
|
-
const handleChange = (event, newValue) => {
|
|
55
|
-
setValue(newValue);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
function a11yProps(index) {
|
|
59
|
-
return {
|
|
60
|
-
id: `simple-tab-${index}`,
|
|
61
|
-
'aria-controls': `simple-tabpanel-${index}`,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const PaymentMethod = ({id, last4, clicked}) => {
|
|
66
|
-
return (
|
|
67
|
-
<Box fullWidth={true} sx={{height: 160, width:"100%", marginTop:2, backgroundColor:"#2196F3", position:"relative", border: "1px solid #2196F3", borderRadius: 1, display:"flex", flexDirection:"column", justifyContent:"center", textAlign:"center", cursor:"pointer"}}
|
|
68
|
-
onClick={() => {
|
|
69
|
-
clicked(id);
|
|
70
|
-
}}>
|
|
71
|
-
<Typography gutterBottom variant="body" component="div" sx={{fontSize:14, position:"absolute", left:15, top:10, color:"white"}}>
|
|
72
|
-
Visa
|
|
73
|
-
</Typography>
|
|
74
|
-
<Typography gutterBottom variant="body" component="div" sx={{verticalAlign:"middle", fontSize:18, color:"white"}}>
|
|
75
|
-
* * * * * * * * * * * * {last4}
|
|
76
|
-
</Typography>
|
|
77
|
-
|
|
78
|
-
<Grid container spacing={1} sx={{position:"absolute", bottom:8, marginLeft:0, width: "100%"}}>
|
|
79
|
-
<Grid item xs={6} sx={{paddingLeft:2}}>
|
|
80
|
-
<Typography gutterBottom variant="body" component="div" sx={{textAlign:"left", fontSize:12, marginTop:1, paddingLeft:1, color:"#e9e9e9"}}>
|
|
81
|
-
CARD HOLDER
|
|
82
|
-
</Typography>
|
|
83
|
-
|
|
84
|
-
<Typography gutterBottom variant="body" component="div" sx={{textAlign:"left", fontSize:12, marginTop:"-9px", paddingLeft:1, color:"white" }}>
|
|
85
|
-
Brandon Zuech
|
|
86
|
-
</Typography>
|
|
87
|
-
</Grid>
|
|
88
|
-
<Grid item xs={6} sx={{textAlign:"right", paddingRight:2}}>
|
|
89
|
-
<Typography gutterBottom variant="body" component="div" sx={{fontSize:12, marginLeft:2, marginTop:1, color:"#e9e9e9"}}>
|
|
90
|
-
EXPIRES
|
|
91
|
-
</Typography>
|
|
92
|
-
|
|
93
|
-
<Typography gutterBottom variant="body" component="div" sx={{fontSize:12, marginLeft:2, marginTop:"-9px", color:"white"}}>
|
|
94
|
-
08/21
|
|
95
|
-
</Typography>
|
|
96
|
-
</Grid>
|
|
97
|
-
</Grid>
|
|
98
|
-
</Box>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
function TabPanel(props) {
|
|
103
|
-
const { children, value, index, ...other } = props;
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
role="tabpanel"
|
|
108
|
-
hidden={value !== index}
|
|
109
|
-
id={`simple-tabpanel-${index}`}
|
|
110
|
-
aria-labelledby={`simple-tab-${index}`}
|
|
111
|
-
{...other}
|
|
112
|
-
>
|
|
113
|
-
{value === index && (
|
|
114
|
-
<Box sx={{ p: 3 }}>
|
|
115
|
-
<Typography>{children}</Typography>
|
|
116
|
-
</Box>
|
|
117
|
-
)}
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<Dialog
|
|
124
|
-
fullWidth={true}
|
|
125
|
-
maxWidth={"sm"}
|
|
126
|
-
open={isOpen}
|
|
127
|
-
onClose={() => onModalClose()}>
|
|
128
|
-
<DialogTitle>{title}
|
|
129
|
-
|
|
130
|
-
<IconButton
|
|
131
|
-
aria-label="close"
|
|
132
|
-
onClick={() => {
|
|
133
|
-
|
|
134
|
-
onModalClose();
|
|
135
|
-
}}
|
|
136
|
-
sx={{
|
|
137
|
-
position: 'absolute',
|
|
138
|
-
right: 8,
|
|
139
|
-
top: 8,
|
|
140
|
-
color: (theme) => theme.palette.grey[500],
|
|
141
|
-
}}>
|
|
142
|
-
<CloseIcon />
|
|
143
|
-
</IconButton>
|
|
144
|
-
</DialogTitle>
|
|
145
|
-
<DialogContent>
|
|
146
|
-
{description}
|
|
147
|
-
|
|
148
|
-
<Box sx={{ width: '100%' }}>
|
|
149
|
-
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
|
|
150
|
-
<Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
|
|
151
|
-
<Tab label="Existing Payment Method" {...a11yProps(0)} />
|
|
152
|
-
<Tab label="Add Payment Method" {...a11yProps(1)} />
|
|
153
|
-
</Tabs>
|
|
154
|
-
</Box>
|
|
155
|
-
<TabPanel value={value} index={0}>
|
|
156
|
-
|
|
157
|
-
<Select
|
|
158
|
-
sx={{marginTop:4}}
|
|
159
|
-
fullWidth={true}
|
|
160
|
-
id="demo-simple-select"
|
|
161
|
-
value={paymentMethod}
|
|
162
|
-
onChange={(val) => {
|
|
163
|
-
setPaymentMethod(val.target.value);
|
|
164
|
-
}}>
|
|
165
|
-
{paymentMethods != null && paymentMethods.map((paymentMethod) => {
|
|
166
|
-
return (
|
|
167
|
-
<MenuItem value={paymentMethod.id} fullWidth={true} sx={{width:"100%"}}>
|
|
168
|
-
<PaymentMethod id={paymentMethod.id} last4={paymentMethod.last4} clicked={() => {
|
|
169
|
-
|
|
170
|
-
}} />
|
|
171
|
-
</MenuItem>)
|
|
172
|
-
})}
|
|
173
|
-
</Select>
|
|
174
|
-
|
|
175
|
-
<Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={paymentMethod == null} sx={{marginTop:2}} onClick={async () => {
|
|
176
|
-
|
|
177
|
-
setIsLoading(true);
|
|
178
|
-
let response = await apiService().post("/NCAInvoices/PayInvoice", {
|
|
179
|
-
InvoiceId: invoiceId,
|
|
180
|
-
WalletId: paymentMethod
|
|
181
|
-
});
|
|
182
|
-
setIsLoading(false);
|
|
183
|
-
|
|
184
|
-
if (response != null && response.status == 200)
|
|
185
|
-
{
|
|
186
|
-
window.location.reload();
|
|
187
|
-
}
|
|
188
|
-
else
|
|
189
|
-
{
|
|
190
|
-
alert("We had an issue with the payment method");
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}}>Pay Now</Button>
|
|
195
|
-
|
|
196
|
-
</TabPanel>
|
|
197
|
-
<TabPanel value={value} index={1}>
|
|
198
|
-
<div>
|
|
199
|
-
<Box mt={4} mb={2}>
|
|
200
|
-
{options != null &&
|
|
201
|
-
<Elements stripe={stripePromise} options={options}>
|
|
202
|
-
<CheckoutForm />
|
|
203
|
-
</Elements>
|
|
204
|
-
}
|
|
205
|
-
</Box>
|
|
206
|
-
</div>
|
|
207
|
-
</TabPanel>
|
|
208
|
-
</Box>
|
|
209
|
-
|
|
210
|
-
</DialogContent>
|
|
211
|
-
<DialogActions>
|
|
212
|
-
</DialogActions>
|
|
213
|
-
</Dialog>
|
|
214
|
-
)
|
|
215
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import Button from '@mui/material/Button';
|
|
3
|
-
import {useStripe, useElements, PaymentElement} from '@stripe/react-stripe-js';
|
|
4
|
-
import PaymentRoundedIcon from '@mui/icons-material/PaymentRounded';
|
|
5
|
-
|
|
6
|
-
const CheckoutForm = () => {
|
|
7
|
-
const stripe = useStripe();
|
|
8
|
-
const elements = useElements();
|
|
9
|
-
|
|
10
|
-
const [errorMessage, setErrorMessage] = useState(null);
|
|
11
|
-
|
|
12
|
-
const handleSubmit = async (event) => {
|
|
13
|
-
|
|
14
|
-
// We don't want to let default form submission happen here,
|
|
15
|
-
// which would refresh the page.
|
|
16
|
-
event.preventDefault();
|
|
17
|
-
|
|
18
|
-
if (!stripe || !elements) {
|
|
19
|
-
// Stripe.js has not yet loaded.
|
|
20
|
-
// Make sure to disable form submission until Stripe.js has loaded.
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const {error} = await stripe.confirmPayment({
|
|
25
|
-
//`Elements` instance that was used to create the Payment Element
|
|
26
|
-
elements,
|
|
27
|
-
confirmParams: {
|
|
28
|
-
return_url: process.env.WebsiteBaseUri + '/confirmPayment?redirectUrl=' + encodeURIComponent(window.location.href),
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
if (error) {
|
|
33
|
-
// This point will only be reached if there is an immediate error when
|
|
34
|
-
// confirming the payment. Show error to your customer (for example, payment
|
|
35
|
-
// details incomplete)
|
|
36
|
-
setErrorMessage(error.message);
|
|
37
|
-
} else {
|
|
38
|
-
// Your customer will be redirected to your `return_url`. For some payment
|
|
39
|
-
// methods like iDEAL, your customer will be redirected to an intermediate
|
|
40
|
-
// site first to authorize the payment, then redirected to the `return_url`.
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<form onSubmit={handleSubmit}>
|
|
47
|
-
<PaymentElement />
|
|
48
|
-
<Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={!stripe} sx={{marginTop:2}}>Pay Now</Button>
|
|
49
|
-
{/* Show error message to your customers */}
|
|
50
|
-
{errorMessage && <div>{errorMessage}</div>}
|
|
51
|
-
</form>
|
|
52
|
-
)
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default CheckoutForm;
|