@fractalpay/fractalpay-next-test 0.0.3 → 0.0.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.
- package/README.md +103 -2
- package/dist/index.d.mts +39 -26
- package/dist/index.d.ts +39 -26
- package/dist/index.js +787 -2542
- package/dist/index.mjs +787 -2504
- package/next-env.d.ts +1 -1
- package/package.json +8 -7
package/dist/index.mjs
CHANGED
|
@@ -1,46 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/app/components/RequestPayment/RequestPayment.tsx
|
|
34
|
-
import "bootstrap/dist/js/bootstrap.bundle.min.js";
|
|
35
|
-
import React6, { useState, useEffect } from "react";
|
|
36
|
-
|
|
37
|
-
// src/app/components/Loader/Loader.tsx
|
|
38
|
-
import React2 from "react";
|
|
39
|
-
|
|
40
|
-
// src/app/components/Loader/LoaderStyle.tsx
|
|
41
|
-
import React from "react";
|
|
42
|
-
var LoaderStyle = (props) => {
|
|
43
|
-
return /* @__PURE__ */ React.createElement("style", null, `
|
|
1
|
+
var Vn=Object.defineProperty,Kn=Object.defineProperties;var On=Object.getOwnPropertyDescriptors;var dn=Object.getOwnPropertySymbols;var _n=Object.prototype.hasOwnProperty,Fn=Object.prototype.propertyIsEnumerable;var kn=(e,L,$)=>L in e?Vn(e,L,{enumerable:!0,configurable:!0,writable:!0,value:$}):e[L]=$,_=(e,L)=>{for(var $ in L||(L={}))_n.call(L,$)&&kn(e,$,L[$]);if(dn)for(var $ of dn(L))Fn.call(L,$)&&kn(e,$,L[$]);return e},I=(e,L)=>Kn(e,On(L));var cn=(e,L)=>{var $={};for(var Z in e)_n.call(e,Z)&&L.indexOf(Z)<0&&($[Z]=e[Z]);if(e!=null&&dn)for(var Z of dn(e))L.indexOf(Z)<0&&Fn.call(e,Z)&&($[Z]=e[Z]);return $};import"bootstrap/dist/js/bootstrap.bundle.min.js";import M,{useState as Et,useEffect as Dn}from"react";import Zt from"react";import Zn from"react";var En=e=>Zn.createElement("style",null,`
|
|
44
2
|
|
|
45
3
|
.loader {
|
|
46
4
|
position: fixed; /* Fixed position to cover the viewport */
|
|
@@ -55,7 +13,8 @@ var LoaderStyle = (props) => {
|
|
|
55
13
|
background-color: rgba(31, 29, 29, 0.52); /* Semi-transparent black background */
|
|
56
14
|
|
|
57
15
|
backdrop-filter: blur(.5px); /* Blur effect */
|
|
58
|
-
z-index: 999999999999; /* Ensure it's on top of other elements */
|
|
16
|
+
z-index: 999999999999 !important; /* Ensure it's on top of other elements */
|
|
17
|
+
transform: translate(0%, 0%) !important
|
|
59
18
|
}
|
|
60
19
|
|
|
61
20
|
.lds-ellipsis {
|
|
@@ -122,54 +81,7 @@ var LoaderStyle = (props) => {
|
|
|
122
81
|
}
|
|
123
82
|
}
|
|
124
83
|
|
|
125
|
-
`);
|
|
126
|
-
};
|
|
127
|
-
var LoaderStyle_default = LoaderStyle;
|
|
128
|
-
|
|
129
|
-
// src/app/components/Loader/Loader.tsx
|
|
130
|
-
var Loader = (props) => {
|
|
131
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(LoaderStyle_default, null), (props == null ? void 0 : props.loading) && /* @__PURE__ */ React2.createElement("div", { className: "loader" }, /* @__PURE__ */ React2.createElement("div", { className: "lds-ellipsis" }, /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null), /* @__PURE__ */ React2.createElement("div", null))));
|
|
132
|
-
};
|
|
133
|
-
var Loader_default = Loader;
|
|
134
|
-
|
|
135
|
-
// src/app/components/baseurl.ts
|
|
136
|
-
var fractalGatewayUrl = "https://api-dev.merchant-trends.com/";
|
|
137
|
-
var masterBaseUrl = "https://testapi.fractalpay.com/";
|
|
138
|
-
var baseUrl = "https://staging-widget.fractalpay.com/";
|
|
139
|
-
|
|
140
|
-
// src/app/components/Errortext.ts
|
|
141
|
-
var ErrorText = {
|
|
142
|
-
namerequired: "Full Name is required",
|
|
143
|
-
amountrequired: "Amount is required",
|
|
144
|
-
amountpositive: "Amount should be positive",
|
|
145
|
-
amountzero: "Amount should not be zero",
|
|
146
|
-
amountenter: "Please enter an amount",
|
|
147
|
-
amountvalid: "Please enter a valid amount",
|
|
148
|
-
phoneoremailrequired: "Phone or Email is required",
|
|
149
|
-
invalidemail: "Please enter a valid email",
|
|
150
|
-
invalidemailformat: "Invalid email format",
|
|
151
|
-
onlylettersallowed: "Only letters are allowed",
|
|
152
|
-
phonenumberlength: "Phone number should be 10 digits",
|
|
153
|
-
phonenumberrequired: "Please enter a phone number",
|
|
154
|
-
// phonenumbervalid:'Please enter a valid 10-digit phone number',
|
|
155
|
-
phonenumbervalid: "Please enter a valid phone number",
|
|
156
|
-
phonenumbervalidnumberonly: "Please enter a valid phone number (numbers only)",
|
|
157
|
-
orderidenter: "Please enter an order ID",
|
|
158
|
-
orderidrequired: "Order ID is required",
|
|
159
|
-
networkresponseerror: "Network response was not ok",
|
|
160
|
-
anerroroccured: "An error occurred. Please try again.",
|
|
161
|
-
montherror: "Please write month only 1 to 12",
|
|
162
|
-
fieldrequired: "This field is required",
|
|
163
|
-
fractalpayclientidrequired: "Fractalpay client key is missing or empty."
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
// src/app/components/CustomModal/CustomModal2.tsx
|
|
167
|
-
import React4 from "react";
|
|
168
|
-
|
|
169
|
-
// src/app/components/CustomModal/CustomModal2styles.tsx
|
|
170
|
-
import React3 from "react";
|
|
171
|
-
var CustomModal2styles = (props) => {
|
|
172
|
-
return /* @__PURE__ */ React3.createElement("style", null, `
|
|
84
|
+
`),Sn=En;var Wn=e=>Zt.createElement(Zt.Fragment,null,Zt.createElement(Sn,null),(e==null?void 0:e.loading)&&Zt.createElement("div",{className:"loader"},Zt.createElement("div",{className:"lds-ellipsis"},Zt.createElement("div",null),Zt.createElement("div",null),Zt.createElement("div",null),Zt.createElement("div",null)))),bt=Wn;var Ht="https://api-dev.merchant-trends.com/",le="https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/",_e="https://testapi.fractalpay.com/",Be="https://staging-widget.fractalpay.com/";var Xe={namerequired:"Full Name is required",amountrequired:"Amount is required",amountpositive:"Amount should be positive",amountzero:"Amount should not be zero",amountenter:"Please enter an amount",amountvalid:"Please enter a valid amount",phoneoremailrequired:"Phone or Email is required",invalidemail:"Please enter a valid email",invalidemailformat:"Invalid email format",onlylettersallowed:"Only letters are allowed",phonenumberlength:"Phone number should be 10 digits",phonenumberrequired:"Please enter a phone number",phonenumbervalid:"Please enter a valid phone number",phonenumbervalidnumberonly:"Please enter a valid phone number (numbers only)",orderidenter:"Please enter an order ID",orderidrequired:"Order ID is required",networkresponseerror:"Network response was not ok",anerroroccured:"An error occurred. Please try again.",montherror:"Please write month only 1 to 12",fieldrequired:"This field is required",fractalpayclientidrequired:"Fractalpay client key is missing or empty."};import tn from"react";import Un from"react";var Gn=e=>Un.createElement("style",null,`
|
|
173
85
|
.fractal-input::placeholder {
|
|
174
86
|
color: #35254D;
|
|
175
87
|
opacity: 1;
|
|
@@ -422,30 +334,7 @@ var CustomModal2styles = (props) => {
|
|
|
422
334
|
padding: 0px !important;
|
|
423
335
|
border-radius: 12px !important;
|
|
424
336
|
}
|
|
425
|
-
`);
|
|
426
|
-
};
|
|
427
|
-
var CustomModal2styles_default = CustomModal2styles;
|
|
428
|
-
|
|
429
|
-
// src/app/components/CustomModal/CustomModal2.tsx
|
|
430
|
-
var CustomModal2 = ({
|
|
431
|
-
open,
|
|
432
|
-
onClose,
|
|
433
|
-
children,
|
|
434
|
-
maxWidth
|
|
435
|
-
}) => {
|
|
436
|
-
if (!open) return null;
|
|
437
|
-
return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(CustomModal2styles_default, null), /* @__PURE__ */ React4.createElement("div", { className: "fractal-popup" }, /* @__PURE__ */ React4.createElement("div", { className: "fractal-popup-content request-payment-popup-container", style: { maxWidth: `${maxWidth != null ? maxWidth : "auto"}` } }, children)));
|
|
438
|
-
};
|
|
439
|
-
var CustomModal2_default = CustomModal2;
|
|
440
|
-
|
|
441
|
-
// src/app/components/RequestPayment/RequestPayment.tsx
|
|
442
|
-
import axios from "axios";
|
|
443
|
-
import { PatternFormat } from "react-number-format";
|
|
444
|
-
|
|
445
|
-
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
|
446
|
-
import React5 from "react";
|
|
447
|
-
var RequestPaymentstyles = (props) => {
|
|
448
|
-
return /* @__PURE__ */ React5.createElement("style", null, `
|
|
337
|
+
`),Pn=Gn;var Jn=({open:e,onClose:L,children:$,maxWidth:Z})=>e?tn.createElement(tn.Fragment,null,tn.createElement(Pn,null),tn.createElement("div",{className:"fractal-popup"},tn.createElement("div",{className:"fractal-popup-content request-payment-popup-container",style:{maxWidth:`${Z!=null?Z:"auto"}`}},$))):null,Lt=Jn;import Rn from"axios";import{PatternFormat as ei}from"react-number-format";import Xn from"react";var Qn=e=>Xn.createElement("style",null,`
|
|
449
338
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
450
339
|
body {
|
|
451
340
|
font-family: 'Inter', sans-serif !important;
|
|
@@ -686,496 +575,7 @@ var RequestPaymentstyles = (props) => {
|
|
|
686
575
|
|
|
687
576
|
font-size: 12px;
|
|
688
577
|
}
|
|
689
|
-
`);
|
|
690
|
-
};
|
|
691
|
-
var RequestPaymentstyles_default = RequestPaymentstyles;
|
|
692
|
-
|
|
693
|
-
// src/app/components/RequestPayment/RequestPayment.tsx
|
|
694
|
-
function RequestPayment(props) {
|
|
695
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
|
696
|
-
const discount = props == null ? void 0 : props.discount;
|
|
697
|
-
const tax = props == null ? void 0 : props.tax;
|
|
698
|
-
const surcharge = props == null ? void 0 : props.surcharge;
|
|
699
|
-
const [show, setShow] = useState(false);
|
|
700
|
-
const [loading, setLoading] = useState(false);
|
|
701
|
-
const [errors, setErrors] = useState({});
|
|
702
|
-
const [phone, setPhone] = useState(null);
|
|
703
|
-
const [requestDetails, setRequestDetails] = useState({
|
|
704
|
-
email: "",
|
|
705
|
-
phone_number: "",
|
|
706
|
-
order_id: "",
|
|
707
|
-
name: "",
|
|
708
|
-
fractalpayPublicKey: fractalpayClientKey
|
|
709
|
-
});
|
|
710
|
-
const [amount, setAmount] = useState("");
|
|
711
|
-
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
|
712
|
-
const [apiResponse, setApiResponse] = useState(null);
|
|
713
|
-
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
|
714
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
|
715
|
-
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
716
|
-
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
|
717
|
-
const handleClose = () => {
|
|
718
|
-
setShow(false);
|
|
719
|
-
setErrors({});
|
|
720
|
-
};
|
|
721
|
-
const handleShow = () => setShow(true);
|
|
722
|
-
const handleCloseConfirmationModal = () => {
|
|
723
|
-
console.log(apiResponse, "apiresponse");
|
|
724
|
-
handleSubmit(apiResponse);
|
|
725
|
-
setShowConfirmationModal(false);
|
|
726
|
-
};
|
|
727
|
-
function emptyFields() {
|
|
728
|
-
setRequestDetails({
|
|
729
|
-
email: "",
|
|
730
|
-
phone_number: "",
|
|
731
|
-
order_id: "",
|
|
732
|
-
name: "",
|
|
733
|
-
fractalpayPublicKey: fractalpayClientKey
|
|
734
|
-
});
|
|
735
|
-
setAmount("");
|
|
736
|
-
}
|
|
737
|
-
function handleSubmit(event) {
|
|
738
|
-
let message = {
|
|
739
|
-
type: "preview.compiledcheck",
|
|
740
|
-
other: __spreadProps(__spreadValues({}, event), { status: true })
|
|
741
|
-
};
|
|
742
|
-
window.parent.postMessage(message, "*");
|
|
743
|
-
}
|
|
744
|
-
const sendRequestPayment = async () => {
|
|
745
|
-
if (Object.keys(errors).length > 0) {
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
setErrors({});
|
|
749
|
-
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
|
750
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
751
|
-
phone: ErrorText.phonenumbervalid
|
|
752
|
-
}));
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
if (!validateForm()) {
|
|
756
|
-
return;
|
|
757
|
-
}
|
|
758
|
-
try {
|
|
759
|
-
setLoading(true);
|
|
760
|
-
const formData = {
|
|
761
|
-
fractalpayPublicKey: fractalpayClientKey,
|
|
762
|
-
amount,
|
|
763
|
-
phone_number: phone,
|
|
764
|
-
order_id: requestDetails.order_id,
|
|
765
|
-
action: "request",
|
|
766
|
-
name: requestDetails.name,
|
|
767
|
-
email: requestDetails.email,
|
|
768
|
-
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
|
|
769
|
-
discount,
|
|
770
|
-
surcharge,
|
|
771
|
-
tax,
|
|
772
|
-
require_3ds: props == null ? void 0 : props.require_3ds
|
|
773
|
-
};
|
|
774
|
-
let response = await axios.post(`${baseUrl}create-widget-order`, formData);
|
|
775
|
-
if ((response == null ? void 0 : response.status) === 200) {
|
|
776
|
-
setShowConfirmationModal(true);
|
|
777
|
-
setShow(false);
|
|
778
|
-
emptyFields();
|
|
779
|
-
setApiResponse(response == null ? void 0 : response.data);
|
|
780
|
-
}
|
|
781
|
-
setLoading(false);
|
|
782
|
-
} catch (error) {
|
|
783
|
-
console.log(error);
|
|
784
|
-
setLoading(false);
|
|
785
|
-
}
|
|
786
|
-
};
|
|
787
|
-
let favicon_logo = baseUrl + "images/logo-img.png";
|
|
788
|
-
const handleChange = (e) => {
|
|
789
|
-
const { value } = e.target;
|
|
790
|
-
const token = e.target.dataset.token;
|
|
791
|
-
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
|
792
|
-
if (token === "name" && !isAlpha(value)) {
|
|
793
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
794
|
-
[token]: ErrorText.onlylettersallowed
|
|
795
|
-
}));
|
|
796
|
-
return;
|
|
797
|
-
}
|
|
798
|
-
let errorobj = errors;
|
|
799
|
-
if (token === "email" && !phone) {
|
|
800
|
-
delete errorobj.phone;
|
|
801
|
-
setErrors(errorobj);
|
|
802
|
-
}
|
|
803
|
-
if (value) {
|
|
804
|
-
delete errorobj[token];
|
|
805
|
-
setErrors(errorobj);
|
|
806
|
-
}
|
|
807
|
-
if (token === "email" && !value) {
|
|
808
|
-
delete errorobj[token];
|
|
809
|
-
setErrors(errorobj);
|
|
810
|
-
}
|
|
811
|
-
};
|
|
812
|
-
const handleAmountChange = (data) => {
|
|
813
|
-
const { value } = data;
|
|
814
|
-
if (Number(value) > 0) {
|
|
815
|
-
let errorobj = errors;
|
|
816
|
-
delete errorobj.amount;
|
|
817
|
-
setErrors(errorobj);
|
|
818
|
-
}
|
|
819
|
-
setAmount(value);
|
|
820
|
-
};
|
|
821
|
-
const validateForm = () => {
|
|
822
|
-
let newErrors = {};
|
|
823
|
-
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
|
824
|
-
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
825
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
|
826
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
|
827
|
-
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
828
|
-
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
|
829
|
-
setErrors(newErrors);
|
|
830
|
-
return Object.keys(newErrors).length === 0;
|
|
831
|
-
};
|
|
832
|
-
useEffect(() => {
|
|
833
|
-
if (props) {
|
|
834
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
835
|
-
order_id: props.orderID ? props.orderID : "",
|
|
836
|
-
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
|
837
|
-
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
|
838
|
-
}));
|
|
839
|
-
setAmount(props.amount ? props.amount : "");
|
|
840
|
-
setPhone(props.phone ? `${props.phone}` : null);
|
|
841
|
-
}
|
|
842
|
-
}, [props]);
|
|
843
|
-
const handlePhoneChange = (e) => {
|
|
844
|
-
let value = e == null ? void 0 : e.value;
|
|
845
|
-
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
|
846
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
847
|
-
phone: ErrorText.phonenumberlength
|
|
848
|
-
}));
|
|
849
|
-
setPhone(value);
|
|
850
|
-
return;
|
|
851
|
-
} else {
|
|
852
|
-
setPhone(value);
|
|
853
|
-
}
|
|
854
|
-
let errorobj = errors;
|
|
855
|
-
delete errorobj.phone;
|
|
856
|
-
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
|
857
|
-
delete errorobj.email;
|
|
858
|
-
}
|
|
859
|
-
setErrors(errorobj);
|
|
860
|
-
};
|
|
861
|
-
function formatAmount(amount2) {
|
|
862
|
-
return new Intl.NumberFormat("en-US", {
|
|
863
|
-
style: "currency",
|
|
864
|
-
currency: "USD",
|
|
865
|
-
minimumFractionDigits: 2,
|
|
866
|
-
maximumFractionDigits: 2
|
|
867
|
-
}).format(Number(amount2));
|
|
868
|
-
}
|
|
869
|
-
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ React6.createElement(Loader_default, { loading }), /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ React6.createElement(
|
|
870
|
-
CustomModal2_default,
|
|
871
|
-
{
|
|
872
|
-
open: show,
|
|
873
|
-
onClose: () => setShow(false),
|
|
874
|
-
maxWidth: "500px"
|
|
875
|
-
},
|
|
876
|
-
/* @__PURE__ */ React6.createElement("div", { style: { maxWidth: "500px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-amount-detail frac-form" }, /* @__PURE__ */ React6.createElement("p", { className: "request-payment-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React6.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React6.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React6.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React6.createElement("defs", null, /* @__PURE__ */ React6.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React6.createElement("rect", { width: "16", height: "16", fill: "white" })))))), /* @__PURE__ */ React6.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React6.createElement(
|
|
877
|
-
"input",
|
|
878
|
-
{
|
|
879
|
-
className: "request-payment-input-box",
|
|
880
|
-
type: "text",
|
|
881
|
-
placeholder: "Full Name",
|
|
882
|
-
"data-token": "name",
|
|
883
|
-
onChange: handleChange,
|
|
884
|
-
value: requestDetails == null ? void 0 : requestDetails.name
|
|
885
|
-
}
|
|
886
|
-
), errors.name && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement("label", { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React6.createElement(
|
|
887
|
-
PatternFormat,
|
|
888
|
-
{
|
|
889
|
-
className: "request-payment-input-box",
|
|
890
|
-
placeholder: "Mobile number",
|
|
891
|
-
format: "+1 (###) ###-####",
|
|
892
|
-
value: phone,
|
|
893
|
-
onValueChange: (e) => {
|
|
894
|
-
handlePhoneChange(e);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
), errors.phone && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React6.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React6.createElement(
|
|
898
|
-
"input",
|
|
899
|
-
{
|
|
900
|
-
className: "request-payment-input-box",
|
|
901
|
-
type: "text",
|
|
902
|
-
placeholder: "Email",
|
|
903
|
-
onChange: handleChange,
|
|
904
|
-
"data-token": "email",
|
|
905
|
-
value: requestDetails == null ? void 0 : requestDetails.email
|
|
906
|
-
}
|
|
907
|
-
), errors.email && /* @__PURE__ */ React6.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React6.createElement(
|
|
908
|
-
"button",
|
|
909
|
-
{
|
|
910
|
-
type: "button",
|
|
911
|
-
className: "request-payment-submit-button",
|
|
912
|
-
onClick: sendRequestPayment,
|
|
913
|
-
disabled: loading
|
|
914
|
-
},
|
|
915
|
-
loading ? "Loading..." : "Send Request"
|
|
916
|
-
), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ React6.createElement("span", null, "Fractal"), /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ React6.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" })))))
|
|
917
|
-
), /* @__PURE__ */ React6.createElement(
|
|
918
|
-
CustomModal2_default,
|
|
919
|
-
{
|
|
920
|
-
open: showConfirmationModal,
|
|
921
|
-
onClose: handleCloseConfirmationModal,
|
|
922
|
-
maxWidth: "500px"
|
|
923
|
-
},
|
|
924
|
-
/* @__PURE__ */ React6.createElement("div", { className: "fractal-popup-content", style: { padding: "0px", maxWidth: "500px" } }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React6.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React6.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React6.createElement("defs", null, /* @__PURE__ */ React6.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React6.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React6.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React6.createElement("path", { d: "M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z", fill: "#61C699" })))), /* @__PURE__ */ React6.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React6.createElement("br", null), "was sent"), /* @__PURE__ */ React6.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React6.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React6.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
|
925
|
-
)));
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
// src/app/components/RequestPayment/RequestPreAuthPayment.tsx
|
|
929
|
-
import "bootstrap/dist/js/bootstrap.bundle.min.js";
|
|
930
|
-
import React7, { useState as useState2, useEffect as useEffect2 } from "react";
|
|
931
|
-
import axios2 from "axios";
|
|
932
|
-
import { PatternFormat as PatternFormat2 } from "react-number-format";
|
|
933
|
-
function RequestPreAuthPayment(props) {
|
|
934
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
|
935
|
-
const discount = props == null ? void 0 : props.discount;
|
|
936
|
-
const tax = props == null ? void 0 : props.tax;
|
|
937
|
-
const surcharge = props == null ? void 0 : props.surcharge;
|
|
938
|
-
const [show, setShow] = useState2(false);
|
|
939
|
-
const [loading, setLoading] = useState2(false);
|
|
940
|
-
const [errors, setErrors] = useState2({});
|
|
941
|
-
const [phone, setPhone] = useState2(null);
|
|
942
|
-
const [requestDetails, setRequestDetails] = useState2({
|
|
943
|
-
email: "",
|
|
944
|
-
phone_number: "",
|
|
945
|
-
order_id: "",
|
|
946
|
-
name: "",
|
|
947
|
-
fractalpayPublicKey: fractalpayClientKey
|
|
948
|
-
});
|
|
949
|
-
const [amount, setAmount] = useState2("");
|
|
950
|
-
const [showConfirmationModal, setShowConfirmationModal] = useState2(false);
|
|
951
|
-
const [apiResponse, setApiResponse] = useState2(null);
|
|
952
|
-
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
|
953
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
|
954
|
-
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
955
|
-
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
|
956
|
-
const handleClose = () => {
|
|
957
|
-
setShow(false);
|
|
958
|
-
setErrors({});
|
|
959
|
-
};
|
|
960
|
-
const handleShow = () => setShow(true);
|
|
961
|
-
const handleCloseConfirmationModal = () => {
|
|
962
|
-
console.log(apiResponse, "apiresponse");
|
|
963
|
-
handleSubmit(apiResponse);
|
|
964
|
-
setShowConfirmationModal(false);
|
|
965
|
-
};
|
|
966
|
-
function emptyFields() {
|
|
967
|
-
setRequestDetails({
|
|
968
|
-
email: "",
|
|
969
|
-
phone_number: "",
|
|
970
|
-
order_id: "",
|
|
971
|
-
name: "",
|
|
972
|
-
fractalpayPublicKey: fractalpayClientKey
|
|
973
|
-
});
|
|
974
|
-
setAmount("");
|
|
975
|
-
}
|
|
976
|
-
function handleSubmit(event) {
|
|
977
|
-
let message = {
|
|
978
|
-
type: "preview.compiledcheck",
|
|
979
|
-
other: __spreadProps(__spreadValues({}, event), { status: true })
|
|
980
|
-
};
|
|
981
|
-
window.parent.postMessage(message, "*");
|
|
982
|
-
}
|
|
983
|
-
const sendRequestPayment = async () => {
|
|
984
|
-
if (Object.keys(errors).length > 0) {
|
|
985
|
-
return;
|
|
986
|
-
}
|
|
987
|
-
setErrors({});
|
|
988
|
-
if (!(requestDetails == null ? void 0 : requestDetails.email) && phone && !phoneNumberRegex(phone)) {
|
|
989
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
990
|
-
phone: ErrorText.phonenumbervalid
|
|
991
|
-
}));
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
if (!validateForm()) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
try {
|
|
998
|
-
setLoading(true);
|
|
999
|
-
const formData = {
|
|
1000
|
-
fractalpayPublicKey: fractalpayClientKey,
|
|
1001
|
-
amount,
|
|
1002
|
-
phone_number: phone,
|
|
1003
|
-
order_id: requestDetails.order_id,
|
|
1004
|
-
action: "request",
|
|
1005
|
-
name: requestDetails.name,
|
|
1006
|
-
email: requestDetails.email,
|
|
1007
|
-
customer_id: (props == null ? void 0 : props.customerId) ? props == null ? void 0 : props.customerId : "",
|
|
1008
|
-
discount,
|
|
1009
|
-
surcharge,
|
|
1010
|
-
tax,
|
|
1011
|
-
require_3ds: props == null ? void 0 : props.require_3ds
|
|
1012
|
-
};
|
|
1013
|
-
let response = await axios2.post(`${baseUrl}send-request-pre-auth-payment`, formData);
|
|
1014
|
-
if ((response == null ? void 0 : response.status) === 200) {
|
|
1015
|
-
setShowConfirmationModal(true);
|
|
1016
|
-
setShow(false);
|
|
1017
|
-
emptyFields();
|
|
1018
|
-
setApiResponse(response == null ? void 0 : response.data);
|
|
1019
|
-
}
|
|
1020
|
-
setLoading(false);
|
|
1021
|
-
} catch (error) {
|
|
1022
|
-
console.log(error);
|
|
1023
|
-
setLoading(false);
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
let favicon_logo = baseUrl + "images/logo-img.png";
|
|
1027
|
-
const handleChange = (e) => {
|
|
1028
|
-
const { value } = e.target;
|
|
1029
|
-
const token = e.target.dataset.token;
|
|
1030
|
-
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
|
1031
|
-
if (token === "name" && !isAlpha(value)) {
|
|
1032
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
1033
|
-
[token]: ErrorText.onlylettersallowed
|
|
1034
|
-
}));
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
let errorobj = errors;
|
|
1038
|
-
if (token === "email" && !phone) {
|
|
1039
|
-
delete errorobj.phone;
|
|
1040
|
-
setErrors(errorobj);
|
|
1041
|
-
}
|
|
1042
|
-
if (value) {
|
|
1043
|
-
delete errorobj[token];
|
|
1044
|
-
setErrors(errorobj);
|
|
1045
|
-
}
|
|
1046
|
-
if (token === "email" && !value) {
|
|
1047
|
-
delete errorobj[token];
|
|
1048
|
-
setErrors(errorobj);
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
const handleAmountChange = (data) => {
|
|
1052
|
-
const { value } = data;
|
|
1053
|
-
if (Number(value) > 0) {
|
|
1054
|
-
let errorobj = errors;
|
|
1055
|
-
delete errorobj.amount;
|
|
1056
|
-
setErrors(errorobj);
|
|
1057
|
-
}
|
|
1058
|
-
setAmount(value);
|
|
1059
|
-
};
|
|
1060
|
-
const validateForm = () => {
|
|
1061
|
-
let newErrors = {};
|
|
1062
|
-
if (!amount) newErrors.amount = ErrorText.amountrequired;
|
|
1063
|
-
if (requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
1064
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone = ErrorText.phoneoremailrequired;
|
|
1065
|
-
if (!phone && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.phoneoremailrequired;
|
|
1066
|
-
if (!phone && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
|
1067
|
-
if (props.from === "merchant" && !requestDetails.order_id) newErrors.order_id = ErrorText.orderidrequired;
|
|
1068
|
-
setErrors(newErrors);
|
|
1069
|
-
return Object.keys(newErrors).length === 0;
|
|
1070
|
-
};
|
|
1071
|
-
useEffect2(() => {
|
|
1072
|
-
if (props) {
|
|
1073
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
1074
|
-
order_id: props.orderID ? props.orderID : "",
|
|
1075
|
-
name: (props == null ? void 0 : props.name) ? props == null ? void 0 : props.name : "",
|
|
1076
|
-
email: (props == null ? void 0 : props.email) ? props == null ? void 0 : props.email : ""
|
|
1077
|
-
}));
|
|
1078
|
-
setAmount(props.amount ? props.amount : "");
|
|
1079
|
-
setPhone(props.phone ? `${props.phone}` : null);
|
|
1080
|
-
}
|
|
1081
|
-
}, [props]);
|
|
1082
|
-
const handlePhoneChange = (e) => {
|
|
1083
|
-
let value = e == null ? void 0 : e.value;
|
|
1084
|
-
if (value && (value == null ? void 0 : value.length) > 0 && (value == null ? void 0 : value.length) !== 10) {
|
|
1085
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
|
1086
|
-
phone: ErrorText.phonenumberlength
|
|
1087
|
-
}));
|
|
1088
|
-
setPhone(value);
|
|
1089
|
-
return;
|
|
1090
|
-
} else {
|
|
1091
|
-
setPhone(value);
|
|
1092
|
-
}
|
|
1093
|
-
let errorobj = errors;
|
|
1094
|
-
delete errorobj.phone;
|
|
1095
|
-
if (value && !(requestDetails == null ? void 0 : requestDetails.email)) {
|
|
1096
|
-
delete errorobj.email;
|
|
1097
|
-
}
|
|
1098
|
-
setErrors(errorobj);
|
|
1099
|
-
};
|
|
1100
|
-
function formatAmount(amount2) {
|
|
1101
|
-
return new Intl.NumberFormat("en-US", {
|
|
1102
|
-
style: "currency",
|
|
1103
|
-
currency: "USD",
|
|
1104
|
-
minimumFractionDigits: 2,
|
|
1105
|
-
maximumFractionDigits: 2
|
|
1106
|
-
}).format(Number(amount2));
|
|
1107
|
-
}
|
|
1108
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ React7.createElement(Loader_default, { loading }), /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Send Request"), /* @__PURE__ */ React7.createElement("div", { className: "frac-form" }, /* @__PURE__ */ React7.createElement(
|
|
1109
|
-
CustomModal2_default,
|
|
1110
|
-
{
|
|
1111
|
-
open: show,
|
|
1112
|
-
onClose: () => setShow(false),
|
|
1113
|
-
maxWidth: "500px"
|
|
1114
|
-
},
|
|
1115
|
-
/* @__PURE__ */ React7.createElement("div", { className: "request-payment-amount-detail" }, /* @__PURE__ */ React7.createElement("p", { className: "request-payment-merchantname" }, "Authorization Request"), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-pre-auth-merchantname" }, "Pay ", props == null ? void 0 : props.webname), /* @__PURE__ */ React7.createElement("p", { className: "request-payment-amount" }, formatAmount(props == null ? void 0 : props.amount)), (props == null ? void 0 : props.from) === "merchant" && /* @__PURE__ */ React7.createElement("p", { className: "request-payment-orderid" }, requestDetails == null ? void 0 : requestDetails.order_id), /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" })))))),
|
|
1116
|
-
/* @__PURE__ */ React7.createElement("form", { className: "request-payment-input-form" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "FULL NAME"), /* @__PURE__ */ React7.createElement(
|
|
1117
|
-
"input",
|
|
1118
|
-
{
|
|
1119
|
-
className: "request-payment-input-box",
|
|
1120
|
-
type: "text",
|
|
1121
|
-
placeholder: "Full Name",
|
|
1122
|
-
"data-token": "name",
|
|
1123
|
-
onChange: handleChange,
|
|
1124
|
-
value: requestDetails == null ? void 0 : requestDetails.name
|
|
1125
|
-
}
|
|
1126
|
-
), errors.name && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.name)), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "requestPhoneNumber", className: "request-payment-input-label" }, "Phone Number"), /* @__PURE__ */ React7.createElement(
|
|
1127
|
-
PatternFormat2,
|
|
1128
|
-
{
|
|
1129
|
-
className: "request-payment-input-box",
|
|
1130
|
-
placeholder: "Mobile number",
|
|
1131
|
-
format: "+1 (###) ###-####",
|
|
1132
|
-
value: phone,
|
|
1133
|
-
onValueChange: (e) => {
|
|
1134
|
-
handlePhoneChange(e);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
), errors.phone && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.phone)), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-list-div" }, /* @__PURE__ */ React7.createElement("label", { htmlFor: "exampleFormControlInput2", className: "request-payment-input-label" }, "EMAIL"), /* @__PURE__ */ React7.createElement(
|
|
1138
|
-
"input",
|
|
1139
|
-
{
|
|
1140
|
-
className: "request-payment-input-box",
|
|
1141
|
-
type: "text",
|
|
1142
|
-
placeholder: "Email",
|
|
1143
|
-
onChange: handleChange,
|
|
1144
|
-
"data-token": "email",
|
|
1145
|
-
value: requestDetails == null ? void 0 : requestDetails.email
|
|
1146
|
-
}
|
|
1147
|
-
), errors.email && /* @__PURE__ */ React7.createElement("small", { className: "request-payment-error-msg" }, errors.email)), /* @__PURE__ */ React7.createElement(
|
|
1148
|
-
"button",
|
|
1149
|
-
{
|
|
1150
|
-
type: "button",
|
|
1151
|
-
className: "request-payment-submit-button",
|
|
1152
|
-
onClick: sendRequestPayment,
|
|
1153
|
-
disabled: loading
|
|
1154
|
-
},
|
|
1155
|
-
loading ? "Loading..." : "Send Request"
|
|
1156
|
-
), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-fractal-powerd-by" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "17", height: "16", viewBox: "0 0 17 16", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z", fill: "#727272" })), "Secure payments powered by ", /* @__PURE__ */ React7.createElement("span", null, "Fractal"), /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z", fill: "#61C699" }), /* @__PURE__ */ React7.createElement("path", { d: "M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z", fill: "#61C699" }))))
|
|
1157
|
-
), /* @__PURE__ */ React7.createElement(
|
|
1158
|
-
CustomModal2_default,
|
|
1159
|
-
{
|
|
1160
|
-
open: showConfirmationModal,
|
|
1161
|
-
onClose: handleCloseConfirmationModal,
|
|
1162
|
-
maxWidth: "500px"
|
|
1163
|
-
},
|
|
1164
|
-
/* @__PURE__ */ React7.createElement("div", { className: "fractal-popup-content", style: { padding: "0px", maxWidth: "500px" } }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-container" }, /* @__PURE__ */ React7.createElement("span", { className: "request-payment-close-popup", onClick: handleCloseConfirmationModal }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React7.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React7.createElement("defs", null, /* @__PURE__ */ React7.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React7.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick-div" }, /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-tick" }, /* @__PURE__ */ React7.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React7.createElement("path", { d: "M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z", fill: "#61C699" })))), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-text" }, "The request ", /* @__PURE__ */ React7.createElement("br", null), "was sent"), /* @__PURE__ */ React7.createElement("h6", { className: "request-payment-success-subtext" }, "Please wait for the customer to pay"), /* @__PURE__ */ React7.createElement("div", { className: "request-payment-success-btn-div" }, /* @__PURE__ */ React7.createElement("button", { onClick: handleCloseConfirmationModal, className: "request-payment-success-btn2" }, "Close"))))
|
|
1165
|
-
))));
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
// src/app/components/Charge/GetPaymentPage.tsx
|
|
1169
|
-
import React13, { useEffect as useEffect4, useState as useState3 } from "react";
|
|
1170
|
-
|
|
1171
|
-
// src/app/components/Charge/Chargewidgetstyles.tsx
|
|
1172
|
-
import React8 from "react";
|
|
1173
|
-
function Chargewidgetstyles() {
|
|
1174
|
-
const primarycolor = "#000";
|
|
1175
|
-
const primarybgcolor = "#fff";
|
|
1176
|
-
const primarybodycolor = "#212529";
|
|
1177
|
-
const primarybordercolor = "#dee2e6";
|
|
1178
|
-
return /* @__PURE__ */ React8.createElement("style", null, `
|
|
578
|
+
`),pn=Qn;function ti(e){let L=e.merchantPublicKey,$=e==null?void 0:e.discount,Z=e==null?void 0:e.tax,j=e==null?void 0:e.surcharge,[Ye,B]=Et(!1),[Qe,xe]=Et(!1),[ie,u]=Et({}),[E,C]=Et(null),[y,a]=Et({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:L}),[de,b]=Et(""),[pe,h]=Et(!1),[Ae,K]=Et(null),ue=p=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(p),ct=/[+-]?([0-9]*[.])?[0-9]+/,$e=p=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p),nt=p=>/^[A-Za-z\s]*$/.test(p),w=()=>{B(!1),u({})},be=()=>B(!0),W=()=>{console.log(Ae,"apiresponse"),g(Ae),h(!1)};function k(){a({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:L}),b("")}function g(p){let r={type:"preview.compiledcheck",other:I(_({},p),{status:!0})};window.parent.postMessage(r,"*")}let me=async()=>{if(!(Object.keys(ie).length>0)){if(u({}),!(y!=null&&y.email)&&E&&!ue(E)){u(p=>I(_({},p),{phone:Xe.phonenumbervalid}));return}if(v())try{xe(!0);let p={fractalpayPublicKey:L,amount:de,phone_number:E,order_id:y.order_id,action:"request",name:y.name,email:y.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:$,surcharge:j,tax:Z,require_3ds:e==null?void 0:e.require_3ds},r=await Rn.post(`${Be}create-widget-order`,p);(r==null?void 0:r.status)===200&&(h(!0),B(!1),k(),K(r==null?void 0:r.data)),xe(!1)}catch(p){console.log(p),xe(!1)}}},R=Be+"images/logo-img.png",m=p=>{let{value:r}=p.target,z=p.target.dataset.token;if(a(I(_({},y),{[z]:r})),z==="name"&&!nt(r)){u(Ne=>I(_({},Ne),{[z]:Xe.onlylettersallowed}));return}let A=ie;z==="email"&&!E&&(delete A.phone,u(A)),r&&(delete A[z],u(A)),z==="email"&&!r&&(delete A[z],u(A))},d=p=>{let{value:r}=p;if(Number(r)>0){let z=ie;delete z.amount,u(z)}b(r)},v=()=>{let p={};return de||(p.amount=Xe.amountrequired),y.email&&!$e(y==null?void 0:y.email)&&(p.email=Xe.invalidemail),!E&&!(y!=null&&y.email)&&(p.phone=Xe.phoneoremailrequired),!E&&!(y!=null&&y.email)&&(p.email=Xe.phoneoremailrequired),!E&&y.email&&!$e(y==null?void 0:y.email)&&(p.email=Xe.invalidemail),e.from==="merchant"&&!y.order_id&&(p.order_id=Xe.orderidrequired),u(p),Object.keys(p).length===0};Dn(()=>{e&&(a(p=>I(_({},p),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),b(e.amount?e.amount:""),C(e.phone?`${e.phone}`:null))},[e]);let J=p=>{let r=p==null?void 0:p.value;if(r&&(r==null?void 0:r.length)>0&&(r==null?void 0:r.length)!==10){u(A=>I(_({},A),{phone:Xe.phonenumberlength})),C(r);return}else C(r);let z=ie;delete z.phone,r&&!(y!=null&&y.email)&&delete z.email,u(z)};function x(p){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(p))}return M.createElement(M.Fragment,null,M.createElement(pn,null),M.createElement(bt,{loading:Qe}),M.createElement(M.Fragment,null,M.createElement("button",{className:"paymentBtn",onClick:be},"Request Payment"),M.createElement(Lt,{open:Ye,onClose:()=>B(!1),maxWidth:"500px"},M.createElement("div",{style:{maxWidth:"500px"}},M.createElement("div",{className:"request-payment-amount-detail frac-form"},M.createElement("p",{className:"request-payment-merchantname"},"Pay ",e==null?void 0:e.webname),M.createElement("p",{className:"request-payment-amount"},x(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&M.createElement("p",{className:"request-payment-orderid"},y==null?void 0:y.order_id),M.createElement("span",{className:"request-payment-close-popup",onClick:w},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("g",{clipPath:"url(#clip0_12425_52336)"},M.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),M.createElement("defs",null,M.createElement("clipPath",{id:"clip0_12425_52336"},M.createElement("rect",{width:"16",height:"16",fill:"white"})))))),M.createElement("form",{className:"request-payment-input-form"},M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),M.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:m,value:y==null?void 0:y.name}),ie.name&&M.createElement("small",{className:"request-payment-error-msg"},ie.name)),M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),M.createElement(ei,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:E,onValueChange:p=>{J(p)}}),ie.phone&&M.createElement("small",{className:"request-payment-error-msg"},ie.phone)),M.createElement("div",{className:"request-payment-list-div"},M.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),M.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:m,"data-token":"email",value:y==null?void 0:y.email}),ie.email&&M.createElement("small",{className:"request-payment-error-msg"},ie.email)),M.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:me,disabled:Qe},Qe?"Loading...":"Send Request"),M.createElement("div",{className:"request-payment-fractal-powerd-by"},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},M.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",M.createElement("span",null,"Fractal"),M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},M.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),M.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),M.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),M.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),M.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),M.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),M.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),M.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),M.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),M.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),M.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),M.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),M.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),M.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),M.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),M.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),M.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),M.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"})))))),M.createElement(Lt,{open:pe,onClose:W,maxWidth:"500px"},M.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},M.createElement("div",{className:"request-payment-success-container"},M.createElement("span",{className:"request-payment-close-popup",onClick:W},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("g",{clipPath:"url(#clip0_12425_52336)"},M.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),M.createElement("defs",null,M.createElement("clipPath",{id:"clip0_12425_52336"},M.createElement("rect",{width:"16",height:"16",fill:"white"}))))),M.createElement("div",{className:"request-payment-success-tick-div"},M.createElement("div",{className:"request-payment-success-tick"},M.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},M.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),M.createElement("h6",{className:"request-payment-success-text"},"The request ",M.createElement("br",null),"was sent"),M.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),M.createElement("div",{className:"request-payment-success-btn-div"},M.createElement("button",{onClick:W,className:"request-payment-success-btn2"},"Close")))))))}import"bootstrap/dist/js/bootstrap.bundle.min.js";import S,{useState as Wt,useEffect as ni}from"react";import ii from"axios";import{PatternFormat as oi}from"react-number-format";function ai(e){let L=e.merchantPublicKey,$=e==null?void 0:e.discount,Z=e==null?void 0:e.tax,j=e==null?void 0:e.surcharge,[Ye,B]=Wt(!1),[Qe,xe]=Wt(!1),[ie,u]=Wt({}),[E,C]=Wt(null),[y,a]=Wt({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:L}),[de,b]=Wt(""),[pe,h]=Wt(!1),[Ae,K]=Wt(null),ue=p=>/^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(p),ct=/[+-]?([0-9]*[.])?[0-9]+/,$e=p=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p),nt=p=>/^[A-Za-z\s]*$/.test(p),w=()=>{B(!1),u({})},be=()=>B(!0),W=()=>{console.log(Ae,"apiresponse"),g(Ae),h(!1)};function k(){a({email:"",phone_number:"",order_id:"",name:"",fractalpayPublicKey:L}),b("")}function g(p){let r={type:"preview.compiledcheck",other:I(_({},p),{status:!0})};window.parent.postMessage(r,"*")}let me=async()=>{if(!(Object.keys(ie).length>0)){if(u({}),!(y!=null&&y.email)&&E&&!ue(E)){u(p=>I(_({},p),{phone:Xe.phonenumbervalid}));return}if(v())try{xe(!0);let p={fractalpayPublicKey:L,amount:de,phone_number:E,order_id:y.order_id,action:"request",name:y.name,email:y.email,customer_id:e!=null&&e.customerId?e==null?void 0:e.customerId:"",discount:$,surcharge:j,tax:Z,require_3ds:e==null?void 0:e.require_3ds},r=await ii.post(`${Be}send-request-pre-auth-payment`,p);(r==null?void 0:r.status)===200&&(h(!0),B(!1),k(),K(r==null?void 0:r.data)),xe(!1)}catch(p){console.log(p),xe(!1)}}},R=Be+"images/logo-img.png",m=p=>{let{value:r}=p.target,z=p.target.dataset.token;if(a(I(_({},y),{[z]:r})),z==="name"&&!nt(r)){u(Ne=>I(_({},Ne),{[z]:Xe.onlylettersallowed}));return}let A=ie;z==="email"&&!E&&(delete A.phone,u(A)),r&&(delete A[z],u(A)),z==="email"&&!r&&(delete A[z],u(A))},d=p=>{let{value:r}=p;if(Number(r)>0){let z=ie;delete z.amount,u(z)}b(r)},v=()=>{let p={};return de||(p.amount=Xe.amountrequired),y.email&&!$e(y==null?void 0:y.email)&&(p.email=Xe.invalidemail),!E&&!(y!=null&&y.email)&&(p.phone=Xe.phoneoremailrequired),!E&&!(y!=null&&y.email)&&(p.email=Xe.phoneoremailrequired),!E&&y.email&&!$e(y==null?void 0:y.email)&&(p.email=Xe.invalidemail),e.from==="merchant"&&!y.order_id&&(p.order_id=Xe.orderidrequired),u(p),Object.keys(p).length===0};ni(()=>{e&&(a(p=>I(_({},p),{order_id:e.orderID?e.orderID:"",name:e!=null&&e.name?e==null?void 0:e.name:"",email:e!=null&&e.email?e==null?void 0:e.email:""})),b(e.amount?e.amount:""),C(e.phone?`${e.phone}`:null))},[e]);let J=p=>{let r=p==null?void 0:p.value;if(r&&(r==null?void 0:r.length)>0&&(r==null?void 0:r.length)!==10){u(A=>I(_({},A),{phone:Xe.phonenumberlength})),C(r);return}else C(r);let z=ie;delete z.phone,r&&!(y!=null&&y.email)&&delete z.email,u(z)};function x(p){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(Number(p))}return S.createElement(S.Fragment,null,S.createElement(pn,null),S.createElement(bt,{loading:Qe}),S.createElement(S.Fragment,null,S.createElement("button",{className:"paymentBtn",onClick:be},"Send Request"),S.createElement("div",{className:"frac-form"},S.createElement(Lt,{open:Ye,onClose:()=>B(!1),maxWidth:"500px"},S.createElement("div",{className:"request-payment-amount-detail"},S.createElement("p",{className:"request-payment-merchantname"},"Authorization Request"),S.createElement("p",{className:"request-payment-pre-auth-merchantname"},"Pay ",e==null?void 0:e.webname),S.createElement("p",{className:"request-payment-amount"},x(e==null?void 0:e.amount)),(e==null?void 0:e.from)==="merchant"&&S.createElement("p",{className:"request-payment-orderid"},y==null?void 0:y.order_id),S.createElement("span",{className:"request-payment-close-popup",onClick:w},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},S.createElement("g",{clipPath:"url(#clip0_12425_52336)"},S.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),S.createElement("defs",null,S.createElement("clipPath",{id:"clip0_12425_52336"},S.createElement("rect",{width:"16",height:"16",fill:"white"})))))),S.createElement("form",{className:"request-payment-input-form"},S.createElement("div",{className:"request-payment-list-div"},S.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"FULL NAME"),S.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Full Name","data-token":"name",onChange:m,value:y==null?void 0:y.name}),ie.name&&S.createElement("small",{className:"request-payment-error-msg"},ie.name)),S.createElement("div",{className:"request-payment-list-div"},S.createElement("label",{htmlFor:"requestPhoneNumber",className:"request-payment-input-label"},"Phone Number"),S.createElement(oi,{className:"request-payment-input-box",placeholder:"Mobile number",format:"+1 (###) ###-####",value:E,onValueChange:p=>{J(p)}}),ie.phone&&S.createElement("small",{className:"request-payment-error-msg"},ie.phone)),S.createElement("div",{className:"request-payment-list-div"},S.createElement("label",{htmlFor:"exampleFormControlInput2",className:"request-payment-input-label"},"EMAIL"),S.createElement("input",{className:"request-payment-input-box",type:"text",placeholder:"Email",onChange:m,"data-token":"email",value:y==null?void 0:y.email}),ie.email&&S.createElement("small",{className:"request-payment-error-msg"},ie.email)),S.createElement("button",{type:"button",className:"request-payment-submit-button",onClick:me,disabled:Qe},Qe?"Loading...":"Send Request"),S.createElement("div",{className:"request-payment-fractal-powerd-by"},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},S.createElement("path",{d:"M15.2165 4.11839C15.1973 3.69746 15.1973 3.29567 15.1973 2.89387C15.1973 2.56861 14.9486 2.31988 14.6234 2.31988C12.2317 2.31988 10.4141 1.63109 8.90257 0.157848C8.67298 -0.0526158 8.32858 -0.0526158 8.09898 0.157848C6.58748 1.63109 4.76984 2.31988 2.37821 2.31988C2.05295 2.31988 1.80422 2.56861 1.80422 2.89387C1.80422 3.29567 1.80422 3.69746 1.78508 4.11839C1.70855 8.13632 1.59375 13.6466 8.30945 15.9617L8.50078 16L8.69211 15.9617C15.3887 13.6466 15.293 8.15546 15.2165 4.11839ZM8.04159 9.6861C7.92679 9.78176 7.79286 9.83916 7.63979 9.83916H7.62066C7.46759 9.83916 7.31453 9.76263 7.21887 9.64783L5.43949 7.67713L6.30048 6.91181L7.69719 8.46158L10.7967 5.5151L11.5812 6.35695L8.04159 9.6861Z",fill:"#727272"})),"Secure payments powered by ",S.createElement("span",null,"Fractal"),S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},S.createElement("path",{d:"M17.4999 5.49758V7.01156C17.4999 7.05924 17.4595 7.09898 17.411 7.09898H12.3516C12.9169 6.54266 13.4781 5.99032 14.0434 5.434C14.0596 5.4181 14.0838 5.41016 14.104 5.41016H17.411C17.4595 5.41016 17.4999 5.44989 17.4999 5.49758Z",fill:"#61C699"}),S.createElement("path",{d:"M12.3462 10.9037V9.29836C12.3462 9.25067 12.3866 9.21094 12.435 9.21094H13.8523C13.929 9.21094 13.9694 9.30631 13.9129 9.35796C13.392 9.87455 12.8711 10.3911 12.3462 10.9037Z",fill:"#61C699"}),S.createElement("path",{d:"M12.4404 9.00523H15.6949C15.7434 9.00523 15.7838 8.96549 15.7838 8.91781V7.40383C15.7838 7.35614 15.7434 7.31641 15.6949 7.31641H12.4404C12.3919 7.31641 12.3516 7.35614 12.3516 7.40383V8.91781C12.3516 8.96549 12.3919 9.00523 12.4404 9.00523Z",fill:"#61C699"}),S.createElement("path",{d:"M10.1581 0.0120725L11.4906 0.77105C11.531 0.794892 11.5471 0.84655 11.5229 0.890261L8.99114 5.20173C8.78521 4.44275 8.57927 3.68775 8.37334 2.92877C8.36527 2.90493 8.3693 2.88109 8.38142 2.86122L10.0329 0.0438621C10.0612 0.000151419 10.1177 -0.0117697 10.1581 0.0120725Z",fill:"#61C699"}),S.createElement("path",{d:"M12.3382 7.10006L10.9289 6.29737C10.8886 6.27353 10.8724 6.22187 10.8966 6.17816L11.6033 4.97015C11.6436 4.9026 11.7446 4.91452 11.7648 4.99002C11.9546 5.69734 12.1484 6.40068 12.3382 7.10006Z",fill:"#61C699"}),S.createElement("path",{d:"M10.7107 6.0771L12.338 3.30345C12.3622 3.26372 12.346 3.20808 12.3057 3.18424L10.9732 2.42526C10.9328 2.40142 10.8763 2.41732 10.852 2.45705L9.22476 5.2307C9.20053 5.27044 9.21669 5.32607 9.25706 5.34991L10.5896 6.10889C10.634 6.13273 10.6865 6.11683 10.7107 6.0771Z",fill:"#61C699"}),S.createElement("path",{d:"M1.66713 3.51237L2.99963 2.75339C3.04001 2.72955 3.09654 2.74544 3.12077 2.78518L5.65251 7.09665C4.88128 6.89399 4.11408 6.69133 3.34285 6.48867C3.31862 6.4847 3.30247 6.4688 3.29036 6.44893L1.63483 3.63158C1.6106 3.58787 1.62271 3.53621 1.66713 3.51237Z",fill:"#61C699"}),S.createElement("path",{d:"M8.99793 5.20018L7.58871 5.99889C7.54833 6.02274 7.4918 6.00684 7.46757 5.9671L6.76095 4.76307C6.72057 4.69552 6.78517 4.61605 6.86189 4.63591C7.57256 4.82268 8.28726 5.00944 8.99793 5.20018Z",fill:"#61C699"}),S.createElement("path",{d:"M7.27986 6.07054L5.6526 3.2969C5.62837 3.25716 5.57588 3.24127 5.53146 3.26511L4.19896 4.02409C4.15858 4.04793 4.14243 4.09959 4.16666 4.1433L5.79392 6.91694C5.81815 6.95668 5.87064 6.97257 5.91506 6.94873L7.24756 6.18975C7.28794 6.16591 7.30409 6.11425 7.27986 6.07054Z",fill:"#61C699"}),S.createElement("path",{d:"M0.5 12.4998V10.9859C0.5 10.9382 0.540379 10.8984 0.588833 10.8984H5.64829C5.08299 11.4548 4.52172 12.0071 3.95642 12.5634C3.94027 12.5793 3.91604 12.5873 3.89585 12.5873H0.588833C0.540379 12.5873 0.5 12.5475 0.5 12.4998Z",fill:"#61C699"}),S.createElement("path",{d:"M5.65129 7.09766V8.70303C5.65129 8.75072 5.61091 8.79045 5.56246 8.79045H4.14516C4.06844 8.79045 4.02806 8.69508 4.08459 8.64343C4.60548 8.12685 5.12637 7.61424 5.65129 7.09766Z",fill:"#61C699"}),S.createElement("path",{d:"M5.55967 8.99609H2.30514C2.25669 8.99609 2.21631 9.03583 2.21631 9.08352V10.5975C2.21631 10.6452 2.25669 10.6849 2.30514 10.6849H5.55967C5.60813 10.6849 5.6485 10.6452 5.6485 10.5975V9.08352C5.6485 9.03583 5.60813 8.99609 5.55967 8.99609Z",fill:"#61C699"}),S.createElement("path",{d:"M7.82638 17.9865L6.49388 17.2276C6.4535 17.2037 6.43735 17.1521 6.46158 17.1083L8.99333 12.7969C9.19926 13.5559 9.40519 14.3109 9.61112 15.0698C9.6192 15.0937 9.61516 15.1175 9.60305 15.1374L7.95155 17.9547C7.91925 17.9985 7.86676 18.0104 7.82638 17.9865Z",fill:"#61C699"}),S.createElement("path",{d:"M5.64795 10.8984L7.05717 11.7011C7.09755 11.725 7.1137 11.7766 7.08947 11.8203L6.38284 13.0283C6.34246 13.0959 6.24152 13.084 6.22133 13.0085C6.02751 12.3012 5.83773 11.5978 5.64795 10.8984Z",fill:"#61C699"}),S.createElement("path",{d:"M7.2739 11.9258L5.64664 14.6994C5.62241 14.7392 5.63856 14.7948 5.67894 14.8187L7.01144 15.5776C7.05182 15.6015 7.10835 15.5856 7.13258 15.5458L8.75984 12.7722C8.78407 12.7325 8.76792 12.6768 8.72754 12.653L7.39504 11.894C7.35062 11.8702 7.29813 11.8861 7.2739 11.9258Z",fill:"#61C699"}),S.createElement("path",{d:"M16.3199 14.4866L14.9874 15.2456C14.947 15.2694 14.8904 15.2535 14.8662 15.2138L12.3345 10.9023C13.1057 11.105 13.8729 11.3077 14.6441 11.5103C14.6684 11.5143 14.6845 11.5302 14.6966 11.5501L16.3481 14.3674C16.3764 14.4111 16.3643 14.4628 16.3199 14.4866Z",fill:"#61C699"}),S.createElement("path",{d:"M8.99121 12.7983L10.4004 11.9956C10.4408 11.9717 10.4973 11.9876 10.5216 12.0274L11.2282 13.2354C11.2686 13.3029 11.204 13.3824 11.1272 13.3625C10.4166 13.1758 9.70188 12.989 8.99121 12.7983Z",fill:"#61C699"}),S.createElement("path",{d:"M10.7077 11.9285L12.3349 14.7021C12.3592 14.7418 12.4117 14.7577 12.4561 14.7339L13.7886 13.9749C13.829 13.9511 13.8451 13.8994 13.8209 13.8557L12.1936 11.0821C12.1694 11.0423 12.1169 11.0264 12.0725 11.0503L10.74 11.8092C10.6996 11.8331 10.6834 11.8847 10.7077 11.9285Z",fill:"#61C699"}))))),S.createElement(Lt,{open:pe,onClose:W,maxWidth:"500px"},S.createElement("div",{className:"fractal-popup-content",style:{padding:"0px",maxWidth:"500px"}},S.createElement("div",{className:"request-payment-success-container"},S.createElement("span",{className:"request-payment-close-popup",onClick:W},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},S.createElement("g",{clipPath:"url(#clip0_12425_52336)"},S.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),S.createElement("defs",null,S.createElement("clipPath",{id:"clip0_12425_52336"},S.createElement("rect",{width:"16",height:"16",fill:"white"}))))),S.createElement("div",{className:"request-payment-success-tick-div"},S.createElement("div",{className:"request-payment-success-tick"},S.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},S.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),S.createElement("h6",{className:"request-payment-success-text"},"The request ",S.createElement("br",null),"was sent"),S.createElement("h6",{className:"request-payment-success-subtext"},"Please wait for the customer to pay"),S.createElement("div",{className:"request-payment-success-btn-div"},S.createElement("button",{onClick:W,className:"request-payment-success-btn2"},"Close"))))))))}import t,{useEffect as pi,useState as et}from"react";import ri from"react";function nn(){let e="#000",L="#fff",$="#212529",Z="#dee2e6";return ri.createElement("style",null,`
|
|
1179
579
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1180
580
|
body
|
|
1181
581
|
{
|
|
@@ -1297,7 +697,7 @@ function Chargewidgetstyles() {
|
|
|
1297
697
|
border-radius: 5px;
|
|
1298
698
|
box-shadow: inherit;
|
|
1299
699
|
outline: none;
|
|
1300
|
-
color: ${
|
|
700
|
+
color: ${e};
|
|
1301
701
|
}
|
|
1302
702
|
|
|
1303
703
|
/* Change background color of buttons on hover */
|
|
@@ -1404,13 +804,13 @@ function Chargewidgetstyles() {
|
|
|
1404
804
|
font-size: 1rem;
|
|
1405
805
|
font-weight: 400;
|
|
1406
806
|
line-height: 1.5;
|
|
1407
|
-
color: ${
|
|
807
|
+
color: ${$};
|
|
1408
808
|
-webkit-appearance: none;
|
|
1409
809
|
-moz-appearance: none;
|
|
1410
810
|
appearance: none;
|
|
1411
|
-
background-color: ${
|
|
811
|
+
background-color: ${L};
|
|
1412
812
|
background-clip: padding-box;
|
|
1413
|
-
border: 1px solid ${
|
|
813
|
+
border: 1px solid ${Z};
|
|
1414
814
|
border-radius: 0.375rem;
|
|
1415
815
|
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
1416
816
|
}
|
|
@@ -1428,7 +828,7 @@ function Chargewidgetstyles() {
|
|
|
1428
828
|
}
|
|
1429
829
|
.card-crdi {
|
|
1430
830
|
display: flex;
|
|
1431
|
-
border: 1px solid ${
|
|
831
|
+
border: 1px solid ${Z};
|
|
1432
832
|
border-radius: 0.375rem;
|
|
1433
833
|
}
|
|
1434
834
|
.card-expiry-new{
|
|
@@ -1454,7 +854,7 @@ function Chargewidgetstyles() {
|
|
|
1454
854
|
border-top-right-radius: 0;
|
|
1455
855
|
border-bottom-right-radius: 0;
|
|
1456
856
|
border: 0;
|
|
1457
|
-
border-right: 1px solid ${
|
|
857
|
+
border-right: 1px solid ${Z};
|
|
1458
858
|
}
|
|
1459
859
|
|
|
1460
860
|
|
|
@@ -1468,7 +868,7 @@ function Chargewidgetstyles() {
|
|
|
1468
868
|
border-radius: 0;
|
|
1469
869
|
border-top: 0;
|
|
1470
870
|
border-bottom: 0;
|
|
1471
|
-
border-right: 1px solid ${
|
|
871
|
+
border-right: 1px solid ${Z};
|
|
1472
872
|
}
|
|
1473
873
|
|
|
1474
874
|
.exp-date input:focus {
|
|
@@ -1654,7 +1054,7 @@ function Chargewidgetstyles() {
|
|
|
1654
1054
|
font-weight: 500;
|
|
1655
1055
|
line-height: 24px;
|
|
1656
1056
|
letter-spacing: -0.28px;
|
|
1657
|
-
margin-bottom: 50px;
|
|
1057
|
+
// margin-bottom: 50px;
|
|
1658
1058
|
}
|
|
1659
1059
|
.charge-payment-back-btn {
|
|
1660
1060
|
display: flex;
|
|
@@ -1769,19 +1169,7 @@ function Chargewidgetstyles() {
|
|
|
1769
1169
|
|
|
1770
1170
|
|
|
1771
1171
|
|
|
1772
|
-
`);
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
// src/app/components/Charge/GetPaymentPage.tsx
|
|
1776
|
-
import axios3 from "axios";
|
|
1777
|
-
|
|
1778
|
-
// src/app/components/SuccessMessage/SuccessMsz.tsx
|
|
1779
|
-
import React10 from "react";
|
|
1780
|
-
|
|
1781
|
-
// src/app/components/SuccessMessage/SuccessMszStyle.tsx
|
|
1782
|
-
import React9 from "react";
|
|
1783
|
-
function SuccessMszStyle() {
|
|
1784
|
-
return /* @__PURE__ */ React9.createElement("style", null, `
|
|
1172
|
+
`)}import Dt from"axios";import we from"react";import si from"react";function fn(){return si.createElement("style",null,`
|
|
1785
1173
|
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1786
1174
|
|
|
1787
1175
|
body{
|
|
@@ -1976,160 +1364,7 @@ function SuccessMszStyle() {
|
|
|
1976
1364
|
gap: 6px;
|
|
1977
1365
|
background-color: #161616;
|
|
1978
1366
|
color: #fff;
|
|
1979
|
-
}`);
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
// src/app/components/SuccessMessage/HandleSubmit.tsx
|
|
1983
|
-
function HandleSubmit(event, key, tranId) {
|
|
1984
|
-
event.preventDefault();
|
|
1985
|
-
const status = key === "close";
|
|
1986
|
-
const message = {
|
|
1987
|
-
type: "preview.compiledcheck",
|
|
1988
|
-
other: {
|
|
1989
|
-
msg: "Payment success!",
|
|
1990
|
-
status,
|
|
1991
|
-
data: {
|
|
1992
|
-
tran_id: tranId,
|
|
1993
|
-
key
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
};
|
|
1997
|
-
console.log("message:", message);
|
|
1998
|
-
window.parent.postMessage(message, "*");
|
|
1999
|
-
}
|
|
2000
|
-
|
|
2001
|
-
// src/app/components/SuccessMessage/SuccessMsz.tsx
|
|
2002
|
-
function SuccessMsz({ onClose, tranId }) {
|
|
2003
|
-
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(SuccessMszStyle, null), /* @__PURE__ */ React10.createElement("div", { className: "payment-msg-container" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-container" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-tick-div" }, /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-tick" }, /* @__PURE__ */ React10.createElement(
|
|
2004
|
-
"svg",
|
|
2005
|
-
{
|
|
2006
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2007
|
-
width: "16",
|
|
2008
|
-
height: "16",
|
|
2009
|
-
viewBox: "0 0 16 16",
|
|
2010
|
-
fill: "none"
|
|
2011
|
-
},
|
|
2012
|
-
/* @__PURE__ */ React10.createElement(
|
|
2013
|
-
"path",
|
|
2014
|
-
{
|
|
2015
|
-
d: "M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",
|
|
2016
|
-
fill: "#61C699"
|
|
2017
|
-
}
|
|
2018
|
-
)
|
|
2019
|
-
))), /* @__PURE__ */ React10.createElement("h6", { className: "charge-payment-success-text" }, "Your charge", /* @__PURE__ */ React10.createElement("br", null), "was successful"), /* @__PURE__ */ React10.createElement("h6", { className: "charge-payment-success-subtext" }, "We\u2019ve processed your charge"), /* @__PURE__ */ React10.createElement("div", { className: "charge-success-payment-button-div" }, /* @__PURE__ */ React10.createElement("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "print", tranId) }, /* @__PURE__ */ React10.createElement(
|
|
2020
|
-
"svg",
|
|
2021
|
-
{
|
|
2022
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2023
|
-
width: "17",
|
|
2024
|
-
height: "16",
|
|
2025
|
-
viewBox: "0 0 17 16",
|
|
2026
|
-
fill: "none"
|
|
2027
|
-
},
|
|
2028
|
-
/* @__PURE__ */ React10.createElement(
|
|
2029
|
-
"path",
|
|
2030
|
-
{
|
|
2031
|
-
d: "M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",
|
|
2032
|
-
fill: "#161616"
|
|
2033
|
-
}
|
|
2034
|
-
),
|
|
2035
|
-
/* @__PURE__ */ React10.createElement(
|
|
2036
|
-
"path",
|
|
2037
|
-
{
|
|
2038
|
-
d: "M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",
|
|
2039
|
-
fill: "#161616"
|
|
2040
|
-
}
|
|
2041
|
-
)
|
|
2042
|
-
), "Print receipt"), /* @__PURE__ */ React10.createElement("button", { className: "charge-success-btn1", onClick: (e) => HandleSubmit(e, "share", tranId) }, /* @__PURE__ */ React10.createElement(
|
|
2043
|
-
"svg",
|
|
2044
|
-
{
|
|
2045
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2046
|
-
width: "17",
|
|
2047
|
-
height: "16",
|
|
2048
|
-
viewBox: "0 0 17 16",
|
|
2049
|
-
fill: "none"
|
|
2050
|
-
},
|
|
2051
|
-
/* @__PURE__ */ React10.createElement("g", { clipPath: "url(#clip0_12420_50683)" }, /* @__PURE__ */ React10.createElement(
|
|
2052
|
-
"path",
|
|
2053
|
-
{
|
|
2054
|
-
d: "M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",
|
|
2055
|
-
fill: "#161616"
|
|
2056
|
-
}
|
|
2057
|
-
)),
|
|
2058
|
-
/* @__PURE__ */ React10.createElement("defs", null, /* @__PURE__ */ React10.createElement("clipPath", { id: "clip0_12420_50683" }, /* @__PURE__ */ React10.createElement(
|
|
2059
|
-
"rect",
|
|
2060
|
-
{
|
|
2061
|
-
width: "16",
|
|
2062
|
-
height: "16",
|
|
2063
|
-
fill: "white",
|
|
2064
|
-
transform: "translate(0.5)"
|
|
2065
|
-
}
|
|
2066
|
-
)))
|
|
2067
|
-
), "Send receipt"))), /* @__PURE__ */ React10.createElement("div", { className: "charge-payment-success-btn-div" }, /* @__PURE__ */ React10.createElement("button", { className: "charge-payment-success-btn1", onClick: (e) => HandleSubmit(e, "tran", tranId) }, "Go to Transactions"), /* @__PURE__ */ React10.createElement("button", { className: "charge-payment-success-btn2", onClick: (e) => {
|
|
2068
|
-
onClose();
|
|
2069
|
-
HandleSubmit(e, "close", tranId);
|
|
2070
|
-
} }, "Close"))));
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
// src/app/components/Charge/GetPaymentPage.tsx
|
|
2074
|
-
import Swal from "sweetalert2";
|
|
2075
|
-
import { IoArrowBack } from "react-icons/io5";
|
|
2076
|
-
|
|
2077
|
-
// src/app/components/Datascript.tsx
|
|
2078
|
-
import { useEffect as useEffect3 } from "react";
|
|
2079
|
-
function DataScript() {
|
|
2080
|
-
useEffect3(() => {
|
|
2081
|
-
const src = "https://token-cert.dcap.com/v1/client";
|
|
2082
|
-
if (typeof window === "undefined") return;
|
|
2083
|
-
if (window.DatacapWebToken) {
|
|
2084
|
-
console.log("\u2705 Datacap already available");
|
|
2085
|
-
return;
|
|
2086
|
-
}
|
|
2087
|
-
if (!document.querySelector(`script[src="${src}"]`)) {
|
|
2088
|
-
const script = document.createElement("script");
|
|
2089
|
-
script.src = src;
|
|
2090
|
-
script.async = true;
|
|
2091
|
-
script.onload = () => {
|
|
2092
|
-
console.log("\u2705 Datacap script loaded");
|
|
2093
|
-
if (window.DatacapWebToken) {
|
|
2094
|
-
console.log("\u2705 DatacapWebToken is ready:", window.DatacapWebToken);
|
|
2095
|
-
} else {
|
|
2096
|
-
console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found");
|
|
2097
|
-
}
|
|
2098
|
-
};
|
|
2099
|
-
script.onerror = (err) => {
|
|
2100
|
-
console.error("\u274C Failed to load Datacap script", err);
|
|
2101
|
-
};
|
|
2102
|
-
document.head.appendChild(script);
|
|
2103
|
-
} else {
|
|
2104
|
-
console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");
|
|
2105
|
-
}
|
|
2106
|
-
}, []);
|
|
2107
|
-
useEffect3(() => {
|
|
2108
|
-
const scriptId = "forge-cdn-script";
|
|
2109
|
-
if (!document.getElementById(scriptId)) {
|
|
2110
|
-
const forgeScript = document.createElement("script");
|
|
2111
|
-
forgeScript.src = "https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js";
|
|
2112
|
-
forgeScript.id = scriptId;
|
|
2113
|
-
forgeScript.async = true;
|
|
2114
|
-
document.head.appendChild(forgeScript);
|
|
2115
|
-
}
|
|
2116
|
-
return () => {
|
|
2117
|
-
const existingScript = document.getElementById(scriptId);
|
|
2118
|
-
if (existingScript) {
|
|
2119
|
-
document.head.removeChild(existingScript);
|
|
2120
|
-
}
|
|
2121
|
-
};
|
|
2122
|
-
}, []);
|
|
2123
|
-
return null;
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
// src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
|
|
2127
|
-
import React12 from "react";
|
|
2128
|
-
|
|
2129
|
-
// src/app/components/ErrorCardMessage/ErrorCardMessageStyle.tsx
|
|
2130
|
-
import React11 from "react";
|
|
2131
|
-
function ErrorCardMszStyle() {
|
|
2132
|
-
return /* @__PURE__ */ React11.createElement("style", null, `
|
|
1367
|
+
}`)}function Ut(e,L,$){e.preventDefault();let j={type:"preview.compiledcheck",other:{msg:"Payment success!",status:L==="close",data:{tran_id:$,key:L}}};console.log("message:",j),window.parent.postMessage(j,"*")}function on({onClose:e,tranId:L}){return we.createElement(we.Fragment,null,we.createElement(fn,null),we.createElement("div",{className:"payment-msg-container"},we.createElement("div",{className:"charge-payment-success-container"},we.createElement("div",{className:"charge-payment-success-tick-div"},we.createElement("div",{className:"charge-payment-success-tick"},we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},we.createElement("path",{d:"M6.12669 13.9774C5.97396 14.131 5.76558 14.2167 5.54913 14.2167C5.33267 14.2167 5.1243 14.131 4.97157 13.9774L0.359012 9.36408C-0.119671 8.8854 -0.119671 8.10919 0.359012 7.6314L0.936573 7.05369C1.4154 6.57501 2.19072 6.57501 2.6694 7.05369L5.54913 9.93357L13.3306 2.15198C13.8094 1.6733 14.5855 1.6733 15.0634 2.15198L15.641 2.72969C16.1196 3.20837 16.1196 3.98444 15.641 4.46237L6.12669 13.9774Z",fill:"#61C699"})))),we.createElement("h6",{className:"charge-payment-success-text"},"Your charge",we.createElement("br",null),"was successful"),we.createElement("h6",{className:"charge-payment-success-subtext"},"We\u2019ve processed your charge"),we.createElement("div",{className:"charge-success-payment-button-div"},we.createElement("button",{className:"charge-success-btn1",onClick:$=>Ut($,"print",L)},we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},we.createElement("path",{d:"M15.7729 8.7272C15.58 8.7272 15.395 8.80383 15.2586 8.94022C15.1222 9.07661 15.0456 9.2616 15.0456 9.45448V12.5185C15.045 13.0559 14.8313 13.5711 14.4513 13.9511C14.0713 14.3311 13.5561 14.5449 13.0187 14.5454H3.98149C3.44409 14.5449 2.92887 14.3311 2.54887 13.9511C2.16887 13.5711 1.95514 13.0559 1.95456 12.5185V9.45448C1.95456 9.2616 1.87794 9.07661 1.74154 8.94022C1.60515 8.80383 1.42017 8.7272 1.22728 8.7272C1.03439 8.7272 0.849407 8.80383 0.713015 8.94022C0.576624 9.07661 0.5 9.2616 0.5 9.45448V12.5185C0.500963 13.4416 0.86807 14.3265 1.52077 14.9792C2.17346 15.6319 3.05844 15.999 3.98149 16H13.0187C13.9417 15.999 14.8267 15.6319 15.4794 14.9792C16.1321 14.3265 16.4992 13.4416 16.5002 12.5185V9.45448C16.5002 9.2616 16.4235 9.07661 16.2871 8.94022C16.1507 8.80383 15.9658 8.7272 15.7729 8.7272Z",fill:"#161616"}),we.createElement("path",{d:"M4.65059 6.75861L7.7728 9.88082V0.72728C7.7728 0.534394 7.84942 0.349407 7.98581 0.213015C8.1222 0.0766239 8.30719 0 8.50008 0C8.69296 0 8.87795 0.0766239 9.01434 0.213015C9.15073 0.349407 9.22736 0.534394 9.22736 0.72728V9.88082L12.3496 6.75861C12.4867 6.62613 12.6704 6.55283 12.8611 6.55448C13.0518 6.55614 13.2342 6.63263 13.3691 6.76747C13.5039 6.90231 13.5804 7.08472 13.5821 7.27541C13.5837 7.46611 13.5104 7.64982 13.3779 7.78698L9.01427 12.1507C8.87788 12.287 8.69293 12.3636 8.50008 12.3636C8.30723 12.3636 8.12228 12.287 7.98589 12.1507L3.62221 7.78698C3.48973 7.64982 3.41643 7.46611 3.41808 7.27541C3.41974 7.08472 3.49623 6.90231 3.63107 6.76747C3.76592 6.63263 3.94833 6.55614 4.13902 6.55448C4.32971 6.55283 4.51342 6.62613 4.65059 6.75861Z",fill:"#161616"})),"Print receipt"),we.createElement("button",{className:"charge-success-btn1",onClick:$=>Ut($,"share",L)},we.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none"},we.createElement("g",{clipPath:"url(#clip0_12420_50683)"},we.createElement("path",{d:"M9.30194 4.78664V2.31152C9.30194 2.09629 9.3862 1.88988 9.53631 1.73768C9.68634 1.5855 9.8899 1.5 10.1021 1.5C10.312 1.50089 10.5132 1.58542 10.6622 1.73534L16.2633 7.41595C16.3383 7.49142 16.3978 7.58117 16.4385 7.68001C16.4791 7.77894 16.5 7.885 16.5 7.99212C16.5 8.09924 16.4791 8.20531 16.4385 8.30423C16.3978 8.40307 16.3383 8.49283 16.2633 8.5683L10.6622 14.2489C10.5499 14.3606 10.4076 14.4362 10.2531 14.4663C10.0987 14.4964 9.93887 14.4797 9.79372 14.4182C9.64857 14.3568 9.52455 14.2532 9.43701 14.1206C9.34955 13.9881 9.30258 13.8323 9.30194 13.6727V11.157H8.62181C7.35764 11.1379 6.10443 11.3981 4.94932 11.9193C3.79422 12.4406 2.76481 13.2107 1.93249 14.1759C1.83215 14.3113 1.6926 14.4115 1.53337 14.4624C1.37406 14.5134 1.20306 14.5125 1.04431 14.4599C0.882759 14.4046 0.742811 14.2984 0.644952 14.1568C0.547092 14.0152 0.496363 13.8456 0.500203 13.6727C0.500203 6.27171 6.96548 5.00575 9.30194 4.78664ZM8.62181 9.51777C9.15695 9.51607 9.69162 9.55129 10.2221 9.62327C10.4115 9.6524 10.5844 9.74954 10.7092 9.89699C10.834 10.0444 10.9025 10.2324 10.9023 10.4267V11.717L14.567 7.99212L10.9023 4.26727V5.55758C10.9023 5.77281 10.8179 5.97922 10.6679 6.13141C10.5178 6.28359 10.3143 6.36909 10.1021 6.36909C9.37396 6.36909 3.61282 6.5314 2.36457 11.5871C4.17637 10.2324 6.3708 9.50665 8.62181 9.51777Z",fill:"#161616"})),we.createElement("defs",null,we.createElement("clipPath",{id:"clip0_12420_50683"},we.createElement("rect",{width:"16",height:"16",fill:"white",transform:"translate(0.5)"})))),"Send receipt"))),we.createElement("div",{className:"charge-payment-success-btn-div"},we.createElement("button",{className:"charge-payment-success-btn1",onClick:$=>Ut($,"tran",L)},"Go to Transactions"),we.createElement("button",{className:"charge-payment-success-btn2",onClick:$=>{e(),Ut($,"close",L)}},"Close"))))}import an from"sweetalert2";import{IoArrowBack as Ln}from"react-icons/io5";import{useEffect as Mn}from"react";function It(){return Mn(()=>{let e="https://token-cert.dcap.com/v1/client";if(typeof window!="undefined"){if(window.DatacapWebToken){console.log("\u2705 Datacap already available");return}if(document.querySelector(`script[src="${e}"]`))console.log("\u2139\uFE0F Script already in DOM, waiting for Datacap...");else{let L=document.createElement("script");L.src=e,L.async=!0,L.onload=()=>{console.log("\u2705 Datacap script loaded"),window.DatacapWebToken?console.log("\u2705 DatacapWebToken is ready:",window.DatacapWebToken):console.warn("\u26A0\uFE0F Script loaded, but DatacapWebToken not found")},L.onerror=$=>{console.error("\u274C Failed to load Datacap script",$)},document.head.appendChild(L)}}},[]),Mn(()=>{let e="forge-cdn-script";if(!document.getElementById(e)){let L=document.createElement("script");L.src="https://cdn.jsdelivr.net/npm/node-forge@1.0.0/dist/forge.min.js",L.id=e,L.async=!0,document.head.appendChild(L)}return()=>{let L=document.getElementById(e);L&&document.head.removeChild(L)}},[]),null}import St from"react";import li from"react";function hn(){return li.createElement("style",null,`
|
|
2133
1368
|
.card-error .logo-container {
|
|
2134
1369
|
display: flex;
|
|
2135
1370
|
justify-content: center;
|
|
@@ -2234,1324 +1469,7 @@ function ErrorCardMszStyle() {
|
|
|
2234
1469
|
padding:10px 17px;
|
|
2235
1470
|
cursor:pointer;
|
|
2236
1471
|
}
|
|
2237
|
-
`);
|
|
2238
|
-
}
|
|
2239
|
-
|
|
2240
|
-
// src/app/components/ErrorCardMessage/ErrorCardMessage.tsx
|
|
2241
|
-
var ErrorCardMessage = ({ onClose, error }) => {
|
|
2242
|
-
return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(ErrorCardMszStyle, null), /* @__PURE__ */ React12.createElement("div", { className: "card-error" }, /* @__PURE__ */ React12.createElement("div", { className: "payment-error-container" }, /* @__PURE__ */ React12.createElement("div", { className: "error-icon" }, /* @__PURE__ */ React12.createElement("div", { className: "circle" }, /* @__PURE__ */ React12.createElement("i", { className: "fa fa-times", "aria-hidden": "true" })), /* @__PURE__ */ React12.createElement("div", { className: "error-text" }, /* @__PURE__ */ React12.createElement("div", { className: "payment-error-text" }, error), /* @__PURE__ */ React12.createElement("div", { className: "thank-you-text" }, "Try again later ")), /* @__PURE__ */ React12.createElement("div", { className: "error-btn-div" }, /* @__PURE__ */ React12.createElement("button", { onClick: onClose }, "OK"))))));
|
|
2243
|
-
};
|
|
2244
|
-
var ErrorCardMessage_default = ErrorCardMessage;
|
|
2245
|
-
|
|
2246
|
-
// src/app/components/socketClient.js
|
|
2247
|
-
import { io } from "socket.io-client";
|
|
2248
|
-
var socket = io(baseUrl, {
|
|
2249
|
-
transports: ["websocket"],
|
|
2250
|
-
// Optional: force WebSocket
|
|
2251
|
-
withCredentials: false
|
|
2252
|
-
});
|
|
2253
|
-
var socketClient_default = socket;
|
|
2254
|
-
|
|
2255
|
-
// src/app/utils/Common.js
|
|
2256
|
-
var isValidJson = (jsonString) => {
|
|
2257
|
-
try {
|
|
2258
|
-
const parsed = JSON.parse(jsonString);
|
|
2259
|
-
return typeof parsed === "object" && parsed !== null;
|
|
2260
|
-
} catch (e) {
|
|
2261
|
-
return false;
|
|
2262
|
-
}
|
|
2263
|
-
};
|
|
2264
|
-
|
|
2265
|
-
// src/app/components/Charge/GetPaymentPage.tsx
|
|
2266
|
-
function GetPaymentPage(props) {
|
|
2267
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2268
|
-
const [loading, setLoading] = useState3(false);
|
|
2269
|
-
const [loading2, setLoading2] = useState3(false);
|
|
2270
|
-
const [error, setError] = useState3("");
|
|
2271
|
-
const [success, setSuccess] = useState3(false);
|
|
2272
|
-
const [show, setShow] = useState3(false);
|
|
2273
|
-
const [activetab, setActive] = useState3("card");
|
|
2274
|
-
const [saveCardInfo, setSaveCardInfo] = useState3(false);
|
|
2275
|
-
const [saveACHinfo, setSaveACHinfo] = useState3(false);
|
|
2276
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
|
2277
|
-
const [cardData, setCardData] = useState3();
|
|
2278
|
-
const [cardError, setCardError] = useState3({});
|
|
2279
|
-
const [achData, setAchData] = useState3();
|
|
2280
|
-
const [achError, setAchError] = useState3({});
|
|
2281
|
-
const [cardList, setCardList] = useState3([]);
|
|
2282
|
-
const [selectedCard, setSelectedCard] = useState3();
|
|
2283
|
-
const [paymentData, setPaymentData] = useState3();
|
|
2284
|
-
let [tranId, setTranId] = useState3("");
|
|
2285
|
-
const showLoader = () => setLoading(true);
|
|
2286
|
-
const hideLoader = () => setLoading(false);
|
|
2287
|
-
const handleClose = () => {
|
|
2288
|
-
setShow(false);
|
|
2289
|
-
setActive("card");
|
|
2290
|
-
setError("");
|
|
2291
|
-
setSuccess(false);
|
|
2292
|
-
setTranId("");
|
|
2293
|
-
setAchData({
|
|
2294
|
-
name: "",
|
|
2295
|
-
routingNumber: "",
|
|
2296
|
-
accountNumber: "",
|
|
2297
|
-
confirmAccountNumber: "",
|
|
2298
|
-
bankName: "",
|
|
2299
|
-
accountType: ""
|
|
2300
|
-
});
|
|
2301
|
-
setAchError({
|
|
2302
|
-
name: "",
|
|
2303
|
-
routingNumber: "",
|
|
2304
|
-
accountNumber: "",
|
|
2305
|
-
confirmAccountNumber: "",
|
|
2306
|
-
bankName: "",
|
|
2307
|
-
accountType: ""
|
|
2308
|
-
});
|
|
2309
|
-
setCardData({
|
|
2310
|
-
cardName: "",
|
|
2311
|
-
cardNumber: "",
|
|
2312
|
-
expiryMonth: "",
|
|
2313
|
-
expiryYear: "",
|
|
2314
|
-
cvv: "",
|
|
2315
|
-
orderId: "",
|
|
2316
|
-
zipCode: ""
|
|
2317
|
-
});
|
|
2318
|
-
setCardError({
|
|
2319
|
-
cardName: "",
|
|
2320
|
-
cardNumber: "",
|
|
2321
|
-
expiryMonth: "",
|
|
2322
|
-
expiryYear: "",
|
|
2323
|
-
cvv: "",
|
|
2324
|
-
orderId: "",
|
|
2325
|
-
zipCode: ""
|
|
2326
|
-
});
|
|
2327
|
-
setSaveACHinfo(false);
|
|
2328
|
-
setSaveCardInfo(false);
|
|
2329
|
-
setSelectedCard({
|
|
2330
|
-
card_type: "",
|
|
2331
|
-
cardlastfourdigit: "",
|
|
2332
|
-
expmonth: 1,
|
|
2333
|
-
expyear: 2025,
|
|
2334
|
-
primary_card: 0,
|
|
2335
|
-
firstname: "",
|
|
2336
|
-
id: "",
|
|
2337
|
-
lastname: ""
|
|
2338
|
-
});
|
|
2339
|
-
};
|
|
2340
|
-
const handleShow = () => setShow(true);
|
|
2341
|
-
const handletabchange = (id) => {
|
|
2342
|
-
setActive(id);
|
|
2343
|
-
};
|
|
2344
|
-
const handleCardChange = (field, value) => {
|
|
2345
|
-
const name = field;
|
|
2346
|
-
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
2347
|
-
if (numericFields.includes(name)) {
|
|
2348
|
-
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
2349
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2350
|
-
[name]: ""
|
|
2351
|
-
}));
|
|
2352
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2353
|
-
[name]: value
|
|
2354
|
-
}));
|
|
2355
|
-
}
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2359
|
-
[name]: ""
|
|
2360
|
-
}));
|
|
2361
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2362
|
-
[name]: value
|
|
2363
|
-
}));
|
|
2364
|
-
};
|
|
2365
|
-
const handleCardNumberChange = (e) => {
|
|
2366
|
-
const input = e.target;
|
|
2367
|
-
const rawValue = input.value.replace(/\D/g, "");
|
|
2368
|
-
let formatted = "";
|
|
2369
|
-
if (/^3[47]/.test(rawValue)) {
|
|
2370
|
-
const trimmed = rawValue.slice(0, 15);
|
|
2371
|
-
formatted = trimmed.replace(
|
|
2372
|
-
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
2373
|
-
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
2374
|
-
);
|
|
2375
|
-
} else {
|
|
2376
|
-
const trimmed = rawValue.slice(0, 16);
|
|
2377
|
-
formatted = trimmed.replace(
|
|
2378
|
-
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
2379
|
-
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
2380
|
-
);
|
|
2381
|
-
}
|
|
2382
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2383
|
-
cardNumber: ""
|
|
2384
|
-
}));
|
|
2385
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2386
|
-
cardNumber: formatted
|
|
2387
|
-
}));
|
|
2388
|
-
};
|
|
2389
|
-
const handleChangeAch = (e) => {
|
|
2390
|
-
const { name, value } = e.target;
|
|
2391
|
-
const numericFields = ["routingNumber", "accountNumber", "confirmAccountNumber"];
|
|
2392
|
-
if (name == "name") {
|
|
2393
|
-
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
2394
|
-
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2395
|
-
[name]: ""
|
|
2396
|
-
}));
|
|
2397
|
-
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2398
|
-
[name]: value
|
|
2399
|
-
}));
|
|
2400
|
-
}
|
|
2401
|
-
return;
|
|
2402
|
-
}
|
|
2403
|
-
if (numericFields.includes(name)) {
|
|
2404
|
-
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
2405
|
-
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2406
|
-
[name]: ""
|
|
2407
|
-
}));
|
|
2408
|
-
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2409
|
-
[name]: value
|
|
2410
|
-
}));
|
|
2411
|
-
}
|
|
2412
|
-
return;
|
|
2413
|
-
}
|
|
2414
|
-
setAchError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2415
|
-
[name]: ""
|
|
2416
|
-
}));
|
|
2417
|
-
setAchData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
2418
|
-
[name]: value
|
|
2419
|
-
}));
|
|
2420
|
-
};
|
|
2421
|
-
const validateCardData = () => {
|
|
2422
|
-
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
2423
|
-
const errors = {};
|
|
2424
|
-
const data = cardData;
|
|
2425
|
-
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
2426
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
2427
|
-
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
2428
|
-
if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
|
|
2429
|
-
if (!((_c2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c2.trim()) || !((_d2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d2.trim())) {
|
|
2430
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
2431
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
2432
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
2433
|
-
}
|
|
2434
|
-
if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
|
|
2435
|
-
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
2436
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
2437
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
2438
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
2439
|
-
const now = /* @__PURE__ */ new Date();
|
|
2440
|
-
const currentMonth = now.getMonth() + 1;
|
|
2441
|
-
const currentYear = now.getFullYear();
|
|
2442
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
2443
|
-
errors.expiryMonth = "Card is expired";
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
setCardError(errors);
|
|
2447
|
-
return Object.keys(errors).length > 0;
|
|
2448
|
-
};
|
|
2449
|
-
const validateAchData = () => {
|
|
2450
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
2451
|
-
const errors = {};
|
|
2452
|
-
const data = achData;
|
|
2453
|
-
if (!((_a2 = data == null ? void 0 : data.name) == null ? void 0 : _a2.trim())) errors.name = "Name is required";
|
|
2454
|
-
if (!((_b2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _b2.trim())) errors.accountNumber = "account number is required";
|
|
2455
|
-
if (((_c2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _c2.trim()) && ((_d2 = data == null ? void 0 : data.accountNumber) == null ? void 0 : _d2.trim()) !== ((_e2 = data == null ? void 0 : data.confirmAccountNumber) == null ? void 0 : _e2.trim())) errors.confirmAccountNumber = "Account numbers must match";
|
|
2456
|
-
if (!((_f2 = data == null ? void 0 : data.bankName) == null ? void 0 : _f2.trim())) errors.bankName = "Bank name is required";
|
|
2457
|
-
if (!((_g2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _g2.trim())) errors.routingNumber = "Routing Number is required";
|
|
2458
|
-
if ((data == null ? void 0 : data.routingNumber) && ((_h2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _h2.length) !== 9) errors.routingNumber = "Routing number must be 9 digits";
|
|
2459
|
-
if (((_i2 = data == null ? void 0 : data.routingNumber) == null ? void 0 : _i2.length) == 9) {
|
|
2460
|
-
let routingNumber = data == null ? void 0 : data.routingNumber;
|
|
2461
|
-
const weights = [3, 7, 1];
|
|
2462
|
-
let sum = 0;
|
|
2463
|
-
for (let i = 0; i < routingNumber.length; i++) {
|
|
2464
|
-
sum += parseInt(routingNumber[i], 10) * weights[i % 3];
|
|
2465
|
-
}
|
|
2466
|
-
if (sum % 10 !== 0) {
|
|
2467
|
-
errors.routingNumber = "Invalid routing number";
|
|
2468
|
-
}
|
|
2469
|
-
}
|
|
2470
|
-
setAchError(errors);
|
|
2471
|
-
return Object.keys(errors).length > 0;
|
|
2472
|
-
};
|
|
2473
|
-
const submitFunc = async (e) => {
|
|
2474
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
|
|
2475
|
-
e.preventDefault();
|
|
2476
|
-
if (activetab !== "ach") {
|
|
2477
|
-
const hasError = validateCardData();
|
|
2478
|
-
if (hasError) return;
|
|
2479
|
-
else {
|
|
2480
|
-
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
2481
|
-
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
2482
|
-
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
2483
|
-
let errors = {};
|
|
2484
|
-
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
2485
|
-
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
2486
|
-
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
2487
|
-
setCardError(errors);
|
|
2488
|
-
if (validCard && validCVV && validExpirationDate) {
|
|
2489
|
-
setLoading2(true);
|
|
2490
|
-
try {
|
|
2491
|
-
const formData = __spreadProps(__spreadValues({}, cardData), {
|
|
2492
|
-
amount: `${props.amount || 0}`,
|
|
2493
|
-
fractalpayPublicKey: fractalpayClientKey,
|
|
2494
|
-
orderId: props == null ? void 0 : props.orderID,
|
|
2495
|
-
customer_id: props == null ? void 0 : props.customerId,
|
|
2496
|
-
discount: props == null ? void 0 : props.discount,
|
|
2497
|
-
surcharge: props == null ? void 0 : props.surcharge,
|
|
2498
|
-
tax: props == null ? void 0 : props.tax
|
|
2499
|
-
});
|
|
2500
|
-
const result = await axios3.post(`${baseUrl}create-widget-order`, formData);
|
|
2501
|
-
let tokenCallback = async function(response) {
|
|
2502
|
-
if (response.Error) {
|
|
2503
|
-
setError(response.Error);
|
|
2504
|
-
setLoading2(false);
|
|
2505
|
-
} else {
|
|
2506
|
-
let name = cardData == null ? void 0 : cardData.cardName;
|
|
2507
|
-
let postal_code = cardData == null ? void 0 : cardData.zipCode;
|
|
2508
|
-
response.name = name;
|
|
2509
|
-
response.postal_code = postal_code;
|
|
2510
|
-
response.isCardSave = `${saveCardInfo}`;
|
|
2511
|
-
response.isCharge = true;
|
|
2512
|
-
response.posSalesIdEncode = result == null ? void 0 : result.data.data.posSalesIdEncode;
|
|
2513
|
-
console.log(response, "resppp");
|
|
2514
|
-
console.log(result == null ? void 0 : result.data.data.posSalesIdEncode, "fkjdashgfuh");
|
|
2515
|
-
socketClient_default.emit("sendMessage", response);
|
|
2516
|
-
socketClient_default.on(result == null ? void 0 : result.data.data.posSalesIdEncode, (data) => {
|
|
2517
|
-
console.log(data, "socket data");
|
|
2518
|
-
if (isValidJson(data == null ? void 0 : data.data)) {
|
|
2519
|
-
let apiResponse = JSON.parse(data.data);
|
|
2520
|
-
console.log("return data : ", apiResponse);
|
|
2521
|
-
if (apiResponse == null ? void 0 : apiResponse.result) {
|
|
2522
|
-
setCardData({
|
|
2523
|
-
cardName: "",
|
|
2524
|
-
cardNumber: "",
|
|
2525
|
-
expiryMonth: "",
|
|
2526
|
-
expiryYear: "",
|
|
2527
|
-
cvv: "",
|
|
2528
|
-
orderId: "",
|
|
2529
|
-
zipCode: ""
|
|
2530
|
-
});
|
|
2531
|
-
setSaveCardInfo(false);
|
|
2532
|
-
setTranId(apiResponse == null ? void 0 : apiResponse.transactionId);
|
|
2533
|
-
setSuccess(true);
|
|
2534
|
-
setLoading2(false);
|
|
2535
|
-
} else {
|
|
2536
|
-
setLoading2(false);
|
|
2537
|
-
setError((apiResponse == null ? void 0 : apiResponse.message) || "Something went wrong.");
|
|
2538
|
-
}
|
|
2539
|
-
} else {
|
|
2540
|
-
setError("Something went wrong.");
|
|
2541
|
-
}
|
|
2542
|
-
});
|
|
2543
|
-
}
|
|
2544
|
-
};
|
|
2545
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
2546
|
-
const requestOptions = {
|
|
2547
|
-
method: "POST",
|
|
2548
|
-
redirect: "follow"
|
|
2549
|
-
};
|
|
2550
|
-
try {
|
|
2551
|
-
let sesionResult = await axios3.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
2552
|
-
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
2553
|
-
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
2554
|
-
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
2555
|
-
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
2556
|
-
const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
|
|
2557
|
-
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
2558
|
-
md: forge.md.sha1.create(),
|
|
2559
|
-
mgf1: {
|
|
2560
|
-
md: forge.md.sha1.create()
|
|
2561
|
-
}
|
|
2562
|
-
});
|
|
2563
|
-
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
2564
|
-
const myHeaders = {
|
|
2565
|
-
"Content-Type": "application/json",
|
|
2566
|
-
"x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
|
|
2567
|
-
};
|
|
2568
|
-
const raw = JSON.stringify({
|
|
2569
|
-
"enc_track2_data": `${encryptedBase64}`,
|
|
2570
|
-
"algorithm": "RSAES_OAEP_SHA_1",
|
|
2571
|
-
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
|
2572
|
-
});
|
|
2573
|
-
try {
|
|
2574
|
-
const tokenizeData = await axios3.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
2575
|
-
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
|
2576
|
-
isSaveCardChecked: saveCardInfo,
|
|
2577
|
-
name: cardData == null ? void 0 : cardData.cardName,
|
|
2578
|
-
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
|
2579
|
-
customer_id: props == null ? void 0 : props.customerId
|
|
2580
|
-
}));
|
|
2581
|
-
const reqData2 = JSON.stringify({
|
|
2582
|
-
"pre_sales_id": `${(_i2 = (_h2 = result == null ? void 0 : result.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.posSalesIdEncode}`,
|
|
2583
|
-
"token": `${(_j2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j2.data.token}`,
|
|
2584
|
-
"json_response": `${reqData}`
|
|
2585
|
-
});
|
|
2586
|
-
let myHeaders2 = JSON.stringify({
|
|
2587
|
-
"Content-Type": "application/json"
|
|
2588
|
-
});
|
|
2589
|
-
const requestOptions2 = {
|
|
2590
|
-
method: "POST",
|
|
2591
|
-
headers: myHeaders2,
|
|
2592
|
-
body: reqData2,
|
|
2593
|
-
redirect: "follow",
|
|
2594
|
-
isChargeviafractal: true
|
|
2595
|
-
};
|
|
2596
|
-
socketClient_default.emit("sendMessage", requestOptions2);
|
|
2597
|
-
socketClient_default.on("chargeviafractalgateway", (data) => {
|
|
2598
|
-
var _a3;
|
|
2599
|
-
console.log(data, "socket data");
|
|
2600
|
-
if (isValidJson(data == null ? void 0 : data.data)) {
|
|
2601
|
-
let paymentRes = JSON.parse(data == null ? void 0 : data.data);
|
|
2602
|
-
console.log(paymentRes, "dfuigdasuf");
|
|
2603
|
-
if (paymentRes == null ? void 0 : paymentRes.result) {
|
|
2604
|
-
setTranId((_a3 = paymentRes == null ? void 0 : paymentRes.data) == null ? void 0 : _a3.transactionId);
|
|
2605
|
-
setSuccess(true);
|
|
2606
|
-
setLoading2(false);
|
|
2607
|
-
} else {
|
|
2608
|
-
setLoading2(false);
|
|
2609
|
-
setError((paymentRes == null ? void 0 : paymentRes.message) || "Something went wrong.");
|
|
2610
|
-
}
|
|
2611
|
-
} else {
|
|
2612
|
-
setError("Something went wrong.");
|
|
2613
|
-
}
|
|
2614
|
-
});
|
|
2615
|
-
} catch (err) {
|
|
2616
|
-
setLoading2(false);
|
|
2617
|
-
setError(((_l2 = (_k2 = err == null ? void 0 : err.response) == null ? void 0 : _k2.data) == null ? void 0 : _l2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
2618
|
-
}
|
|
2619
|
-
} catch (err) {
|
|
2620
|
-
setLoading2(false);
|
|
2621
|
-
setError(((_n2 = (_m2 = err == null ? void 0 : err.response) == null ? void 0 : _m2.data) == null ? void 0 : _n2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
2622
|
-
}
|
|
2623
|
-
} else {
|
|
2624
|
-
if (typeof DatacapWebToken !== "undefined") {
|
|
2625
|
-
DatacapWebToken.requestToken(result == null ? void 0 : result.data.data.dctoken, "PaymentForm", tokenCallback);
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
} catch (err) {
|
|
2629
|
-
setLoading2(false);
|
|
2630
|
-
setError(((_p2 = (_o2 = err == null ? void 0 : err.response) == null ? void 0 : _o2.data) == null ? void 0 : _p2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
}
|
|
2634
|
-
} else {
|
|
2635
|
-
const hasError = validateAchData();
|
|
2636
|
-
if (hasError) return;
|
|
2637
|
-
else {
|
|
2638
|
-
setLoading2(true);
|
|
2639
|
-
let dataForm = {
|
|
2640
|
-
fractalpayPublicKey: fractalpayClientKey,
|
|
2641
|
-
label: (achData == null ? void 0 : achData.name) || "John Doe",
|
|
2642
|
-
account_number: achData == null ? void 0 : achData.accountNumber,
|
|
2643
|
-
routing_number: achData == null ? void 0 : achData.routingNumber,
|
|
2644
|
-
bank_name: achData == null ? void 0 : achData.bankName,
|
|
2645
|
-
account_type: achData == null ? void 0 : achData.accountType,
|
|
2646
|
-
amount: String(props.amount || 0),
|
|
2647
|
-
isSaveAch: saveACHinfo,
|
|
2648
|
-
customer_id: props == null ? void 0 : props.customerId,
|
|
2649
|
-
order_id: props == null ? void 0 : props.orderID,
|
|
2650
|
-
tax: props == null ? void 0 : props.tax,
|
|
2651
|
-
discount: props == null ? void 0 : props.discount,
|
|
2652
|
-
surcharge: props == null ? void 0 : props.surcharge,
|
|
2653
|
-
isChargeACH: true
|
|
2654
|
-
};
|
|
2655
|
-
socketClient_default.emit("sendMessage", dataForm);
|
|
2656
|
-
socketClient_default.on("ach-incoming", (data) => {
|
|
2657
|
-
var _a3;
|
|
2658
|
-
console.log(data, "sfhdwhf");
|
|
2659
|
-
if ((data == null ? void 0 : data.status) == "Failed") {
|
|
2660
|
-
if (typeof (data == null ? void 0 : data.message) == "object") {
|
|
2661
|
-
Object.values(data == null ? void 0 : data.message).forEach((message) => {
|
|
2662
|
-
setError(message || "Something went wrong");
|
|
2663
|
-
});
|
|
2664
|
-
} else {
|
|
2665
|
-
setError((data == null ? void 0 : data.message) || "Something went wrong");
|
|
2666
|
-
}
|
|
2667
|
-
} else {
|
|
2668
|
-
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
|
2669
|
-
setSuccess(true);
|
|
2670
|
-
setLoading2(false);
|
|
2671
|
-
}
|
|
2672
|
-
});
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
};
|
|
2676
|
-
const getPaymentDetails = async () => {
|
|
2677
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q, _r, _s;
|
|
2678
|
-
showLoader();
|
|
2679
|
-
try {
|
|
2680
|
-
const data = {
|
|
2681
|
-
fractalpayPublicKey: fractalpayClientKey,
|
|
2682
|
-
"customer_id": props == null ? void 0 : props.customerId
|
|
2683
|
-
};
|
|
2684
|
-
let paymentData2 = await axios3.post(`${baseUrl}get-payment-details`, data);
|
|
2685
|
-
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
2686
|
-
if (!((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.paymentGateway)) {
|
|
2687
|
-
handleClose();
|
|
2688
|
-
setError("Something went wrong.");
|
|
2689
|
-
}
|
|
2690
|
-
if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
|
|
2691
|
-
setCardList((_j2 = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j2.card_list);
|
|
2692
|
-
setActive("cardList");
|
|
2693
|
-
let primary_card = (_m2 = (_l2 = (_k2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _k2.data) == null ? void 0 : _l2.card_list) == null ? void 0 : _m2.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
|
|
2694
|
-
if ((primary_card == null ? void 0 : primary_card[0]) && ((_n2 = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _n2.payment_method_type) == ((_p2 = (_o2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o2.data) == null ? void 0 : _p2.paymentGateway)) {
|
|
2695
|
-
setSelectedCard(primary_card[0]);
|
|
2696
|
-
} else if (((_q = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _q.card_type) === "Bank") {
|
|
2697
|
-
setSelectedCard(primary_card[0]);
|
|
2698
|
-
}
|
|
2699
|
-
} else {
|
|
2700
|
-
setActive("card");
|
|
2701
|
-
}
|
|
2702
|
-
hideLoader();
|
|
2703
|
-
} catch (err) {
|
|
2704
|
-
console.log(err);
|
|
2705
|
-
hideLoader();
|
|
2706
|
-
setError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "Something went wrong");
|
|
2707
|
-
}
|
|
2708
|
-
};
|
|
2709
|
-
const handlechargeCustomer = async () => {
|
|
2710
|
-
let customer_id = props == null ? void 0 : props.customerId;
|
|
2711
|
-
let discount = String(props == null ? void 0 : props.discount);
|
|
2712
|
-
let surcharge = String(props == null ? void 0 : props.surcharge);
|
|
2713
|
-
let tax = String(props == null ? void 0 : props.tax);
|
|
2714
|
-
let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
|
2715
|
-
let order_id = props == null ? void 0 : props.orderID;
|
|
2716
|
-
let amount = String(props == null ? void 0 : props.amount);
|
|
2717
|
-
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
|
2718
|
-
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
|
2719
|
-
if (fractalpayPublicKey && order_id && amount) {
|
|
2720
|
-
if (customer_id) {
|
|
2721
|
-
if (card_id) {
|
|
2722
|
-
let chargeobj = {
|
|
2723
|
-
amount,
|
|
2724
|
-
order_id,
|
|
2725
|
-
customer_id,
|
|
2726
|
-
card_id,
|
|
2727
|
-
fractalpayPublicKey,
|
|
2728
|
-
isCardSave: saveCardInfo,
|
|
2729
|
-
discount,
|
|
2730
|
-
surcharge,
|
|
2731
|
-
tax
|
|
2732
|
-
};
|
|
2733
|
-
let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
|
|
2734
|
-
let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
|
|
2735
|
-
let chargeurl = baseUrl + endpoint;
|
|
2736
|
-
const headers = {
|
|
2737
|
-
"Content-Type": "application/json"
|
|
2738
|
-
};
|
|
2739
|
-
setLoading2(true);
|
|
2740
|
-
socketClient_default.emit("sendMessage", { url: chargeurl, body: card_type == "Bank" ? rest : chargeobj, isChargebycard: true });
|
|
2741
|
-
socketClient_default.on("charge-by-card", (response) => {
|
|
2742
|
-
var _a3;
|
|
2743
|
-
console.log(response, "response");
|
|
2744
|
-
if ((response == null ? void 0 : response.result) == true || (response == null ? void 0 : response.status) == true) {
|
|
2745
|
-
setTranId((_a3 = response.data) == null ? void 0 : _a3.transaction_id);
|
|
2746
|
-
setSuccess(true);
|
|
2747
|
-
setLoading2(false);
|
|
2748
|
-
} else {
|
|
2749
|
-
setError((response == null ? void 0 : response.message) || "Something went wrong.");
|
|
2750
|
-
}
|
|
2751
|
-
});
|
|
2752
|
-
} else {
|
|
2753
|
-
setError("Please Select A Card/ACH");
|
|
2754
|
-
}
|
|
2755
|
-
} else {
|
|
2756
|
-
setError("Please Select Customer");
|
|
2757
|
-
}
|
|
2758
|
-
} else {
|
|
2759
|
-
setError("Something went wrong.");
|
|
2760
|
-
}
|
|
2761
|
-
};
|
|
2762
|
-
useEffect4(() => {
|
|
2763
|
-
if (show && fractalpayClientKey) {
|
|
2764
|
-
getPaymentDetails();
|
|
2765
|
-
}
|
|
2766
|
-
}, [fractalpayClientKey, show]);
|
|
2767
|
-
const handleDeleteCard = async (cardId) => {
|
|
2768
|
-
Swal.fire({
|
|
2769
|
-
icon: "warning",
|
|
2770
|
-
text: "Do you want to delete the card?",
|
|
2771
|
-
showCancelButton: true,
|
|
2772
|
-
confirmButtonText: "Yes",
|
|
2773
|
-
cancelButtonText: "No",
|
|
2774
|
-
reverseButtons: true,
|
|
2775
|
-
buttonsStyling: false,
|
|
2776
|
-
customClass: {
|
|
2777
|
-
confirmButton: "swal2-confirm btn btn-dark",
|
|
2778
|
-
cancelButton: "swal2-cancel btn btn-dark",
|
|
2779
|
-
popup: "custom-swal-popup",
|
|
2780
|
-
icon: "custom-swal-icon"
|
|
2781
|
-
}
|
|
2782
|
-
}).then(async (result) => {
|
|
2783
|
-
if (result.isConfirmed) {
|
|
2784
|
-
setLoading2(true);
|
|
2785
|
-
try {
|
|
2786
|
-
let obj = {
|
|
2787
|
-
card_id: cardId,
|
|
2788
|
-
customer_id: props == null ? void 0 : props.customerId,
|
|
2789
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
2790
|
-
};
|
|
2791
|
-
const res = await axios3.post(`${baseUrl}delete-customer-card`, obj);
|
|
2792
|
-
setLoading2(false);
|
|
2793
|
-
getPaymentDetails();
|
|
2794
|
-
Swal.fire({
|
|
2795
|
-
icon: "success",
|
|
2796
|
-
title: "Deleted!",
|
|
2797
|
-
text: "Card deleted.",
|
|
2798
|
-
confirmButtonText: "OK",
|
|
2799
|
-
showConfirmButton: true,
|
|
2800
|
-
timer: 1e3,
|
|
2801
|
-
// auto-close after 1 second
|
|
2802
|
-
timerProgressBar: true,
|
|
2803
|
-
customClass: {
|
|
2804
|
-
confirmButton: "btn btn-dark"
|
|
2805
|
-
}
|
|
2806
|
-
});
|
|
2807
|
-
} catch (err) {
|
|
2808
|
-
setLoading2(false);
|
|
2809
|
-
Swal.fire({
|
|
2810
|
-
icon: "error",
|
|
2811
|
-
title: "Error!",
|
|
2812
|
-
text: "Failed to delete the card.",
|
|
2813
|
-
confirmButtonText: "OK",
|
|
2814
|
-
customClass: {
|
|
2815
|
-
confirmButton: "btn btn-dark"
|
|
2816
|
-
}
|
|
2817
|
-
});
|
|
2818
|
-
}
|
|
2819
|
-
} else if (result.dismiss === Swal.DismissReason.cancel) {
|
|
2820
|
-
Swal.fire({
|
|
2821
|
-
icon: "info",
|
|
2822
|
-
text: "Card not deleted",
|
|
2823
|
-
confirmButtonText: "OK",
|
|
2824
|
-
buttonsStyling: false,
|
|
2825
|
-
customClass: {
|
|
2826
|
-
confirmButton: "btn btn-dark float-end",
|
|
2827
|
-
actions: "swal2-actions-end"
|
|
2828
|
-
}
|
|
2829
|
-
});
|
|
2830
|
-
}
|
|
2831
|
-
});
|
|
2832
|
-
};
|
|
2833
|
-
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(DataScript, null), /* @__PURE__ */ React13.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
|
|
2834
|
-
"button",
|
|
2835
|
-
{
|
|
2836
|
-
className: "paymentBtn",
|
|
2837
|
-
onClick: handleShow
|
|
2838
|
-
},
|
|
2839
|
-
"Pay"
|
|
2840
|
-
), /* @__PURE__ */ React13.createElement(
|
|
2841
|
-
CustomModal2_default,
|
|
2842
|
-
{
|
|
2843
|
-
open: show,
|
|
2844
|
-
onClose: handleClose
|
|
2845
|
-
},
|
|
2846
|
-
error && /* @__PURE__ */ React13.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React13.createElement(ErrorCardMessage_default, { error, onClose: handleClose })),
|
|
2847
|
-
success && /* @__PURE__ */ React13.createElement(SuccessMsz, { onClose: handleClose, tranId }),
|
|
2848
|
-
!error && !success && /* @__PURE__ */ React13.createElement(React13.Fragment, null, (loading || loading2) && /* @__PURE__ */ React13.createElement(Loader_default, { loading: loading || loading2 }), /* @__PURE__ */ React13.createElement("div", { className: "frac-card-payment-page frac-form" }, /* @__PURE__ */ React13.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React13.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React13.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React13.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React13.createElement("defs", null, /* @__PURE__ */ React13.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React13.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React13.createElement("div", { className: "pay-main-logo-res" }, /* @__PURE__ */ React13.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React13.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React13.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React13.createElement("h1", { className: "pay-heading" }, "Pay"), (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ React13.createElement("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React13.createElement(IoArrowBack, null), " Back")), /* @__PURE__ */ React13.createElement("div", { className: "amt-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" })))), /* @__PURE__ */ React13.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React13.createElement("div", null)), /* @__PURE__ */ React13.createElement("div", { className: "pay-tab pay-conatiner-two" }, !loading && /* @__PURE__ */ React13.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React13.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React13.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React13.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React13.createElement(IoArrowBack, null), " Back"), (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ React13.createElement("div", { className: "tab" }, /* @__PURE__ */ React13.createElement("button", { className: "tablinks", onClick: (e) => {
|
|
2849
|
-
handletabchange("card");
|
|
2850
|
-
}, style: { border: activetab === "card" ? "1px solid" : "" } }, /* @__PURE__ */ React13.createElement("i", { className: "fas fa-credit-card me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Card"), /* @__PURE__ */ React13.createElement("button", { className: "tablinks", onClick: (e) => {
|
|
2851
|
-
handletabchange("ach");
|
|
2852
|
-
}, style: { border: activetab === "ach" ? "1px solid" : "" } }, /* @__PURE__ */ React13.createElement("i", { className: "fas fa-university me-2", style: { marginRight: "8px", fontSize: "15px" } }), "Bank")), /* @__PURE__ */ React13.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_b = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _b.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" }))))) : /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" } }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React13.createElement("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" } }, " Cards/ACH"), /* @__PURE__ */ React13.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React13.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React13.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React13.createElement("strong", { className: "pay-amount" }, "$", (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2))), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" }))))), /* @__PURE__ */ React13.createElement("div", { id: "ach", style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React13.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_d = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _d.length) > 0 && ((_e = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _e.map((card, index) => /* @__PURE__ */ React13.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React13.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React13.createElement(
|
|
2853
|
-
"input",
|
|
2854
|
-
{
|
|
2855
|
-
disabled: (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type) && (card == null ? void 0 : card.card_type) != "Bank",
|
|
2856
|
-
type: "radio",
|
|
2857
|
-
className: "cardRadio",
|
|
2858
|
-
name: "selected_card",
|
|
2859
|
-
id: "",
|
|
2860
|
-
checked: selectedCard === card,
|
|
2861
|
-
onChange: (e) => setSelectedCard(card)
|
|
2862
|
-
}
|
|
2863
|
-
), /* @__PURE__ */ React13.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), (card == null ? void 0 : card.card_type) != "Bank" && /* @__PURE__ */ React13.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React13.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React13.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React13.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React13.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React13.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Pay With Other Card", /* @__PURE__ */ React13.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React13.createElement("div", { className: "form-group", style: { padding: "0" } }, /* @__PURE__ */ React13.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", (_f = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _f.toFixed(2)))), /* @__PURE__ */ React13.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("form", { id: "PaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React13.createElement("div", { className: "ach-scrl", style: { minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "398px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "456px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "cardHolderName" }, "NAME ON CARD "), /* @__PURE__ */ React13.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "John Doe", value: (cardData == null ? void 0 : cardData.cardName) || "", onChange: (e) => {
|
|
2864
|
-
const value = e.target.value;
|
|
2865
|
-
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
2866
|
-
handleCardChange("cardName", value);
|
|
2867
|
-
}
|
|
2868
|
-
} }), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "cardNumber" }, "CARD NUMBER"), /* @__PURE__ */ React13.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React13.createElement(
|
|
2869
|
-
"input",
|
|
2870
|
-
{
|
|
2871
|
-
className: "form-control card-number-new",
|
|
2872
|
-
type: "text",
|
|
2873
|
-
maxLength: 19,
|
|
2874
|
-
inputMode: "numeric",
|
|
2875
|
-
placeholder: "0000 0000 0000 0000",
|
|
2876
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
2877
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
2878
|
-
"data-token": "card_number"
|
|
2879
|
-
}
|
|
2880
|
-
), /* @__PURE__ */ React13.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React13.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React13.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React13.createElement(
|
|
2881
|
-
"input",
|
|
2882
|
-
{
|
|
2883
|
-
"data-token": "exp_month",
|
|
2884
|
-
className: "form-control required card-cvv-in",
|
|
2885
|
-
type: "text",
|
|
2886
|
-
style: { maxHeight: "36px" },
|
|
2887
|
-
placeholder: "MM",
|
|
2888
|
-
maxLength: 2,
|
|
2889
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
2890
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
2891
|
-
}
|
|
2892
|
-
)), /* @__PURE__ */ React13.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React13.createElement(
|
|
2893
|
-
"input",
|
|
2894
|
-
{
|
|
2895
|
-
"data-token": "exp_year",
|
|
2896
|
-
className: "form-control required card-cvv-in",
|
|
2897
|
-
type: "text",
|
|
2898
|
-
style: { maxHeight: "36px" },
|
|
2899
|
-
placeholder: "YYYY",
|
|
2900
|
-
maxLength: 4,
|
|
2901
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
2902
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
2903
|
-
}
|
|
2904
|
-
)), /* @__PURE__ */ React13.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React13.createElement(
|
|
2905
|
-
"input",
|
|
2906
|
-
{
|
|
2907
|
-
"data-token": "cvv",
|
|
2908
|
-
className: "form-control card-cvv-in required",
|
|
2909
|
-
type: "text",
|
|
2910
|
-
style: { maxHeight: "36px" },
|
|
2911
|
-
maxLength: 4,
|
|
2912
|
-
placeholder: "CVC",
|
|
2913
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
2914
|
-
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
2915
|
-
}
|
|
2916
|
-
)))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React13.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React13.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React13.createElement(
|
|
2917
|
-
"input",
|
|
2918
|
-
{
|
|
2919
|
-
type: "text",
|
|
2920
|
-
className: "form-control",
|
|
2921
|
-
maxLength: 100,
|
|
2922
|
-
placeholder: "OID123456",
|
|
2923
|
-
disabled: true,
|
|
2924
|
-
value: (_g = props == null ? void 0 : props.orderID) != null ? _g : "",
|
|
2925
|
-
style: { background: "#F6F6F7", color: "#727272" }
|
|
2926
|
-
}
|
|
2927
|
-
)), /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React13.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React13.createElement("div", { className: "form-group" }, /* @__PURE__ */ React13.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React13.createElement(
|
|
2928
|
-
"input",
|
|
2929
|
-
{
|
|
2930
|
-
type: "checkbox",
|
|
2931
|
-
id: "save_card",
|
|
2932
|
-
className: "toggle-checkbox",
|
|
2933
|
-
checked: saveCardInfo,
|
|
2934
|
-
onChange: (e) => setSaveCardInfo(e.target.checked)
|
|
2935
|
-
}
|
|
2936
|
-
), /* @__PURE__ */ React13.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React13.createElement("label", { htmlFor: "save_card" }, "Save card for future payments "), /* @__PURE__ */ React13.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React13.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React13.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React13.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React13.createElement("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })), /* @__PURE__ */ React13.createElement("defs", null, /* @__PURE__ */ React13.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React13.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React13.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: "0" } }, /* @__PURE__ */ React13.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", (_i = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _i.toFixed(2))))), /* @__PURE__ */ React13.createElement("div", { id: "ach", style: { display: activetab === "ach" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React13.createElement("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc }, /* @__PURE__ */ React13.createElement("div", { className: "ach-scrl", style: {
|
|
2937
|
-
minHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "378px" : (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) == 0 ? "436px" : (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px",
|
|
2938
|
-
maxHeight: (paymentData == null ? void 0 : paymentData.isSkyFiAccount) && (cardList == null ? void 0 : cardList.length) > 0 ? "358px" : (cardList == null ? void 0 : cardList.length) > 0 ? "380px" : "380px"
|
|
2939
|
-
} }, /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "nameonaccount" }, "Name on account"), /* @__PURE__ */ React13.createElement("input", { type: "text", id: "nameonaccount", className: "form-control", maxLength: 100, placeholder: "John Doe", name: "name", value: (_j = achData == null ? void 0 : achData.name) != null ? _j : "", onChange: handleChangeAch }), (achError == null ? void 0 : achError.name) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.name)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "routingnumber" }, "Routing number"), /* @__PURE__ */ React13.createElement(
|
|
2940
|
-
"input",
|
|
2941
|
-
{
|
|
2942
|
-
type: "text",
|
|
2943
|
-
id: "routingnumber",
|
|
2944
|
-
className: "form-control",
|
|
2945
|
-
maxLength: 9,
|
|
2946
|
-
placeholder: "000000000",
|
|
2947
|
-
name: "routingNumber",
|
|
2948
|
-
value: (_k = achData == null ? void 0 : achData.routingNumber) != null ? _k : "",
|
|
2949
|
-
onChange: handleChangeAch
|
|
2950
|
-
}
|
|
2951
|
-
), (achError == null ? void 0 : achError.routingNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.routingNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "accountnumber" }, "Account number"), /* @__PURE__ */ React13.createElement(
|
|
2952
|
-
"input",
|
|
2953
|
-
{
|
|
2954
|
-
type: "text",
|
|
2955
|
-
id: "accountnumber",
|
|
2956
|
-
className: "form-control",
|
|
2957
|
-
maxLength: 16,
|
|
2958
|
-
placeholder: "0000000000",
|
|
2959
|
-
name: "accountNumber",
|
|
2960
|
-
value: (_l = achData == null ? void 0 : achData.accountNumber) != null ? _l : "",
|
|
2961
|
-
onChange: handleChangeAch
|
|
2962
|
-
}
|
|
2963
|
-
), (achError == null ? void 0 : achError.accountNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.accountNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "confirmaccountnumber" }, "Confirm account number"), /* @__PURE__ */ React13.createElement(
|
|
2964
|
-
"input",
|
|
2965
|
-
{
|
|
2966
|
-
type: "text",
|
|
2967
|
-
id: "confirmaccountnumber",
|
|
2968
|
-
className: "form-control",
|
|
2969
|
-
maxLength: 16,
|
|
2970
|
-
placeholder: "0000000000",
|
|
2971
|
-
name: "confirmAccountNumber",
|
|
2972
|
-
value: (_m = achData == null ? void 0 : achData.confirmAccountNumber) != null ? _m : "",
|
|
2973
|
-
onChange: handleChangeAch
|
|
2974
|
-
}
|
|
2975
|
-
), (achError == null ? void 0 : achError.confirmAccountNumber) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.confirmAccountNumber)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "bankname" }, "Bank name"), /* @__PURE__ */ React13.createElement(
|
|
2976
|
-
"input",
|
|
2977
|
-
{
|
|
2978
|
-
type: "text",
|
|
2979
|
-
id: "bankname",
|
|
2980
|
-
className: "form-control",
|
|
2981
|
-
maxLength: 100,
|
|
2982
|
-
placeholder: "My Bank",
|
|
2983
|
-
name: "bankName",
|
|
2984
|
-
value: (_n = achData == null ? void 0 : achData.bankName) != null ? _n : "",
|
|
2985
|
-
onChange: handleChangeAch
|
|
2986
|
-
}
|
|
2987
|
-
), (achError == null ? void 0 : achError.bankName) && /* @__PURE__ */ React13.createElement("span", { className: "error-span" }, achError == null ? void 0 : achError.bankName)), /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4" }, /* @__PURE__ */ React13.createElement("label", { htmlFor: "accounttype" }, "Select account type"), /* @__PURE__ */ React13.createElement("select", { name: "accountType", id: "accounttype", className: "form-control", value: (_o = achData == null ? void 0 : achData.accountType) != null ? _o : "", onChange: handleChangeAch }, /* @__PURE__ */ React13.createElement("option", { value: "" }, "Select account"), /* @__PURE__ */ React13.createElement("option", { value: "Personal Saving" }, "Personal Saving"), /* @__PURE__ */ React13.createElement("option", { value: "Business Saving" }, "Business Saving"), /* @__PURE__ */ React13.createElement("option", { value: "Personal Checking" }, "Personal Checking"), /* @__PURE__ */ React13.createElement("option", { value: "Business Checking" }, "Business Checking"))), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4 save-ach-div", style: { paddingTop: "5px" } }, /* @__PURE__ */ React13.createElement("input", { type: "checkbox", id: "saveACH", className: "", maxLength: 100, placeholder: "My Bank", checked: saveACHinfo, onChange: (e) => setSaveACHinfo(e.target.checked) }), /* @__PURE__ */ React13.createElement("label", { htmlFor: "saveACH" }, "Save ACH")), saveACHinfo && /* @__PURE__ */ React13.createElement("div", { className: "form-group mb-4", style: { fontSize: "12px", color: "#727272" } }, /* @__PURE__ */ React13.createElement("p", null, "If checked, I agree for ", /* @__PURE__ */ React13.createElement("b", null, "ecommerce"), " to have my permission to charge this credit card for agreed upon purchases in the future."))), /* @__PURE__ */ React13.createElement("div", { className: "form-group " }, /* @__PURE__ */ React13.createElement("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit" }, "$", (_p = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _p.toFixed(2))))))))))))
|
|
2988
|
-
)));
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
// src/app/components/PreAuthCharge/PreAuthPaymentPage.tsx
|
|
2992
|
-
import React14, { useEffect as useEffect5, useState as useState4 } from "react";
|
|
2993
|
-
import axios4 from "axios";
|
|
2994
|
-
import Swal2 from "sweetalert2";
|
|
2995
|
-
import { IoArrowBack as IoArrowBack2 } from "react-icons/io5";
|
|
2996
|
-
function PreAuthPayment(props) {
|
|
2997
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2998
|
-
const [loading, setLoading] = useState4(false);
|
|
2999
|
-
const [loading2, setLoading2] = useState4(false);
|
|
3000
|
-
const [error, setError] = useState4("");
|
|
3001
|
-
const [success, setSuccess] = useState4(false);
|
|
3002
|
-
const [show, setShow] = useState4(false);
|
|
3003
|
-
const [activetab, setActive] = useState4("card");
|
|
3004
|
-
const [saveCardInfo, setSaveCardInfo] = useState4(false);
|
|
3005
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
|
3006
|
-
const [cardData, setCardData] = useState4();
|
|
3007
|
-
const [cardError, setCardError] = useState4({});
|
|
3008
|
-
const [cardList, setCardList] = useState4([]);
|
|
3009
|
-
const [selectedCard, setSelectedCard] = useState4();
|
|
3010
|
-
const [paymentData, setPaymentData] = useState4();
|
|
3011
|
-
let [tranId, setTranId] = useState4("");
|
|
3012
|
-
const showLoader = () => setLoading(true);
|
|
3013
|
-
const hideLoader = () => setLoading(false);
|
|
3014
|
-
const handleClose = () => {
|
|
3015
|
-
setShow(false);
|
|
3016
|
-
setActive("card");
|
|
3017
|
-
setLoading2(false);
|
|
3018
|
-
setError("");
|
|
3019
|
-
setSuccess(false);
|
|
3020
|
-
setTranId("");
|
|
3021
|
-
setCardData({
|
|
3022
|
-
cardName: "",
|
|
3023
|
-
cardNumber: "",
|
|
3024
|
-
expiryMonth: "",
|
|
3025
|
-
expiryYear: "",
|
|
3026
|
-
cvv: "",
|
|
3027
|
-
orderId: "",
|
|
3028
|
-
zipCode: ""
|
|
3029
|
-
});
|
|
3030
|
-
setCardError({
|
|
3031
|
-
cardName: "",
|
|
3032
|
-
cardNumber: "",
|
|
3033
|
-
expiryMonth: "",
|
|
3034
|
-
expiryYear: "",
|
|
3035
|
-
cvv: "",
|
|
3036
|
-
orderId: "",
|
|
3037
|
-
zipCode: ""
|
|
3038
|
-
});
|
|
3039
|
-
setSaveCardInfo(false);
|
|
3040
|
-
setSelectedCard({
|
|
3041
|
-
card_type: "",
|
|
3042
|
-
cardlastfourdigit: "",
|
|
3043
|
-
expmonth: 1,
|
|
3044
|
-
expyear: 2025,
|
|
3045
|
-
primary_card: 0,
|
|
3046
|
-
firstname: "",
|
|
3047
|
-
id: "",
|
|
3048
|
-
lastname: ""
|
|
3049
|
-
});
|
|
3050
|
-
};
|
|
3051
|
-
const handleShow = () => setShow(true);
|
|
3052
|
-
const handleCardChange = (field, value) => {
|
|
3053
|
-
const name = field;
|
|
3054
|
-
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
3055
|
-
if (numericFields.includes(name)) {
|
|
3056
|
-
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
3057
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3058
|
-
[name]: ""
|
|
3059
|
-
}));
|
|
3060
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3061
|
-
[name]: value
|
|
3062
|
-
}));
|
|
3063
|
-
}
|
|
3064
|
-
return;
|
|
3065
|
-
}
|
|
3066
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3067
|
-
[name]: ""
|
|
3068
|
-
}));
|
|
3069
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3070
|
-
[name]: value
|
|
3071
|
-
}));
|
|
3072
|
-
};
|
|
3073
|
-
const handleCardNumberChange = (e) => {
|
|
3074
|
-
const input = e.target;
|
|
3075
|
-
const rawValue = input.value.replace(/\D/g, "");
|
|
3076
|
-
let formatted = "";
|
|
3077
|
-
if (/^3[47]/.test(rawValue)) {
|
|
3078
|
-
const trimmed = rawValue.slice(0, 15);
|
|
3079
|
-
formatted = trimmed.replace(
|
|
3080
|
-
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
3081
|
-
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
3082
|
-
);
|
|
3083
|
-
} else {
|
|
3084
|
-
const trimmed = rawValue.slice(0, 16);
|
|
3085
|
-
formatted = trimmed.replace(
|
|
3086
|
-
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
3087
|
-
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
3088
|
-
);
|
|
3089
|
-
}
|
|
3090
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3091
|
-
cardNumber: ""
|
|
3092
|
-
}));
|
|
3093
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3094
|
-
cardNumber: formatted
|
|
3095
|
-
}));
|
|
3096
|
-
};
|
|
3097
|
-
const validateCardData = () => {
|
|
3098
|
-
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
3099
|
-
const errors = {};
|
|
3100
|
-
const data = cardData;
|
|
3101
|
-
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
3102
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
3103
|
-
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
3104
|
-
if (!((_b2 = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b2.trim())) errors.cardNumber = "Card number is required";
|
|
3105
|
-
if (!((_c2 = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c2.trim()) || !((_d2 = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d2.trim())) {
|
|
3106
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
3107
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
3108
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
3109
|
-
}
|
|
3110
|
-
if (!((_e2 = data == null ? void 0 : data.cvv) == null ? void 0 : _e2.trim())) errors.cvv = "CVV is required";
|
|
3111
|
-
if (!((_f2 = data == null ? void 0 : data.zipCode) == null ? void 0 : _f2.trim())) errors.zipCode = "ZIP code is required";
|
|
3112
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
3113
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
3114
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
3115
|
-
const now = /* @__PURE__ */ new Date();
|
|
3116
|
-
const currentMonth = now.getMonth() + 1;
|
|
3117
|
-
const currentYear = now.getFullYear();
|
|
3118
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
3119
|
-
errors.expiryMonth = "Card is expired";
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
|
-
setCardError(errors);
|
|
3123
|
-
return Object.keys(errors).length > 0;
|
|
3124
|
-
};
|
|
3125
|
-
const submitFunc = async (e) => {
|
|
3126
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
3127
|
-
e.preventDefault();
|
|
3128
|
-
if (activetab == "card") {
|
|
3129
|
-
const hasError = validateCardData();
|
|
3130
|
-
if (hasError) return;
|
|
3131
|
-
else {
|
|
3132
|
-
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
3133
|
-
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
3134
|
-
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
3135
|
-
let errors = {};
|
|
3136
|
-
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
3137
|
-
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
3138
|
-
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
3139
|
-
setCardError(errors);
|
|
3140
|
-
if (validCard && validCVV && validExpirationDate) {
|
|
3141
|
-
setLoading2(true);
|
|
3142
|
-
try {
|
|
3143
|
-
let tokenCallback = async function(response) {
|
|
3144
|
-
if (response.Error) {
|
|
3145
|
-
setError(response.Error);
|
|
3146
|
-
setLoading2(false);
|
|
3147
|
-
} else {
|
|
3148
|
-
let name = cardData == null ? void 0 : cardData.cardName;
|
|
3149
|
-
let postal_code = cardData == null ? void 0 : cardData.zipCode;
|
|
3150
|
-
response.name = name;
|
|
3151
|
-
response.postal_code = postal_code;
|
|
3152
|
-
response.fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
|
3153
|
-
response.amount = props == null ? void 0 : props.amount;
|
|
3154
|
-
response.order_id = props == null ? void 0 : props.orderID;
|
|
3155
|
-
response.preAuth_id = "";
|
|
3156
|
-
response.isCardSave = saveCardInfo;
|
|
3157
|
-
response.customer_id = props == null ? void 0 : props.customerId;
|
|
3158
|
-
response.link_token = "";
|
|
3159
|
-
response.gateway_id = paymentData == null ? void 0 : paymentData.paymentGateway;
|
|
3160
|
-
response.discount = props == null ? void 0 : props.discount;
|
|
3161
|
-
response.tax = props == null ? void 0 : props.tax;
|
|
3162
|
-
response.surcharge = props == null ? void 0 : props.surcharge;
|
|
3163
|
-
const myHeaders = new Headers();
|
|
3164
|
-
myHeaders.append("Content-Type", "application/json");
|
|
3165
|
-
const requestOptions = {
|
|
3166
|
-
method: "POST",
|
|
3167
|
-
body: JSON.stringify(response),
|
|
3168
|
-
redirect: "follow"
|
|
3169
|
-
};
|
|
3170
|
-
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions), { "isChargePreauth": true }));
|
|
3171
|
-
socketClient_default.on("charge-preauth", (data) => {
|
|
3172
|
-
var _a3;
|
|
3173
|
-
console.log(data, "datdata");
|
|
3174
|
-
if ((data == null ? void 0 : data.status) == "Failed") {
|
|
3175
|
-
setLoading2(false);
|
|
3176
|
-
setError((data == null ? void 0 : data.message) || "Something went wrong. Please try again later.");
|
|
3177
|
-
} else {
|
|
3178
|
-
setSuccess(true);
|
|
3179
|
-
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
|
3180
|
-
setLoading2(false);
|
|
3181
|
-
setCardData({
|
|
3182
|
-
cardName: "",
|
|
3183
|
-
cardNumber: "",
|
|
3184
|
-
expiryMonth: "",
|
|
3185
|
-
expiryYear: "",
|
|
3186
|
-
cvv: "",
|
|
3187
|
-
orderId: "",
|
|
3188
|
-
zipCode: ""
|
|
3189
|
-
});
|
|
3190
|
-
}
|
|
3191
|
-
});
|
|
3192
|
-
}
|
|
3193
|
-
};
|
|
3194
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
3195
|
-
const requestOptions = {
|
|
3196
|
-
method: "POST",
|
|
3197
|
-
redirect: "follow"
|
|
3198
|
-
};
|
|
3199
|
-
try {
|
|
3200
|
-
let sesionResult = await axios4.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
3201
|
-
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
3202
|
-
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
3203
|
-
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
3204
|
-
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
3205
|
-
const publicKey = forge.pki.publicKeyFromPem((_b2 = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b2.publicKeyPem);
|
|
3206
|
-
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
3207
|
-
md: forge.md.sha1.create(),
|
|
3208
|
-
mgf1: {
|
|
3209
|
-
md: forge.md.sha1.create()
|
|
3210
|
-
}
|
|
3211
|
-
});
|
|
3212
|
-
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
3213
|
-
const myHeaders = {
|
|
3214
|
-
"Content-Type": "application/json",
|
|
3215
|
-
"x-app-session-key": (_d2 = (_c2 = sesionResult.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.session_key
|
|
3216
|
-
};
|
|
3217
|
-
const raw = JSON.stringify({
|
|
3218
|
-
"enc_track2_data": `${encryptedBase64}`,
|
|
3219
|
-
"algorithm": "RSAES_OAEP_SHA_1",
|
|
3220
|
-
session_key: `${(_f2 = (_e2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e2.data) == null ? void 0 : _f2.session_key}`
|
|
3221
|
-
});
|
|
3222
|
-
try {
|
|
3223
|
-
const tokenizeData = await axios4.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
3224
|
-
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g2.data), {
|
|
3225
|
-
// isSaveCardChecked: saveCardInfo,
|
|
3226
|
-
name: cardData == null ? void 0 : cardData.cardName,
|
|
3227
|
-
postal_code: cardData == null ? void 0 : cardData.zipCode,
|
|
3228
|
-
customer_id: props == null ? void 0 : props.customerId,
|
|
3229
|
-
"amount": props == null ? void 0 : props.amount,
|
|
3230
|
-
"Token": `${(_i2 = (_h2 = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _h2.data) == null ? void 0 : _i2.token}`,
|
|
3231
|
-
"fractalpayPublicKey": fractalpayClientKey,
|
|
3232
|
-
"order_id": props == null ? void 0 : props.orderID,
|
|
3233
|
-
"preAuth_id": "",
|
|
3234
|
-
"isCardSave": saveCardInfo,
|
|
3235
|
-
"discount": props == null ? void 0 : props.discount,
|
|
3236
|
-
"surcharge": props == null ? void 0 : props.surcharge,
|
|
3237
|
-
"tax": props == null ? void 0 : props.tax,
|
|
3238
|
-
"link_token": "",
|
|
3239
|
-
"ExpirationYear": cardData == null ? void 0 : cardData.expiryYear,
|
|
3240
|
-
"ExpirationMonth": cardData == null ? void 0 : cardData.expiryMonth,
|
|
3241
|
-
"CVV": cardData == null ? void 0 : cardData.cvv,
|
|
3242
|
-
"Last4": (_k = (_j = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _j.data) == null ? void 0 : _k.last4,
|
|
3243
|
-
"Brand": (_m = (_l = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _l.data) == null ? void 0 : _m.brand,
|
|
3244
|
-
"gateway_id": paymentData == null ? void 0 : paymentData.paymentGateway
|
|
3245
|
-
}));
|
|
3246
|
-
let myHeaders2 = {
|
|
3247
|
-
"Content-Type": "application/json"
|
|
3248
|
-
};
|
|
3249
|
-
const requestOptions2 = {
|
|
3250
|
-
method: "POST",
|
|
3251
|
-
headers: myHeaders2,
|
|
3252
|
-
body: reqData,
|
|
3253
|
-
redirect: "follow"
|
|
3254
|
-
};
|
|
3255
|
-
socketClient_default.emit("sendMessage", __spreadProps(__spreadValues({}, requestOptions2), { "isFractalPreauth": true }));
|
|
3256
|
-
socketClient_default.on("fractal-charge-preauth", (data) => {
|
|
3257
|
-
var _a3;
|
|
3258
|
-
if ((data == null ? void 0 : data.status) == "Failed") {
|
|
3259
|
-
setLoading2(false);
|
|
3260
|
-
setError((data == null ? void 0 : data.message) || "Something went wrong , Try again later");
|
|
3261
|
-
} else {
|
|
3262
|
-
setTranId((_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.transaction_id);
|
|
3263
|
-
setSuccess(true);
|
|
3264
|
-
setLoading2(false);
|
|
3265
|
-
}
|
|
3266
|
-
});
|
|
3267
|
-
} catch (err) {
|
|
3268
|
-
console.log(err);
|
|
3269
|
-
setLoading2(false);
|
|
3270
|
-
setError(((_o = (_n = err == null ? void 0 : err.response) == null ? void 0 : _n.data) == null ? void 0 : _o.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
3271
|
-
}
|
|
3272
|
-
} catch (err) {
|
|
3273
|
-
setLoading2(false);
|
|
3274
|
-
setError(((_q = (_p = err == null ? void 0 : err.response) == null ? void 0 : _p.data) == null ? void 0 : _q.message) || (err == null ? void 0 : err.message) || "Something went wrong , Try again later");
|
|
3275
|
-
}
|
|
3276
|
-
} else {
|
|
3277
|
-
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "PaymentForm", tokenCallback);
|
|
3278
|
-
}
|
|
3279
|
-
} catch (err) {
|
|
3280
|
-
setLoading2(false);
|
|
3281
|
-
setError(((_s = (_r = err == null ? void 0 : err.response) == null ? void 0 : _r.data) == null ? void 0 : _s.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
};
|
|
3287
|
-
const getPaymentDetails = async () => {
|
|
3288
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3289
|
-
showLoader();
|
|
3290
|
-
try {
|
|
3291
|
-
const data = {
|
|
3292
|
-
fractalpayPublicKey: fractalpayClientKey,
|
|
3293
|
-
"customer_id": props == null ? void 0 : props.customerId,
|
|
3294
|
-
preauth: true
|
|
3295
|
-
};
|
|
3296
|
-
let paymentData2 = await axios4.post(`${baseUrl}get-payment-details`, data);
|
|
3297
|
-
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
3298
|
-
if (!((_c2 = (_b2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.paymentGateway)) {
|
|
3299
|
-
handleClose();
|
|
3300
|
-
setError("Something went wrong.");
|
|
3301
|
-
}
|
|
3302
|
-
if (((_e2 = (_d2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _d2.data) == null ? void 0 : _e2.card_list) && ((_h2 = (_g2 = (_f2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _f2.data) == null ? void 0 : _g2.card_list) == null ? void 0 : _h2.length) > 0) {
|
|
3303
|
-
setCardList((_j = (_i2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _i2.data) == null ? void 0 : _j.card_list);
|
|
3304
|
-
setActive("cardList");
|
|
3305
|
-
let primary_card = (_m = (_l = (_k = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _k.data) == null ? void 0 : _l.card_list) == null ? void 0 : _m.filter((card) => (card == null ? void 0 : card.primary_card) == 1);
|
|
3306
|
-
if ((primary_card == null ? void 0 : primary_card[0]) && ((_n = primary_card == null ? void 0 : primary_card[0]) == null ? void 0 : _n.payment_method_type) == ((_p = (_o = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _o.data) == null ? void 0 : _p.paymentGateway)) {
|
|
3307
|
-
setSelectedCard(primary_card[0]);
|
|
3308
|
-
}
|
|
3309
|
-
} else {
|
|
3310
|
-
setActive("card");
|
|
3311
|
-
}
|
|
3312
|
-
hideLoader();
|
|
3313
|
-
} catch (err) {
|
|
3314
|
-
console.log(err);
|
|
3315
|
-
hideLoader();
|
|
3316
|
-
setError(((_r = (_q = err == null ? void 0 : err.response) == null ? void 0 : _q.data) == null ? void 0 : _r.message) || (err == null ? void 0 : err.message) || "Something went wrong");
|
|
3317
|
-
}
|
|
3318
|
-
};
|
|
3319
|
-
const handlechargeCustomer = async () => {
|
|
3320
|
-
var _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
3321
|
-
let customer_id = props == null ? void 0 : props.customerId;
|
|
3322
|
-
let discount = props == null ? void 0 : props.discount;
|
|
3323
|
-
let surcharge = props == null ? void 0 : props.surcharge;
|
|
3324
|
-
let tax = props == null ? void 0 : props.tax;
|
|
3325
|
-
let fractalpayPublicKey = props == null ? void 0 : props.fractalpayClientKey;
|
|
3326
|
-
let order_id = props == null ? void 0 : props.orderID;
|
|
3327
|
-
let amount = props == null ? void 0 : props.amount;
|
|
3328
|
-
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
|
3329
|
-
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
|
3330
|
-
if (fractalpayPublicKey && order_id && amount) {
|
|
3331
|
-
if (customer_id) {
|
|
3332
|
-
if (card_id) {
|
|
3333
|
-
let chargeobj = {
|
|
3334
|
-
amount,
|
|
3335
|
-
order_id,
|
|
3336
|
-
customer_id,
|
|
3337
|
-
card_id,
|
|
3338
|
-
fractalpayPublicKey,
|
|
3339
|
-
isCardSave: card_type != "Bank",
|
|
3340
|
-
discount,
|
|
3341
|
-
surcharge,
|
|
3342
|
-
tax
|
|
3343
|
-
};
|
|
3344
|
-
let _a2 = chargeobj, { isCardSave } = _a2, rest = __objRest(_a2, ["isCardSave"]);
|
|
3345
|
-
let endpoint = card_type === "Bank" ? "charge-ach" : "charge-by-card";
|
|
3346
|
-
let chargeurl = baseUrl + endpoint;
|
|
3347
|
-
const headers = {
|
|
3348
|
-
"Content-Type": "application/json"
|
|
3349
|
-
};
|
|
3350
|
-
setLoading2(true);
|
|
3351
|
-
try {
|
|
3352
|
-
let result = await axios4.post(chargeurl, card_type == "Bank" ? rest : chargeobj, { headers });
|
|
3353
|
-
if ((_b2 = result == null ? void 0 : result.data) == null ? void 0 : _b2.result) {
|
|
3354
|
-
setTranId((_d2 = (_c2 = result == null ? void 0 : result.data) == null ? void 0 : _c2.data) == null ? void 0 : _d2.transaction_id);
|
|
3355
|
-
setSuccess(true);
|
|
3356
|
-
setLoading2(false);
|
|
3357
|
-
}
|
|
3358
|
-
} catch (err) {
|
|
3359
|
-
setLoading2(false);
|
|
3360
|
-
console.log(err);
|
|
3361
|
-
setError(((_f2 = (_e2 = err == null ? void 0 : err.response) == null ? void 0 : _e2.data) == null ? void 0 : _f2.message) || ((_h2 = (_g2 = err == null ? void 0 : err.response) == null ? void 0 : _g2.data) == null ? void 0 : _h2.status) || "Something went erong");
|
|
3362
|
-
}
|
|
3363
|
-
} else {
|
|
3364
|
-
setError("Please Select A Card/ACH");
|
|
3365
|
-
}
|
|
3366
|
-
} else {
|
|
3367
|
-
setError("Please Select Customer");
|
|
3368
|
-
}
|
|
3369
|
-
} else {
|
|
3370
|
-
setError("Something went wrong.");
|
|
3371
|
-
}
|
|
3372
|
-
};
|
|
3373
|
-
useEffect5(() => {
|
|
3374
|
-
if (show && fractalpayClientKey) {
|
|
3375
|
-
getPaymentDetails();
|
|
3376
|
-
}
|
|
3377
|
-
}, [fractalpayClientKey, show]);
|
|
3378
|
-
const handleDeleteCard = async (cardId) => {
|
|
3379
|
-
Swal2.fire({
|
|
3380
|
-
icon: "warning",
|
|
3381
|
-
text: "Do you want to delete the card?",
|
|
3382
|
-
showCancelButton: true,
|
|
3383
|
-
confirmButtonText: "Yes",
|
|
3384
|
-
cancelButtonText: "No",
|
|
3385
|
-
reverseButtons: true,
|
|
3386
|
-
buttonsStyling: false,
|
|
3387
|
-
customClass: {
|
|
3388
|
-
confirmButton: "swal2-confirm btn btn-dark",
|
|
3389
|
-
cancelButton: "swal2-cancel btn btn-dark",
|
|
3390
|
-
popup: "custom-swal-popup",
|
|
3391
|
-
icon: "custom-swal-icon"
|
|
3392
|
-
}
|
|
3393
|
-
}).then(async (result) => {
|
|
3394
|
-
if (result.isConfirmed) {
|
|
3395
|
-
setLoading2(true);
|
|
3396
|
-
try {
|
|
3397
|
-
let obj = {
|
|
3398
|
-
card_id: cardId,
|
|
3399
|
-
customer_id: props == null ? void 0 : props.customerId,
|
|
3400
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
3401
|
-
};
|
|
3402
|
-
const res = await axios4.post(`${baseUrl}delete-customer-card`, obj);
|
|
3403
|
-
setLoading2(false);
|
|
3404
|
-
getPaymentDetails();
|
|
3405
|
-
Swal2.fire({
|
|
3406
|
-
icon: "success",
|
|
3407
|
-
title: "Deleted!",
|
|
3408
|
-
text: "The card has been deleted.",
|
|
3409
|
-
confirmButtonText: "OK",
|
|
3410
|
-
customClass: {
|
|
3411
|
-
confirmButton: "btn btn-dark"
|
|
3412
|
-
}
|
|
3413
|
-
});
|
|
3414
|
-
} catch (err) {
|
|
3415
|
-
setLoading2(false);
|
|
3416
|
-
Swal2.fire({
|
|
3417
|
-
icon: "error",
|
|
3418
|
-
title: "Error!",
|
|
3419
|
-
text: "Failed to delete the card.",
|
|
3420
|
-
confirmButtonText: "OK",
|
|
3421
|
-
customClass: {
|
|
3422
|
-
confirmButton: "btn btn-dark"
|
|
3423
|
-
}
|
|
3424
|
-
});
|
|
3425
|
-
}
|
|
3426
|
-
}
|
|
3427
|
-
});
|
|
3428
|
-
};
|
|
3429
|
-
return /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(DataScript, null), /* @__PURE__ */ React14.createElement(Chargewidgetstyles, null), /* @__PURE__ */ React14.createElement(React14.Fragment, null, /* @__PURE__ */ React14.createElement(
|
|
3430
|
-
"button",
|
|
3431
|
-
{
|
|
3432
|
-
className: "paymentBtn",
|
|
3433
|
-
onClick: handleShow
|
|
3434
|
-
},
|
|
3435
|
-
"Pre Auth Pay"
|
|
3436
|
-
), /* @__PURE__ */ React14.createElement(
|
|
3437
|
-
CustomModal2_default,
|
|
3438
|
-
{
|
|
3439
|
-
open: show,
|
|
3440
|
-
onClose: handleClose
|
|
3441
|
-
},
|
|
3442
|
-
error && /* @__PURE__ */ React14.createElement("div", { style: { maxHeight: "606px", minHeight: "60vh", padding: "40px" } }, /* @__PURE__ */ React14.createElement(ErrorCardMessage_default, { error, onClose: handleClose })),
|
|
3443
|
-
success && /* @__PURE__ */ React14.createElement(SuccessMsz, { onClose: handleClose, tranId }),
|
|
3444
|
-
!error && !success && /* @__PURE__ */ React14.createElement(React14.Fragment, null, (loading || loading2) && /* @__PURE__ */ React14.createElement(Loader_default, { loading: loading || loading2 }), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", { className: "frac-card-payment-page frac-form" }, /* @__PURE__ */ React14.createElement("div", { className: "parent-pay-container" }, /* @__PURE__ */ React14.createElement("span", { className: "request-payment-close-popup", onClick: handleClose }, /* @__PURE__ */ React14.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React14.createElement("g", { clipPath: "url(#clip0_12425_52336)" }, /* @__PURE__ */ React14.createElement("path", { d: "M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z", fill: "#727272" })), /* @__PURE__ */ React14.createElement("defs", null, /* @__PURE__ */ React14.createElement("clipPath", { id: "clip0_12425_52336" }, /* @__PURE__ */ React14.createElement("rect", { width: "16", height: "16", fill: "white" }))))), /* @__PURE__ */ React14.createElement("div", { className: "pay-container" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-header pay-conatiner-one" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-conatiner-one-first" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-logo-container" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-main-logo" }, /* @__PURE__ */ React14.createElement("img", { src: "https://fractal-userdata-upload.s3.us-east-1.amazonaws.com/uploaded/merchant_logo/20250311131124_merchant_logo.png", id: "pay-logos" })), /* @__PURE__ */ React14.createElement("h1", { className: "pay-heading" }, "Pay"), (cardList == null ? void 0 : cardList.length) > 0 && activetab !== "cardList" && /* @__PURE__ */ React14.createElement("button", { className: "res-charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React14.createElement(IoArrowBack2, null), " Back")), /* @__PURE__ */ React14.createElement("div", { className: "amt-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner" }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2))), activetab != "ach" && /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", gap: "8px", margin: "8px 0" } }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 33, alt: "" }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 33 }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 33, alt: "" })))), /* @__PURE__ */ React14.createElement("div", { className: "pay-conatiner-one-last" }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/secure-img.png", alt: "" }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/pov-by.png", alt: "" }), "Secure payments powered by Fractal"), /* @__PURE__ */ React14.createElement("div", null)), !loading && /* @__PURE__ */ React14.createElement("div", { className: "pay-tab pay-conatiner-two" }, /* @__PURE__ */ React14.createElement("div", { className: "col-md-12" }, /* @__PURE__ */ React14.createElement("div", { id: "payment-form-div" }, activetab !== "cardList" ? /* @__PURE__ */ React14.createElement("div", null, (cardList == null ? void 0 : cardList.length) > 0 && /* @__PURE__ */ React14.createElement("button", { className: "charge-payment-back-btn ", onClick: () => setActive("cardList") }, " ", /* @__PURE__ */ React14.createElement(IoArrowBack2, null), " Back"), /* @__PURE__ */ React14.createElement("div", { className: "" }, /* @__PURE__ */ React14.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_b = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _b.toFixed(2))), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" })))))) : /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("h6", { className: "charge-customer-name", style: { marginBottom: "16px !important" } }, " Charge ", paymentData == null ? void 0 : paymentData.customer_name), /* @__PURE__ */ React14.createElement("div", { className: "res-pay-con" }, /* @__PURE__ */ React14.createElement("div", { className: "pay-amount-conatiner", style: { margin: 0 } }, /* @__PURE__ */ React14.createElement("small", { className: "pay-payment-amount" }, "Payment Amount"), /* @__PURE__ */ React14.createElement("strong", { className: "pay-amount" }, "$", (_c = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _c.toFixed(2))), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/visa-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/mc-img.svg", width: 35, alt: "" })), /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/ae-img.svg", alt: "", width: 35, style: { paddingRight: "5px" } }), /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/discover-img.svg", width: 35, alt: "" })))), /* @__PURE__ */ React14.createElement("h6", { className: "card-ach-heading", style: { marginBottom: "10px !important" } }, " Cards")), /* @__PURE__ */ React14.createElement("div", { style: { display: activetab === "cardList" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React14.createElement("div", { className: "card-lint-div-in" }, /* @__PURE__ */ React14.createElement("div", { className: "card-list-div" }, (paymentData == null ? void 0 : paymentData.card_list) && ((_d = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _d.length) > 0 && ((_e = paymentData == null ? void 0 : paymentData.card_list) == null ? void 0 : _e.map((card, index) => /* @__PURE__ */ React14.createElement("div", { className: "card-list-single-div", key: index }, /* @__PURE__ */ React14.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React14.createElement(
|
|
3445
|
-
"input",
|
|
3446
|
-
{
|
|
3447
|
-
disabled: (paymentData == null ? void 0 : paymentData.paymentGateway) != (card == null ? void 0 : card.payment_method_type),
|
|
3448
|
-
type: "radio",
|
|
3449
|
-
className: "cardRadio",
|
|
3450
|
-
name: "selected_card",
|
|
3451
|
-
id: "",
|
|
3452
|
-
checked: selectedCard === card,
|
|
3453
|
-
onChange: (e) => setSelectedCard(card)
|
|
3454
|
-
}
|
|
3455
|
-
), /* @__PURE__ */ React14.createElement("label", { htmlFor: "", className: "card-number-last-four" }, "**** ", card == null ? void 0 : card.cardlastfourdigit), /* @__PURE__ */ React14.createElement("h6", { className: "card-expiry-date" }, card == null ? void 0 : card.expmonth, "/", card == null ? void 0 : card.expyear)), /* @__PURE__ */ React14.createElement("div", { className: "card-number-radio" }, /* @__PURE__ */ React14.createElement("span", { className: "visa-card" }, /* @__PURE__ */ React14.createElement("img", { src: (card == null ? void 0 : card.card_type) != "Bank" ? "https://dev-widget.fractalpay.com/images/visa-img.svg" : "https://dev-widget.fractalpay.com/images/bank.svg", alt: "" })), /* @__PURE__ */ React14.createElement("span", { className: "visa-card", style: { cursor: "pointer" }, onClick: () => handleDeleteCard(card == null ? void 0 : card.id) }, /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/Trash.svg", alt: "" }))))))), /* @__PURE__ */ React14.createElement("div", { className: "pay-with-other-card ", onClick: () => setActive("card") }, "Authorize With Other Card", /* @__PURE__ */ React14.createElement("img", { src: "https://dev-widget.fractalpay.com/images/card.svg", alt: "" }))), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlechargeCustomer }, "$", (_f = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _f.toFixed(2)))), /* @__PURE__ */ React14.createElement("div", { id: "card", style: { display: activetab === "card" ? "block" : "none" }, className: "tabcontent" }, /* @__PURE__ */ React14.createElement("form", { id: "PaymentForm", onSubmit: submitFunc }, /* @__PURE__ */ React14.createElement("div", { className: "ach-scrl", style: { minHeight: (cardList == null ? void 0 : cardList.length) > 0 ? "462px" : "520px", overflow: "auto", marginRight: "5px" } }, /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "cardHolderName" }, "Name on Card"), /* @__PURE__ */ React14.createElement(
|
|
3456
|
-
"input",
|
|
3457
|
-
{
|
|
3458
|
-
type: "text",
|
|
3459
|
-
className: "form-control",
|
|
3460
|
-
placeholder: "John Doe",
|
|
3461
|
-
value: (cardData == null ? void 0 : cardData.cardName) || "",
|
|
3462
|
-
onChange: (e) => {
|
|
3463
|
-
const value = e.target.value;
|
|
3464
|
-
if (/^[a-zA-Z\s]*$/.test(value)) {
|
|
3465
|
-
handleCardChange("cardName", value);
|
|
3466
|
-
}
|
|
3467
|
-
}
|
|
3468
|
-
}
|
|
3469
|
-
), (cardError == null ? void 0 : cardError.cardName) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardName)), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "cardNumber" }, "Card Number"), /* @__PURE__ */ React14.createElement("div", { className: "toggle-num-wrapper" }, /* @__PURE__ */ React14.createElement(
|
|
3470
|
-
"input",
|
|
3471
|
-
{
|
|
3472
|
-
className: "form-control card-number-new",
|
|
3473
|
-
type: "text",
|
|
3474
|
-
maxLength: 19,
|
|
3475
|
-
inputMode: "numeric",
|
|
3476
|
-
placeholder: "0000 0000 0000 0000",
|
|
3477
|
-
value: (cardData == null ? void 0 : cardData.cardNumber) || "",
|
|
3478
|
-
onChange: (e) => handleCardNumberChange(e),
|
|
3479
|
-
"data-token": "card_number"
|
|
3480
|
-
}
|
|
3481
|
-
), /* @__PURE__ */ React14.createElement("div", { className: "card-crdi card-expiry-new" }, /* @__PURE__ */ React14.createElement("div", { className: "exp-date-year-container" }, /* @__PURE__ */ React14.createElement("div", { className: "exp-date form-group" }, /* @__PURE__ */ React14.createElement(
|
|
3482
|
-
"input",
|
|
3483
|
-
{
|
|
3484
|
-
"data-token": "exp_month",
|
|
3485
|
-
className: "form-control required card-cvv-in",
|
|
3486
|
-
type: "text",
|
|
3487
|
-
style: { maxHeight: "36px" },
|
|
3488
|
-
placeholder: "MM",
|
|
3489
|
-
maxLength: 2,
|
|
3490
|
-
value: (cardData == null ? void 0 : cardData.expiryMonth) || "",
|
|
3491
|
-
onChange: (e) => handleCardChange("expiryMonth", e.target.value)
|
|
3492
|
-
}
|
|
3493
|
-
)), /* @__PURE__ */ React14.createElement("div", { className: "exp-year form-group" }, /* @__PURE__ */ React14.createElement(
|
|
3494
|
-
"input",
|
|
3495
|
-
{
|
|
3496
|
-
"data-token": "exp_year",
|
|
3497
|
-
className: "form-control required card-cvv-in",
|
|
3498
|
-
type: "text",
|
|
3499
|
-
style: { maxHeight: "36px" },
|
|
3500
|
-
placeholder: "YYYY",
|
|
3501
|
-
maxLength: 4,
|
|
3502
|
-
value: (cardData == null ? void 0 : cardData.expiryYear) || "",
|
|
3503
|
-
onChange: (e) => handleCardChange("expiryYear", e.target.value)
|
|
3504
|
-
}
|
|
3505
|
-
)), /* @__PURE__ */ React14.createElement("div", { className: "security-digit form-group" }, /* @__PURE__ */ React14.createElement(
|
|
3506
|
-
"input",
|
|
3507
|
-
{
|
|
3508
|
-
"data-token": "cvv",
|
|
3509
|
-
className: "form-control required card-cvv-in",
|
|
3510
|
-
type: "text",
|
|
3511
|
-
style: { maxHeight: "36px" },
|
|
3512
|
-
maxLength: 4,
|
|
3513
|
-
placeholder: "CVC",
|
|
3514
|
-
value: (cardData == null ? void 0 : cardData.cvv) || "",
|
|
3515
|
-
onChange: (e) => handleCardChange("cvv", e.target.value)
|
|
3516
|
-
}
|
|
3517
|
-
)))), (cardError == null ? void 0 : cardError.cardNumber) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cardNumber), /* @__PURE__ */ React14.createElement("p", { style: { margin: "0" } }, (cardError == null ? void 0 : cardError.expiryMonth) || (cardError == null ? void 0 : cardError.expiryYear) ? /* @__PURE__ */ React14.createElement("span", { className: "error-span", style: { paddingRight: "4px" } }, cardError == null ? void 0 : cardError.expiryMonth) : "", (cardError == null ? void 0 : cardError.cvv) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.cvv)))), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "OrderId" }, "Order ID / Description"), /* @__PURE__ */ React14.createElement(
|
|
3518
|
-
"input",
|
|
3519
|
-
{
|
|
3520
|
-
type: "text",
|
|
3521
|
-
className: "form-control",
|
|
3522
|
-
maxLength: 100,
|
|
3523
|
-
placeholder: "OID123456",
|
|
3524
|
-
disabled: true,
|
|
3525
|
-
value: (_g = cardData == null ? void 0 : cardData.orderId) != null ? _g : "OID123456",
|
|
3526
|
-
onChange: (e) => handleCardChange("orderId", e.target.value),
|
|
3527
|
-
style: { background: "#F6F6F7", color: "#727272" }
|
|
3528
|
-
}
|
|
3529
|
-
)), /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("label", { htmlFor: "zip" }, "ZIP"), /* @__PURE__ */ React14.createElement("input", { type: "text", className: "form-control", maxLength: 100, placeholder: "000000", value: (_h = cardData == null ? void 0 : cardData.zipCode) != null ? _h : "", onChange: (e) => handleCardChange("zipCode", e.target.value) }), (cardError == null ? void 0 : cardError.zipCode) && /* @__PURE__ */ React14.createElement("span", { className: "error-span" }, cardError == null ? void 0 : cardError.zipCode)), (props == null ? void 0 : props.customerId) && /* @__PURE__ */ React14.createElement("div", { className: "form-group" }, /* @__PURE__ */ React14.createElement("div", { style: { display: "flex", alignItems: "center", gap: "10px", paddingTop: "10px" } }, /* @__PURE__ */ React14.createElement(
|
|
3530
|
-
"input",
|
|
3531
|
-
{
|
|
3532
|
-
type: "checkbox",
|
|
3533
|
-
id: "save_card",
|
|
3534
|
-
className: "toggle-checkbox",
|
|
3535
|
-
checked: saveCardInfo,
|
|
3536
|
-
onChange: (e) => setSaveCardInfo(e.target.checked)
|
|
3537
|
-
}
|
|
3538
|
-
), /* @__PURE__ */ React14.createElement("label", { htmlFor: "save_card", className: "toggle-label" }), /* @__PURE__ */ React14.createElement("label", { htmlFor: "save_card" }, "Save card for future payments "), /* @__PURE__ */ React14.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React14.createElement("g", { clipPath: "url(#clip0_12420_50192)" }, /* @__PURE__ */ React14.createElement("rect", { width: "20", height: "20", fill: "white" }), /* @__PURE__ */ React14.createElement("circle", { cx: "10", cy: "10", r: "10", fill: "#E0DFE2" }), /* @__PURE__ */ React14.createElement("path", { d: "M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z", fill: "#161616" })), /* @__PURE__ */ React14.createElement("defs", null, /* @__PURE__ */ React14.createElement("clipPath", { id: "clip0_12420_50192" }, /* @__PURE__ */ React14.createElement("rect", { width: "20", height: "20", fill: "white" }))))))), /* @__PURE__ */ React14.createElement("div", { className: "form-group", style: { marginTop: "20px", padding: 0 } }, /* @__PURE__ */ React14.createElement("button", { type: "submit", style: { margin: 0 }, className: "pay-button" }, "$", (_i = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _i.toFixed(2)))))))))))))
|
|
3539
|
-
)));
|
|
3540
|
-
}
|
|
3541
|
-
|
|
3542
|
-
// src/app/components/AddCard/AddCardEasyPay.tsx
|
|
3543
|
-
import React18, { useEffect as useEffect6, useState as useState5 } from "react";
|
|
3544
|
-
import Swal3 from "sweetalert2";
|
|
3545
|
-
import axios5 from "axios";
|
|
3546
|
-
|
|
3547
|
-
// src/app/components/AddCard/AddCardStyles.tsx
|
|
3548
|
-
import React15 from "react";
|
|
3549
|
-
function AddCardStyle() {
|
|
3550
|
-
const primarycolor = "#000";
|
|
3551
|
-
const primarybgcolor = "#fff";
|
|
3552
|
-
const primarybodycolor = "#212529";
|
|
3553
|
-
const primarybordercolor = "#dee2e6";
|
|
3554
|
-
return /* @__PURE__ */ React15.createElement("style", null, `
|
|
1472
|
+
`)}var mi=({onClose:e,error:L})=>St.createElement(St.Fragment,null,St.createElement(hn,null),St.createElement("div",{className:"card-error"},St.createElement("div",{className:"payment-error-container"},St.createElement("div",{className:"error-icon"},St.createElement("div",{className:"circle"},St.createElement("i",{className:"fa fa-times","aria-hidden":"true"})),St.createElement("div",{className:"error-text"},St.createElement("div",{className:"payment-error-text"},L),St.createElement("div",{className:"thank-you-text"},"Try again later ")),St.createElement("div",{className:"error-btn-div"},St.createElement("button",{onClick:e},"OK")))))),jt=mi;import{io as di}from"socket.io-client";var ci=di(Be,{transports:["websocket"],withCredentials:!1}),vt=ci;var yn=e=>{try{let L=JSON.parse(e);return typeof L=="object"&&L!==null}catch(L){return!1}},un=[{value:"personal saving",label:"Personal Saving"},{value:"business saving",label:"Business Saving"},{value:"personal checking",label:"Personal Checking"},{value:"business checking",label:"Business Checking"}];function Gt(e){let L=Number(e);return isNaN(L)?`$${e}`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(L)}function ui(e){var Le,ve,Ve,Ke,lt,mt,wt,Nt,kt,Re,ce,gt,yt,Tt,Te,Bt,xt,ze,Oe,Vt,Mt,Kt,ot,l,c,U;let[L,$]=et(!1),[Z,j]=et(!1),[Ye,B]=et(""),[Qe,xe]=et(!1),[ie,u]=et(!1),[E,C]=et("card"),[y,a]=et("card"),[de,b]=et(!0),[pe,h]=et(!1),[Ae,K]=et(!1),ue=e.merchantPublicKey,ct=le+"widget/mc-img.svg",$e=le+"widget/visa-img.svg",nt=le+"widget/ae-img.svg",w=le+"widget/discover-img.svg",be=le+"widget/card.svg",W=le+"widget/Trash.svg",k=le+"widget/bank.svg",g=le+"widget/secure-img.png",me=le+"widget/pov-by.png",R=le+"widget/pax.svg",[m,d]=et(),[v,J]=et({}),[x,p]=et(),[r,z]=et({}),[A,Ne]=et([]),[Fe,ht]=et(),[qe,De]=et(),[f,Ct]=et(),[pt,rt]=et(""),tt=()=>$(!0),it=()=>$(!1),ut=()=>{u(!1),C("card"),B(""),xe(!1),rt(""),p({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),z({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),d({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),J({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),K(!1),h(!1),ht({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""}),De({}),a("card"),b(!0),j(!1),$(!1)},qt=()=>u(!0),st=o=>{C(o)},Ge=(o,n)=>{let F=o;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(F)){(n===""||/^[0-9]+$/.test(n))&&(J(P=>I(_({},P),{[F]:""})),d(P=>I(_({},P),{[F]:n})));return}J(P=>I(_({},P),{[F]:""})),d(P=>I(_({},P),{[F]:n}))},ke=o=>{let F=o.target.value.replace(/\D/g,""),H="";/^3[47]/.test(F)?H=F.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(O,V,T,D)=>[V,T,D].filter(Boolean).join(" ")):H=F.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(O,V,T,D,te)=>[V,T,D,te].filter(Boolean).join(" ")),J(P=>I(_({},P),{cardNumber:""})),d(P=>I(_({},P),{cardNumber:H}))},oe=o=>{let{name:n,value:F}=o.target,H=["routingNumber","accountNumber","confirmAccountNumber"];if(n=="name"){/^[a-zA-Z\s]*$/.test(F)&&(z(P=>I(_({},P),{[n]:""})),p(P=>I(_({},P),{[n]:F})));return}if(H.includes(n)){(F===""||/^[0-9]+$/.test(F))&&(z(P=>I(_({},P),{[n]:""})),p(P=>I(_({},P),{[n]:F})));return}z(P=>I(_({},P),{[n]:""})),p(P=>I(_({},P),{[n]:F}))},N=()=>{var P,O,V,T,D,te;let o={},n=m,F=parseInt((n==null?void 0:n.expiryMonth)||"",10),H=(n==null?void 0:n.expiryYear)||"";if((P=n==null?void 0:n.cardName)!=null&&P.trim()||(o.cardName="Card name is required"),(O=n==null?void 0:n.cardNumber)!=null&&O.trim()||(o.cardNumber="Card number is required"),(!((V=n==null?void 0:n.expiryMonth)!=null&&V.trim())||!((T=n==null?void 0:n.expiryYear)!=null&&T.trim())||isNaN(F)||F<1||F>12||H.length!==4)&&(o.expiryMonth="Invalid Expiration Date."),(D=n==null?void 0:n.cvv)!=null&&D.trim()||(o.cvv="CVV is required"),(te=n==null?void 0:n.zipCode)!=null&&te.trim()||(o.zipCode="ZIP code is required"),n!=null&&n.expiryMonth&&(n!=null&&n.expiryYear)&&n.expiryMonth.length<=2&&n.expiryYear.length===4){let ee=parseInt(n.expiryMonth,10),G=parseInt(n.expiryYear,10),dt=new Date,re=dt.getMonth()+1,Je=dt.getFullYear();(G<Je||G===Je&&ee<re)&&(o.expiryMonth="Card is expired")}return J(o),Object.keys(o).length>0},Y=()=>{var F,H,P,O,V,T,D,te;let o={},n=x;return(F=n==null?void 0:n.name)!=null&&F.trim()||(o.name="Name is required"),(H=n==null?void 0:n.accountNumber)!=null&&H.trim()||(o.accountNumber="Account number is required"),(P=n==null?void 0:n.accountNumber)!=null&&P.trim()&&((O=n==null?void 0:n.accountNumber)==null?void 0:O.trim())!==((V=n==null?void 0:n.confirmAccountNumber)==null?void 0:V.trim())&&(o.confirmAccountNumber="Account numbers must match"),(T=n==null?void 0:n.bankName)!=null&&T.trim()||(o.bankName="Bank name is required"),(D=n==null?void 0:n.routingNumber)!=null&&D.trim()||(o.routingNumber="Routing Number is required"),n!=null&&n.routingNumber&&((te=n==null?void 0:n.routingNumber)==null?void 0:te.length)!==9&&(o.routingNumber="Routing number must be 9 digits"),((n==null?void 0:n.accountType)==="business saving"||(n==null?void 0:n.accountType)==="business checking")&&(!(n!=null&&n.companyName)||(n==null?void 0:n.companyName)==="")&&(o.companyName="Company Name is required for business accounts"),z(o),Object.keys(o).length>0},ae=async o=>{var n,F,H,P,O,V,T,D,te,ee,G,dt,re,Je,Yt,Ze;if(o.preventDefault(),E!=="ach"){if(N())return;{let Ce=DatacapWebToken.validateCardNumber(m==null?void 0:m.cardNumber.replaceAll(" ","")),Se=DatacapWebToken.validateExpirationDate(m==null?void 0:m.expiryMonth,m==null?void 0:m.expiryYear),$t=DatacapWebToken.validateCVV(m==null?void 0:m.cvv),zt={};if(Ce||(zt.cardNumber="Invalid card Number"),Se||(zt.expiryMonth="Invalid Expiration Date."),$t||(zt.cvv="Invalid CVV"),J(zt),Ce&&$t&&Se){j(!0);try{let _t=I(_({},m),{amount:`${e.amount||0}`,fractalpayPublicKey:ue,orderId:e==null?void 0:e.orderID,customer_id:e==null?void 0:e.customerId,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax}),Ee=await Dt.post(`${Be}create-widget-order`,_t),Xt=async function(Pe){if(Pe.Error)B(Pe.Error),j(!1);else{let se=m==null?void 0:m.cardName,ne=m==null?void 0:m.zipCode;Pe.name=se,Pe.postal_code=ne,Pe.isCardSave=`${pe}`,Pe.isCharge=!0,Pe.posSalesIdEncode=Ee==null?void 0:Ee.data.data.posSalesIdEncode,vt.emit("sendMessage",Pe),vt.on(Ee==null?void 0:Ee.data.data.posSalesIdEncode,Ie=>{if(yn(Ie==null?void 0:Ie.data)){let We=JSON.parse(Ie.data);We!=null&&We.result?(d({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),h(!1),rt(We==null?void 0:We.transactionId),xe(!0),j(!1)):(j(!1),B((We==null?void 0:We.message)||"Something went wrong."))}else B("Something went wrong.")})}};if((f==null?void 0:f.paymentGateway)===32){let Pe={method:"POST",redirect:"follow"};try{let se=await Dt.post(`${_e}api/v1/widget/generate-session`,Pe),ne=Number(m==null?void 0:m.expiryYear)%100,Ie=m==null?void 0:m.cardNumber;Ie=Ie==null?void 0:Ie.replace(/\s+/g,"");let We=`${Ie}=${ne}${m==null?void 0:m.expiryMonth} ${m==null?void 0:m.cvv}`,qn=forge.pki.publicKeyFromPem((F=(n=se==null?void 0:se.data)==null?void 0:n.data)==null?void 0:F.publicKeyPem).encrypt(We,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),Tn=forge.util.encode64(qn),Bn={"Content-Type":"application/json","x-app-session-key":(P=(H=se.data)==null?void 0:H.data)==null?void 0:P.session_key},Yn=JSON.stringify({enc_track2_data:`${Tn}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(V=(O=se==null?void 0:se.data)==null?void 0:O.data)==null?void 0:V.session_key}`});try{let Ft=await Dt.post(`${Ht}tokenizer/tokenize`,Yn,{headers:Bn}),$n=JSON.stringify(I(_({},(T=Ft==null?void 0:Ft.data)==null?void 0:T.data),{isSaveCardChecked:pe,name:m==null?void 0:m.cardName,postal_code:m==null?void 0:m.zipCode,customer_id:e==null?void 0:e.customerId})),Hn=JSON.stringify({pre_sales_id:`${(te=(D=Ee==null?void 0:Ee.data)==null?void 0:D.data)==null?void 0:te.posSalesIdEncode}`,token:`${(ee=Ft==null?void 0:Ft.data)==null?void 0:ee.data.token}`,json_response:`${$n}`}),jn={method:"POST",headers:JSON.stringify({"Content-Type":"application/json"}),body:Hn,redirect:"follow",isChargeviafractal:!0};vt.emit("sendMessage",jn),vt.on("chargeviafractalgateway",Qt=>{var Nn;if(yn(Qt==null?void 0:Qt.data)){let Ot=JSON.parse(Qt==null?void 0:Qt.data);Ot!=null&&Ot.result?(rt((Nn=Ot==null?void 0:Ot.data)==null?void 0:Nn.transactionId),xe(!0),j(!1)):(j(!1),B((Ot==null?void 0:Ot.message)||"Something went wrong."))}else B("Something went wrong.")})}catch(Ft){j(!1),B(((dt=(G=Ft==null?void 0:Ft.response)==null?void 0:G.data)==null?void 0:dt.message)||(Ft==null?void 0:Ft.message)||"Something went wrong.")}}catch(se){j(!1),B(((Je=(re=se==null?void 0:se.response)==null?void 0:re.data)==null?void 0:Je.message)||(se==null?void 0:se.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(Ee==null?void 0:Ee.data.data.dctoken,"PaymentForm",Xt)}catch(_t){j(!1),B(((Ze=(Yt=_t==null?void 0:_t.response)==null?void 0:Yt.data)==null?void 0:Ze.message)||(_t==null?void 0:_t.message)||"Something went wrong.")}}}}else{if(Y())return;{j(!0);let Ce={fractalpayPublicKey:ue,label:(x==null?void 0:x.name)||"John Doe",account_number:x==null?void 0:x.accountNumber,routing_number:x==null?void 0:x.routingNumber,bank_name:x==null?void 0:x.bankName,account_type:x==null?void 0:x.accountType,amount:String(e.amount||0),isSaveAch:Ae,customer_id:e==null?void 0:e.customerId,order_id:e==null?void 0:e.orderID,tax:e==null?void 0:e.tax,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,isChargeACH:!0,company_name:(x==null?void 0:x.companyName)||""};vt.emit("sendMessage",Ce),vt.on("ach-incoming",Se=>{var $t;(Se==null?void 0:Se.status)=="Failed"?typeof(Se==null?void 0:Se.message)=="object"?Object.values(Se==null?void 0:Se.message).forEach(zt=>{B(zt||"Something went wrong")}):B((Se==null?void 0:Se.message)||"Something went wrong"):(rt(($t=Se==null?void 0:Se.data)==null?void 0:$t.transaction_id),xe(!0),j(!1))})}}},Me=async()=>{var o,n,F,H,P,O,V,T,D,te,ee,G,dt,re,Je,Yt,Ze,Ue,Ce,Se,$t,zt,_t,Ee,Xt,Pe;tt();try{let se={fractalpayPublicKey:ue,customer_id:e==null?void 0:e.customerId},ne=await Dt.post(`${Be}get-payment-details`,se);if(Ct((o=ne==null?void 0:ne.data)==null?void 0:o.data),(F=(n=ne==null?void 0:ne.data)==null?void 0:n.data)!=null&&F.paymentGateway||(ut(),B("Something went wrong.")),(P=(H=ne==null?void 0:ne.data)==null?void 0:H.data)!=null&&P.card_list&&((T=(V=(O=ne==null?void 0:ne.data)==null?void 0:O.data)==null?void 0:V.card_list)==null?void 0:T.length)>0){Ne((te=(D=ne==null?void 0:ne.data)==null?void 0:D.data)==null?void 0:te.card_list),C("cardList");let Ie=(dt=(G=(ee=ne==null?void 0:ne.data)==null?void 0:ee.data)==null?void 0:G.card_list)==null?void 0:dt.filter(We=>(We==null?void 0:We.primary_card)==1);(Ie!=null&&Ie[0]&&((re=Ie==null?void 0:Ie[0])==null?void 0:re.payment_method_type)==((Yt=(Je=ne==null?void 0:ne.data)==null?void 0:Je.data)==null?void 0:Yt.paymentGateway)||((Ze=Ie==null?void 0:Ie[0])==null?void 0:Ze.card_type)==="Bank")&&ht(Ie[0])}else C("card");(Ce=(Ue=ne==null?void 0:ne.data)==null?void 0:Ue.data)!=null&&Ce.paymentDeviceList&&((zt=($t=(Se=ne==null?void 0:ne.data)==null?void 0:Se.data)==null?void 0:$t.paymentDeviceList)==null?void 0:zt.length)>0&&De((Ee=(_t=ne==null?void 0:ne.data)==null?void 0:_t.data)==null?void 0:Ee.paymentDeviceList[0]),it()}catch(se){console.log(se),it(),B(((Pe=(Xt=se==null?void 0:se.response)==null?void 0:Xt.data)==null?void 0:Pe.message)||(se==null?void 0:se.message)||"Something went wrong")}},X=async()=>{let o=e==null?void 0:e.customerId,n=String(e==null?void 0:e.discount),F=String(e==null?void 0:e.surcharge),H=String(e==null?void 0:e.tax),P=e==null?void 0:e.merchantPublicKey,O=e==null?void 0:e.orderID,V=String(e==null?void 0:e.amount),T=Fe==null?void 0:Fe.id,D=Fe==null?void 0:Fe.card_type;if(P&&O&&V)if(o)if(T){let ee={amount:V,order_id:O,customer_id:o,card_id:T,fractalpayPublicKey:P,isCardSave:pe,discount:n,surcharge:F,tax:H},te=ee,{isCardSave:G}=te,dt=cn(te,["isCardSave"]),Je=Be+(D==="Bank"?"charge-ach":"charge-by-card"),Yt={"Content-Type":"application/json"};j(!0),vt.emit("sendMessage",{url:Je,body:D=="Bank"?dt:ee,isChargebycard:!0}),vt.on("charge-by-card",Ze=>{var Ue;(Ze==null?void 0:Ze.result)==!0||(Ze==null?void 0:Ze.status)==!0?(rt((Ue=Ze.data)==null?void 0:Ue.transaction_id),xe(!0),j(!1)):B((Ze==null?void 0:Ze.message)||"Something went wrong.")})}else B("Please Select A Card/ACH");else B("Please Select Customer");else B("Something went wrong.")},He=async()=>{var P,O,V,T,D,te;let o=e==null?void 0:e.merchantPublicKey,n=e==null?void 0:e.orderID,F=String(e==null?void 0:e.amount),H=e==null?void 0:e.customerId;if(!(qe!=null&&qe.device_id)){B("Please Select A Payment Device");return}if(o&&n&&F){j(!0);let ee={amount:F,fractalpayPublicKey:o,customer_order_id:n,device_id:qe==null?void 0:qe.device_id,customer_id:H||""};try{let G=await Dt.post(`${Be}charge-with-reader`,ee);((P=G==null?void 0:G.data)==null?void 0:P.result)==!0?(rt((V=(O=G==null?void 0:G.data)==null?void 0:O.data)==null?void 0:V.transaction_id),xe(!0),j(!1)):(B(((T=G==null?void 0:G.data)==null?void 0:T.message)||"Something went wrong."),j(!1))}catch(G){B(((te=(D=G==null?void 0:G.response)==null?void 0:D.data)==null?void 0:te.message)||"Something went wrong."),j(!1)}}else B("Something went wrong.")},ge=()=>{y==="card"?X():y==="reader"&&He()};pi(()=>{ie&&ue&&Me()},[ue,ie]);let fe=async o=>{an.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async n=>{if(n.isConfirmed){j(!0);try{let F={card_id:o,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},H=await Dt.post(`${Be}delete-customer-card`,F);j(!1),Me(),an.fire({icon:"success",title:"Deleted!",text:"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})}catch(F){j(!1),an.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else n.dismiss===an.DismissReason.cancel&&an.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},je=o=>{switch(o==null?void 0:o.toLowerCase()){case"visa":return $e;case"mastercard":case"mc":case"m/c":return ct;case"amex":case"american express":case"ae":return nt;case"discover":case"dcvr":return w;case"bank":return k;default:return o}};return t.createElement(t.Fragment,null,t.createElement(It,null),t.createElement(nn,null),t.createElement(t.Fragment,null,t.createElement("button",{className:"paymentBtn",onClick:qt},"Pay"),t.createElement(Lt,{open:ie,onClose:ut},Ye&&t.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},t.createElement(jt,{error:Ye,onClose:ut})),Qe&&t.createElement(on,{onClose:ut,tranId:pt}),!Ye&&!Qe&&t.createElement(t.Fragment,null,(L||Z)&&t.createElement(bt,{loading:L||Z}),t.createElement("div",{className:"frac-card-payment-page frac-form"},t.createElement("div",{className:"parent-pay-container"},t.createElement("span",{className:"request-payment-close-popup",onClick:ut},t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12425_52336)"},t.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12425_52336"},t.createElement("rect",{width:"16",height:"16",fill:"white"}))))),t.createElement("div",{className:"pay-main-logo-res"},t.createElement("img",{src:f==null?void 0:f.logo,id:"pay-logos"})),t.createElement("div",{className:"pay-container"},t.createElement("div",{className:"pay-header pay-conatiner-one"},t.createElement("div",{className:"pay-conatiner-one-first"},t.createElement("div",{className:"pay-logo-container"},t.createElement("div",{className:"pay-main-logo"},t.createElement("img",{src:f==null?void 0:f.logo,id:"pay-logos"})),t.createElement("h1",{className:"pay-heading"},"Pay"),(A==null?void 0:A.length)>0&&E!=="cardList"&&t.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>C("cardList")}," ",t.createElement(Ln,null)," Back")),t.createElement("div",{className:"amt-pay-con"},t.createElement("div",{className:"pay-amount-conatiner"},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Le=Number(e==null?void 0:e.amount))==null?void 0:Le.toFixed(2))),E!="ach"&&t.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},t.createElement("img",{src:$e,alt:"",width:33}),t.createElement("img",{src:ct,width:33,alt:""}),t.createElement("img",{src:nt,alt:"",width:33}),t.createElement("img",{src:w,width:33,alt:""})))),t.createElement("div",{className:"pay-conatiner-one-last"},t.createElement("img",{src:g,alt:""}),t.createElement("img",{src:me,alt:""}),"Secure payments powered by Fractal"),t.createElement("div",null)),t.createElement("div",{className:"pay-tab pay-conatiner-two"},!L&&t.createElement("div",{className:"col-md-12"},t.createElement("div",{id:"payment-form-div"},E!=="cardList"?t.createElement("div",null,(A==null?void 0:A.length)>0&&t.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>C("cardList")}," ",t.createElement(Ln,null)," Back"),(f==null?void 0:f.isSkyFiAccount)&&t.createElement("div",{className:"tab"},t.createElement("button",{className:"tablinks",onClick:o=>{st("card")},style:{border:E==="card"?"1px solid":""}},t.createElement("i",{className:"fas fa-credit-card me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Card"),t.createElement("button",{className:"tablinks",onClick:o=>{st("ach")},style:{border:E==="ach"?"1px solid":""}},t.createElement("i",{className:"fas fa-university me-2",style:{marginRight:"8px",fontSize:"15px"}}),"Bank")),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(ve=Number(e==null?void 0:e.amount))==null?void 0:ve.toFixed(2))),E!="ach"&&t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:$e,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:ct,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:nt,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:w,width:35,alt:""}))))):t.createElement("div",null,t.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",f==null?void 0:f.customer_name),t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," ",y==="card"?"Cards/Banks":"Readers"," "),t.createElement("div",{className:"res-pay-con"},t.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},t.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),t.createElement("strong",{className:"pay-amount"},"$",(Ve=Number(e==null?void 0:e.amount))==null?void 0:Ve.toFixed(2))),t.createElement("div",null,t.createElement("div",null,t.createElement("img",{src:$e,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:ct,width:35,alt:""})),t.createElement("div",null,t.createElement("img",{src:nt,alt:"",width:35,style:{paddingRight:"5px"}}),t.createElement("img",{src:w,width:35,alt:""}))))),t.createElement("div",{id:"ach",style:{display:E==="cardList"?"block":"none"},className:"tabcontent"},t.createElement("div",{className:"card-lint-div-in"},t.createElement("div",{className:"card-list-div"},y==="card"?t.createElement(t.Fragment,null,(f==null?void 0:f.card_list)&&((Ke=f==null?void 0:f.card_list)==null?void 0:Ke.length)>0&&((lt=f==null?void 0:f.card_list)==null?void 0:lt.map((o,n)=>t.createElement("div",{className:"card-list-single-div",key:n},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{disabled:(f==null?void 0:f.paymentGateway)!=(o==null?void 0:o.payment_method_type)&&(o==null?void 0:o.card_type)!="Bank",type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:Fe===o,onChange:F=>ht(o)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",o==null?void 0:o.cardlastfourdigit),(o==null?void 0:o.card_type)!="Bank"&&t.createElement("h6",{className:"card-expiry-date"},o==null?void 0:o.expmonth,"/",o==null?void 0:o.expyear)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:je(o==null?void 0:o.card_type),alt:""})),t.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>fe(o==null?void 0:o.id)},t.createElement("img",{src:W,alt:""}))))))):t.createElement(t.Fragment,null,(f==null?void 0:f.paymentDeviceList)&&((mt=f==null?void 0:f.paymentDeviceList)==null?void 0:mt.length)>0&&((wt=f==null?void 0:f.paymentDeviceList)==null?void 0:wt.map((o,n)=>t.createElement("div",{className:"card-list-single-div",key:n},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:qe===o,onChange:F=>De(o)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},o==null?void 0:o.device_name)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:R,alt:""})))))))),t.createElement("div",{className:"pay-with-other-card",onClick:()=>C("card")},"Pay With Other Card",t.createElement("img",{src:be,alt:""})),y==="card"&&(f==null?void 0:f.paymentDeviceList)&&((Nt=f==null?void 0:f.paymentDeviceList)==null?void 0:Nt.length)>0&&t.createElement("div",{className:"pay-with-other-card ",onClick:()=>a("reader")},"Pay With Reader",t.createElement("img",{src:R,alt:""})),y==="reader"&&(f==null?void 0:f.paymentDeviceList)&&((kt=f==null?void 0:f.paymentDeviceList)==null?void 0:kt.length)>0&&t.createElement("div",{className:"pay-with-other-card ",onClick:()=>a("card")},"Pay With Saved Card",t.createElement("img",{src:be,alt:""}))),t.createElement("div",{className:"form-group",style:{padding:"0"}},t.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:ge},"$",(Re=Number(e==null?void 0:e.amount))==null?void 0:Re.toFixed(2)))),t.createElement("div",{id:"card",style:{display:E==="card"?"block":"none"},className:"tabcontent"},de?t.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:ae},t.createElement("div",{className:"ach-scrl",style:{minHeight:f!=null&&f.isSkyFiAccount&&(A==null?void 0:A.length)>0?"398px":f!=null&&f.isSkyFiAccount&&(A==null?void 0:A.length)==0?"456px":(A==null?void 0:A.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"John Doe",value:(m==null?void 0:m.cardName)||"",onChange:o=>{let n=o.target.value;/^[a-zA-Z\s]*$/.test(n)&&Ge("cardName",n)}}),(v==null?void 0:v.cardName)&&t.createElement("span",{className:"error-span"},v==null?void 0:v.cardName)),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),t.createElement("div",{className:"toggle-num-wrapper"},t.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(m==null?void 0:m.cardNumber)||"",onChange:o=>ke(o),"data-token":"card_number"}),t.createElement("div",{className:"card-crdi card-expiry-new"},t.createElement("div",{className:"exp-date-year-container"},t.createElement("div",{className:"exp-date form-group"},t.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(m==null?void 0:m.expiryMonth)||"",onChange:o=>Ge("expiryMonth",o.target.value)})),t.createElement("div",{className:"exp-year form-group"},t.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(m==null?void 0:m.expiryYear)||"",onChange:o=>Ge("expiryYear",o.target.value)})),t.createElement("div",{className:"security-digit form-group"},t.createElement("input",{"data-token":"cvv",className:"form-control card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(m==null?void 0:m.cvv)||"",onChange:o=>Ge("cvv",o.target.value)})))),(v==null?void 0:v.cardNumber)&&t.createElement("span",{className:"error-span"},v==null?void 0:v.cardNumber),t.createElement("p",{style:{margin:"0"}},v!=null&&v.expiryMonth||v!=null&&v.expiryYear?t.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},v==null?void 0:v.expiryMonth):"",(v==null?void 0:v.cvv)&&t.createElement("span",{className:"error-span"},v==null?void 0:v.cvv)))),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(ce=e==null?void 0:e.orderID)!=null?ce:"",style:{background:"#F6F6F7",color:"#727272"}})),t.createElement("div",{className:"form-group"},t.createElement("label",{htmlFor:"zip"},"ZIP"),t.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(gt=m==null?void 0:m.zipCode)!=null?gt:"",onChange:o=>Ge("zipCode",o.target.value)}),(v==null?void 0:v.zipCode)&&t.createElement("span",{className:"error-span"},v==null?void 0:v.zipCode)),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group"},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},t.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:pe,onChange:o=>h(o.target.checked)}),t.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),t.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},t.createElement("g",{clipPath:"url(#clip0_12420_50192)"},t.createElement("rect",{width:"20",height:"20",fill:"white"}),t.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),t.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_12420_50192"},t.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(f==null?void 0:f.paymentDeviceList)&&((yt=f==null?void 0:f.paymentDeviceList)==null?void 0:yt.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>b(!de)},de?"Pay With Reader":"Pay With Card"),t.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(Tt=Number(e==null?void 0:e.amount))==null?void 0:Tt.toFixed(2)))):t.createElement(t.Fragment,null,t.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}},"Readers"),t.createElement("div",{className:"card-lint-div-in"},t.createElement("div",{className:"card-list-div"},(f==null?void 0:f.paymentDeviceList)&&((Te=f==null?void 0:f.paymentDeviceList)==null?void 0:Te.length)>0&&((Bt=f==null?void 0:f.paymentDeviceList)==null?void 0:Bt.map((o,n)=>t.createElement("div",{className:"card-list-single-div",key:n},t.createElement("div",{className:"card-number-radio"},t.createElement("input",{type:"radio",className:"cardRadio",name:"selected_reader",id:"",checked:qe===o,onChange:F=>De(o)}),t.createElement("label",{htmlFor:"",className:"card-number-last-four"},o==null?void 0:o.device_name)),t.createElement("div",{className:"card-number-radio"},t.createElement("span",{className:"visa-card"},t.createElement("img",{src:R,alt:""})))))))),t.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:"0"}},(f==null?void 0:f.paymentDeviceList)&&((xt=f==null?void 0:f.paymentDeviceList)==null?void 0:xt.length)>0&&t.createElement("button",{type:"button",style:{marginBottom:"10px"},className:"pay-button",onClick:()=>b(!de)},de?"Pay With Reader":"Pay With Card"),t.createElement("button",{onClick:He,className:"pay-button"},"$",(ze=Number(e==null?void 0:e.amount))==null?void 0:ze.toFixed(2))))),t.createElement("div",{id:"ach",style:{display:E==="ach"?"block":"none"},className:"tabcontent"},t.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:ae},t.createElement("div",{className:"ach-scrl",style:{minHeight:f!=null&&f.isSkyFiAccount&&(A==null?void 0:A.length)>0?"378px":f!=null&&f.isSkyFiAccount&&(A==null?void 0:A.length)==0?"436px":(A==null?void 0:A.length)>0?"462px":"520px",maxHeight:f!=null&&f.isSkyFiAccount&&(A==null?void 0:A.length)>0?"358px":((A==null?void 0:A.length)>0,"380px")}},t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),t.createElement("input",{type:"text",id:"nameonaccount",className:"form-control",maxLength:100,placeholder:"John Doe",name:"name",value:(Oe=x==null?void 0:x.name)!=null?Oe:"",onChange:oe}),(r==null?void 0:r.name)&&t.createElement("span",{className:"error-span"},r==null?void 0:r.name)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"routingnumber"},"Routing number"),t.createElement("input",{type:"text",id:"routingnumber",className:"form-control",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(Vt=x==null?void 0:x.routingNumber)!=null?Vt:"",onChange:oe}),(r==null?void 0:r.routingNumber)&&t.createElement("span",{className:"error-span"},r==null?void 0:r.routingNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accountnumber"},"Account number"),t.createElement("input",{type:"text",id:"accountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(Mt=x==null?void 0:x.accountNumber)!=null?Mt:"",onChange:oe}),(r==null?void 0:r.accountNumber)&&t.createElement("span",{className:"error-span"},r==null?void 0:r.accountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),t.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Kt=x==null?void 0:x.confirmAccountNumber)!=null?Kt:"",onChange:oe}),(r==null?void 0:r.confirmAccountNumber)&&t.createElement("span",{className:"error-span"},r==null?void 0:r.confirmAccountNumber)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"bankname"},"Bank name"),t.createElement("input",{type:"text",id:"bankname",className:"form-control",maxLength:100,placeholder:"My Bank",name:"bankName",value:(ot=x==null?void 0:x.bankName)!=null?ot:"",onChange:oe}),(r==null?void 0:r.bankName)&&t.createElement("span",{className:"error-span"},r==null?void 0:r.bankName)),((x==null?void 0:x.accountType)==="business saving"||(x==null?void 0:x.accountType)==="business checking")&&t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"companyName"},"Company name"),t.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(l=x==null?void 0:x.companyName)!=null?l:"",onChange:oe}),(r==null?void 0:r.companyName)&&t.createElement("span",{className:"error-span"},r==null?void 0:r.companyName)),t.createElement("div",{className:"form-group mb-4"},t.createElement("label",{htmlFor:"accounttype"},"Select account type"),t.createElement("select",{name:"accountType",id:"accounttype",className:"form-control",value:(c=x==null?void 0:x.accountType)!=null?c:"",onChange:oe},t.createElement("option",{value:""},"Select account"),un.map(o=>t.createElement("option",{key:o.value,value:o.value},o.label)))),(e==null?void 0:e.customerId)&&t.createElement("div",{className:"form-group mb-4 save-ach-div",style:{paddingTop:"5px"}},t.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:Ae,onChange:o=>K(o.target.checked)}),t.createElement("label",{htmlFor:"saveACH"},"Save ACH")),Ae&&t.createElement("div",{className:"form-group mb-4",style:{fontSize:"12px",color:"#727272"}},t.createElement("p",null,"If checked, I agree for ",t.createElement("b",null,"ecommerce")," to have my permission to charge this credit card for agreed upon purchases in the future."))),t.createElement("div",{className:"form-group "},t.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},"$",(U=Number(e==null?void 0:e.amount))==null?void 0:U.toFixed(2)))))))))))))))}import s,{useEffect as gi,useState as Pt}from"react";import rn from"axios";import xn from"sweetalert2";import{IoArrowBack as zn}from"react-icons/io5";function fi(e){var rt,tt,it,ut,qt,st,Ge,ke,oe;let[L,$]=Pt(!1),[Z,j]=Pt(!1),[Ye,B]=Pt(""),[Qe,xe]=Pt(!1),[ie,u]=Pt(!1),[E,C]=Pt("card"),[y,a]=Pt(!1),de=e.merchantPublicKey,b=le+"widget/mc-img.svg",pe=le+"widget/visa-img.svg",h=le+"widget/ae-img.svg",Ae=le+"widget/discover-img.svg",K=le+"widget/card.svg",ue=le+"widget/Trash.svg",ct=le+"widget/bank.svg",$e=le+"widget/secure-img.png",nt=le+"widget/pov-by.png",[w,be]=Pt(),[W,k]=Pt({}),[g,me]=Pt([]),[R,m]=Pt(),[d,v]=Pt(),[J,x]=Pt(""),p=()=>$(!0),r=()=>$(!1),z=()=>{u(!1),C("card"),j(!1),B(""),xe(!1),x(""),be({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),k({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),a(!1),m({card_type:"",cardlastfourdigit:"",expmonth:1,expyear:2025,primary_card:0,firstname:"",id:"",lastname:""})},A=()=>u(!0),Ne=(N,Y)=>{let ae=N;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(ae)){(Y===""||/^[0-9]+$/.test(Y))&&(k(X=>I(_({},X),{[ae]:""})),be(X=>I(_({},X),{[ae]:Y})));return}k(X=>I(_({},X),{[ae]:""})),be(X=>I(_({},X),{[ae]:Y}))},Fe=N=>{let ae=N.target.value.replace(/\D/g,""),Me="";/^3[47]/.test(ae)?Me=ae.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(He,ge,fe,je)=>[ge,fe,je].filter(Boolean).join(" ")):Me=ae.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(He,ge,fe,je,Le)=>[ge,fe,je,Le].filter(Boolean).join(" ")),k(X=>I(_({},X),{cardNumber:""})),be(X=>I(_({},X),{cardNumber:Me}))},ht=()=>{var X,He,ge,fe,je,Le;let N={},Y=w,ae=parseInt((Y==null?void 0:Y.expiryMonth)||"",10),Me=(Y==null?void 0:Y.expiryYear)||"";if((X=Y==null?void 0:Y.cardName)!=null&&X.trim()||(N.cardName="Card name is required"),(He=Y==null?void 0:Y.cardNumber)!=null&&He.trim()||(N.cardNumber="Card number is required"),(!((ge=Y==null?void 0:Y.expiryMonth)!=null&&ge.trim())||!((fe=Y==null?void 0:Y.expiryYear)!=null&&fe.trim())||isNaN(ae)||ae<1||ae>12||Me.length!==4)&&(N.expiryMonth="Invalid Expiration Date."),(je=Y==null?void 0:Y.cvv)!=null&&je.trim()||(N.cvv="CVV is required"),(Le=Y==null?void 0:Y.zipCode)!=null&&Le.trim()||(N.zipCode="ZIP code is required"),Y!=null&&Y.expiryMonth&&(Y!=null&&Y.expiryYear)&&Y.expiryMonth.length<=2&&Y.expiryYear.length===4){let ve=parseInt(Y.expiryMonth,10),Ve=parseInt(Y.expiryYear,10),Ke=new Date,lt=Ke.getMonth()+1,mt=Ke.getFullYear();(Ve<mt||Ve===mt&&ve<lt)&&(N.expiryMonth="Card is expired")}return k(N),Object.keys(N).length>0},qe=async N=>{var Y,ae,Me,X,He,ge,fe,je,Le,ve,Ve,Ke,lt,mt,wt,Nt,kt,Re,ce;if(N.preventDefault(),E=="card"){if(ht())return;{let yt=DatacapWebToken.validateCardNumber(w==null?void 0:w.cardNumber.replaceAll(" ","")),Tt=DatacapWebToken.validateExpirationDate(w==null?void 0:w.expiryMonth,w==null?void 0:w.expiryYear),Te=DatacapWebToken.validateCVV(w==null?void 0:w.cvv),Bt={};if(yt||(Bt.cardNumber="Invalid card Number"),Tt||(Bt.expiryMonth="Invalid Expiration Date."),Te||(Bt.cvv="Invalid CVV"),k(Bt),yt&&Te&&Tt){j(!0);try{let xt=async function(ze){if(ze.Error)B(ze.Error),j(!1);else{let Oe=w==null?void 0:w.cardName,Vt=w==null?void 0:w.zipCode;ze.name=Oe,ze.postal_code=Vt,ze.fractalpayPublicKey=e==null?void 0:e.merchantPublicKey,ze.amount=e==null?void 0:e.amount,ze.order_id=e==null?void 0:e.orderID,ze.preAuth_id="",ze.isCardSave=y,ze.customer_id=e==null?void 0:e.customerId,ze.link_token="",ze.gateway_id=d==null?void 0:d.paymentGateway,ze.discount=e==null?void 0:e.discount,ze.tax=e==null?void 0:e.tax,ze.surcharge=e==null?void 0:e.surcharge,new Headers().append("Content-Type","application/json");let Kt={method:"POST",body:JSON.stringify(ze),redirect:"follow"};vt.emit("sendMessage",I(_({},Kt),{isChargePreauth:!0})),vt.on("charge-preauth",ot=>{var l;console.log(ot,"datdata"),(ot==null?void 0:ot.status)=="Failed"?(j(!1),B((ot==null?void 0:ot.message)||"Something went wrong. Please try again later.")):(xe(!0),x((l=ot==null?void 0:ot.data)==null?void 0:l.transaction_id),j(!1),be({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}))})}};if((d==null?void 0:d.paymentGateway)===32){let ze={method:"POST",redirect:"follow"};try{let Oe=await rn.post(`${_e}api/v1/widget/generate-session`,ze),Vt=Number(w==null?void 0:w.expiryYear)%100,Mt=w==null?void 0:w.cardNumber;Mt=Mt==null?void 0:Mt.replace(/\s+/g,"");let Kt=`${Mt}=${Vt}${w==null?void 0:w.expiryMonth} ${w==null?void 0:w.cvv}`,l=forge.pki.publicKeyFromPem((ae=(Y=Oe==null?void 0:Oe.data)==null?void 0:Y.data)==null?void 0:ae.publicKeyPem).encrypt(Kt,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),c=forge.util.encode64(l),U={"Content-Type":"application/json","x-app-session-key":(X=(Me=Oe.data)==null?void 0:Me.data)==null?void 0:X.session_key},o=JSON.stringify({enc_track2_data:`${c}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(ge=(He=Oe==null?void 0:Oe.data)==null?void 0:He.data)==null?void 0:ge.session_key}`});try{let n=await rn.post(`${Ht}tokenizer/tokenize`,o,{headers:U}),F=JSON.stringify(I(_({},(fe=n==null?void 0:n.data)==null?void 0:fe.data),{name:w==null?void 0:w.cardName,postal_code:w==null?void 0:w.zipCode,customer_id:e==null?void 0:e.customerId,amount:e==null?void 0:e.amount,Token:`${(Le=(je=n==null?void 0:n.data)==null?void 0:je.data)==null?void 0:Le.token}`,fractalpayPublicKey:de,order_id:e==null?void 0:e.orderID,preAuth_id:"",isCardSave:y,discount:e==null?void 0:e.discount,surcharge:e==null?void 0:e.surcharge,tax:e==null?void 0:e.tax,link_token:"",ExpirationYear:w==null?void 0:w.expiryYear,ExpirationMonth:w==null?void 0:w.expiryMonth,CVV:w==null?void 0:w.cvv,Last4:(Ve=(ve=n==null?void 0:n.data)==null?void 0:ve.data)==null?void 0:Ve.last4,Brand:(lt=(Ke=n==null?void 0:n.data)==null?void 0:Ke.data)==null?void 0:lt.brand,gateway_id:d==null?void 0:d.paymentGateway})),P={method:"POST",headers:{"Content-Type":"application/json"},body:F,redirect:"follow"};vt.emit("sendMessage",I(_({},P),{isFractalPreauth:!0})),vt.on("fractal-charge-preauth",O=>{var V;(O==null?void 0:O.status)=="Failed"?(j(!1),B((O==null?void 0:O.message)||"Something went wrong , Try again later")):(x((V=O==null?void 0:O.data)==null?void 0:V.transaction_id),xe(!0),j(!1))})}catch(n){console.log(n),j(!1),B(((wt=(mt=n==null?void 0:n.response)==null?void 0:mt.data)==null?void 0:wt.message)||(n==null?void 0:n.message)||"Something went wrong , Try again later")}}catch(Oe){j(!1),B(((kt=(Nt=Oe==null?void 0:Oe.response)==null?void 0:Nt.data)==null?void 0:kt.message)||(Oe==null?void 0:Oe.message)||"Something went wrong , Try again later")}}else DatacapWebToken.requestToken(d==null?void 0:d.dctoken,"PaymentForm",xt)}catch(xt){j(!1),B(((ce=(Re=xt==null?void 0:xt.response)==null?void 0:Re.data)==null?void 0:ce.message)||(xt==null?void 0:xt.message)||"Something went wrong.")}}}}},De=async()=>{var N,Y,ae,Me,X,He,ge,fe,je,Le,ve,Ve,Ke,lt,mt,wt,Nt,kt;p();try{let Re={fractalpayPublicKey:de,customer_id:e==null?void 0:e.customerId,preauth:!0},ce=await rn.post(`${Be}get-payment-details`,Re);if(v((N=ce==null?void 0:ce.data)==null?void 0:N.data),(ae=(Y=ce==null?void 0:ce.data)==null?void 0:Y.data)!=null&&ae.paymentGateway||(z(),B("Something went wrong.")),(X=(Me=ce==null?void 0:ce.data)==null?void 0:Me.data)!=null&&X.card_list&&((fe=(ge=(He=ce==null?void 0:ce.data)==null?void 0:He.data)==null?void 0:ge.card_list)==null?void 0:fe.length)>0){me((Le=(je=ce==null?void 0:ce.data)==null?void 0:je.data)==null?void 0:Le.card_list),C("cardList");let gt=(Ke=(Ve=(ve=ce==null?void 0:ce.data)==null?void 0:ve.data)==null?void 0:Ve.card_list)==null?void 0:Ke.filter(yt=>(yt==null?void 0:yt.primary_card)==1);gt!=null&>[0]&&((lt=gt==null?void 0:gt[0])==null?void 0:lt.payment_method_type)==((wt=(mt=ce==null?void 0:ce.data)==null?void 0:mt.data)==null?void 0:wt.paymentGateway)&&m(gt[0])}else C("card");r()}catch(Re){console.log(Re),r(),B(((kt=(Nt=Re==null?void 0:Re.response)==null?void 0:Nt.data)==null?void 0:kt.message)||(Re==null?void 0:Re.message)||"Something went wrong")}},f=async()=>{var ve,Ve,Ke,lt,mt,wt,Nt;let N=e==null?void 0:e.customerId,Y=e==null?void 0:e.discount,ae=e==null?void 0:e.surcharge,Me=e==null?void 0:e.tax,X=e==null?void 0:e.merchantPublicKey,He=e==null?void 0:e.orderID,ge=e==null?void 0:e.amount,fe=R==null?void 0:R.id,je=R==null?void 0:R.card_type;if(X&&He&&ge)if(N)if(fe){let kt={amount:ge,order_id:He,customer_id:N,card_id:fe,fractalpayPublicKey:X,isCardSave:je!="Bank",discount:Y,surcharge:ae,tax:Me},Le=kt,{isCardSave:Re}=Le,ce=cn(Le,["isCardSave"]),yt=Be+"authorize-by-card",Tt={"Content-Type":"application/json"};j(!0);try{let Te=await rn.post(yt,je=="Bank"?ce:kt,{headers:Tt});(ve=Te==null?void 0:Te.data)!=null&&ve.result&&(x((Ke=(Ve=Te==null?void 0:Te.data)==null?void 0:Ve.data)==null?void 0:Ke.transaction_id),xe(!0),j(!1))}catch(Te){j(!1),console.log(Te),B(((mt=(lt=Te==null?void 0:Te.response)==null?void 0:lt.data)==null?void 0:mt.message)||((Nt=(wt=Te==null?void 0:Te.response)==null?void 0:wt.data)==null?void 0:Nt.status)||"Something went erong")}}else B("Please Select A Card/ACH");else B("Please Select Customer");else B("Something went wrong.")};gi(()=>{ie&&de&&De()},[de,ie]);let Ct=async N=>{xn.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async Y=>{if(Y.isConfirmed){j(!0);try{let ae={card_id:N,customer_id:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey},Me=await rn.post(`${Be}delete-customer-card`,ae);j(!1),De(),xn.fire({icon:"success",title:"Deleted!",text:"The card has been deleted.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}catch(ae){j(!1),xn.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}})},pt=N=>{switch(N==null?void 0:N.toLowerCase()){case"visa":return pe;case"mastercard":case"mc":case"m/c":return b;case"amex":case"american express":case"ae":return h;case"discover":case"dcvr":return Ae;case"bank":return ct;default:return N}};return s.createElement(s.Fragment,null,s.createElement(It,null),s.createElement(nn,null),s.createElement(s.Fragment,null,s.createElement("button",{className:"paymentBtn",onClick:A},"PreAuth Payment"),s.createElement(Lt,{open:ie,onClose:z},Ye&&s.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},s.createElement(jt,{error:Ye,onClose:z})),Qe&&s.createElement(on,{onClose:z,tranId:J}),!Ye&&!Qe&&s.createElement(s.Fragment,null,(L||Z)&&s.createElement(bt,{loading:L||Z}),s.createElement("div",null,s.createElement("div",{className:"frac-card-payment-page frac-form"},s.createElement("div",{className:"parent-pay-container"},s.createElement("span",{className:"request-payment-close-popup",onClick:z},s.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},s.createElement("g",{clipPath:"url(#clip0_12425_52336)"},s.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_12425_52336"},s.createElement("rect",{width:"16",height:"16",fill:"white"}))))),s.createElement("div",{className:"pay-container"},s.createElement("div",{className:"pay-header pay-conatiner-one"},s.createElement("div",{className:"pay-conatiner-one-first"},s.createElement("div",{className:"pay-logo-container"},s.createElement("div",{className:"pay-main-logo"},s.createElement("img",{src:d==null?void 0:d.logo,id:"pay-logos"})),s.createElement("h1",{className:"pay-heading"},"Pay"),(g==null?void 0:g.length)>0&&E!=="cardList"&&s.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>C("cardList")}," ",s.createElement(zn,null)," Back")),s.createElement("div",{className:"amt-pay-con"},s.createElement("div",{className:"pay-amount-conatiner"},s.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),s.createElement("strong",{className:"pay-amount"},"$",(rt=Number(e==null?void 0:e.amount))==null?void 0:rt.toFixed(2))),E!="ach"&&s.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},s.createElement("img",{src:pe,alt:"",width:33}),s.createElement("img",{src:b,width:33,alt:""}),s.createElement("img",{src:h,alt:"",width:33}),s.createElement("img",{src:Ae,width:33,alt:""})))),s.createElement("div",{className:"pay-conatiner-one-last"},s.createElement("img",{src:$e,alt:""}),s.createElement("img",{src:nt,alt:""}),"Secure payments powered by Fractal"),s.createElement("div",null)),!L&&s.createElement("div",{className:"pay-tab pay-conatiner-two"},s.createElement("div",{className:"col-md-12"},s.createElement("div",{id:"payment-form-div"},E!=="cardList"?s.createElement("div",null,(g==null?void 0:g.length)>0&&s.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>C("cardList")}," ",s.createElement(zn,null)," Back"),s.createElement("div",{className:""},s.createElement("div",{className:"res-pay-con"},s.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},s.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),s.createElement("strong",{className:"pay-amount"},"$",(tt=Number(e==null?void 0:e.amount))==null?void 0:tt.toFixed(2))),s.createElement("div",null,s.createElement("div",null,s.createElement("img",{src:pe,alt:"",width:35,style:{paddingRight:"5px"}}),s.createElement("img",{src:b,width:35,alt:""})),s.createElement("div",null,s.createElement("img",{src:h,alt:"",width:35,style:{paddingRight:"5px"}}),s.createElement("img",{src:Ae,width:35,alt:""})))))):s.createElement("div",null,s.createElement("h6",{className:"charge-customer-name",style:{marginBottom:"16px !important"}}," Charge ",d==null?void 0:d.customer_name),s.createElement("div",{className:"res-pay-con"},s.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},s.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),s.createElement("strong",{className:"pay-amount"},"$",(it=Number(e==null?void 0:e.amount))==null?void 0:it.toFixed(2))),s.createElement("div",null,s.createElement("div",null,s.createElement("img",{src:pe,alt:"",width:35,style:{paddingRight:"5px"}}),s.createElement("img",{src:b,width:35,alt:""})),s.createElement("div",null,s.createElement("img",{src:h,alt:"",width:35,style:{paddingRight:"5px"}}),s.createElement("img",{src:Ae,width:35,alt:""})))),s.createElement("h6",{className:"card-ach-heading",style:{marginBottom:"10px !important"}}," Cards")),s.createElement("div",{style:{display:E==="cardList"?"block":"none"},className:"tabcontent"},s.createElement("div",{className:"card-lint-div-in"},s.createElement("div",{className:"card-list-div"},(d==null?void 0:d.card_list)&&((ut=d==null?void 0:d.card_list)==null?void 0:ut.length)>0&&((qt=d==null?void 0:d.card_list)==null?void 0:qt.map((N,Y)=>s.createElement("div",{className:"card-list-single-div",key:Y},s.createElement("div",{className:"card-number-radio"},s.createElement("input",{disabled:(d==null?void 0:d.paymentGateway)!=(N==null?void 0:N.payment_method_type),type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:R===N,onChange:ae=>m(N)}),s.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",N==null?void 0:N.cardlastfourdigit),s.createElement("h6",{className:"card-expiry-date"},N==null?void 0:N.expmonth,"/",N==null?void 0:N.expyear)),s.createElement("div",{className:"card-number-radio"},s.createElement("span",{className:"visa-card"},s.createElement("img",{src:pt(N==null?void 0:N.card_type),alt:""})),s.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>Ct(N==null?void 0:N.id)},s.createElement("img",{src:ue,alt:""}))))))),s.createElement("div",{className:"pay-with-other-card ",onClick:()=>C("card")},"Authorize With Other Card",s.createElement("img",{src:K,alt:""}))),s.createElement("div",{className:"form-group"},s.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:f},"$",(st=Number(e==null?void 0:e.amount))==null?void 0:st.toFixed(2)))),s.createElement("div",{id:"card",style:{display:E==="card"?"block":"none"},className:"tabcontent"},s.createElement("form",{id:"PaymentForm",onSubmit:qe},s.createElement("div",{className:"ach-scrl",style:{minHeight:(g==null?void 0:g.length)>0?"462px":"520px",overflow:"auto",marginRight:"5px"}},s.createElement("div",{className:"form-group"},s.createElement("label",{htmlFor:"cardHolderName"},"Name on Card"),s.createElement("input",{type:"text",className:"form-control",placeholder:"John Doe",value:(w==null?void 0:w.cardName)||"",onChange:N=>{let Y=N.target.value;/^[a-zA-Z\s]*$/.test(Y)&&Ne("cardName",Y)}}),(W==null?void 0:W.cardName)&&s.createElement("span",{className:"error-span"},W==null?void 0:W.cardName)),s.createElement("div",{className:"form-group"},s.createElement("label",{htmlFor:"cardNumber"},"Card Number"),s.createElement("div",{className:"toggle-num-wrapper"},s.createElement("input",{className:"form-control card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(w==null?void 0:w.cardNumber)||"",onChange:N=>Fe(N),"data-token":"card_number"}),s.createElement("div",{className:"card-crdi card-expiry-new"},s.createElement("div",{className:"exp-date-year-container"},s.createElement("div",{className:"exp-date form-group"},s.createElement("input",{"data-token":"exp_month",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(w==null?void 0:w.expiryMonth)||"",onChange:N=>Ne("expiryMonth",N.target.value)})),s.createElement("div",{className:"exp-year form-group"},s.createElement("input",{"data-token":"exp_year",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(w==null?void 0:w.expiryYear)||"",onChange:N=>Ne("expiryYear",N.target.value)})),s.createElement("div",{className:"security-digit form-group"},s.createElement("input",{"data-token":"cvv",className:"form-control required card-cvv-in",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(w==null?void 0:w.cvv)||"",onChange:N=>Ne("cvv",N.target.value)})))),(W==null?void 0:W.cardNumber)&&s.createElement("span",{className:"error-span"},W==null?void 0:W.cardNumber),s.createElement("p",{style:{margin:"0"}},W!=null&&W.expiryMonth||W!=null&&W.expiryYear?s.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},W==null?void 0:W.expiryMonth):"",(W==null?void 0:W.cvv)&&s.createElement("span",{className:"error-span"},W==null?void 0:W.cvv)))),s.createElement("div",{className:"form-group"},s.createElement("label",{htmlFor:"OrderId"},"Order ID / Description"),s.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"OID123456",disabled:!0,value:(Ge=w==null?void 0:w.orderId)!=null?Ge:"OID123456",onChange:N=>Ne("orderId",N.target.value),style:{background:"#F6F6F7",color:"#727272"}})),s.createElement("div",{className:"form-group"},s.createElement("label",{htmlFor:"zip"},"ZIP"),s.createElement("input",{type:"text",className:"form-control",maxLength:100,placeholder:"000000",value:(ke=w==null?void 0:w.zipCode)!=null?ke:"",onChange:N=>Ne("zipCode",N.target.value)}),(W==null?void 0:W.zipCode)&&s.createElement("span",{className:"error-span"},W==null?void 0:W.zipCode)),(e==null?void 0:e.customerId)&&s.createElement("div",{className:"form-group"},s.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},s.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:y,onChange:N=>a(N.target.checked)}),s.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),s.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),s.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},s.createElement("g",{clipPath:"url(#clip0_12420_50192)"},s.createElement("rect",{width:"20",height:"20",fill:"white"}),s.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),s.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_12420_50192"},s.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),s.createElement("div",{className:"form-group",style:{marginTop:"20px",padding:0}},s.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},"$",(oe=Number(e==null?void 0:e.amount))==null?void 0:oe.toFixed(2))))))))))))))))}import Q,{useEffect as bi,useRef as sn,useState as Jt}from"react";import vi from"sweetalert2";import Rt from"axios";import hi from"react";function bn(){let e="#000",L="#fff",$="#212529",Z="#dee2e6";return hi.createElement("style",null,`
|
|
3555
1473
|
.add-card {
|
|
3556
1474
|
max-width:380px;
|
|
3557
1475
|
padding: 0 20px
|
|
@@ -3810,16 +1728,7 @@ function AddCardStyle() {
|
|
|
3810
1728
|
}
|
|
3811
1729
|
}
|
|
3812
1730
|
|
|
3813
|
-
`);
|
|
3814
|
-
}
|
|
3815
|
-
|
|
3816
|
-
// src/app/components/SuccessCardMessage/SuccessCardMsz.tsx
|
|
3817
|
-
import React17 from "react";
|
|
3818
|
-
|
|
3819
|
-
// src/app/components/SuccessCardMessage/SuccessCardMszStyle.tsx
|
|
3820
|
-
import React16 from "react";
|
|
3821
|
-
function SuccessCardMszStyle() {
|
|
3822
|
-
return /* @__PURE__ */ React16.createElement("style", null, `
|
|
1731
|
+
`)}import At from"react";import yi from"react";function vn(){return yi.createElement("style",null,`
|
|
3823
1732
|
.card-success .logo-container {
|
|
3824
1733
|
display: flex;
|
|
3825
1734
|
justify-content: center;
|
|
@@ -3907,402 +1816,776 @@ function SuccessCardMszStyle() {
|
|
|
3907
1816
|
color: #161616;
|
|
3908
1817
|
opacity: 0.5;
|
|
3909
1818
|
}
|
|
3910
|
-
`);
|
|
3911
|
-
|
|
1819
|
+
`)}var xi=({onClose:e})=>At.createElement(At.Fragment,null,At.createElement(vn,null),At.createElement("div",{className:"card-success"},At.createElement("div",{className:"payment-success-container"},At.createElement("div",{className:"success-icon"},At.createElement("div",{className:"circle"},At.createElement("i",{className:"fa fa-check-circle","aria-hidden":"true"})),At.createElement("div",{className:"success-text"},At.createElement("div",{className:"payment-success-text"},"Your card was added successfully."),At.createElement("div",{className:"thank-you-text"},"Thank you ")))))),In=xi;function Ci(e){var R;let[L,$]=Jt(!1),[Z,j]=Jt(!1),[Ye,B]=Jt(""),[Qe,xe]=Jt(!1),ie=sn(null),u=sn(null),E=sn(null),C=sn(null),y=sn(null),[a,de]=Jt(),[b,pe]=Jt({}),[h,Ae]=Jt(),K=()=>$(!0),ue=()=>$(!1),ct=m=>{vi.fire({icon:"error",text:m,customClass:{popup:"custom-z-index"}})},$e=()=>{xe(!1),j(!1),B(""),de({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""})},nt=()=>xe(!0),w=()=>{$e()},be=(m,d)=>{var x,p,r;let v=m,J=["expiryMonth","expiryYear","zipCode","cvv"];if(console.log(v,d==null?void 0:d.length,"dfih",v==="expiryMonth"&&(d==null?void 0:d.length)===2),v==="expiryMonth"&&(d==null?void 0:d.length)===2&&((x=E==null?void 0:E.current)==null||x.focus()),v==="expiryYear"&&(d==null?void 0:d.length)===4&&((p=C==null?void 0:C.current)==null||p.focus()),v==="cvv"&&(d==null?void 0:d.length)===3&&((r=y==null?void 0:y.current)==null||r.focus()),J.includes(v)){(d===""||/^[0-9]+$/.test(d))&&(pe(z=>I(_({},z),{[v]:""})),de(z=>I(_({},z),{[v]:d})));return}pe(z=>I(_({},z),{[v]:""})),console.log(d,v),de(z=>I(_({},z),{[v]:d}))},W=m=>{var x;let v=m.target.value.replace(/\D/g,""),J="";/^3[47]/.test(v)?J=v.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(r,z,A,Ne)=>[z,A,Ne].filter(Boolean).join(" ")):J=v.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(r,z,A,Ne,Fe)=>[z,A,Ne,Fe].filter(Boolean).join(" ")),pe(p=>I(_({},p),{cardNumber:""})),de(p=>I(_({},p),{cardNumber:J})),console.log(v==null?void 0:v.length,"length"),(v==null?void 0:v.length)===16&&((x=u==null?void 0:u.current)==null||x.focus())},k=()=>{var x,p,r,z,A,Ne;let m={},d=a,v=parseInt((d==null?void 0:d.expiryMonth)||"",10),J=(d==null?void 0:d.expiryYear)||"";if((x=d==null?void 0:d.cardName)!=null&&x.trim()||(m.cardName="Card name is required"),(p=d==null?void 0:d.cardNumber)!=null&&p.trim()||(m.cardNumber="Card number is required"),(r=d==null?void 0:d.expiryMonth)!=null&&r.trim()?(Number(d==null?void 0:d.expiryMonth)>12||Number(d==null?void 0:d.expiryMonth)<1)&&(m.expiryMonth="Invalid Expiration Month."):m.expiryMonth="Expiration month is required",(z=d==null?void 0:d.expiryYear)!=null&&z.trim()?((A=d==null?void 0:d.expiryYear)==null?void 0:A.trim().length)!==4||Number(d==null?void 0:d.expiryYear)<2025?m.expiryYear="Invalid Expiration Year.":(isNaN(v)||v<1||v>12||J.length!==4)&&(m.expiryMonth="Invalid Expiration Date."):m.expiryYear="Expiration year is required",(Ne=d==null?void 0:d.cvv)!=null&&Ne.trim()||(m.cvv="CVC is required"),d!=null&&d.expiryMonth&&(d!=null&&d.expiryYear)&&d.expiryMonth.length<=2&&d.expiryYear.length===4){let Fe=parseInt(d.expiryMonth,10),ht=parseInt(d.expiryYear,10),qe=new Date,De=qe.getMonth()+1,f=qe.getFullYear();(ht<f||ht===f&&Fe<De)&&(m.expiryMonth="Card is expired")}return pe(m),Object.keys(m).length>0},g=async()=>{var m,d,v;K();try{let J={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,customer_id:e==null?void 0:e.customerId,addcard:!0},x=await Rt.post(`${Be}get-payment-details`,J);console.log(x),Ae((m=x==null?void 0:x.data)==null?void 0:m.data),(v=(d=x==null?void 0:x.data)==null?void 0:d.data)!=null&&v.paymentGateway||($e(),B("Something went wrong.")),ue()}catch(J){console.log(J),ue(),$e(),B("Something went wrong.")}};return bi(()=>{e!=null&&e.merchantPublicKey&&g()},[e==null?void 0:e.merchantPublicKey]),Q.createElement(Q.Fragment,null,Q.createElement(It,null),Q.createElement(bn,null),Q.createElement(bt,{loading:L}),Ye&&Q.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},Q.createElement(jt,{error:Ye,onClose:$e})),Z&&Q.createElement(In,{onClose:w}),!Ye&&!Z&&Q.createElement(Q.Fragment,null,Q.createElement("div",{className:"container-creditcard add-card modal-content",id:"add-credit-card-panel",style:{margin:"auto"}},Q.createElement("form",{id:"creditCardForm",onSubmit:async m=>{var v,J,x,p,r,z,A,Ne,Fe,ht,qe,De,f,Ct,pt,rt;m.preventDefault();let d=k();if(console.log(a),!d){let tt=DatacapWebToken.validateCardNumber(a==null?void 0:a.cardNumber.replaceAll(" ","")),it=DatacapWebToken.validateExpirationDate(a==null?void 0:a.expiryMonth,a==null?void 0:a.expiryYear),ut=DatacapWebToken.validateCVV(a==null?void 0:a.cvv),qt={};if(tt||(qt.cardNumber="Invalid card Number"),it||(qt.expiryMonth="Invalid Expiration Date."),ut||(qt.cvv="Invalid CVV"),pe(qt),tt&&ut&&it){K();try{let st=async function(Ge){var ke,oe,N,Y,ae;if(console.log(Ge),Ge.Error)console.log(Ge==null?void 0:Ge.Error),B(Ge.Error),ue();else{let Me={userId:e==null?void 0:e.customerId,cardName:a==null?void 0:a.cardName,zip:a==null?void 0:a.zipCode,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,token:Ge};try{let X=await Rt.post(`${Be}add-card`,Me);console.log(X);let He={fractalpayPublicKey:e==null?void 0:e.merchantPublicKey,wallet_id:"",card_number:a==null?void 0:a.cardNumber.replaceAll(" ",""),exp_month:a==null?void 0:a.expiryMonth,exp_year:(ke=a==null?void 0:a.expiryYear)==null?void 0:ke.slice(-2),cvv:a==null?void 0:a.cvv};try{let ge=await Rt.post(`${Be}link-wallet`,He);console.log(ge),j(!0),ue(),de({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),Ut(m,"close","")}catch(ge){console.log(ge),ue(),B(((N=(oe=ge==null?void 0:ge.response)==null?void 0:oe.data)==null?void 0:N.message)||(ge==null?void 0:ge.message)||"Something went wrong.")}}catch(X){console.log(X),ue(),B(((ae=(Y=X==null?void 0:X.response)==null?void 0:Y.data)==null?void 0:ae.message)||(X==null?void 0:X.message)||"Something went wrong.")}}};if((h==null?void 0:h.paymentGateway)===32){let Ge={method:"POST",redirect:"follow"};try{let ke=await Rt.post(`${_e}api/v1/widget/generate-session`,Ge),oe=Number(a==null?void 0:a.expiryYear)%100,N=a==null?void 0:a.cardNumber;N=N==null?void 0:N.replace(/\s+/g,"");let Y=`${N}=${oe}${a==null?void 0:a.expiryMonth} ${a==null?void 0:a.cvv}`,Me=forge.pki.publicKeyFromPem((J=(v=ke==null?void 0:ke.data)==null?void 0:v.data)==null?void 0:J.publicKeyPem).encrypt(Y,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),X=forge.util.encode64(Me),He={"Content-Type":"application/json","x-app-session-key":(p=(x=ke.data)==null?void 0:x.data)==null?void 0:p.session_key},ge=JSON.stringify({enc_track2_data:`${X}`,algorithm:"RSAES_OAEP_SHA_1",session_key:`${(z=(r=ke==null?void 0:ke.data)==null?void 0:r.data)==null?void 0:z.session_key}`});try{let fe=await Rt.post(`${Ht}tokenizer/tokenize`,ge,{headers:He}),je=JSON.stringify(I(_({},(A=fe==null?void 0:fe.data)==null?void 0:A.data),{cvv:a==null?void 0:a.cvv,cardName:a==null?void 0:a.cardName,zip:a==null?void 0:a.zipCode,userId:e==null?void 0:e.customerId,fractalpayPublicKey:e==null?void 0:e.merchantPublicKey})),Le={"Content-Type":"application/json"};try{let ve=await Rt.post(`${Be}add-card`,je,{headers:Le});console.log(ve),(Ne=ve==null?void 0:ve.data)!=null&&Ne.result&&(j(!0),ue(),Ut(m,"close",""))}catch(ve){ue(),B(((ht=(Fe=ve==null?void 0:ve.response)==null?void 0:Fe.data)==null?void 0:ht.message)||(ve==null?void 0:ve.message)||"Something went wrong.")}}catch(fe){ue(),B(((De=(qe=fe==null?void 0:fe.response)==null?void 0:qe.data)==null?void 0:De.message)||(fe==null?void 0:fe.message)||"Something went wrong.")}}catch(ke){ue(),B(((Ct=(f=ke==null?void 0:ke.response)==null?void 0:f.data)==null?void 0:Ct.message)||(ke==null?void 0:ke.message)||"Something went wrong.")}}else typeof DatacapWebToken!="undefined"&&DatacapWebToken.requestToken(h==null?void 0:h.dctoken,"creditCardForm",st)}catch(st){ue(),B(((rt=(pt=st==null?void 0:st.response)==null?void 0:pt.data)==null?void 0:rt.message)||(st==null?void 0:st.message)||"Something went wrong.")}}}},style:{padding:"0 10px"}},Q.createElement("div",{style:{maxHeight:"350px",minHeight:"0"},className:"card-scrl"},Q.createElement("div",{className:"form-group",style:{marginTop:"0",marginBottom:"10px"}},Q.createElement("label",{htmlFor:"cardNumber"},"Card Number"),Q.createElement("input",{type:"text","data-token":"card_number",placeholder:"Enter card number",maxLength:19,inputMode:"numeric",value:(a==null?void 0:a.cardNumber)||"",onChange:m=>W(m),ref:ie}),(b==null?void 0:b.cardNumber)&&Q.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},b==null?void 0:b.cardNumber),Q.createElement("br",null)),Q.createElement("div",{className:"card-dtl"},Q.createElement("div",{className:"exp-cvc-container",style:{margin:"0"}},Q.createElement("div",{className:"form-group",style:{marginTop:"0"}},Q.createElement("label",{htmlFor:"expMonth"},"MM"),Q.createElement("input",{"data-token":"exp_month",className:"form-control required",type:"text",placeholder:"MM",maxLength:2,value:(a==null?void 0:a.expiryMonth)||"",onChange:m=>be("expiryMonth",m.target.value),ref:u}),(b==null?void 0:b.expiryMonth)&&Q.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},b==null?void 0:b.expiryMonth)),Q.createElement("div",{className:"form-group",style:{marginTop:"0"}},Q.createElement("label",{htmlFor:"expYear"},"YYYY"),Q.createElement("input",{"data-token":"exp_year",className:"form-control required",type:"text",placeholder:"YYYY",maxLength:4,value:(a==null?void 0:a.expiryYear)||"",onChange:m=>be("expiryYear",m.target.value),ref:E}),(b==null?void 0:b.expiryYear)&&Q.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},b==null?void 0:b.expiryYear)),Q.createElement("div",{className:"form-group",style:{marginTop:"0"}},Q.createElement("label",{htmlFor:"cvc"},"CVC"),Q.createElement("input",{"data-token":"cvv",className:"form-control required",type:"text",placeholder:"CVC",maxLength:4,value:(a==null?void 0:a.cvv)||"",onChange:m=>be("cvv",m.target.value),ref:C}),(b==null?void 0:b.cvv)&&Q.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},b==null?void 0:b.cvv)))),Q.createElement("div",{className:"form-group",style:{marginTop:"0"}},Q.createElement("label",{htmlFor:"cardholderName"},"Name on card"),Q.createElement("input",{type:"text",id:"cardholderName",name:"cardholderName",placeholder:"Name on card required",value:(a==null?void 0:a.cardName)||"",onChange:m=>{let d=m.target.value;/^[a-zA-Z\s]*$/.test(d)&&be("cardName",d)},ref:y}),(b==null?void 0:b.cardName)&&Q.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},b==null?void 0:b.cardName)),Q.createElement("div",{className:"form-group",style:{marginTop:"0"}},Q.createElement("label",{htmlFor:"zipcode"},"Zip"),Q.createElement("input",{type:"text",id:"",name:"zipcode",placeholder:"Zip",value:(R=a==null?void 0:a.zipCode)!=null?R:"",onChange:m=>be("zipCode",m.target.value)}),(b==null?void 0:b.zipCode)&&Q.createElement("span",{className:"error-span",style:{color:"red",fontSize:"12px"}},b==null?void 0:b.zipCode))),Q.createElement("input",{type:"submit",className:"idle-green-btn w-100",defaultValue:"Submit"})))))}import q,{useState as ln}from"react";import mn from"axios";var gn={PROPAYKEY:"25",PAYARCKEY:"26",STRIPEKEYCC:"27",PAYRIXKEY:"28",SKYFIACHKEY:"29",JUSTIFIKEY:"30",INFINICEPTKEY:"31",FRACTALKEY:"32"};import wi from"react";function Cn({}){return wi.createElement("style",null,`
|
|
1820
|
+
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap");
|
|
3912
1821
|
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
var SuccessCardMsz_default = SuccessCardMsz;
|
|
3918
|
-
|
|
3919
|
-
// src/app/components/AddCard/AddCardEasyPay.tsx
|
|
3920
|
-
function AddCardEasyPay(props) {
|
|
3921
|
-
var _a;
|
|
3922
|
-
const [loading, setLoading] = useState5(false);
|
|
3923
|
-
const [success, setSuccess] = useState5(false);
|
|
3924
|
-
const [error, setError] = useState5("");
|
|
3925
|
-
const [show, setShow] = useState5(false);
|
|
3926
|
-
const [cardData, setCardData] = useState5();
|
|
3927
|
-
const [cardError, setCardError] = useState5({});
|
|
3928
|
-
const [paymentData, setPaymentData] = useState5();
|
|
3929
|
-
const showLoader = () => setLoading(true);
|
|
3930
|
-
const hideLoader = () => setLoading(false);
|
|
3931
|
-
const showError = (msz) => {
|
|
3932
|
-
Swal3.fire({
|
|
3933
|
-
icon: "error",
|
|
3934
|
-
text: msz,
|
|
3935
|
-
customClass: {
|
|
3936
|
-
popup: "custom-z-index"
|
|
3937
|
-
}
|
|
3938
|
-
});
|
|
3939
|
-
};
|
|
3940
|
-
const handleClose = () => {
|
|
3941
|
-
setShow(false);
|
|
3942
|
-
setSuccess(false);
|
|
3943
|
-
setError("");
|
|
3944
|
-
setCardData({
|
|
3945
|
-
cardName: "",
|
|
3946
|
-
cardNumber: "",
|
|
3947
|
-
expiryMonth: "",
|
|
3948
|
-
expiryYear: "",
|
|
3949
|
-
cvv: "",
|
|
3950
|
-
orderId: "",
|
|
3951
|
-
zipCode: ""
|
|
3952
|
-
});
|
|
3953
|
-
};
|
|
3954
|
-
const handleShow = () => setShow(true);
|
|
3955
|
-
const handleCloseSeccess = () => {
|
|
3956
|
-
handleClose();
|
|
3957
|
-
};
|
|
3958
|
-
const handleCardChange = (field, value) => {
|
|
3959
|
-
const name = field;
|
|
3960
|
-
const numericFields = ["expiryMonth", "expiryYear", "zipCode", "cvv"];
|
|
3961
|
-
if (numericFields.includes(name)) {
|
|
3962
|
-
if (value === "" || /^[0-9]+$/.test(value)) {
|
|
3963
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3964
|
-
[name]: ""
|
|
3965
|
-
}));
|
|
3966
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3967
|
-
[name]: value
|
|
3968
|
-
}));
|
|
3969
|
-
}
|
|
3970
|
-
return;
|
|
3971
|
-
}
|
|
3972
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3973
|
-
[name]: ""
|
|
3974
|
-
}));
|
|
3975
|
-
console.log(value, name);
|
|
3976
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3977
|
-
[name]: value
|
|
3978
|
-
}));
|
|
3979
|
-
};
|
|
3980
|
-
const handleCardNumberChange = (e) => {
|
|
3981
|
-
const input = e.target;
|
|
3982
|
-
const rawValue = input.value.replace(/\D/g, "");
|
|
3983
|
-
let formatted = "";
|
|
3984
|
-
if (/^3[47]/.test(rawValue)) {
|
|
3985
|
-
const trimmed = rawValue.slice(0, 15);
|
|
3986
|
-
formatted = trimmed.replace(
|
|
3987
|
-
/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,
|
|
3988
|
-
(_, g1, g2, g3) => [g1, g2, g3].filter(Boolean).join(" ")
|
|
3989
|
-
);
|
|
3990
|
-
} else {
|
|
3991
|
-
const trimmed = rawValue.slice(0, 16);
|
|
3992
|
-
formatted = trimmed.replace(
|
|
3993
|
-
/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,
|
|
3994
|
-
(_, g1, g2, g3, g4) => [g1, g2, g3, g4].filter(Boolean).join(" ")
|
|
3995
|
-
);
|
|
3996
|
-
}
|
|
3997
|
-
setCardError((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
3998
|
-
cardNumber: ""
|
|
3999
|
-
}));
|
|
4000
|
-
setCardData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
4001
|
-
cardNumber: formatted
|
|
4002
|
-
}));
|
|
4003
|
-
};
|
|
4004
|
-
const validateCardData = () => {
|
|
4005
|
-
var _a2, _b, _c, _d, _e, _f;
|
|
4006
|
-
const errors = {};
|
|
4007
|
-
const data = cardData;
|
|
4008
|
-
const month = parseInt((data == null ? void 0 : data.expiryMonth) || "", 10);
|
|
4009
|
-
const year = (data == null ? void 0 : data.expiryYear) || "";
|
|
4010
|
-
if (!((_a2 = data == null ? void 0 : data.cardName) == null ? void 0 : _a2.trim())) errors.cardName = "Card name is required";
|
|
4011
|
-
if (!((_b = data == null ? void 0 : data.cardNumber) == null ? void 0 : _b.trim())) errors.cardNumber = "Card number is required";
|
|
4012
|
-
if (!((_c = data == null ? void 0 : data.expiryMonth) == null ? void 0 : _c.trim())) {
|
|
4013
|
-
errors.expiryMonth = "Expiration month is required";
|
|
4014
|
-
} else if (Number(data == null ? void 0 : data.expiryMonth) > 12 || Number(data == null ? void 0 : data.expiryMonth) < 1) {
|
|
4015
|
-
errors.expiryMonth = "Invalid Expiration Month.";
|
|
4016
|
-
}
|
|
4017
|
-
if (!((_d = data == null ? void 0 : data.expiryYear) == null ? void 0 : _d.trim())) {
|
|
4018
|
-
errors.expiryYear = "Expiration year is required";
|
|
4019
|
-
} else if (((_e = data == null ? void 0 : data.expiryYear) == null ? void 0 : _e.trim().length) !== 4 || Number(data == null ? void 0 : data.expiryYear) < 2025) {
|
|
4020
|
-
errors.expiryYear = "Invalid Expiration Year.";
|
|
4021
|
-
} else if (isNaN(month) || month < 1 || month > 12 || year.length !== 4) {
|
|
4022
|
-
errors.expiryMonth = "Invalid Expiration Date.";
|
|
4023
|
-
}
|
|
4024
|
-
if (!((_f = data == null ? void 0 : data.cvv) == null ? void 0 : _f.trim())) errors.cvv = "CVC is required";
|
|
4025
|
-
if ((data == null ? void 0 : data.expiryMonth) && (data == null ? void 0 : data.expiryYear) && data.expiryMonth.length <= 2 && data.expiryYear.length === 4) {
|
|
4026
|
-
const month2 = parseInt(data.expiryMonth, 10);
|
|
4027
|
-
const year2 = parseInt(data.expiryYear, 10);
|
|
4028
|
-
const now = /* @__PURE__ */ new Date();
|
|
4029
|
-
const currentMonth = now.getMonth() + 1;
|
|
4030
|
-
const currentYear = now.getFullYear();
|
|
4031
|
-
if (year2 < currentYear || year2 === currentYear && month2 < currentMonth) {
|
|
4032
|
-
errors.expiryMonth = "Card is expired";
|
|
4033
|
-
}
|
|
4034
|
-
}
|
|
4035
|
-
setCardError(errors);
|
|
4036
|
-
return Object.keys(errors).length > 0;
|
|
4037
|
-
};
|
|
4038
|
-
const getPaymentDetails = async () => {
|
|
4039
|
-
var _a2, _b, _c;
|
|
4040
|
-
showLoader();
|
|
4041
|
-
try {
|
|
4042
|
-
const data = {
|
|
4043
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4044
|
-
"customer_id": props == null ? void 0 : props.customerId,
|
|
4045
|
-
addcard: true
|
|
4046
|
-
};
|
|
4047
|
-
let paymentData2 = await axios5.post(`${baseUrl}get-payment-details`, data);
|
|
4048
|
-
console.log(paymentData2);
|
|
4049
|
-
setPaymentData((_a2 = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _a2.data);
|
|
4050
|
-
if (!((_c = (_b = paymentData2 == null ? void 0 : paymentData2.data) == null ? void 0 : _b.data) == null ? void 0 : _c.paymentGateway)) {
|
|
4051
|
-
handleClose();
|
|
4052
|
-
setError("Something went wrong.");
|
|
4053
|
-
}
|
|
4054
|
-
hideLoader();
|
|
4055
|
-
} catch (err) {
|
|
4056
|
-
console.log(err);
|
|
4057
|
-
hideLoader();
|
|
4058
|
-
handleClose();
|
|
4059
|
-
setError("Something went wrong.");
|
|
4060
|
-
}
|
|
4061
|
-
};
|
|
4062
|
-
useEffect6(() => {
|
|
4063
|
-
if (props.fractalpayClientKey) {
|
|
4064
|
-
getPaymentDetails();
|
|
4065
|
-
}
|
|
4066
|
-
}, [props == null ? void 0 : props.fractalpayClientKey]);
|
|
4067
|
-
const addCardFunc = async (e) => {
|
|
4068
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
4069
|
-
e.preventDefault();
|
|
4070
|
-
const hasError = validateCardData();
|
|
4071
|
-
console.log(cardData);
|
|
4072
|
-
if (hasError) return;
|
|
4073
|
-
else {
|
|
4074
|
-
let validCard = DatacapWebToken.validateCardNumber(cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""));
|
|
4075
|
-
let validExpirationDate = DatacapWebToken.validateExpirationDate(cardData == null ? void 0 : cardData.expiryMonth, cardData == null ? void 0 : cardData.expiryYear);
|
|
4076
|
-
let validCVV = DatacapWebToken.validateCVV(cardData == null ? void 0 : cardData.cvv);
|
|
4077
|
-
let errors = {};
|
|
4078
|
-
if (!validCard) errors.cardNumber = "Invalid card Number";
|
|
4079
|
-
if (!validExpirationDate) errors.expiryMonth = "Invalid Expiration Date.";
|
|
4080
|
-
if (!validCVV) errors.cvv = "Invalid CVV";
|
|
4081
|
-
setCardError(errors);
|
|
4082
|
-
if (validCard && validCVV && validExpirationDate) {
|
|
4083
|
-
showLoader();
|
|
4084
|
-
try {
|
|
4085
|
-
let getTokenCallback = async function(token) {
|
|
4086
|
-
var _a3, _b2, _c2, _d2, _e2;
|
|
4087
|
-
console.log(token);
|
|
4088
|
-
if (token.Error) {
|
|
4089
|
-
console.log(token == null ? void 0 : token.Error);
|
|
4090
|
-
setError(token.Error);
|
|
4091
|
-
hideLoader();
|
|
4092
|
-
} else {
|
|
4093
|
-
const reqData = {
|
|
4094
|
-
userId: props == null ? void 0 : props.customerId,
|
|
4095
|
-
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4096
|
-
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4097
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4098
|
-
token
|
|
4099
|
-
};
|
|
4100
|
-
try {
|
|
4101
|
-
let apiResponse = await axios5.post(`${baseUrl}add-card`, reqData);
|
|
4102
|
-
console.log(apiResponse);
|
|
4103
|
-
let formData = {
|
|
4104
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey,
|
|
4105
|
-
wallet_id: "",
|
|
4106
|
-
card_number: cardData == null ? void 0 : cardData.cardNumber.replaceAll(" ", ""),
|
|
4107
|
-
exp_month: cardData == null ? void 0 : cardData.expiryMonth,
|
|
4108
|
-
exp_year: (_a3 = cardData == null ? void 0 : cardData.expiryYear) == null ? void 0 : _a3.slice(-2),
|
|
4109
|
-
cvv: cardData == null ? void 0 : cardData.cvv
|
|
4110
|
-
};
|
|
4111
|
-
try {
|
|
4112
|
-
const result = await axios5.post(`${baseUrl}link-wallet`, formData);
|
|
4113
|
-
console.log(result);
|
|
4114
|
-
setSuccess(true);
|
|
4115
|
-
hideLoader();
|
|
4116
|
-
setCardData({
|
|
4117
|
-
cardName: "",
|
|
4118
|
-
cardNumber: "",
|
|
4119
|
-
expiryMonth: "",
|
|
4120
|
-
expiryYear: "",
|
|
4121
|
-
cvv: "",
|
|
4122
|
-
orderId: "",
|
|
4123
|
-
zipCode: ""
|
|
4124
|
-
});
|
|
4125
|
-
HandleSubmit(e, "close", "");
|
|
4126
|
-
} catch (err) {
|
|
4127
|
-
console.log(err);
|
|
4128
|
-
hideLoader();
|
|
4129
|
-
setError(((_c2 = (_b2 = err == null ? void 0 : err.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4130
|
-
}
|
|
4131
|
-
} catch (err) {
|
|
4132
|
-
console.log(err);
|
|
4133
|
-
hideLoader();
|
|
4134
|
-
setError(((_e2 = (_d2 = err == null ? void 0 : err.response) == null ? void 0 : _d2.data) == null ? void 0 : _e2.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4135
|
-
}
|
|
4136
|
-
}
|
|
4137
|
-
};
|
|
4138
|
-
if ((paymentData == null ? void 0 : paymentData.paymentGateway) === 32) {
|
|
4139
|
-
const requestOptions = {
|
|
4140
|
-
method: "POST",
|
|
4141
|
-
redirect: "follow"
|
|
4142
|
-
};
|
|
4143
|
-
try {
|
|
4144
|
-
let sesionResult = await axios5.post(`${masterBaseUrl}api/v1/widget/generate-session`, requestOptions);
|
|
4145
|
-
let expYear = Number(cardData == null ? void 0 : cardData.expiryYear) % 100;
|
|
4146
|
-
let cardNumber = cardData == null ? void 0 : cardData.cardNumber;
|
|
4147
|
-
cardNumber = cardNumber == null ? void 0 : cardNumber.replace(/\s+/g, "");
|
|
4148
|
-
let track2_data = `${cardNumber}=${expYear}${cardData == null ? void 0 : cardData.expiryMonth} ${cardData == null ? void 0 : cardData.cvv}`;
|
|
4149
|
-
const publicKey = forge.pki.publicKeyFromPem((_b = (_a2 = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _a2.data) == null ? void 0 : _b.publicKeyPem);
|
|
4150
|
-
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
|
4151
|
-
md: forge.md.sha1.create(),
|
|
4152
|
-
mgf1: {
|
|
4153
|
-
md: forge.md.sha1.create()
|
|
4154
|
-
}
|
|
4155
|
-
});
|
|
4156
|
-
const encryptedBase64 = forge.util.encode64(encrypted);
|
|
4157
|
-
const myHeaders = {
|
|
4158
|
-
"Content-Type": "application/json",
|
|
4159
|
-
"x-app-session-key": (_d = (_c = sesionResult.data) == null ? void 0 : _c.data) == null ? void 0 : _d.session_key
|
|
4160
|
-
};
|
|
4161
|
-
const raw = JSON.stringify({
|
|
4162
|
-
"enc_track2_data": `${encryptedBase64}`,
|
|
4163
|
-
"algorithm": "RSAES_OAEP_SHA_1",
|
|
4164
|
-
session_key: `${(_f = (_e = sesionResult == null ? void 0 : sesionResult.data) == null ? void 0 : _e.data) == null ? void 0 : _f.session_key}`
|
|
4165
|
-
});
|
|
4166
|
-
try {
|
|
4167
|
-
const tokenizeData = await axios5.post(`${fractalGatewayUrl}tokenizer/tokenize`, raw, { headers: myHeaders });
|
|
4168
|
-
const reqData = JSON.stringify(__spreadProps(__spreadValues({}, (_g = tokenizeData == null ? void 0 : tokenizeData.data) == null ? void 0 : _g.data), {
|
|
4169
|
-
cvv: cardData == null ? void 0 : cardData.cvv,
|
|
4170
|
-
cardName: cardData == null ? void 0 : cardData.cardName,
|
|
4171
|
-
zip: cardData == null ? void 0 : cardData.zipCode,
|
|
4172
|
-
userId: props == null ? void 0 : props.customerId,
|
|
4173
|
-
fractalpayPublicKey: props == null ? void 0 : props.fractalpayClientKey
|
|
4174
|
-
}));
|
|
4175
|
-
let myHeaders2 = {
|
|
4176
|
-
"Content-Type": "application/json"
|
|
4177
|
-
};
|
|
4178
|
-
try {
|
|
4179
|
-
let addCardRes = await axios5.post(
|
|
4180
|
-
`${baseUrl}add-card`,
|
|
4181
|
-
reqData,
|
|
4182
|
-
{
|
|
4183
|
-
headers: myHeaders2
|
|
4184
|
-
}
|
|
4185
|
-
);
|
|
4186
|
-
console.log(addCardRes);
|
|
4187
|
-
if ((_h = addCardRes == null ? void 0 : addCardRes.data) == null ? void 0 : _h.result) {
|
|
4188
|
-
setSuccess(true);
|
|
4189
|
-
hideLoader();
|
|
4190
|
-
HandleSubmit(e, "close", "");
|
|
4191
|
-
}
|
|
4192
|
-
} catch (err) {
|
|
4193
|
-
hideLoader();
|
|
4194
|
-
setError(((_j = (_i = err == null ? void 0 : err.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4195
|
-
}
|
|
4196
|
-
} catch (err) {
|
|
4197
|
-
hideLoader();
|
|
4198
|
-
setError(((_l = (_k = err == null ? void 0 : err.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4199
|
-
}
|
|
4200
|
-
} catch (err) {
|
|
4201
|
-
hideLoader();
|
|
4202
|
-
setError(((_n = (_m = err == null ? void 0 : err.response) == null ? void 0 : _m.data) == null ? void 0 : _n.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
4203
|
-
}
|
|
4204
|
-
} else {
|
|
4205
|
-
if (typeof DatacapWebToken !== "undefined") {
|
|
4206
|
-
DatacapWebToken.requestToken(paymentData == null ? void 0 : paymentData.dctoken, "creditCardForm", getTokenCallback);
|
|
4207
|
-
}
|
|
4208
|
-
}
|
|
4209
|
-
} catch (err) {
|
|
4210
|
-
hideLoader();
|
|
4211
|
-
setError(((_p = (_o = err == null ? void 0 : err.response) == null ? void 0 : _o.data) == null ? void 0 : _p.message) || (err == null ? void 0 : err.message) || "Something went wrong.");
|
|
1822
|
+
.creditformbox {
|
|
1823
|
+
// max-width: 550px;
|
|
1824
|
+
margin: 0 auto;
|
|
1825
|
+
font-family: Poppins !important;
|
|
4212
1826
|
}
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
1827
|
+
|
|
1828
|
+
.name-row {
|
|
1829
|
+
display: flex;
|
|
1830
|
+
gap: 10px;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
label {
|
|
1834
|
+
display: block;
|
|
1835
|
+
color: #383838;
|
|
1836
|
+
font-size: 16px;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
.form-group span.text-danger{
|
|
1840
|
+
color:red;
|
|
1841
|
+
}
|
|
1842
|
+
.form-group small.error{
|
|
1843
|
+
color:red;
|
|
1844
|
+
font-size:11px;
|
|
1845
|
+
}
|
|
1846
|
+
.name-row .form-group {
|
|
1847
|
+
display: block;
|
|
1848
|
+
width: 50%;
|
|
1849
|
+
margin-bottom: 15px;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.creditformbox input, .creditformbox select {
|
|
1853
|
+
border: 1.25px solid rgba(234, 236, 239, 1);
|
|
1854
|
+
color: rgba(94, 94, 94, 0.75);
|
|
1855
|
+
border-radius: 10px;
|
|
1856
|
+
width: -webkit-fill-available;
|
|
1857
|
+
padding: 10px 12px;
|
|
1858
|
+
font-size: .875rem;
|
|
1859
|
+
min-height: 20px;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
.form-pay-row {
|
|
1863
|
+
display: block;
|
|
1864
|
+
width: 100%;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
.form-pay-row .form-group {
|
|
1868
|
+
display: block;
|
|
1869
|
+
width: 100%;
|
|
1870
|
+
margin-bottom: 15px;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
.card-pay-row {
|
|
1874
|
+
display: flex;
|
|
1875
|
+
width: 100%;
|
|
1876
|
+
gap: 10px;
|
|
1877
|
+
flex-wrap: wrap;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
.card-pay-row .form-group {
|
|
1881
|
+
flex: 1;
|
|
1882
|
+
margin-bottom: 15px;
|
|
1883
|
+
min-width: 100px;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
.creditformbox input:focus {
|
|
1887
|
+
color: #212529;
|
|
1888
|
+
background-color: #fff;
|
|
1889
|
+
border-color: #86b7fe;
|
|
1890
|
+
outline: 0;
|
|
1891
|
+
box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
.checks-row{
|
|
1895
|
+
display:flex;
|
|
1896
|
+
align-items:start;
|
|
1897
|
+
gap:10px
|
|
1898
|
+
}
|
|
1899
|
+
.checks-row input {
|
|
1900
|
+
border: 1.25px solid rgba(234, 236, 239, 1);
|
|
1901
|
+
color: rgba(94, 94, 94, 0.75);
|
|
1902
|
+
border-radius: 10px;
|
|
1903
|
+
min-width: 16px !important;
|
|
1904
|
+
width:16px !important;
|
|
1905
|
+
padding: 10px 12px;
|
|
1906
|
+
font-size: .875rem;
|
|
1907
|
+
max-height: 16px !important;
|
|
1908
|
+
height: 16px !important;
|
|
1909
|
+
}
|
|
1910
|
+
// .checks-row input.is-valid:checked{
|
|
1911
|
+
// background-color: #198754;
|
|
1912
|
+
// border-color: #198754;
|
|
1913
|
+
// background-image: url(data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e);
|
|
1914
|
+
// }
|
|
1915
|
+
.check-error{
|
|
1916
|
+
color:red;
|
|
1917
|
+
font-size:11px;
|
|
1918
|
+
padding-left:25px
|
|
1919
|
+
}
|
|
1920
|
+
.button-row{
|
|
1921
|
+
display: flex;
|
|
1922
|
+
width: 100%;
|
|
1923
|
+
gap: 10px;
|
|
1924
|
+
flex-wrap: wrap;
|
|
1925
|
+
margin-top: 20px !important
|
|
1926
|
+
}
|
|
1927
|
+
.button-row .btn{
|
|
1928
|
+
flex: 1;
|
|
1929
|
+
margin-top:20px;
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
.cancelbtn {
|
|
1933
|
+
font-size:15px;
|
|
1934
|
+
color: #000000 !important;
|
|
1935
|
+
background-color: transparent !important;
|
|
1936
|
+
background: transparent !important;
|
|
1937
|
+
border:1px solid #000000 !important;
|
|
1938
|
+
border-radius: 10px !important;
|
|
1939
|
+
padding: 10px 25px !important;
|
|
1940
|
+
cursor:pointer;
|
|
1941
|
+
font-size: 16px;
|
|
4279
1942
|
}
|
|
1943
|
+
.cancelbtn:hover {
|
|
1944
|
+
background:#000000 !important;
|
|
1945
|
+
color:#ffffff !important;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
.savebtn {
|
|
1949
|
+
font-size:15px;
|
|
1950
|
+
color: #2979FF !important;
|
|
1951
|
+
background-color: transparent !important;
|
|
1952
|
+
background: transparent !important;
|
|
1953
|
+
border:1px solid #2979FF !important;
|
|
1954
|
+
border-radius: 10px !important;
|
|
1955
|
+
padding: 10px 25px !important;
|
|
1956
|
+
cursor:pointer;
|
|
1957
|
+
font-size: 16px;
|
|
4280
1958
|
}
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
id: "",
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
}
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
1959
|
+
.savebtn:hover {
|
|
1960
|
+
background:#2979FF !important;
|
|
1961
|
+
color:#ffffff !important;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
`)}function Ni({session_token:e,callback:L,isloading:$,onCancel:Z,showChecks:j,merchantName:Ye}){var W;let[B,Qe]=ln(!1),[xe,ie]=ln(!1),[u,E]=ln(),[C,y]=ln({}),[a,de]=ln(""),b=()=>Qe(!0),pe=()=>Qe(!1),h=()=>{var m,d,v,J,x,p,r,z;let k={},g=u,me=parseInt((g==null?void 0:g.expiryMonth)||"",10),R=(g==null?void 0:g.expiryYear)||"";return(m=g==null?void 0:g.firstName)!=null&&m.trim()||(k.firstName="Please enter a first name."),(d=g==null?void 0:g.lastName)!=null&&d.trim()||(k.lastName="Please enter a last name."),(v=g==null?void 0:g.cardNumber)!=null&&v.trim()||(k.cardNumber="Please enter a card number."),(J=g==null?void 0:g.expiryMonth)!=null&&J.trim()?(Number(g==null?void 0:g.expiryMonth)>12||Number(g==null?void 0:g.expiryMonth)<1)&&(k.expiryMonth="Invalid Expiration Month."):k.expiryMonth="Please enter an expiry month.",(x=g==null?void 0:g.expiryYear)!=null&&x.trim()?((p=g==null?void 0:g.expiryYear)==null?void 0:p.trim().length)!==4||Number(g==null?void 0:g.expiryYear)<2025?k.expiryYear="Invalid Expiration Year.":(isNaN(me)||me<1||me>12||R.length!==4)&&(k.expiryMonth="Invalid Expiration Date."):k.expiryYear="Please enter an expiry year.",(r=g==null?void 0:g.cvv)!=null&&r.trim()||(k.cvv="Please enter a CVV."),(z=g==null?void 0:g.zipCode)!=null&&z.trim()||(k.zipCode="Please enter a zip code."),j&&!(g!=null&&g.authHold)&&(k.authHold="You must authorize this before proceeding."),j&&!(g!=null&&g.authorise)&&(k.authorise="Please confirm your authorization to continue."),y(k),Object.keys(k).length>0},Ae=k=>{let me=k.target.value.replace(/\D/g,""),R="";/^3[47]/.test(me)?R=me.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(d,v,J,x)=>[v,J,x].filter(Boolean).join(" ")):R=me.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(d,v,J,x,p)=>[v,J,x,p].filter(Boolean).join(" ")),y(m=>I(_({},m),{cardNumber:""})),E(m=>I(_({},m),{cardNumber:R}))},K=(k,g)=>{let me=k;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(me)){(g===""||/^[0-9]+$/.test(g))&&(y(m=>I(_({},m),{[me]:""})),E(m=>I(_({},m),{[me]:g})));return}y(m=>I(_({},m),{[me]:""})),E(m=>I(_({},m),{[me]:g}))},ue=()=>{let k=DatacapWebToken.validateCardNumber(u==null?void 0:u.cardNumber.replaceAll(" ","")),g=DatacapWebToken.validateExpirationDate(u==null?void 0:u.expiryMonth,u==null?void 0:u.expiryYear),me=DatacapWebToken.validateCVV(u==null?void 0:u.cvv),R={};return k||(R.cardNumber="Invalid card Number"),g||(R.expiryMonth="Invalid Expiration Date."),me||(R.cvv="Invalid CVV"),y(R),k&&me&&g},ct=async k=>{var g,me;if(k.Error)de(k.Error),pe();else{let R={token:k.Token,resp:k},m=await mn.post(`${_e}api/v1/gateway/update/token/${e}`,R);if((m==null?void 0:m.status)==200){let d=_(_({Token:(me=(g=m==null?void 0:m.data)==null?void 0:g.data)==null?void 0:me.gateway_token,Brand:k.Brand,ExpirationMonth:k.ExpirationMonth,ExpirationYear:k.ExpirationYear,Last4:k.Last4,Bin:k.Bin,CVV:k.CVV,postalCode:u==null?void 0:u.zipCode},j&&{authHold:u==null?void 0:u.authHold}),j&&{authorise:u==null?void 0:u.authorise});pe(),L(d)}}},$e=async()=>{var k,g,me,R,m,d,v,J,x,p;try{let r={method:"POST",redirect:"follow"},z=await mn.post(`${_e}api/v1/widget/generate-session`,r),A=Number(u==null?void 0:u.expiryYear)%100,Fe=`${(k=u==null?void 0:u.cardNumber)==null?void 0:k.replace(/\s+/g,"")}=${A}${u==null?void 0:u.expiryMonth} ${u==null?void 0:u.cvv}`,qe=forge.pki.publicKeyFromPem((me=(g=z==null?void 0:z.data)==null?void 0:g.data)==null?void 0:me.publicKeyPem).encrypt(Fe,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),De=forge.util.encode64(qe),f={"Content-Type":"application/json","x-app-session-key":(m=(R=z.data)==null?void 0:R.data)==null?void 0:m.session_key},Ct=JSON.stringify({enc_track2_data:De,algorithm:"RSAES_OAEP_SHA_1",session_key:(v=(d=z==null?void 0:z.data)==null?void 0:d.data)==null?void 0:v.session_key}),pt=await mn.post(`${Ht}tokenizer/tokenize`,Ct,{headers:f});if((pt==null?void 0:pt.status)==200){let rt=(x=(J=pt==null?void 0:pt.data)==null?void 0:J.data)==null?void 0:x.token;try{let tt=await mn.post(`${_e}api/v1/gateway/verify-and-save/${e}`,{token:rt});if((tt==null?void 0:tt.status)==200){let it=(p=tt==null?void 0:tt.data)==null?void 0:p.data,ut={Token:it.gateway_token,Brand:it.card_data.brand,ExpirationMonth:it.card_data.expire_mm,ExpirationYear:it.card_data.expire_yy,Last4:it.card_data.last4,Bin:it.card_data.bin,postalCode:u==null?void 0:u.zipCode};pe(),L(ut)}}catch(tt){console.log(tt,"error"),pe()}}}catch(r){console.log(r,"eroror")}},nt=async k=>{var R,m,d,v,J,x,p;if(k.preventDefault(),!(h()||!ue())){b();try{let r=await mn.get(`${_e}api/v1/gateway/token/${e}`);if((r==null?void 0:r.status)==200){let z=(m=(R=r==null?void 0:r.data)==null?void 0:R.data)==null?void 0:m.gateway_token;((v=(d=r==null?void 0:r.data)==null?void 0:d.data)==null?void 0:v.paymentGateway)==((J=gn)==null?void 0:J.FRACTALKEY)?await $e():DatacapWebToken.requestToken(z,"creditCardForm",ct)}}catch(r){pe(),de(((p=(x=r==null?void 0:r.response)==null?void 0:x.data)==null?void 0:p.message)||"Something went wrong!")}}},w=()=>{de("")},be=()=>{de(""),E({firstName:"",lastName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",zipCode:"",authHold:!1,authorise:!1}),Z()};return q.createElement(q.Fragment,null,q.createElement(It,null),q.createElement(Cn,null),q.createElement(bt,{loading:B||$}),a&&q.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},q.createElement(jt,{error:a,onClose:w})),!a&&q.createElement("div",{className:"creditformbox"},q.createElement("form",{id:"creditCardForm",onSubmit:nt},q.createElement("div",{className:"name-row"},q.createElement("div",{className:"form-group"},q.createElement("label",null," First Name ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text",name:"first_name",placeholder:"First Name",value:(u==null?void 0:u.firstName)||"",onChange:k=>{let g=k.target.value;/^[a-zA-Z\s]*$/.test(g)&&K("firstName",g)}}),(C==null?void 0:C.firstName)&&q.createElement("small",{className:"error"},C==null?void 0:C.firstName)),q.createElement("div",{className:"form-group"},q.createElement("label",null," Last Name ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text",name:"last_name",placeholder:"Last Name",value:(u==null?void 0:u.lastName)||"",onChange:k=>{let g=k.target.value;/^[a-zA-Z\s]*$/.test(g)&&K("lastName",g)}}),(C==null?void 0:C.lastName)&&q.createElement("small",{className:"error"},C==null?void 0:C.lastName))),q.createElement("div",{className:"form-pay-row"},q.createElement("div",{className:"form-group"},q.createElement("label",null," Card Number ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"card_number",placeholder:"Card Number",maxLength:19,inputMode:"numeric",value:(u==null?void 0:u.cardNumber)||"",onChange:k=>Ae(k)}),(C==null?void 0:C.cardNumber)&&q.createElement("small",{className:"error"},C==null?void 0:C.cardNumber))),q.createElement("div",{className:"card-pay-row"},q.createElement("div",{className:"form-group"},q.createElement("label",null," Exp Month ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"exp_month",placeholder:"MM",maxLength:2,value:(u==null?void 0:u.expiryMonth)||"",onChange:k=>K("expiryMonth",k.target.value)}),(C==null?void 0:C.expiryMonth)&&q.createElement("small",{className:"error"},C==null?void 0:C.expiryMonth)),q.createElement("div",{className:"form-group"},q.createElement("label",null," Exp Year ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"exp_year",placeholder:"YYYY",maxLength:4,value:(u==null?void 0:u.expiryYear)||"",onChange:k=>K("expiryYear",k.target.value)}),(C==null?void 0:C.expiryYear)&&q.createElement("small",{className:"error"},C==null?void 0:C.expiryYear)),q.createElement("div",{className:"form-group"},q.createElement("label",null," CVV ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text","data-token":"cvv",placeholder:"CVV",maxLength:4,value:(u==null?void 0:u.cvv)||"",onChange:k=>K("cvv",k.target.value)}),(C==null?void 0:C.cvv)&&q.createElement("small",{className:"error"},C==null?void 0:C.cvv)),q.createElement("div",{className:"form-group"},q.createElement("label",null," Zip ",q.createElement("span",{className:"text-danger"},"*")),q.createElement("input",{type:"text",name:"zipcode",placeholder:"Zip Code",value:(W=u==null?void 0:u.zipCode)!=null?W:"",onChange:k=>K("zipCode",k.target.value)}),(C==null?void 0:C.zipCode)&&q.createElement("small",{className:"error"},C==null?void 0:C.zipCode))),j&&q.createElement(q.Fragment,null,q.createElement("div",{className:"checks-row"},q.createElement("input",{name:"authHold",type:"checkbox",id:"authHold",checked:!!(u!=null&&u.authHold),onChange:k=>K("authHold",k.target.checked)}),q.createElement("label",{htmlFor:"authHold",className:"form-check-label"},"To securely save your card on file, we will place a temporary authorization hold of $1.00. This is not a charge and will be released by your card issuer shortly after verification.")),(C==null?void 0:C.authHold)&&q.createElement("small",{className:"check-error"},C==null?void 0:C.authHold),q.createElement("div",{className:"checks-row "},q.createElement("input",{name:"authorise",type:"checkbox",id:"authorise",checked:!!(u!=null&&u.authorise),onChange:k=>K("authorise",k.target.checked)}),q.createElement("label",{htmlFor:"authorise",className:"form-check-label see-more"},xe?q.createElement(q.Fragment,null,q.createElement("span",null,"By providing your payment information, you authorize"," ",q.createElement("strong",null,Ye),", a Sky Systemz merchant, to securely store your card on file for future payments. Your card information will be encrypted and stored in compliance with PCI-DSS (Payment Card Industry Data Security Standard) regulations using Sky Systemz\u2019s secure payment technology. This information will be used solely for transactions you authorize with"," ",q.createElement("strong",null,Ye),". You may request the removal of your stored payment information at any time by contacting"," ",q.createElement("strong",null,Ye)," directly. By signing or proceeding with this transaction, you acknowledge and agree to this card on file authorization.",q.createElement("a",{href:"#",onClick:k=>{k.preventDefault(),ie(!1)}},"See less ..."))):q.createElement(q.Fragment,null,q.createElement("span",null,"By providing your payment information, you authorize ",Ye,", a Sky Systemz merchant, to securely store your card on file for future pay..."," "),q.createElement("a",{href:"#",onClick:k=>{k.preventDefault(),ie(!0)}},"See more ...")))),(C==null?void 0:C.authorise)&&q.createElement("small",{className:"check-error"},C==null?void 0:C.authorise)),q.createElement("div",{className:"button-row"},q.createElement("button",{className:"cancelbtn",type:"button",onClick:be},"Cancel"),q.createElement("button",{className:"savebtn",type:"submit"},"Save")))))}import i,{useEffect as _i,useState as at}from"react";import ki from"react";function wn(){let e="#000",L="#fff",$="#212529",Z="#dee2e6";return ki.createElement("style",null,`
|
|
1965
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
|
|
1966
|
+
body
|
|
1967
|
+
{
|
|
1968
|
+
font-family: 'Inter', sans-serif;
|
|
1969
|
+
}
|
|
1970
|
+
input
|
|
1971
|
+
{
|
|
1972
|
+
font-family: 'Inter', sans-serif !important;
|
|
1973
|
+
}
|
|
1974
|
+
.frac-form .form-group-frac{
|
|
1975
|
+
margin:0 !important
|
|
1976
|
+
}
|
|
1977
|
+
.frac-form .mb-4{
|
|
1978
|
+
margin-bottom : 10px !important
|
|
1979
|
+
}
|
|
1980
|
+
.frac-form .save-ach-div{
|
|
1981
|
+
display:flex !important;
|
|
1982
|
+
gap:5px !important;
|
|
1983
|
+
align-items:center
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
.frac-form .card-cvv-in{
|
|
1987
|
+
height : 36px !importantt;
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
.frac-form .pay-payment-amount{
|
|
1991
|
+
text-align:start !important
|
|
1992
|
+
}
|
|
1993
|
+
.frac-form .pay-amount{
|
|
1994
|
+
text-align:start !important
|
|
1995
|
+
}
|
|
1996
|
+
.frac-form .pay-main-logo{
|
|
1997
|
+
text-align:start !important
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
|
|
2001
|
+
|
|
2002
|
+
.paymentBtn {
|
|
2003
|
+
background-color: black;
|
|
2004
|
+
border: none;
|
|
2005
|
+
color: white;
|
|
2006
|
+
padding: 15px 32px;
|
|
2007
|
+
text-align: center;
|
|
2008
|
+
text-decoration: none;
|
|
2009
|
+
display: inline-block;
|
|
2010
|
+
font-size: 16px;
|
|
2011
|
+
margin: 4px 2px;
|
|
2012
|
+
cursor: pointer;
|
|
2013
|
+
border-radius: 180px;
|
|
2014
|
+
/* width: auto; */
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
.main-logo {
|
|
2018
|
+
text-align: center;
|
|
2019
|
+
margin-bottom: 20px;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.main-logo img {
|
|
2023
|
+
max-width: 180px;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
.pay-main-box {
|
|
2027
|
+
width: 365px !important;
|
|
2028
|
+
height: 93%;
|
|
2029
|
+
background: 0 0 #ffffff;
|
|
2030
|
+
border-radius: 12px;
|
|
2031
|
+
|
|
2032
|
+
|
|
2033
|
+
border: 1px solid #E0DFE2;
|
|
2034
|
+
margin: 0 auto;
|
|
2035
|
+
display: block;
|
|
2036
|
+
padding: 0px 26px !important
|
|
2037
|
+
}
|
|
2038
|
+
.pay-main-box .pay-header {
|
|
2039
|
+
display: flex;
|
|
2040
|
+
justify-content: center;
|
|
2041
|
+
align-items: center;
|
|
2042
|
+
text-align: center;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
.pay-main-box .pay-header button {
|
|
2046
|
+
border: 0;
|
|
2047
|
+
background: none;
|
|
2048
|
+
padding: 0;
|
|
2049
|
+
box-shadow: 0;
|
|
2050
|
+
outline: inherit;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
.pay-main-box h1 {
|
|
2054
|
+
margin: 0;
|
|
2055
|
+
flex: 1;
|
|
2056
|
+
padding: 10px 0;
|
|
2057
|
+
font-size: 23px;
|
|
2058
|
+
font-weight: 500;
|
|
2059
|
+
color: #35254D;
|
|
2060
|
+
align-items: start;
|
|
2061
|
+
display: flex;
|
|
2062
|
+
}
|
|
2063
|
+
.tab {
|
|
2064
|
+
overflow: hidden;
|
|
2065
|
+
padding: 5px;
|
|
2066
|
+
border-radius: 8px;
|
|
2067
|
+
display: flex;
|
|
2068
|
+
justify-content: space-around;
|
|
2069
|
+
margin-bottom:12px
|
|
2070
|
+
}
|
|
2071
|
+
|
|
2072
|
+
/* Style the buttons inside the tab */
|
|
2073
|
+
.tab button {
|
|
2074
|
+
float: left;
|
|
2075
|
+
border: none;
|
|
2076
|
+
outline: none;
|
|
2077
|
+
cursor: pointer;
|
|
2078
|
+
background:white;
|
|
2079
|
+
padding: 11px 16px;
|
|
2080
|
+
transition: 0.3s;
|
|
2081
|
+
font-size: 16px;
|
|
2082
|
+
width: 143px;
|
|
2083
|
+
border-radius: 5px;
|
|
2084
|
+
box-shadow: inherit;
|
|
2085
|
+
outline: none;
|
|
2086
|
+
color: ${e};
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/* Change background color of buttons on hover */
|
|
2090
|
+
.tab button:hover {
|
|
2091
|
+
background-color: #f0f0f0;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
/* Create an active/current tablink class */
|
|
2095
|
+
// .tab button.active {
|
|
2096
|
+
// background-color: #ccc;
|
|
2097
|
+
// }
|
|
2098
|
+
|
|
2099
|
+
/* Style the tab content */
|
|
2100
|
+
|
|
2101
|
+
|
|
2102
|
+
.parent-pay-container{
|
|
2103
|
+
padding: 20px 10% ;
|
|
2104
|
+
}
|
|
2105
|
+
.pay-container{
|
|
2106
|
+
display: grid;
|
|
2107
|
+
grid-template-columns: 2fr 3fr;
|
|
2108
|
+
|
|
2109
|
+
}
|
|
2110
|
+
.pay-main{
|
|
2111
|
+
padding-y: 20px}
|
|
2112
|
+
|
|
2113
|
+
.request-payment-close-popup {
|
|
2114
|
+
position: absolute;
|
|
2115
|
+
right: 20px;
|
|
2116
|
+
top: 20px;
|
|
2117
|
+
cursor: pointer;
|
|
2118
|
+
}
|
|
2119
|
+
.pay-conatiner-one{
|
|
2120
|
+
border-right: 1px solid #E0DFE2;
|
|
2121
|
+
display: flex;
|
|
2122
|
+
flex-direction: column;
|
|
2123
|
+
justify-content: space-between;
|
|
2124
|
+
}
|
|
2125
|
+
.pay-conatiner-one-first{
|
|
2126
|
+
|
|
2127
|
+
min-height:inherit !important;
|
|
2128
|
+
}
|
|
2129
|
+
.pay-conatiner-one-last{
|
|
2130
|
+
display:flex;
|
|
2131
|
+
font-size:12px;
|
|
2132
|
+
gap:5px;
|
|
2133
|
+
max-width:250px;
|
|
2134
|
+
align-items:center;
|
|
2135
|
+
color:black !important
|
|
2136
|
+
}
|
|
2137
|
+
.pay-conatiner-one-last img{
|
|
2138
|
+
width : 17px;
|
|
2139
|
+
height:17px
|
|
2140
|
+
}
|
|
2141
|
+
.pay-conatiner-two{
|
|
2142
|
+
padding: 0 5% 0;
|
|
2143
|
+
}
|
|
2144
|
+
.pay-logo-container{
|
|
2145
|
+
border-bottom: 1px solid #E0DFE2
|
|
2146
|
+
}
|
|
2147
|
+
.pay-heading{
|
|
2148
|
+
margin: 0;
|
|
2149
|
+
flex: 1;
|
|
2150
|
+
padding: 10px 0;
|
|
2151
|
+
font-size: 23px;
|
|
2152
|
+
font-weight: 500;
|
|
2153
|
+
color: #35254D;
|
|
2154
|
+
align-items: start;
|
|
2155
|
+
display: flex;
|
|
2156
|
+
}
|
|
2157
|
+
.pay-main-logo > img{
|
|
2158
|
+
width: 50%;
|
|
2159
|
+
}
|
|
2160
|
+
.pay-main-logo-res > img{
|
|
2161
|
+
width: 50%;
|
|
2162
|
+
display : none
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
.pay-payment-amount{
|
|
2166
|
+
display: block;
|
|
2167
|
+
font-size: 12px;
|
|
2168
|
+
color: #727272;
|
|
2169
|
+
margin-bottom: 8px;
|
|
2170
|
+
}
|
|
2171
|
+
.pay-amount-conatiner{
|
|
2172
|
+
margin-top: 6%;
|
|
2173
|
+
}
|
|
2174
|
+
.pay-amount{
|
|
2175
|
+
color: #000000;
|
|
2176
|
+
font-size: 38px;
|
|
2177
|
+
display: block;
|
|
2178
|
+
line-height: 110%;
|
|
2179
|
+
letter-spacing: -1px;
|
|
2180
|
+
}
|
|
2181
|
+
.frac-form label{
|
|
2182
|
+
font-family: 'IBM Plex Mono', monospace !important;
|
|
2183
|
+
color: #727272 !important;
|
|
2184
|
+
margin-bottom: 2px !important;
|
|
2185
|
+
font-weight: 600 !important;
|
|
2186
|
+
font-size: 12px !important;
|
|
2187
|
+
display:block !important;
|
|
2188
|
+
text-align : left !important
|
|
2189
|
+
}
|
|
2190
|
+
.form-control-frac{
|
|
2191
|
+
display: block;
|
|
2192
|
+
width: 100%;
|
|
2193
|
+
padding: .375rem .75rem;
|
|
2194
|
+
font-size: 1rem;
|
|
2195
|
+
font-weight: 400;
|
|
2196
|
+
line-height: 1.5;
|
|
2197
|
+
color: ${$};
|
|
2198
|
+
-webkit-appearance: none;
|
|
2199
|
+
-moz-appearance: none;
|
|
2200
|
+
appearance: none;
|
|
2201
|
+
background-color: ${L};
|
|
2202
|
+
background-clip: padding-box;
|
|
2203
|
+
border: 1px solid ${Z};
|
|
2204
|
+
border-radius: 0.375rem;
|
|
2205
|
+
transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
|
2206
|
+
}
|
|
2207
|
+
.form-control-frac:focus{
|
|
2208
|
+
border-color: #86b7fe;
|
|
2209
|
+
outline: 0;
|
|
2210
|
+
}
|
|
2211
|
+
.toggle-num-wrapper {
|
|
2212
|
+
position: relative;
|
|
2213
|
+
}
|
|
2214
|
+
.card-number-new{
|
|
2215
|
+
border-bottom: none;
|
|
2216
|
+
border-bottom-left-radius: 0px;
|
|
2217
|
+
border-bottom-right-radius: 0px;
|
|
2218
|
+
}
|
|
2219
|
+
.card-crdi {
|
|
2220
|
+
display: flex;
|
|
2221
|
+
border: 1px solid ${Z};
|
|
2222
|
+
border-radius: 0.375rem;
|
|
2223
|
+
}
|
|
2224
|
+
.card-expiry-new{
|
|
2225
|
+
border-top-left-radius: 0px;
|
|
2226
|
+
border-top-right-radius: 0px;
|
|
2227
|
+
}
|
|
2228
|
+
.exp-date-year-container{
|
|
2229
|
+
display: flex;
|
|
2230
|
+
flex-wrap: wrap;
|
|
2231
|
+
}
|
|
2232
|
+
.exp-date-year-container .form-group-frac{
|
|
2233
|
+
flex:1;
|
|
2234
|
+
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
.exp-date {
|
|
2238
|
+
float: left;
|
|
2239
|
+
// width: 30%
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
.exp-date input {
|
|
2243
|
+
width: calc(100% + 1px);
|
|
2244
|
+
border-top-right-radius: 0;
|
|
2245
|
+
border-bottom-right-radius: 0;
|
|
2246
|
+
border: 0;
|
|
2247
|
+
border-right: 1px solid ${Z};
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
|
|
2251
|
+
.exp-year {
|
|
2252
|
+
float: left;
|
|
2253
|
+
// width: 30%
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
.exp-year input {
|
|
2257
|
+
width: calc(100% + 1px);
|
|
2258
|
+
border-radius: 0;
|
|
2259
|
+
border-top: 0;
|
|
2260
|
+
border-bottom: 0;
|
|
2261
|
+
border-right: 1px solid ${Z};
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
.exp-date input:focus {
|
|
2265
|
+
position: relative;
|
|
2266
|
+
z-index: 10;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
.security-digit {
|
|
2270
|
+
float: right;
|
|
2271
|
+
// width: 40%;
|
|
2272
|
+
position: relative;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
.security-digit input {
|
|
2276
|
+
border-top-left-radius: 0;
|
|
2277
|
+
border-bottom-left-radius: 0;
|
|
2278
|
+
border-top: 0;
|
|
2279
|
+
border-bottom: 0;
|
|
2280
|
+
border-right:0;
|
|
2281
|
+
}
|
|
2282
|
+
.card-expiry-new{
|
|
2283
|
+
border-top-left-radius: 0px;
|
|
2284
|
+
border-top-right-radius: 0px;
|
|
2285
|
+
}
|
|
2286
|
+
.form-control-frac{box-sizing: border-box ;}
|
|
2287
|
+
#PaymentForm .form-group-frac{
|
|
2288
|
+
padding:5px 0 ;
|
|
2289
|
+
matgin: 0 !important
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2292
|
+
.toggle-label {
|
|
2293
|
+
position: relative;
|
|
2294
|
+
display: inline-block;
|
|
2295
|
+
width: 40px;
|
|
2296
|
+
height: 24px;
|
|
2297
|
+
background-color: #ccc;
|
|
2298
|
+
border-radius: 12px;
|
|
2299
|
+
cursor: pointer;
|
|
2300
|
+
transition: background-color 0.3s;
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
.toggle-label::before {
|
|
2304
|
+
content: "";
|
|
2305
|
+
position: absolute;
|
|
2306
|
+
top: 2px;
|
|
2307
|
+
left: 2px;
|
|
2308
|
+
width: 20px;
|
|
2309
|
+
height: 20px;
|
|
2310
|
+
background: #ffffff;
|
|
2311
|
+
border-radius: 50%;
|
|
2312
|
+
transition: left 300ms linear;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
.toggle-checkbox {
|
|
2316
|
+
display: none;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
.toggle-checkbox:checked + .toggle-label {
|
|
2320
|
+
background-color: #4caf50;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
.toggle-checkbox:checked + .toggle-label::before {
|
|
2324
|
+
left: 18px;
|
|
2325
|
+
}
|
|
2326
|
+
.ach-scrl {
|
|
2327
|
+
max-height: 380px;
|
|
2328
|
+
min-height: 380px;
|
|
2329
|
+
overflow-y: auto;
|
|
2330
|
+
padding-right: 6px;
|
|
2331
|
+
}
|
|
2332
|
+
.mb-4{
|
|
2333
|
+
margin-bottom:4px
|
|
2334
|
+
}
|
|
2335
|
+
.ach-scrl::-webkit-scrollbar {
|
|
2336
|
+
width: 3px;
|
|
2337
|
+
background-color: #F5F5F5;
|
|
2338
|
+
}
|
|
2339
|
+
.ach-scrl::-webkit-scrollbar-thumb {
|
|
2340
|
+
background-color: #35254D;
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
.error-span{
|
|
2344
|
+
color:red !important;
|
|
2345
|
+
font-size:12px !important;
|
|
2346
|
+
text-align: left !important;
|
|
2347
|
+
width: 100% !important;
|
|
2348
|
+
display: block;
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
.charge-customer-name-frac{
|
|
2352
|
+
color: #161616;
|
|
2353
|
+
font-family: Inter;
|
|
2354
|
+
font-size: 24px;
|
|
2355
|
+
font-style: normal;
|
|
2356
|
+
font-weight: 600;
|
|
2357
|
+
line-height: 32px;
|
|
2358
|
+
letter-spacing: -0.48px;
|
|
2359
|
+
text-transform: capitalize;
|
|
2360
|
+
margin-top:0;
|
|
2361
|
+
margin-bottom:16px !important;
|
|
2362
|
+
text-align:left !important
|
|
2363
|
+
}
|
|
2364
|
+
.card-ach-heading-frac {
|
|
2365
|
+
color: #727272;
|
|
2366
|
+
font-family: Inter;
|
|
2367
|
+
font-size: 12px;
|
|
2368
|
+
font-style: normal;
|
|
2369
|
+
font-weight: 500;
|
|
2370
|
+
line-height: 18px;
|
|
2371
|
+
letter-spacing: -0.24px;
|
|
2372
|
+
margin : 0 0 10px !important;
|
|
2373
|
+
text-align : left
|
|
2374
|
+
}
|
|
2375
|
+
.card-list-div{
|
|
2376
|
+
max-height : 190px;
|
|
2377
|
+
overflow-y : auto;
|
|
2378
|
+
border:1px solid #E0DFE2;
|
|
2379
|
+
border-radius : 8px
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
|
|
2383
|
+
.card-list-div::-webkit-scrollbar{
|
|
2384
|
+
width:2px;
|
|
2385
|
+
background-color:#F5F5F5
|
|
2386
|
+
}
|
|
2387
|
+
.card-list-div::-webkit-scrollbar-thumb{
|
|
2388
|
+
background-color:#35254D
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
.card-list-single-div{
|
|
2392
|
+
border-bottom: 1px solid #E0DFE2;
|
|
2393
|
+
padding : 8px 11px;
|
|
2394
|
+
display : flex ;
|
|
2395
|
+
align-items:center;
|
|
2396
|
+
justify-content : space-between;
|
|
2397
|
+
gap:12px
|
|
2398
|
+
}
|
|
2399
|
+
.card-list-single-div:last-child {
|
|
2400
|
+
border-bottom: none;
|
|
2401
|
+
}
|
|
2402
|
+
.card-lint-div-in{
|
|
2403
|
+
min-height:444px}
|
|
2404
|
+
.card-number-radio{
|
|
2405
|
+
display:flex;
|
|
2406
|
+
gap:12px;
|
|
2407
|
+
}
|
|
2408
|
+
.card-number-radio .card-number-last-four{
|
|
2409
|
+
color:#161616 !important;
|
|
2410
|
+
font-family:Inter !important;
|
|
2411
|
+
font-size:14px !important;
|
|
2412
|
+
font-weight:500 !important;
|
|
2413
|
+
font-style:normal !important;
|
|
2414
|
+
line-height : 18px !important;
|
|
2415
|
+
latter-spacing:-0.18px !important
|
|
2416
|
+
}
|
|
2417
|
+
.card-expiry-date{
|
|
2418
|
+
margin:0;
|
|
2419
|
+
color:#00000080;
|
|
2420
|
+
font-family:Inter;
|
|
2421
|
+
font-size:14px;
|
|
2422
|
+
font-weight:500;
|
|
2423
|
+
font-style"normal;
|
|
2424
|
+
line-height : 18px;
|
|
2425
|
+
latter-spacing:-0.18px
|
|
2426
|
+
}
|
|
2427
|
+
.pay-with-other-card {
|
|
2428
|
+
margin-top : 12px;
|
|
2429
|
+
padding:12px 32px;
|
|
2430
|
+
border :1px solid #E0DFE2;
|
|
2431
|
+
border-radius : 1000px;
|
|
2432
|
+
display: flex;
|
|
2433
|
+
justify-content : center;
|
|
2434
|
+
align-items:center;
|
|
2435
|
+
gap:10px;
|
|
2436
|
+
// width:100%;
|
|
2437
|
+
background:white;
|
|
2438
|
+
cursor:pointer;
|
|
2439
|
+
color:#161616;
|
|
2440
|
+
text-align:center
|
|
2441
|
+
font-family: Inter;
|
|
2442
|
+
font-size: 14px;
|
|
2443
|
+
font-style: normal;
|
|
2444
|
+
font-weight: 500;
|
|
2445
|
+
line-height: 24px;
|
|
2446
|
+
letter-spacing: -0.28px;
|
|
2447
|
+
// margin-bottom: 50px;
|
|
2448
|
+
}
|
|
2449
|
+
.charge-payment-back-btn {
|
|
2450
|
+
display: flex;
|
|
2451
|
+
padding: 9px 16px;
|
|
2452
|
+
align-items: center;
|
|
2453
|
+
gap: 6px;
|
|
2454
|
+
margin-bottom: 20px;
|
|
2455
|
+
border-radius: 1000px;
|
|
2456
|
+
border: 1px solid #E0DFE2;
|
|
2457
|
+
background: #FFF;
|
|
2458
|
+
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
|
2459
|
+
font-size:16px;
|
|
2460
|
+
curso:pointer;
|
|
2461
|
+
color:black
|
|
2462
|
+
}
|
|
2463
|
+
.res-charge-payment-back-btn{
|
|
2464
|
+
padding: 9px 16px;
|
|
2465
|
+
align-items: center;
|
|
2466
|
+
gap: 6px;
|
|
2467
|
+
margin-bottom: 20px;
|
|
2468
|
+
border-radius: 1000px;
|
|
2469
|
+
border: 1px solid #E0DFE2;
|
|
2470
|
+
background: #FFF;
|
|
2471
|
+
box-shadow: 0px 6px 12px 0px rgba(206, 197, 221, 0.31);
|
|
2472
|
+
font-size:16px;
|
|
2473
|
+
curso:pointer;
|
|
2474
|
+
color:black;
|
|
2475
|
+
display:none
|
|
2476
|
+
}
|
|
2477
|
+
.btn {
|
|
2478
|
+
padding: 11px 23px;
|
|
2479
|
+
background-color: black;
|
|
2480
|
+
color: white;
|
|
2481
|
+
border: none;
|
|
2482
|
+
border-radius: 6px;
|
|
2483
|
+
font-weight: bold;
|
|
2484
|
+
margin: 0 10px;
|
|
2485
|
+
cursor: pointer;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
.custom-swal-icon {
|
|
2489
|
+
margin: 20px auto;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
.custom-swal-popup {
|
|
2493
|
+
font-size: 16px;
|
|
2494
|
+
text-align: center;
|
|
2495
|
+
}
|
|
2496
|
+
|
|
2497
|
+
.frac-form .res-pay-con{
|
|
2498
|
+
display:none
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
.saveachtext p, .saveachtext b {
|
|
2502
|
+
font-size: 12px !important;
|
|
2503
|
+
color: #727272 !important;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
.cardicon-img img {
|
|
2507
|
+
margin-top: -2px !important;
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
.bankicon-img img {
|
|
2511
|
+
margin-top: -4px !important;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
.cardicon {
|
|
2515
|
+
margin-right : 8px !important;
|
|
2516
|
+
width : 18px !important;
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
.bankicon {
|
|
2520
|
+
margin-right : 8px !important;
|
|
2521
|
+
width : 18px !important;
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
|
|
2525
|
+
@media (max-width: 768px) {
|
|
2526
|
+
.request-payment-close-popup {
|
|
2527
|
+
right: 12px !important;
|
|
2528
|
+
top: 12px !important;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
.parent-pay-container{
|
|
2532
|
+
padding: 20px 5%;
|
|
2533
|
+
}
|
|
2534
|
+
.pay-container {
|
|
2535
|
+
grid-template-columns: 1fr;
|
|
2536
|
+
padding: 10px 5%;
|
|
2537
|
+
border:1px solid #E0DFE2;
|
|
2538
|
+
border-radius : 12px
|
|
2539
|
+
}
|
|
2540
|
+
.pay-conatiner-one{
|
|
2541
|
+
border-right: none;
|
|
2542
|
+
}
|
|
2543
|
+
.pay-conatiner-one-first{
|
|
2544
|
+
min-height:0
|
|
2545
|
+
}
|
|
2546
|
+
.pay-main-logo > img{
|
|
2547
|
+
display: none;
|
|
2548
|
+
}
|
|
2549
|
+
.pay-main-logo-res > img {
|
|
2550
|
+
display:block;
|
|
2551
|
+
margin:auto
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
.pay-logo-container{
|
|
2555
|
+
border :none
|
|
2556
|
+
}
|
|
2557
|
+
.res-charge-payment-back-btn {
|
|
2558
|
+
display:flex !important
|
|
2559
|
+
}
|
|
2560
|
+
.charge-payment-back-btn{
|
|
2561
|
+
display:none !important
|
|
2562
|
+
}
|
|
2563
|
+
.frac-form .res-pay-con{
|
|
2564
|
+
display:flex;
|
|
2565
|
+
justify-content :space-between;
|
|
2566
|
+
align-items:center;
|
|
2567
|
+
padding-bottom : 10px
|
|
2568
|
+
}
|
|
2569
|
+
.frac-form .amt-pay-con{
|
|
2570
|
+
display:none
|
|
2571
|
+
}
|
|
2572
|
+
.pay-conatiner-one-last{
|
|
2573
|
+
display:none}
|
|
2574
|
+
.pay-conatiner-two{
|
|
2575
|
+
padding:0
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
}
|
|
2580
|
+
@media (max-width : 512px){
|
|
2581
|
+
.tab button {
|
|
2582
|
+
padding: 6px 16px;
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
|
|
2587
|
+
|
|
2588
|
+
|
|
2589
|
+
|
|
2590
|
+
|
|
2591
|
+
`)}import ft from"axios";import{IoArrowBack as An}from"react-icons/io5";import en from"sweetalert2";var Fi=({amount:e,submitBtnText:L="Pay",session_token:$,customerId:Z,callback:j,merchantName:Ye="merchant",isPreAuth:B,surcharge:Qe="0",submitBtnClass:xe,submitBtnIcon:ie})=>{var Re,ce,gt,yt,Tt,Te,Bt,xt,ze,Oe,Vt,Mt,Kt,ot;let[u,E]=at("card"),[C,y]=at("card"),[a,de]=at(),[b,pe]=at({}),[h,Ae]=at(),[K,ue]=at({}),[ct,$e]=at(!1),[nt,w]=at(!1),[be,W]=at(!1),[k,g]=at(""),[me,R]=at(!1),[m,d]=at(""),[v,J]=at(!1),[x,p]=at(!1),[r,z]=at([]),[A,Ne]=at(),[Fe,ht]=at();console.log(xe,"submitBtnClass");let qe=le+"widget/mc-img.svg",De=le+"widget/visa-img.svg",f=le+"widget/ae-img.svg",Ct=le+"widget/discover-img.svg",pt=le+"widget/card.svg",rt=le+"widget/Trash.svg",tt=le+"widget/bank.svg",it=le+"widget/secure-img.png",ut=le+"widget/pov-by.png",qt=le+"widget/pax.svg",st=le+"widget/cardicon.svg",Ge=le+"widget/bankicon.svg",ke=()=>J(!0),oe=()=>J(!1),N=async l=>{var c,U,o,n,F,H,P,O;console.log(l,"ndfkjhdskjfhds");try{let V={pass_fee_amount:Qe,Token:l==null?void 0:l.Token,amount:e,postal_code:l==null?void 0:l.postalCode},T=await ft.post(`${_e}api/v1/gateway/charge/${$}`,V);if((c=T==null?void 0:T.data)!=null&&c.result){let D={};if(be&&Z)try{let ee={postal_code:a==null?void 0:a.zipCode,customer_id:Z,gateway_token:(l==null?void 0:l.gateway_token)||(l==null?void 0:l.Token)},G=await ft.post(`${_e}api/v1/gateway/add-card/${$}`,ee);(U=G==null?void 0:G.data)!=null&&U.result&&(G=(o=G==null?void 0:G.data)==null?void 0:o.data)}catch(ee){console.log(ee,"error"),oe(),g(((F=(n=ee==null?void 0:ee.response)==null?void 0:n.data)==null?void 0:F.message)||"Something went wrong!")}let te={cardDetails:_(_({},D),l),callback:I(_({},(H=T==null?void 0:T.data)==null?void 0:H.data),{name:a==null?void 0:a.cardName,isPreAuth:B})};be||delete te.cardDetails,j(te),oe(),Ke()}}catch(V){g(((O=(P=V==null?void 0:V.response)==null?void 0:P.data)==null?void 0:O.message)||"Something went wrong!"),oe()}},Y=async l=>{var c,U,o,n,F,H,P,O;try{let V={Token:l==null?void 0:l.Token,amount:e,postal_code:l==null?void 0:l.postalCode},T=await ft.post(`${_e}api/v1/gateway/preauth/${$}`,V);if((c=T==null?void 0:T.data)!=null&&c.result){let D={};if(be&&Z)try{let ee={postal_code:a==null?void 0:a.zipCode,customer_id:Z,gateway_token:l==null?void 0:l.gateway_token},G=await ft.post(`${_e}api/v1/gateway/add-card/${$}`,ee);(U=G==null?void 0:G.data)!=null&&U.result&&(G=(o=G==null?void 0:G.data)==null?void 0:o.data)}catch(ee){console.log(ee,"error"),oe(),g(((F=(n=ee==null?void 0:ee.response)==null?void 0:n.data)==null?void 0:F.message)||"Something went wrong!")}let te={cardDetails:_(_({},D),l),callback:I(_({},(H=T==null?void 0:T.data)==null?void 0:H.data),{name:a==null?void 0:a.cardName,isPreAuth:B})};be||delete te.cardDetails,j(te),oe(),Ke()}}catch(V){g(((O=(P=V==null?void 0:V.response)==null?void 0:P.data)==null?void 0:O.message)||"Something went wrong!"),oe()}},ae=async l=>{var c,U,o,n;if(l.Error)g(l.Error),oe();else{let F={token:l.Token,resp:l};try{let H=await ft.post(`${_e}api/v1/gateway/update/token/${$}`,F);if((H==null?void 0:H.status)==200){let P={Token:(U=(c=H==null?void 0:H.data)==null?void 0:c.data)==null?void 0:U.gateway_token,Brand:l.Brand,ExpirationMonth:l.ExpirationMonth,ExpirationYear:l.ExpirationYear,Last4:l.Last4,Bin:l.Bin,CVV:l.CVV,postalCode:a==null?void 0:a.zipCode},O;B?Y(P):N(P)}}catch(H){console.log(H,"error"),oe(),g(((n=(o=H==null?void 0:H.response)==null?void 0:o.data)==null?void 0:n.message)||"Something went wrong!")}}},Me=()=>w(!0),X=l=>{E(l)},He=()=>{var U,o,n,F,H,P,O,V;let l={},c=h;return(U=c==null?void 0:c.name)!=null&&U.trim()||(l.name="Name is required"),(o=c==null?void 0:c.accountNumber)!=null&&o.trim()||(l.accountNumber="Account number is required"),(n=c==null?void 0:c.accountNumber)!=null&&n.trim()&&((F=c==null?void 0:c.accountNumber)==null?void 0:F.trim())!==((H=c==null?void 0:c.confirmAccountNumber)==null?void 0:H.trim())&&(l.confirmAccountNumber="Account numbers must match"),(P=c==null?void 0:c.bankName)!=null&&P.trim()||(l.bankName="Bank name is required"),(O=c==null?void 0:c.routingNumber)!=null&&O.trim()||(l.routingNumber="Routing Number is required"),c!=null&&c.routingNumber&&((V=c==null?void 0:c.routingNumber)==null?void 0:V.length)!==9&&(l.routingNumber="Routing number must be 9 digits"),((c==null?void 0:c.accountType)==="business saving"||(c==null?void 0:c.accountType)==="business checking")&&(!(c!=null&&c.companyName)||(c==null?void 0:c.companyName)==="")&&(l.companyName="Company Name is required for business accounts"),ue(l),Object.keys(l).length>0},ge=async()=>{var l,c,U,o,n,F,H,P,O,V,T,D,te,ee,G,dt;try{let re={method:"POST",redirect:"follow"},Je=await ft.post(`${_e}api/v1/widget/generate-session`,re),Yt=Number(a==null?void 0:a.expiryYear)%100,Ue=`${(l=a==null?void 0:a.cardNumber)==null?void 0:l.replace(/\s+/g,"")}=${Yt}${a==null?void 0:a.expiryMonth} ${a==null?void 0:a.cvv}`,Se=forge.pki.publicKeyFromPem((U=(c=Je==null?void 0:Je.data)==null?void 0:c.data)==null?void 0:U.publicKeyPem).encrypt(Ue,"RSA-OAEP",{md:forge.md.sha1.create(),mgf1:{md:forge.md.sha1.create()}}),$t=forge.util.encode64(Se),zt={"Content-Type":"application/json","x-app-session-key":(n=(o=Je.data)==null?void 0:o.data)==null?void 0:n.session_key},_t=JSON.stringify({enc_track2_data:$t,algorithm:"RSAES_OAEP_SHA_1",session_key:(H=(F=Je==null?void 0:Je.data)==null?void 0:F.data)==null?void 0:H.session_key}),Ee=await ft.post(`${Ht}tokenizer/tokenize`,_t,{headers:zt});if((Ee==null?void 0:Ee.status)==200){let Xt=(O=(P=Ee==null?void 0:Ee.data)==null?void 0:P.data)==null?void 0:O.token;try{let Pe=await ft.post(`${_e}api/v1/gateway/verify-and-save/${$}`,{token:Xt});if((Pe==null?void 0:Pe.status)==200){let se=(V=Pe==null?void 0:Pe.data)==null?void 0:V.data,ne={Token:se.gateway_token,Brand:se.card_data.brand,ExpirationMonth:se.card_data.expire_mm,ExpirationYear:se.card_data.expire_yy,Last4:se.card_data.last4,Bin:se.card_data.bin,postalCode:a==null?void 0:a.zipCode},Ie;if(be&&Z)try{let We={postal_code:a==null?void 0:a.zipCode,customer_id:Z,gateway_token:se.gateway_token};Ie=await ft.post(`${_e}api/v1/gateway/add-card/${$}`,We)}catch(We){console.log(We,"error"),oe(),g(((D=(T=We==null?void 0:We.response)==null?void 0:T.data)==null?void 0:D.message)||"Something went wrong!")}B?Y(ne):N(ne)}}catch(Pe){console.log(Pe,"error"),g(((ee=(te=Pe==null?void 0:Pe.response)==null?void 0:te.data)==null?void 0:ee.message)||"Something went wrong!"),oe()}}}catch(re){oe(),console.log(re,"error"),g(((dt=(G=re==null?void 0:re.response)==null?void 0:G.data)==null?void 0:dt.message)||"Something went wrong!")}},fe=()=>{var n,F,H,P,O,V;let l={},c=a,U=parseInt((c==null?void 0:c.expiryMonth)||"",10),o=(c==null?void 0:c.expiryYear)||"";if((n=c==null?void 0:c.cardName)!=null&&n.trim()||(l.cardName="Card name is required"),(F=c==null?void 0:c.cardNumber)!=null&&F.trim()||(l.cardNumber="Card number is required"),(!((H=c==null?void 0:c.expiryMonth)!=null&&H.trim())||!((P=c==null?void 0:c.expiryYear)!=null&&P.trim())||isNaN(U)||U<1||U>12||o.length!==4)&&(l.expiryMonth="Invalid Expiration Date."),(O=c==null?void 0:c.cvv)!=null&&O.trim()||(l.cvv="CVV is required"),(V=c==null?void 0:c.zipCode)!=null&&V.trim()||(l.zipCode="ZIP code is required"),c!=null&&c.expiryMonth&&(c!=null&&c.expiryYear)&&c.expiryMonth.length<=2&&c.expiryYear.length===4){let T=parseInt(c.expiryMonth,10),D=parseInt(c.expiryYear,10),te=new Date,ee=te.getMonth()+1,G=te.getFullYear();(D<G||D===G&&T<ee)&&(l.expiryMonth="Card is expired")}return pe(l),Object.keys(l).length>0},je=async l=>{var c,U,o,n,F,H,P,O,V,T,D,te,ee,G,dt;if(l.preventDefault(),u!=="ach"){if(fe())return}else if(He())return;try{ke();let re=await ft.get(`${_e}api/v1/gateway/token/${$}`);if((re==null?void 0:re.status)==200){let Je=(U=(c=re==null?void 0:re.data)==null?void 0:c.data)==null?void 0:U.gateway_token,Yt=(n=(o=re==null?void 0:re.data)==null?void 0:o.data)==null?void 0:n.paymentGateway;if(u!=="ach")Yt==((F=gn)==null?void 0:F.FRACTALKEY)?await ge():DatacapWebToken.requestToken(Je,"PaymentForm",ae);else{let Ze;try{let Ue=await ft.post(`${_e}api/v1/gateway/bank-charge/${$}`,{label:h==null?void 0:h.name,account_number:h==null?void 0:h.accountNumber,routing_number:h==null?void 0:h.routingNumber,bank_name:h==null?void 0:h.bankName,account_type:h==null?void 0:h.accountType,amount:e,customer_id:null,isSaveAch:!1,tax:"0.00",discount:"0.00",surcharge:"0.00",order_id:"",company_name:(h==null?void 0:h.companyName)||""});if((H=Ue==null?void 0:Ue.data)!=null&&H.result){if(ct&&Z)try{let Ce=await ft.post(`${_e}api/v1/gateway/add-bank/${$}`,{name:h==null?void 0:h.name,account_number:h==null?void 0:h.accountNumber,routing_number:h==null?void 0:h.routingNumber,bank_name:h==null?void 0:h.bankName,account_type:h==null?void 0:h.accountType,customer_id:Z||"",company_name:(h==null?void 0:h.companyName)||""});Ce.data.result&&(Ze={bankDetails:I(_({},(P=Ce==null?void 0:Ce.data)==null?void 0:P.data),{account_type:h==null?void 0:h.accountType})})}catch(Ce){oe(),g(((V=(O=Ce==null?void 0:Ce.response)==null?void 0:O.data)==null?void 0:V.message)||"Something went wrong!")}Ze=I(_({},Ze),{callback:I(_({},(T=Ue==null?void 0:Ue.data)==null?void 0:T.data),{name:h==null?void 0:h.name,isPreAuth:B})}),j(Ze),Ke(),oe()}}catch(Ue){console.log(Ue,"errororor");let Ce=(D=Ue==null?void 0:Ue.response)==null?void 0:D.data;typeof(Ce==null?void 0:Ce.message)=="object"?Object.values(Ce==null?void 0:Ce.message).forEach(Se=>{g(Se||"Something went wrong")}):g((Ce==null?void 0:Ce.message)||"Something went wrong"),oe()}}}}catch(re){oe(),j({error:((ee=(te=re==null?void 0:re.response)==null?void 0:te.data)==null?void 0:ee.message)||"Something went wrong!"}),g(((dt=(G=re==null?void 0:re.response)==null?void 0:G.data)==null?void 0:dt.message)||"Something went wrong!")}},Le=(l,c)=>{let U=l;if(["expiryMonth","expiryYear","zipCode","cvv"].includes(U)){(c===""||/^[0-9]+$/.test(c))&&(pe(n=>I(_({},n),{[U]:""})),de(n=>I(_({},n),{[U]:c})));return}pe(n=>I(_({},n),{[U]:""})),de(n=>I(_({},n),{[U]:c}))},ve=l=>{let U=l.target.value.replace(/\D/g,""),o="";/^3[47]/.test(U)?o=U.slice(0,15).replace(/^(\d{1,4})(\d{1,6})?(\d{1,5})?$/,(F,H,P,O)=>[H,P,O].filter(Boolean).join(" ")):o=U.slice(0,16).replace(/^(\d{1,4})(\d{1,4})?(\d{1,4})?(\d{1,4})?$/,(F,H,P,O,V)=>[H,P,O,V].filter(Boolean).join(" ")),pe(n=>I(_({},n),{cardNumber:""})),de(n=>I(_({},n),{cardNumber:o}))},Ve=l=>{let{name:c,value:U}=l.target,o=["routingNumber","accountNumber","confirmAccountNumber"];if(c=="name"){/^[a-zA-Z\s]*$/.test(U)&&(ue(n=>I(_({},n),{[c]:""})),Ae(n=>I(_({},n),{[c]:U})));return}if(o.includes(c)){(U===""||/^[0-9]+$/.test(U))&&(ue(n=>I(_({},n),{[c]:""})),Ae(n=>I(_({},n),{[c]:U})));return}ue(n=>I(_({},n),{[c]:""})),Ae(n=>I(_({},n),{[c]:U}))},Ke=()=>{w(!1),E("card"),g(""),R(!1),d(""),Ae({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),ue({name:"",routingNumber:"",accountNumber:"",confirmAccountNumber:"",bankName:"",accountType:""}),de({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),pe({cardName:"",cardNumber:"",expiryMonth:"",expiryYear:"",cvv:"",orderId:"",zipCode:""}),$e(!1),W(!1),z([])},lt=async()=>{var l,c,U,o,n,F,H,P,O;ke();try{let V={isPreAuth:B,customerId:Z},T=await ft.post(`${_e}api/v1/gateway/card-list/${$}`,V);if(console.log("paymentData",T),(c=(l=T==null?void 0:T.data)==null?void 0:l.data)!=null&&c.cardList&&((n=(o=(U=T==null?void 0:T.data)==null?void 0:U.data)==null?void 0:o.cardList)==null?void 0:n.length)>0){E("cardList");let D=(H=(F=T==null?void 0:T.data)==null?void 0:F.data)==null?void 0:H.cardList;z(D);let te=D==null?void 0:D.find(ee=>(ee==null?void 0:ee.primary_card)==1);te&&Ne(te)}else E("card");oe()}catch(V){console.log(V),oe(),g(((O=(P=V==null?void 0:V.response)==null?void 0:P.data)==null?void 0:O.message)||(V==null?void 0:V.message)||"Something went wrong")}},mt=l=>{switch(l==null?void 0:l.toLowerCase()){case"visa":return De;case"mastercard":case"mc":case"m/c":return qe;case"amex":case"american express":case"ae":return f;case"discover":case"dcvr":return Ct;case"bank":return tt;default:return l}},wt=async l=>{en.fire({icon:"warning",text:"Do you want to delete the card?",showCancelButton:!0,confirmButtonText:"Yes",cancelButtonText:"No",reverseButtons:!0,buttonsStyling:!1,customClass:{confirmButton:"swal2-confirm btn btn-dark",cancelButton:"swal2-cancel btn btn-dark",popup:"custom-swal-popup",icon:"custom-swal-icon"}}).then(async c=>{var U,o;if(c.isConfirmed){p(!0);try{let n={card_id:l,customer_id:Z},F=await ft.patch(`${_e}api/v1/gateway/delete-card/${$}`,n);(U=F==null?void 0:F.data)!=null&&U.result?(p(!1),lt(),en.fire({icon:"success",title:"Deleted!",text:((o=F==null?void 0:F.data)==null?void 0:o.message)||"Card deleted.",confirmButtonText:"OK",showConfirmButton:!0,timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}})):(p(!1),en.fire({icon:"error",title:"Failure!",text:"Card not deleted.",timer:1e3,timerProgressBar:!0,customClass:{confirmButton:"btn btn-dark"}}))}catch(n){p(!1),en.fire({icon:"error",title:"Error!",text:"Failed to delete the card.",confirmButtonText:"OK",customClass:{confirmButton:"btn btn-dark"}})}}else c.dismiss===en.DismissReason.cancel&&en.fire({icon:"info",text:"Card not deleted",confirmButtonText:"OK",buttonsStyling:!1,customClass:{confirmButton:"btn btn-dark float-end",actions:"swal2-actions-end"}})})},Nt=async()=>{var o,n,F,H;let l=Z,c=A==null?void 0:A.id,U=A==null?void 0:A.card_type;if(e)if(l)if(c){let P={amount:e,customer_id:l,card_id:c};B&&(P.isPreauth=!0);let O=_e+"api/v1/gateway/charge-by-saved-details/"+$,V={"Content-Type":"application/json"};try{ke();let T=await ft.post(O,P);console.log(T,"res"),(o=T==null?void 0:T.data)!=null&&o.result&&(j((n=T==null?void 0:T.data)==null?void 0:n.data),oe(),Ke())}catch(T){console.log(T==null?void 0:T.response,"error by saved details"),oe(),g(((H=(F=T==null?void 0:T.response)==null?void 0:F.data)==null?void 0:H.message)||"Something went wrong!")}}else g("Please Select A Card/ACH");else g("Please Select Customer");else g("Something went wrong.")};_i(()=>{Z&&nt&<()},[Z,nt]);let kt=()=>B?"Cards":"Cards/Bank";return i.createElement(i.Fragment,null,i.createElement("link",{href:"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css"}),i.createElement(It,null),i.createElement(wn,null),i.createElement("button",{className:xe||"paymentBtn",onClick:Me},L,ie),i.createElement(Lt,{open:nt,onClose:Ke},k&&i.createElement("div",{style:{maxHeight:"606px",minHeight:"60vh",padding:"40px"}},i.createElement(jt,{error:k,onClose:Ke})),!k&&i.createElement(i.Fragment,null,(v||x)&&i.createElement(bt,{loading:v||x}),i.createElement("div",{className:"frac-card-payment-page frac-form"},i.createElement("div",{className:"parent-pay-container"},i.createElement("span",{className:"request-payment-close-popup",onClick:Ke},i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},i.createElement("g",{clipPath:"url(#clip0_12425_52336)"},i.createElement("path",{d:"M9.46585 8.01168L15.6959 1.7814C16.1014 1.37615 16.1014 0.720912 15.6959 0.315659C15.2907 -0.0895946 14.6354 -0.0895946 14.2302 0.315659L7.99991 6.54593L1.76983 0.315659C1.36438 -0.0895946 0.709336 -0.0895946 0.304082 0.315659C-0.101361 0.720912 -0.101361 1.37615 0.304082 1.7814L6.53416 8.01168L0.304082 14.2419C-0.101361 14.6472 -0.101361 15.3024 0.304082 15.7077C0.506045 15.9098 0.771595 16.0114 1.03695 16.0114C1.30232 16.0114 1.56768 15.9098 1.76983 15.7077L7.99991 9.47742L14.2302 15.7077C14.4323 15.9098 14.6977 16.0114 14.9631 16.0114C15.2284 16.0114 15.4938 15.9098 15.6959 15.7077C16.1014 15.3024 16.1014 14.6472 15.6959 14.2419L9.46585 8.01168Z",fill:"#727272"})),i.createElement("defs",null,i.createElement("clipPath",{id:"clip0_12425_52336"},i.createElement("rect",{width:"16",height:"16",fill:"white"}))))),i.createElement("div",{className:"pay-main-logo-res"}),i.createElement("div",{className:"pay-container"},i.createElement("div",{className:"pay-header pay-conatiner-one"},i.createElement("div",{className:"pay-conatiner-one-first"},i.createElement("div",{className:"pay-logo-container"},i.createElement("div",{className:"pay-main-logo"}),i.createElement("h1",{className:"pay-heading"},"Pay"),(r==null?void 0:r.length)>0&&u!=="cardList"&&i.createElement("button",{className:"res-charge-payment-back-btn ",onClick:()=>E("cardList")}," ",i.createElement(An,null)," Back")),i.createElement("div",{className:"amt-pay-con"},i.createElement("div",{className:"pay-amount-conatiner"},i.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),i.createElement("strong",{className:"pay-amount"},Gt((Re=Number(e))==null?void 0:Re.toFixed(2)))),u!="ach"&&i.createElement("div",{style:{display:"flex",gap:"8px",margin:"8px 0"}},i.createElement("img",{src:De,alt:"",width:33}),i.createElement("img",{src:qe,width:33,alt:""}),i.createElement("img",{src:f,alt:"",width:33}),i.createElement("img",{src:Ct,width:33,alt:""})))),i.createElement("div",{className:"pay-conatiner-one-last"},i.createElement("img",{src:it,alt:""}),i.createElement("img",{src:ut,alt:""}),"Secure payments powered by Fractal")),i.createElement("div",{className:"pay-tab pay-conatiner-two"},i.createElement("div",{className:"col-md-12"},i.createElement("div",{id:"payment-form-div"},u!=="cardList"?i.createElement("div",null,(r==null?void 0:r.length)>0&&i.createElement("button",{className:"charge-payment-back-btn ",onClick:()=>E("cardList")}," ",i.createElement(An,null)," Back"),!B&&i.createElement("div",{className:"tab"},i.createElement("button",{className:"tablinks cardicon-img",onClick:l=>{X("card")},style:{border:u==="card"?"1px solid":"",display:"flex",justifyContent:"center",alignItems:"center"}},i.createElement("img",{className:"cardicon",src:st}),"Card"),i.createElement("button",{className:"tablinks bankicon-img",onClick:l=>{X("ach")},style:{border:u==="ach"?"1px solid":"",display:"flex",justifyContent:"center",alignItems:"center"}},i.createElement("img",{className:"bankicon",src:Ge}),"Bank")),i.createElement("div",{className:"res-pay-con"},i.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},i.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),i.createElement("strong",{className:"pay-amount"},Gt((ce=Number(e))==null?void 0:ce.toFixed(2)))),u!="ach"&&i.createElement("div",null,i.createElement("div",null,i.createElement("img",{src:De,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:qe,width:35,alt:""})),i.createElement("div",null,i.createElement("img",{src:f,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:Ct,width:35,alt:""}))))):i.createElement("div",null,i.createElement("div",{className:"charge-customer-name-frac",style:{marginBottom:"16px !important"}}," Charge ",Fe==null?void 0:Fe.customer_name),i.createElement("div",{className:"card-ach-heading-frac",style:{marginBottom:"10px !important"}}," ",C==="card"?kt():"Readers"," "),i.createElement("div",{className:"res-pay-con"},i.createElement("div",{className:"pay-amount-conatiner",style:{margin:0}},i.createElement("small",{className:"pay-payment-amount"},"Payment Amount"),i.createElement("strong",{className:"pay-amount"},Gt((gt=Number(e))==null?void 0:gt.toFixed(2)))),i.createElement("div",null,i.createElement("div",null,i.createElement("img",{src:De,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:qe,width:35,alt:""})),i.createElement("div",null,i.createElement("img",{src:f,alt:"",width:35,style:{paddingRight:"5px"}}),i.createElement("img",{src:Ct,width:35,alt:""}))))),i.createElement("div",{id:"ach",style:{display:u==="cardList"?"block":"none"},className:"tabcontent"},i.createElement("div",{className:"card-lint-div-in"},i.createElement("div",{className:"card-list-div"},r&&(r==null?void 0:r.length)>0&&(r==null?void 0:r.map((l,c)=>i.createElement("div",{className:"card-list-single-div",key:c},i.createElement("div",{className:"card-number-radio"},i.createElement("input",{disabled:(Fe==null?void 0:Fe.paymentGateway)!=(l==null?void 0:l.payment_method_type)&&(l==null?void 0:l.card_type)!="Bank",type:"radio",className:"cardRadio",name:"selected_card",id:"",checked:A===l,onChange:U=>Ne(l)}),i.createElement("label",{htmlFor:"",className:"card-number-last-four"},"**** ",l==null?void 0:l.cardlastfourdigit),(l==null?void 0:l.card_type)!="Bank"&&i.createElement("h6",{className:"card-expiry-date"},l==null?void 0:l.expmonth,"/",l==null?void 0:l.expyear)),i.createElement("div",{className:"card-number-radio"},i.createElement("span",{className:"visa-card"},i.createElement("img",{src:mt(l==null?void 0:l.card_type),alt:""})),i.createElement("span",{className:"visa-card",style:{cursor:"pointer"},onClick:()=>wt(l==null?void 0:l.id)},i.createElement("img",{src:rt,alt:""}))))))),i.createElement("div",{className:"pay-with-other-card",onClick:()=>E("card")},"Pay With Other Card",i.createElement("img",{src:pt,alt:""}))),i.createElement("div",{className:"form-group-frac",style:{padding:"0"}},i.createElement("button",{className:"pay-button",style:{margin:"0px"},type:"submit",onClick:Nt},Gt((yt=Number(e))==null?void 0:yt.toFixed(2))))),i.createElement("div",{id:"ach",style:{display:u==="card"?"block":"none"},className:"tabcontent"},i.createElement("form",{id:"PaymentForm",style:{textAlign:"start"},onSubmit:je},i.createElement("div",{className:"ach-scrl",style:{minHeight:"398px",maxHeight:"398px",overflow:"auto",marginRight:"5px"}},i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"cardHolderName"},"NAME ON CARD "),i.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"John Doe",value:(a==null?void 0:a.cardName)||"",onChange:l=>{let c=l.target.value;/^[a-zA-Z\s]*$/.test(c)&&Le("cardName",c)}}),(b==null?void 0:b.cardName)&&i.createElement("span",{className:"error-span"},b==null?void 0:b.cardName)),i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"cardNumber"},"CARD NUMBER"),i.createElement("div",{className:"toggle-num-wrapper"},i.createElement("input",{className:"form-control-frac card-number-new",type:"text",maxLength:19,inputMode:"numeric",placeholder:"0000 0000 0000 0000",value:(a==null?void 0:a.cardNumber)||"",onChange:l=>ve(l),"data-token":"card_number"}),i.createElement("div",{className:"card-crdi card-expiry-new"},i.createElement("div",{className:"exp-date-year-container"},i.createElement("div",{className:"exp-date form-group-frac"},i.createElement("input",{"data-token":"exp_month",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"MM",maxLength:2,value:(a==null?void 0:a.expiryMonth)||"",onChange:l=>Le("expiryMonth",l.target.value)})),i.createElement("div",{className:"exp-year form-group-frac"},i.createElement("input",{"data-token":"exp_year",className:"form-control-frac required card-cvv-in",type:"text",style:{maxHeight:"36px"},placeholder:"YYYY",maxLength:4,value:(a==null?void 0:a.expiryYear)||"",onChange:l=>Le("expiryYear",l.target.value)})),i.createElement("div",{className:"security-digit form-group-frac"},i.createElement("input",{"data-token":"cvv",className:"form-control-frac card-cvv-in required",type:"text",style:{maxHeight:"36px"},maxLength:4,placeholder:"CVC",value:(a==null?void 0:a.cvv)||"",onChange:l=>Le("cvv",l.target.value)})))),(b==null?void 0:b.cardNumber)&&i.createElement("span",{className:"error-span"},b==null?void 0:b.cardNumber),i.createElement("p",{style:{margin:"0"}},b!=null&&b.expiryMonth||b!=null&&b.expiryYear?i.createElement("span",{className:"error-span",style:{paddingRight:"4px"}},b==null?void 0:b.expiryMonth):"",(b==null?void 0:b.cvv)&&i.createElement("span",{className:"error-span"},b==null?void 0:b.cvv)))),i.createElement("div",{className:"form-group-frac"},i.createElement("label",{htmlFor:"zip"},"ZIP"),i.createElement("input",{type:"text",className:"form-control-frac",maxLength:100,placeholder:"000000",value:(Tt=a==null?void 0:a.zipCode)!=null?Tt:"",onChange:l=>Le("zipCode",l.target.value)}),(b==null?void 0:b.zipCode)&&i.createElement("span",{className:"error-span"},b==null?void 0:b.zipCode)),Z&&i.createElement("div",{className:"form-group-frac"},i.createElement("div",{style:{display:"flex",alignItems:"center",gap:"10px",paddingTop:"10px"}},i.createElement("input",{type:"checkbox",id:"save_card",className:"toggle-checkbox",checked:be,onChange:l=>W(l.target.checked)}),i.createElement("label",{htmlFor:"save_card",className:"toggle-label"}),i.createElement("label",{htmlFor:"save_card"},"Save card for future payments "),i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},i.createElement("g",{clipPath:"url(#clip0_12420_50192)"},i.createElement("rect",{width:"20",height:"20",fill:"white"}),i.createElement("circle",{cx:"10",cy:"10",r:"10",fill:"#E0DFE2"}),i.createElement("path",{d:"M9.03406 12.0979V12.0072C9.04055 11.4153 9.10057 10.9443 9.21411 10.5943C9.3309 10.2442 9.49635 9.96102 9.71046 9.74463C9.92457 9.52824 10.1825 9.33095 10.4842 9.15274C10.6788 9.03182 10.854 8.89658 11.0097 8.74702C11.1655 8.59745 11.2887 8.42562 11.3796 8.2315C11.4704 8.03739 11.5158 7.82259 11.5158 7.58711C11.5158 7.3039 11.4477 7.05887 11.3114 6.85203C11.1752 6.64519 10.9935 6.48608 10.7664 6.3747C10.5426 6.26014 10.2928 6.20286 10.017 6.20286C9.76723 6.20286 9.52879 6.25378 9.3017 6.35561C9.07461 6.45744 8.88646 6.61655 8.73723 6.83294C8.588 7.04614 8.50203 7.3214 8.47932 7.65871H7C7.02271 7.08592 7.17032 6.60223 7.44282 6.20764C7.71533 5.80986 8.07543 5.50915 8.52311 5.30549C8.97405 5.10183 9.47202 5 10.017 5C10.6139 5 11.1363 5.10979 11.5839 5.32936C12.0316 5.54574 12.3788 5.84964 12.6253 6.24105C12.8751 6.62928 13 7.08274 13 7.60143C13 7.95784 12.9432 8.27924 12.8297 8.56563C12.7161 8.84885 12.5539 9.10183 12.3431 9.32458C12.1354 9.54733 11.8856 9.74463 11.5937 9.91647C11.3179 10.0851 11.0941 10.2601 10.9221 10.4415C10.7534 10.6229 10.6302 10.8377 10.5523 11.0859C10.4745 11.3341 10.4323 11.6412 10.4258 12.0072V12.0979H9.03406ZM9.76886 15C9.50284 15 9.27413 14.9077 9.08273 14.7232C8.89132 14.5354 8.79562 14.3095 8.79562 14.0453C8.79562 13.7844 8.89132 13.5617 9.08273 13.3771C9.27413 13.1893 9.50284 13.0955 9.76886 13.0955C10.0316 13.0955 10.2587 13.1893 10.4501 13.3771C10.6448 13.5617 10.7421 13.7844 10.7421 14.0453C10.7421 14.2204 10.6967 14.3811 10.6058 14.5274C10.5182 14.6706 10.4015 14.7852 10.2555 14.8711C10.1095 14.957 9.94728 15 9.76886 15Z",fill:"#161616"})),i.createElement("defs",null,i.createElement("clipPath",{id:"clip0_12420_50192"},i.createElement("rect",{width:"20",height:"20",fill:"white"}))))))),i.createElement("div",{className:"form-group-frac",style:{marginTop:"20px",padding:"0"}},i.createElement("button",{type:"submit",style:{margin:0},className:"pay-button"},Gt((Te=Number(e))==null?void 0:Te.toFixed(2)))))),i.createElement("div",{id:"ach",style:{display:u==="ach"?"block":"none"},className:"tabcontent"},i.createElement("form",{id:"ACHPaymentForm",style:{textAlign:"start"},onSubmit:je},i.createElement("div",{className:"ach-scrl",style:{minHeight:"358px",maxHeight:"378px"}},i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"nameonaccount"},"Name on account"),i.createElement("input",{type:"text",id:"nameonaccount",className:"form-control-frac",maxLength:100,placeholder:"John Doe",name:"name",value:(Bt=h==null?void 0:h.name)!=null?Bt:"",onChange:Ve}),(K==null?void 0:K.name)&&i.createElement("span",{className:"error-span"},K==null?void 0:K.name)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"routingnumber"},"Routing number"),i.createElement("input",{type:"text",id:"routingnumber",className:"form-control-frac",maxLength:9,placeholder:"000000000",name:"routingNumber",value:(xt=h==null?void 0:h.routingNumber)!=null?xt:"",onChange:Ve}),(K==null?void 0:K.routingNumber)&&i.createElement("span",{className:"error-span"},K==null?void 0:K.routingNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"accountnumber"},"Account number"),i.createElement("input",{type:"text",id:"accountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"accountNumber",value:(ze=h==null?void 0:h.accountNumber)!=null?ze:"",onChange:Ve}),(K==null?void 0:K.accountNumber)&&i.createElement("span",{className:"error-span"},K==null?void 0:K.accountNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"confirmaccountnumber"},"Confirm account number"),i.createElement("input",{type:"text",id:"confirmaccountnumber",className:"form-control-frac",maxLength:16,placeholder:"0000000000",name:"confirmAccountNumber",value:(Oe=h==null?void 0:h.confirmAccountNumber)!=null?Oe:"",onChange:Ve}),(K==null?void 0:K.confirmAccountNumber)&&i.createElement("span",{className:"error-span"},K==null?void 0:K.confirmAccountNumber)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"bankname"},"Bank name"),i.createElement("input",{type:"text",id:"bankname",className:"form-control-frac",maxLength:100,placeholder:"My Bank",name:"bankName",value:(Vt=h==null?void 0:h.bankName)!=null?Vt:"",onChange:Ve}),(K==null?void 0:K.bankName)&&i.createElement("span",{className:"error-span"},K==null?void 0:K.bankName)),((h==null?void 0:h.accountType)==="business saving"||(h==null?void 0:h.accountType)==="business checking")&&i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"companyName"},"Company name"),i.createElement("input",{type:"text",id:"companyName",className:"form-control",maxLength:100,placeholder:"My Company",name:"companyName",value:(Mt=h==null?void 0:h.companyName)!=null?Mt:"",onChange:Ve}),(K==null?void 0:K.companyName)&&i.createElement("span",{className:"error-span"},K==null?void 0:K.companyName)),i.createElement("div",{className:"form-group-frac mb-4"},i.createElement("label",{htmlFor:"accounttype"},"Select account type"),i.createElement("select",{name:"accountType",id:"accounttype",className:"form-control-frac",value:(Kt=h==null?void 0:h.accountType)!=null?Kt:"",onChange:Ve},i.createElement("option",{value:""},"Select account"),un.map(l=>i.createElement("option",{key:l.value,value:l.value},l.label)))),Z&&i.createElement("div",{className:"form-group-frac mb-4 save-ach-div",style:{paddingTop:"5px"}},i.createElement("input",{type:"checkbox",id:"saveACH",className:"",maxLength:100,placeholder:"My Bank",checked:ct,onChange:l=>$e(l.target.checked)}),i.createElement("label",{htmlFor:"saveACH"},"Save ACH")),ct&&i.createElement("div",{className:"form-group-frac mb-4 saveachtext"},i.createElement("p",null,"If checked, I agree for ",i.createElement("b",null,Ye||"merchant")," to have my permission to charge this credit card for agreed upon purchases in the future."))),i.createElement("div",{className:"form-group-frac "},i.createElement("button",{className:"pay-button",style:{margin:"20px 0 0"},type:"submit"},Gt((ot=Number(e))==null?void 0:ot.toFixed(2)))))))))))))))};export{Ci as AddCard,Ni as CardOnFile,ui as GetPaymentPage,Fi as PaymentWidget,fi as PreAuthPayment,ti as RequestPayment,ai as RequestPreAuthPayment};
|