@pinerohit11/testwidget 0.1.48 → 0.1.50
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{index.mjs → index.cjs} +575 -554
- package/dist/index.js +539 -590
- package/package.json +3 -2
- package/dist/index.css +0 -652
- /package/dist/{index.d.mts → index.d.cts} +0 -0
@@ -1,7 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
1
3
|
var __defProp = Object.defineProperty;
|
2
4
|
var __defProps = Object.defineProperties;
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
5
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -17,17 +22,54 @@ var __spreadValues = (a, b) => {
|
|
17
22
|
return a;
|
18
23
|
};
|
19
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
25
|
+
var __export = (target, all) => {
|
26
|
+
for (var name in all)
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
28
|
+
};
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
31
|
+
for (let key of __getOwnPropNames(from))
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
34
|
+
}
|
35
|
+
return to;
|
36
|
+
};
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
43
|
+
mod
|
44
|
+
));
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
46
|
+
|
47
|
+
// src/app/index.ts
|
48
|
+
var app_exports = {};
|
49
|
+
__export(app_exports, {
|
50
|
+
CompletedTransactions: () => CompletedTransactions,
|
51
|
+
GetPaymentDynamic: () => GetPaymentDynamic,
|
52
|
+
Payment: () => Payment,
|
53
|
+
RequestPayment: () => RequestPayment,
|
54
|
+
RequestPaymentAllInput: () => RequestPaymentAllInput,
|
55
|
+
RequestPaymentDynamic: () => RequestPaymentDynamic,
|
56
|
+
RequestPaymentonClick: () => RequestPaymentonClick,
|
57
|
+
RqstPaymntInputField: () => RqstPaymntInputField,
|
58
|
+
TockenizPay: () => TockenizPay
|
59
|
+
});
|
60
|
+
module.exports = __toCommonJS(app_exports);
|
20
61
|
|
21
62
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
22
|
-
|
63
|
+
var import_react4 = __toESM(require("react"), 1);
|
64
|
+
var import_axios = __toESM(require("axios"), 1);
|
23
65
|
|
24
66
|
// src/app/components/Loader/Loader.tsx
|
25
|
-
|
67
|
+
var import_react2 = __toESM(require("react"), 1);
|
26
68
|
|
27
69
|
// src/app/components/Loader/LoaderStyle.tsx
|
28
|
-
|
70
|
+
var import_react = __toESM(require("react"), 1);
|
29
71
|
var LoaderStyle = (props) => {
|
30
|
-
return /* @__PURE__ */
|
72
|
+
return /* @__PURE__ */ import_react.default.createElement("style", null, `
|
31
73
|
.loader {
|
32
74
|
position: fixed;
|
33
75
|
/* Fixed position to cover the viewport */
|
@@ -146,359 +188,17 @@ var LoaderStyle_default = LoaderStyle;
|
|
146
188
|
|
147
189
|
// src/app/components/Loader/Loader.tsx
|
148
190
|
var Loader = (props) => {
|
149
|
-
return /* @__PURE__ */
|
191
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(LoaderStyle_default, null), (props == null ? void 0 : props.loading) && /* @__PURE__ */ import_react2.default.createElement("div", { className: "loader" }, /* @__PURE__ */ import_react2.default.createElement("div", { className: "lds-ellipsis" }, /* @__PURE__ */ import_react2.default.createElement("div", null), /* @__PURE__ */ import_react2.default.createElement("div", null), /* @__PURE__ */ import_react2.default.createElement("div", null), /* @__PURE__ */ import_react2.default.createElement("div", null))));
|
150
192
|
};
|
151
193
|
var Loader_default = Loader;
|
152
194
|
|
153
195
|
// src/app/components/RequestPayment/RequestPayment.tsx
|
154
|
-
|
155
|
-
|
156
|
-
// src/app/components/baseurl.ts
|
157
|
-
var baseUrl = "https://staging-widget.fractalpay.com/";
|
158
|
-
|
159
|
-
// src/app/components/Errortext.ts
|
160
|
-
var ErrorText = {
|
161
|
-
namerequired: "Full Name is required",
|
162
|
-
amountrequired: "Amount is required",
|
163
|
-
amountpositive: "Amount should be positive",
|
164
|
-
amountzero: "Amount should not be zero",
|
165
|
-
amountenter: "Please enter an amount",
|
166
|
-
amountvalid: "Please enter a valid amount",
|
167
|
-
phoneoremailrequired: "Phone or Email is required",
|
168
|
-
invalidemail: "Invalid email",
|
169
|
-
invalidemailformat: "Invalid email format",
|
170
|
-
onlylettersallowed: "Only letters are allowed",
|
171
|
-
phonenumberlength: "Phone number should be 10 digits",
|
172
|
-
phonenumberrequired: "Please enter a phone number",
|
173
|
-
phonenumbervalid: "Please enter a valid 10-digit phone number",
|
174
|
-
orderidenter: "Please enter an order ID",
|
175
|
-
networkresponseerror: "Network response was not ok",
|
176
|
-
anerroroccured: "An error occurred. Please try again.",
|
177
|
-
montherror: "Please write month only 1 to 12",
|
178
|
-
fieldrequired: "This field is required"
|
179
|
-
};
|
180
|
-
|
181
|
-
// src/app/components/RequestPayment/RequestPayment.tsx
|
182
|
-
function RequestPayment(props) {
|
183
|
-
const fractalpayClientKey = props.fractalpayClientKey;
|
184
|
-
const [show, setShow] = useState(false);
|
185
|
-
const [loading, setLoading] = useState(false);
|
186
|
-
const [errors, setErrors] = useState({});
|
187
|
-
const [requestDetails, setRequestDetails] = useState({
|
188
|
-
email: "",
|
189
|
-
amount: "",
|
190
|
-
phone_number: "",
|
191
|
-
order_id: "",
|
192
|
-
name: "",
|
193
|
-
fractalpayPublicKey: fractalpayClientKey
|
194
|
-
});
|
195
|
-
const [showConfirmationModal, setShowConfirmationModal] = useState(false);
|
196
|
-
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
197
|
-
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
198
|
-
const positiveAmountRegex = /^[+]?\d+(\.\d+)?$/;
|
199
|
-
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
200
|
-
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
201
|
-
const handleClose = () => {
|
202
|
-
setShow(false);
|
203
|
-
emptyFields();
|
204
|
-
setErrors({});
|
205
|
-
};
|
206
|
-
const handleShow = () => setShow(true);
|
207
|
-
const handleCloseConfirmationModal = () => setShowConfirmationModal(false);
|
208
|
-
const emptyFields = () => {
|
209
|
-
setRequestDetails({
|
210
|
-
email: "",
|
211
|
-
amount: "",
|
212
|
-
phone_number: "",
|
213
|
-
order_id: "",
|
214
|
-
name: "",
|
215
|
-
fractalpayPublicKey: fractalpayClientKey
|
216
|
-
});
|
217
|
-
};
|
218
|
-
const handleSubmit = (event) => {
|
219
|
-
let message = {
|
220
|
-
type: "preview.compiledcheck",
|
221
|
-
other: __spreadProps(__spreadValues({}, event), { status: true })
|
222
|
-
};
|
223
|
-
console.log("message: ", message);
|
224
|
-
window.parent.postMessage(message, "*");
|
225
|
-
};
|
226
|
-
const sendRequestPayment = async () => {
|
227
|
-
setErrors({});
|
228
|
-
if (!(requestDetails == null ? void 0 : requestDetails.email) && requestDetails.phone_number && !phoneNumberRegex(requestDetails.phone_number)) {
|
229
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
230
|
-
phone_number: "Phone number should be 10 digits"
|
231
|
-
}));
|
232
|
-
return;
|
233
|
-
}
|
234
|
-
if (!validateForm()) {
|
235
|
-
return;
|
236
|
-
}
|
237
|
-
try {
|
238
|
-
setLoading(true);
|
239
|
-
const formData = {
|
240
|
-
fractalpayPublicKey: fractalpayClientKey,
|
241
|
-
amount: requestDetails.amount,
|
242
|
-
phone_number: requestDetails.phone_number,
|
243
|
-
order_id: requestDetails.order_id,
|
244
|
-
action: "request",
|
245
|
-
name: requestDetails.name,
|
246
|
-
email: requestDetails.email
|
247
|
-
};
|
248
|
-
let response = await fetch(`${baseUrl}create-widget-order`, {
|
249
|
-
method: "POST",
|
250
|
-
headers: {
|
251
|
-
"Content-Type": "application/json"
|
252
|
-
// Setting the header for JSON content
|
253
|
-
},
|
254
|
-
body: JSON.stringify(formData)
|
255
|
-
// Sending the formData as JSON
|
256
|
-
});
|
257
|
-
if (response.ok) {
|
258
|
-
const data = await response.json();
|
259
|
-
setShowConfirmationModal(true);
|
260
|
-
setShow(false);
|
261
|
-
emptyFields();
|
262
|
-
handleSubmit(data);
|
263
|
-
} else {
|
264
|
-
console.log(`HTTP error! Status: ${response.status}`);
|
265
|
-
}
|
266
|
-
console.log(response == null ? void 0 : response.data);
|
267
|
-
setLoading(false);
|
268
|
-
} catch (error) {
|
269
|
-
console.log(error);
|
270
|
-
setLoading(false);
|
271
|
-
}
|
272
|
-
};
|
273
|
-
const validateAmount = (amount) => amoutRegex.test(amount);
|
274
|
-
const PositiveAmount = (amount) => positiveAmountRegex.test(amount);
|
275
|
-
const handleChange = (e) => {
|
276
|
-
const { value } = e.target;
|
277
|
-
const token = e.target.dataset.token;
|
278
|
-
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
279
|
-
if (token === "name" && !isAlpha(value)) {
|
280
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
281
|
-
[token]: ErrorText.onlylettersallowed
|
282
|
-
}));
|
283
|
-
return;
|
284
|
-
}
|
285
|
-
if (token === "phone_number" && !phoneNumberRegex(value)) {
|
286
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
287
|
-
[token]: ErrorText.phonenumberlength
|
288
|
-
}));
|
289
|
-
return;
|
290
|
-
}
|
291
|
-
if (token === "email" && !isValidEmail(value)) {
|
292
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
293
|
-
email: ErrorText.invalidemailformat
|
294
|
-
}));
|
295
|
-
return;
|
296
|
-
}
|
297
|
-
if (token === "amount" && !value) {
|
298
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
299
|
-
amount: ErrorText.amountrequired
|
300
|
-
}));
|
301
|
-
return;
|
302
|
-
}
|
303
|
-
if (token === "amount" && !PositiveAmount(value)) {
|
304
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
305
|
-
amount: ErrorText.amountpositive
|
306
|
-
}));
|
307
|
-
return;
|
308
|
-
}
|
309
|
-
if (token === "amount" && parseFloat(value) === 0) {
|
310
|
-
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
311
|
-
amount: ErrorText.amountzero
|
312
|
-
}));
|
313
|
-
return;
|
314
|
-
}
|
315
|
-
if (value) {
|
316
|
-
setErrors(__spreadProps(__spreadValues({}, errors), { [token]: "" }));
|
317
|
-
}
|
318
|
-
};
|
319
|
-
const handleAmountBlur = () => {
|
320
|
-
const value = requestDetails.amount;
|
321
|
-
if (value && !value.includes(".")) {
|
322
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
323
|
-
amount: `${value}.00`
|
324
|
-
}));
|
325
|
-
}
|
326
|
-
};
|
327
|
-
const validateForm = () => {
|
328
|
-
let newErrors = {};
|
329
|
-
if (!requestDetails.name) newErrors.name = ErrorText.namerequired;
|
330
|
-
if (!requestDetails.amount) newErrors.amount = ErrorText.amountrequired;
|
331
|
-
if (!requestDetails.phone_number && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone_number = ErrorText.phoneoremailrequired;
|
332
|
-
if (!requestDetails.email && !requestDetails.phone_number) newErrors.email = ErrorText.phoneoremailrequired;
|
333
|
-
if (!requestDetails.phone_number && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
334
|
-
setErrors(newErrors);
|
335
|
-
return Object.keys(newErrors).length === 0;
|
336
|
-
};
|
337
|
-
useEffect(() => {
|
338
|
-
if (props.amount) {
|
339
|
-
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), { amount: props.amount }));
|
340
|
-
}
|
341
|
-
}, [props.amount]);
|
342
|
-
const handleKeyDown = (e) => {
|
343
|
-
if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
344
|
-
e.preventDefault();
|
345
|
-
}
|
346
|
-
};
|
347
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(Loader_default, { loading }), /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ React3.createElement(
|
348
|
-
Modal,
|
349
|
-
{
|
350
|
-
show,
|
351
|
-
onHide: handleClose,
|
352
|
-
size: "lg",
|
353
|
-
backdrop: "static",
|
354
|
-
keyboard: false
|
355
|
-
},
|
356
|
-
/* @__PURE__ */ React3.createElement(Modal.Header, { closeButton: true }, /* @__PURE__ */ React3.createElement(Modal.Title, { className: "testcolor" }, "Request Payment")),
|
357
|
-
/* @__PURE__ */ React3.createElement(Modal.Body, { id: "Checkout" }, /* @__PURE__ */ React3.createElement(Form, null, /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "FULL NAME *"), /* @__PURE__ */ React3.createElement(
|
358
|
-
"input",
|
359
|
-
{
|
360
|
-
className: "form-control",
|
361
|
-
type: "text",
|
362
|
-
placeholder: "Full Name",
|
363
|
-
"data-token": "name",
|
364
|
-
onChange: handleChange
|
365
|
-
}
|
366
|
-
), errors.name && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.name)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "requestPhoneNumber", className: "form-label" }, "Phone Number"), /* @__PURE__ */ React3.createElement(
|
367
|
-
"input",
|
368
|
-
{
|
369
|
-
maxLength: 10,
|
370
|
-
className: "form-control",
|
371
|
-
onChange: (e) => {
|
372
|
-
handleChange(e);
|
373
|
-
},
|
374
|
-
placeholder: "Phone Number",
|
375
|
-
type: "text",
|
376
|
-
"data-token": "phone_number"
|
377
|
-
}
|
378
|
-
), errors.phone_number && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.phone_number)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "EMAIL"), /* @__PURE__ */ React3.createElement(
|
379
|
-
"input",
|
380
|
-
{
|
381
|
-
className: "form-control",
|
382
|
-
type: "text",
|
383
|
-
placeholder: "Email",
|
384
|
-
onChange: handleChange,
|
385
|
-
"data-token": "email"
|
386
|
-
}
|
387
|
-
), errors.email && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.email)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "AMOUNT *"), /* @__PURE__ */ React3.createElement("div", { className: "input-group" }, /* @__PURE__ */ React3.createElement("span", { className: "input-group-text" }, "$"), /* @__PURE__ */ React3.createElement(
|
388
|
-
"input",
|
389
|
-
{
|
390
|
-
"data-token": "amount",
|
391
|
-
placeholder: "Amount",
|
392
|
-
min: 0,
|
393
|
-
type: "number",
|
394
|
-
className: "form-control",
|
395
|
-
value: requestDetails.amount,
|
396
|
-
onChange: handleChange,
|
397
|
-
onBlur: handleAmountBlur,
|
398
|
-
onKeyDown: handleKeyDown,
|
399
|
-
onFocus: (e) => e.target.addEventListener("wheel", function(e2) {
|
400
|
-
e2.preventDefault();
|
401
|
-
}, { passive: false })
|
402
|
-
}
|
403
|
-
)), errors.amount && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.amount)), /* @__PURE__ */ React3.createElement("div", { className: "mb-3" }, /* @__PURE__ */ React3.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "ORDER ID"), /* @__PURE__ */ React3.createElement(
|
404
|
-
"input",
|
405
|
-
{
|
406
|
-
className: "form-control",
|
407
|
-
type: "text",
|
408
|
-
placeholder: "Order Id",
|
409
|
-
onChange: handleChange,
|
410
|
-
"data-token": "order_id"
|
411
|
-
}
|
412
|
-
), errors.order_id && /* @__PURE__ */ React3.createElement("small", { className: "text-danger" }, errors.order_id)), /* @__PURE__ */ React3.createElement(
|
413
|
-
Button,
|
414
|
-
{
|
415
|
-
type: "button",
|
416
|
-
className: "PayButton",
|
417
|
-
onClick: sendRequestPayment,
|
418
|
-
disabled: loading
|
419
|
-
},
|
420
|
-
loading ? "Loading..." : "Send Request"
|
421
|
-
)), /* @__PURE__ */ React3.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ React3.createElement(
|
422
|
-
"svg",
|
423
|
-
{
|
424
|
-
xmlns: "http://www.w3.org/2000/svg",
|
425
|
-
width: "20",
|
426
|
-
height: "20",
|
427
|
-
viewBox: "0 0 26 26"
|
428
|
-
},
|
429
|
-
/* @__PURE__ */ React3.createElement(
|
430
|
-
"path",
|
431
|
-
{
|
432
|
-
fill: "currentColor",
|
433
|
-
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
434
|
-
}
|
435
|
-
)
|
436
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */ React3.createElement(
|
437
|
-
"img",
|
438
|
-
{
|
439
|
-
src: "https://ui.fractalpay.com/favicon.ico",
|
440
|
-
alt: "Fractal logo",
|
441
|
-
className: "powered-logo"
|
442
|
-
}
|
443
|
-
)))
|
444
|
-
), /* @__PURE__ */ React3.createElement(
|
445
|
-
Modal,
|
446
|
-
{
|
447
|
-
className: "payment-suc",
|
448
|
-
show: showConfirmationModal,
|
449
|
-
onHide: handleCloseConfirmationModal
|
450
|
-
},
|
451
|
-
/* @__PURE__ */ React3.createElement(Modal.Header, { closeButton: true }),
|
452
|
-
/* @__PURE__ */ React3.createElement(Modal.Body, null, /* @__PURE__ */ React3.createElement(
|
453
|
-
"svg",
|
454
|
-
{
|
455
|
-
width: "60",
|
456
|
-
height: "60",
|
457
|
-
viewBox: "0 0 60 60",
|
458
|
-
fill: "none",
|
459
|
-
xmlns: "http://www.w3.org/2000/svg"
|
460
|
-
},
|
461
|
-
/* @__PURE__ */ React3.createElement(
|
462
|
-
"rect",
|
463
|
-
{
|
464
|
-
x: "0.5",
|
465
|
-
y: "0.5",
|
466
|
-
width: "59",
|
467
|
-
height: "59",
|
468
|
-
rx: "29.5",
|
469
|
-
stroke: "#31B379"
|
470
|
-
}
|
471
|
-
),
|
472
|
-
/* @__PURE__ */ React3.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ React3.createElement(
|
473
|
-
"path",
|
474
|
-
{
|
475
|
-
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
476
|
-
fill: "#31B379"
|
477
|
-
}
|
478
|
-
)),
|
479
|
-
/* @__PURE__ */ React3.createElement("defs", null, /* @__PURE__ */ React3.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ React3.createElement(
|
480
|
-
"rect",
|
481
|
-
{
|
482
|
-
width: "22",
|
483
|
-
height: "22",
|
484
|
-
fill: "white",
|
485
|
-
transform: "translate(19.5 19.0039)"
|
486
|
-
}
|
487
|
-
)))
|
488
|
-
), /* @__PURE__ */ React3.createElement("h2", null, "Payment link has been ", /* @__PURE__ */ React3.createElement("br", null), " sent successfully"))
|
489
|
-
)));
|
490
|
-
}
|
491
|
-
|
492
|
-
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
493
|
-
import React5, { useState as useState2 } from "react";
|
494
|
-
import { Modal as Modal2 } from "react-bootstrap";
|
495
|
-
import { toast, ToastContainer } from "react-toastify";
|
496
|
-
import "react-toastify/dist/ReactToastify.css";
|
196
|
+
var import_react_bootstrap = require("react-bootstrap");
|
497
197
|
|
498
198
|
// src/app/components/RequestPayment/RequestPaymentstyles.tsx
|
499
|
-
|
199
|
+
var import_react3 = __toESM(require("react"), 1);
|
500
200
|
var RequestPaymentstyles = (props) => {
|
501
|
-
return /* @__PURE__ */
|
201
|
+
return /* @__PURE__ */ import_react3.default.createElement("style", null, `
|
502
202
|
.paymentBtn {
|
503
203
|
background-color: black;
|
504
204
|
border: none;
|
@@ -1320,24 +1020,353 @@ input[type="number"] {
|
|
1320
1020
|
-moz-appearance: textfield;
|
1321
1021
|
}
|
1322
1022
|
|
1323
|
-
`);
|
1324
|
-
};
|
1325
|
-
var RequestPaymentstyles_default = RequestPaymentstyles;
|
1326
|
-
|
1023
|
+
`);
|
1024
|
+
};
|
1025
|
+
var RequestPaymentstyles_default = RequestPaymentstyles;
|
1026
|
+
|
1027
|
+
// src/app/components/baseurl.ts
|
1028
|
+
var baseUrl = "https://staging-widget.fractalpay.com/";
|
1029
|
+
|
1030
|
+
// src/app/components/Errortext.ts
|
1031
|
+
var ErrorText = {
|
1032
|
+
namerequired: "Full Name is required",
|
1033
|
+
amountrequired: "Amount is required",
|
1034
|
+
amountpositive: "Amount should be positive",
|
1035
|
+
amountzero: "Amount should not be zero",
|
1036
|
+
amountenter: "Please enter an amount",
|
1037
|
+
amountvalid: "Please enter a valid amount",
|
1038
|
+
phoneoremailrequired: "Phone or Email is required",
|
1039
|
+
invalidemail: "Invalid email",
|
1040
|
+
invalidemailformat: "Invalid email format",
|
1041
|
+
onlylettersallowed: "Only letters are allowed",
|
1042
|
+
phonenumberlength: "Phone number should be 10 digits",
|
1043
|
+
phonenumberrequired: "Please enter a phone number",
|
1044
|
+
phonenumbervalid: "Please enter a valid 10-digit phone number",
|
1045
|
+
orderidenter: "Please enter an order ID",
|
1046
|
+
networkresponseerror: "Network response was not ok",
|
1047
|
+
anerroroccured: "An error occurred. Please try again.",
|
1048
|
+
montherror: "Please write month only 1 to 12",
|
1049
|
+
fieldrequired: "This field is required"
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
// src/app/components/RequestPayment/RequestPayment.tsx
|
1053
|
+
function RequestPayment(props) {
|
1054
|
+
const fractalpayClientKey = props.fractalpayClientKey;
|
1055
|
+
const [show, setShow] = (0, import_react4.useState)(false);
|
1056
|
+
const [loading, setLoading] = (0, import_react4.useState)(false);
|
1057
|
+
const [errors, setErrors] = (0, import_react4.useState)({});
|
1058
|
+
const [requestDetails, setRequestDetails] = (0, import_react4.useState)({
|
1059
|
+
email: "",
|
1060
|
+
amount: "",
|
1061
|
+
phone_number: "",
|
1062
|
+
order_id: "",
|
1063
|
+
name: "",
|
1064
|
+
fractalpayPublicKey: fractalpayClientKey
|
1065
|
+
});
|
1066
|
+
const [showConfirmationModal, setShowConfirmationModal] = (0, import_react4.useState)(false);
|
1067
|
+
const phoneNumberRegex = (value) => /^\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(value);
|
1068
|
+
const amoutRegex = /[+-]?([0-9]*[.])?[0-9]+/;
|
1069
|
+
const positiveAmountRegex = /^[+]?\d+(\.\d+)?$/;
|
1070
|
+
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
1071
|
+
const isAlpha = (value) => /^[A-Za-z\s]*$/.test(value);
|
1072
|
+
const handleClose = () => {
|
1073
|
+
setShow(false);
|
1074
|
+
emptyFields();
|
1075
|
+
setErrors({});
|
1076
|
+
};
|
1077
|
+
const handleShow = () => setShow(true);
|
1078
|
+
const handleCloseConfirmationModal = () => setShowConfirmationModal(false);
|
1079
|
+
const emptyFields = () => {
|
1080
|
+
setRequestDetails({
|
1081
|
+
email: "",
|
1082
|
+
amount: "",
|
1083
|
+
phone_number: "",
|
1084
|
+
order_id: "",
|
1085
|
+
name: "",
|
1086
|
+
fractalpayPublicKey: fractalpayClientKey
|
1087
|
+
});
|
1088
|
+
};
|
1089
|
+
const handleSubmit = (event) => {
|
1090
|
+
let message = {
|
1091
|
+
type: "preview.compiledcheck",
|
1092
|
+
other: __spreadProps(__spreadValues({}, event), { status: true })
|
1093
|
+
};
|
1094
|
+
console.log("message: ", message);
|
1095
|
+
window.parent.postMessage(message, "*");
|
1096
|
+
};
|
1097
|
+
const sendRequestPayment = async () => {
|
1098
|
+
setErrors({});
|
1099
|
+
if (!(requestDetails == null ? void 0 : requestDetails.email) && requestDetails.phone_number && !phoneNumberRegex(requestDetails.phone_number)) {
|
1100
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1101
|
+
phone_number: "Phone number should be 10 digits"
|
1102
|
+
}));
|
1103
|
+
return;
|
1104
|
+
}
|
1105
|
+
if (!validateForm()) {
|
1106
|
+
return;
|
1107
|
+
}
|
1108
|
+
try {
|
1109
|
+
setLoading(true);
|
1110
|
+
const formData = {
|
1111
|
+
fractalpayPublicKey: fractalpayClientKey,
|
1112
|
+
amount: requestDetails.amount,
|
1113
|
+
phone_number: requestDetails.phone_number,
|
1114
|
+
order_id: requestDetails.order_id,
|
1115
|
+
action: "request",
|
1116
|
+
name: requestDetails.name,
|
1117
|
+
email: requestDetails.email
|
1118
|
+
};
|
1119
|
+
let response = await import_axios.default.post(`${baseUrl}create-widget-order`, formData);
|
1120
|
+
if ((response == null ? void 0 : response.status) === 200) {
|
1121
|
+
setShowConfirmationModal(true);
|
1122
|
+
setShow(false);
|
1123
|
+
emptyFields();
|
1124
|
+
handleSubmit(response == null ? void 0 : response.data);
|
1125
|
+
}
|
1126
|
+
console.log(response == null ? void 0 : response.data);
|
1127
|
+
setLoading(false);
|
1128
|
+
} catch (error) {
|
1129
|
+
console.log(error);
|
1130
|
+
setLoading(false);
|
1131
|
+
}
|
1132
|
+
};
|
1133
|
+
const validateAmount = (amount) => amoutRegex.test(amount);
|
1134
|
+
const PositiveAmount = (amount) => positiveAmountRegex.test(amount);
|
1135
|
+
const handleChange = (e) => {
|
1136
|
+
const { value } = e.target;
|
1137
|
+
const token = e.target.dataset.token;
|
1138
|
+
setRequestDetails(__spreadProps(__spreadValues({}, requestDetails), { [token]: value }));
|
1139
|
+
if (token === "name" && !isAlpha(value)) {
|
1140
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1141
|
+
[token]: ErrorText.onlylettersallowed
|
1142
|
+
}));
|
1143
|
+
return;
|
1144
|
+
}
|
1145
|
+
if (token === "phone_number" && !phoneNumberRegex(value)) {
|
1146
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1147
|
+
[token]: ErrorText.phonenumberlength
|
1148
|
+
}));
|
1149
|
+
return;
|
1150
|
+
}
|
1151
|
+
if (token === "email" && !isValidEmail(value)) {
|
1152
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1153
|
+
email: ErrorText.invalidemailformat
|
1154
|
+
}));
|
1155
|
+
return;
|
1156
|
+
}
|
1157
|
+
if (token === "amount" && !value) {
|
1158
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1159
|
+
amount: ErrorText.amountrequired
|
1160
|
+
}));
|
1161
|
+
return;
|
1162
|
+
}
|
1163
|
+
if (token === "amount" && !PositiveAmount(value)) {
|
1164
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1165
|
+
amount: ErrorText.amountpositive
|
1166
|
+
}));
|
1167
|
+
return;
|
1168
|
+
}
|
1169
|
+
if (token === "amount" && parseFloat(value) === 0) {
|
1170
|
+
setErrors((prevErrors) => __spreadProps(__spreadValues({}, prevErrors), {
|
1171
|
+
amount: ErrorText.amountzero
|
1172
|
+
}));
|
1173
|
+
return;
|
1174
|
+
}
|
1175
|
+
if (value) {
|
1176
|
+
setErrors(__spreadProps(__spreadValues({}, errors), { [token]: "" }));
|
1177
|
+
}
|
1178
|
+
};
|
1179
|
+
const handleAmountBlur = () => {
|
1180
|
+
const value = requestDetails.amount;
|
1181
|
+
if (value && !value.includes(".")) {
|
1182
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), {
|
1183
|
+
amount: `${value}.00`
|
1184
|
+
}));
|
1185
|
+
}
|
1186
|
+
};
|
1187
|
+
const validateForm = () => {
|
1188
|
+
let newErrors = {};
|
1189
|
+
if (!requestDetails.name) newErrors.name = ErrorText.namerequired;
|
1190
|
+
if (!requestDetails.amount) newErrors.amount = ErrorText.amountrequired;
|
1191
|
+
if (!requestDetails.phone_number && !(requestDetails == null ? void 0 : requestDetails.email)) newErrors.phone_number = ErrorText.phoneoremailrequired;
|
1192
|
+
if (!requestDetails.email && !requestDetails.phone_number) newErrors.email = ErrorText.phoneoremailrequired;
|
1193
|
+
if (!requestDetails.phone_number && requestDetails.email && !isValidEmail(requestDetails == null ? void 0 : requestDetails.email)) newErrors.email = ErrorText.invalidemail;
|
1194
|
+
setErrors(newErrors);
|
1195
|
+
return Object.keys(newErrors).length === 0;
|
1196
|
+
};
|
1197
|
+
(0, import_react4.useEffect)(() => {
|
1198
|
+
if (props.amount) {
|
1199
|
+
setRequestDetails((prev) => __spreadProps(__spreadValues({}, prev), { amount: props.amount }));
|
1200
|
+
}
|
1201
|
+
}, [props.amount]);
|
1202
|
+
const handleKeyDown = (e) => {
|
1203
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
1204
|
+
e.preventDefault();
|
1205
|
+
}
|
1206
|
+
};
|
1207
|
+
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react4.default.createElement(Loader_default, { loading }), /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, /* @__PURE__ */ import_react4.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Request Payment"), /* @__PURE__ */ import_react4.default.createElement(
|
1208
|
+
import_react_bootstrap.Modal,
|
1209
|
+
{
|
1210
|
+
show,
|
1211
|
+
onHide: handleClose,
|
1212
|
+
size: "lg",
|
1213
|
+
backdrop: "static",
|
1214
|
+
keyboard: false
|
1215
|
+
},
|
1216
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Header, { closeButton: true }, /* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Title, null, "Request Payment")),
|
1217
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Body, { id: "Checkout" }, /* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Form, null, /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "FULL NAME *"), /* @__PURE__ */ import_react4.default.createElement(
|
1218
|
+
"input",
|
1219
|
+
{
|
1220
|
+
className: "form-control",
|
1221
|
+
type: "text",
|
1222
|
+
placeholder: "Full Name",
|
1223
|
+
"data-token": "name",
|
1224
|
+
onChange: handleChange
|
1225
|
+
}
|
1226
|
+
), errors.name && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.name)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "requestPhoneNumber", className: "form-label" }, "Phone Number"), /* @__PURE__ */ import_react4.default.createElement(
|
1227
|
+
"input",
|
1228
|
+
{
|
1229
|
+
maxLength: 10,
|
1230
|
+
className: "form-control",
|
1231
|
+
onChange: (e) => {
|
1232
|
+
handleChange(e);
|
1233
|
+
},
|
1234
|
+
placeholder: "Phone Number",
|
1235
|
+
type: "text",
|
1236
|
+
"data-token": "phone_number"
|
1237
|
+
}
|
1238
|
+
), errors.phone_number && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.phone_number)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "EMAIL"), /* @__PURE__ */ import_react4.default.createElement(
|
1239
|
+
"input",
|
1240
|
+
{
|
1241
|
+
className: "form-control",
|
1242
|
+
type: "text",
|
1243
|
+
placeholder: "Email",
|
1244
|
+
onChange: handleChange,
|
1245
|
+
"data-token": "email"
|
1246
|
+
}
|
1247
|
+
), errors.email && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.email)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "AMOUNT *"), /* @__PURE__ */ import_react4.default.createElement("div", { className: "input-group" }, /* @__PURE__ */ import_react4.default.createElement("span", { className: "input-group-text" }, "$"), /* @__PURE__ */ import_react4.default.createElement(
|
1248
|
+
"input",
|
1249
|
+
{
|
1250
|
+
"data-token": "amount",
|
1251
|
+
placeholder: "Amount",
|
1252
|
+
min: 0,
|
1253
|
+
type: "number",
|
1254
|
+
className: "form-control",
|
1255
|
+
value: requestDetails.amount,
|
1256
|
+
onChange: handleChange,
|
1257
|
+
onBlur: handleAmountBlur,
|
1258
|
+
onKeyDown: handleKeyDown,
|
1259
|
+
onFocus: (e) => e.target.addEventListener("wheel", function(e2) {
|
1260
|
+
e2.preventDefault();
|
1261
|
+
}, { passive: false })
|
1262
|
+
}
|
1263
|
+
)), errors.amount && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.amount)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "mb-3" }, /* @__PURE__ */ import_react4.default.createElement("label", { htmlFor: "exampleFormControlInput2", className: "form-label" }, "ORDER ID"), /* @__PURE__ */ import_react4.default.createElement(
|
1264
|
+
"input",
|
1265
|
+
{
|
1266
|
+
className: "form-control",
|
1267
|
+
type: "text",
|
1268
|
+
placeholder: "Order Id",
|
1269
|
+
onChange: handleChange,
|
1270
|
+
"data-token": "order_id"
|
1271
|
+
}
|
1272
|
+
), errors.order_id && /* @__PURE__ */ import_react4.default.createElement("small", { className: "text-danger" }, errors.order_id)), /* @__PURE__ */ import_react4.default.createElement(
|
1273
|
+
import_react_bootstrap.Button,
|
1274
|
+
{
|
1275
|
+
type: "button",
|
1276
|
+
className: "PayButton",
|
1277
|
+
onClick: sendRequestPayment,
|
1278
|
+
disabled: loading
|
1279
|
+
},
|
1280
|
+
loading ? "Loading..." : "Send Request"
|
1281
|
+
)), /* @__PURE__ */ import_react4.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react4.default.createElement(
|
1282
|
+
"svg",
|
1283
|
+
{
|
1284
|
+
xmlns: "http://www.w3.org/2000/svg",
|
1285
|
+
width: "20",
|
1286
|
+
height: "20",
|
1287
|
+
viewBox: "0 0 26 26"
|
1288
|
+
},
|
1289
|
+
/* @__PURE__ */ import_react4.default.createElement(
|
1290
|
+
"path",
|
1291
|
+
{
|
1292
|
+
fill: "currentColor",
|
1293
|
+
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
1294
|
+
}
|
1295
|
+
)
|
1296
|
+
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react4.default.createElement(
|
1297
|
+
"img",
|
1298
|
+
{
|
1299
|
+
src: "https://ui.fractalpay.com/favicon.ico",
|
1300
|
+
alt: "Fractal logo",
|
1301
|
+
className: "powered-logo"
|
1302
|
+
}
|
1303
|
+
)))
|
1304
|
+
), /* @__PURE__ */ import_react4.default.createElement(
|
1305
|
+
import_react_bootstrap.Modal,
|
1306
|
+
{
|
1307
|
+
className: "payment-suc",
|
1308
|
+
show: showConfirmationModal,
|
1309
|
+
onHide: handleCloseConfirmationModal
|
1310
|
+
},
|
1311
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Header, { closeButton: true }),
|
1312
|
+
/* @__PURE__ */ import_react4.default.createElement(import_react_bootstrap.Modal.Body, null, /* @__PURE__ */ import_react4.default.createElement(
|
1313
|
+
"svg",
|
1314
|
+
{
|
1315
|
+
width: "60",
|
1316
|
+
height: "60",
|
1317
|
+
viewBox: "0 0 60 60",
|
1318
|
+
fill: "none",
|
1319
|
+
xmlns: "http://www.w3.org/2000/svg"
|
1320
|
+
},
|
1321
|
+
/* @__PURE__ */ import_react4.default.createElement(
|
1322
|
+
"rect",
|
1323
|
+
{
|
1324
|
+
x: "0.5",
|
1325
|
+
y: "0.5",
|
1326
|
+
width: "59",
|
1327
|
+
height: "59",
|
1328
|
+
rx: "29.5",
|
1329
|
+
stroke: "#31B379"
|
1330
|
+
}
|
1331
|
+
),
|
1332
|
+
/* @__PURE__ */ import_react4.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react4.default.createElement(
|
1333
|
+
"path",
|
1334
|
+
{
|
1335
|
+
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1336
|
+
fill: "#31B379"
|
1337
|
+
}
|
1338
|
+
)),
|
1339
|
+
/* @__PURE__ */ import_react4.default.createElement("defs", null, /* @__PURE__ */ import_react4.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react4.default.createElement(
|
1340
|
+
"rect",
|
1341
|
+
{
|
1342
|
+
width: "22",
|
1343
|
+
height: "22",
|
1344
|
+
fill: "white",
|
1345
|
+
transform: "translate(19.5 19.0039)"
|
1346
|
+
}
|
1347
|
+
)))
|
1348
|
+
), /* @__PURE__ */ import_react4.default.createElement("h2", null, "Payment link has been ", /* @__PURE__ */ import_react4.default.createElement("br", null), " sent successfully"))
|
1349
|
+
)));
|
1350
|
+
}
|
1351
|
+
|
1327
1352
|
// src/app/components/RequestPayment/RequestPaymentAllInput.tsx
|
1353
|
+
var import_react5 = __toESM(require("react"), 1);
|
1354
|
+
var import_react_bootstrap2 = require("react-bootstrap");
|
1355
|
+
var import_react_toastify = require("react-toastify");
|
1356
|
+
var import_ReactToastify = require("react-toastify/dist/ReactToastify.css");
|
1328
1357
|
function RequestPaymentAllInput({ fractalpayClientKey }) {
|
1329
|
-
const [isLoading, setIsLoading] =
|
1330
|
-
const [show, setShow] =
|
1331
|
-
const [phoneNumber, setPhoneNumber] =
|
1332
|
-
const [amount, setAmount] =
|
1333
|
-
const [orderId, setOrderId] =
|
1334
|
-
const [isValidNumber, setIsValidNumber] =
|
1335
|
-
const [isValidAmount, setIsValidAmount] =
|
1336
|
-
const [isValidOrderId, setIsValidOrderId] =
|
1337
|
-
const [errorMessagephone, setErrorMessagephone] =
|
1338
|
-
const [errorMessageamount, setErrorMessageamount] =
|
1339
|
-
const [errorMessageorderid, setErrorMessageorderid] =
|
1340
|
-
const [submitClicked, setSubmitClicked] =
|
1358
|
+
const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
|
1359
|
+
const [show, setShow] = (0, import_react5.useState)(false);
|
1360
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react5.useState)("");
|
1361
|
+
const [amount, setAmount] = (0, import_react5.useState)("");
|
1362
|
+
const [orderId, setOrderId] = (0, import_react5.useState)("");
|
1363
|
+
const [isValidNumber, setIsValidNumber] = (0, import_react5.useState)(true);
|
1364
|
+
const [isValidAmount, setIsValidAmount] = (0, import_react5.useState)(true);
|
1365
|
+
const [isValidOrderId, setIsValidOrderId] = (0, import_react5.useState)(true);
|
1366
|
+
const [errorMessagephone, setErrorMessagephone] = (0, import_react5.useState)("");
|
1367
|
+
const [errorMessageamount, setErrorMessageamount] = (0, import_react5.useState)("");
|
1368
|
+
const [errorMessageorderid, setErrorMessageorderid] = (0, import_react5.useState)("");
|
1369
|
+
const [submitClicked, setSubmitClicked] = (0, import_react5.useState)(false);
|
1341
1370
|
const handleClose = () => setShow(false);
|
1342
1371
|
const handleShow = () => setShow(true);
|
1343
1372
|
const sendRequestPayment = () => {
|
@@ -1399,7 +1428,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1399
1428
|
}).catch((error) => {
|
1400
1429
|
setIsLoading(false);
|
1401
1430
|
console.error("Error:", error);
|
1402
|
-
toast.error(ErrorText.anerroroccured);
|
1431
|
+
import_react_toastify.toast.error(ErrorText.anerroroccured);
|
1403
1432
|
});
|
1404
1433
|
};
|
1405
1434
|
const handlePhoneNumberChange = (e) => {
|
@@ -1439,7 +1468,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1439
1468
|
setIsValidOrderId(false);
|
1440
1469
|
}
|
1441
1470
|
};
|
1442
|
-
return /* @__PURE__ */
|
1471
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_react5.default.Fragment, null, /* @__PURE__ */ import_react5.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react5.default.createElement("div", { className: " border-container" }, /* @__PURE__ */ import_react5.default.createElement("div", { className: "payment-column" }, /* @__PURE__ */ import_react5.default.createElement("label", null, "Enter Phone Number:"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react5.default.createElement(
|
1443
1472
|
"input",
|
1444
1473
|
{
|
1445
1474
|
type: "text",
|
@@ -1449,7 +1478,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1449
1478
|
maxLength: 10,
|
1450
1479
|
className: submitClicked && (!phoneNumber || !isValidNumber) ? "error" : ""
|
1451
1480
|
}
|
1452
|
-
), errorMessagephone && /* @__PURE__ */
|
1481
|
+
), errorMessagephone && /* @__PURE__ */ import_react5.default.createElement("div", { className: "error-message text-danger" }, errorMessagephone))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "payment-column" }, /* @__PURE__ */ import_react5.default.createElement("label", null, "Enter Amount:"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react5.default.createElement(
|
1453
1482
|
"input",
|
1454
1483
|
{
|
1455
1484
|
type: "text",
|
@@ -1458,7 +1487,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1458
1487
|
placeholder: "Enter amount",
|
1459
1488
|
className: submitClicked && (!amount || !isValidAmount) ? "error" : ""
|
1460
1489
|
}
|
1461
|
-
), errorMessageamount && /* @__PURE__ */
|
1490
|
+
), errorMessageamount && /* @__PURE__ */ import_react5.default.createElement("div", { className: "error-message text-danger" }, errorMessageamount))), /* @__PURE__ */ import_react5.default.createElement("div", { className: "payment-column" }, /* @__PURE__ */ import_react5.default.createElement("label", null, "Enter Order ID:"), /* @__PURE__ */ import_react5.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react5.default.createElement(
|
1462
1491
|
"input",
|
1463
1492
|
{
|
1464
1493
|
type: "text",
|
@@ -1467,7 +1496,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1467
1496
|
placeholder: "Enter order ID",
|
1468
1497
|
className: submitClicked && (!orderId || !isValidOrderId) ? "error" : ""
|
1469
1498
|
}
|
1470
|
-
), errorMessageorderid && /* @__PURE__ */
|
1499
|
+
), errorMessageorderid && /* @__PURE__ */ import_react5.default.createElement("div", { className: "error-message text-danger" }, errorMessageorderid))), /* @__PURE__ */ import_react5.default.createElement(
|
1471
1500
|
"button",
|
1472
1501
|
{
|
1473
1502
|
onClick: sendRequestPayment,
|
@@ -1475,7 +1504,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1475
1504
|
className: "paymentBtn"
|
1476
1505
|
},
|
1477
1506
|
isLoading ? "Loading..." : "Request Payment"
|
1478
|
-
)), /* @__PURE__ */
|
1507
|
+
)), /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal.Body, null, /* @__PURE__ */ import_react5.default.createElement(
|
1479
1508
|
"svg",
|
1480
1509
|
{
|
1481
1510
|
width: "60",
|
@@ -1484,7 +1513,7 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1484
1513
|
fill: "none",
|
1485
1514
|
xmlns: "http://www.w3.org/2000/svg"
|
1486
1515
|
},
|
1487
|
-
/* @__PURE__ */
|
1516
|
+
/* @__PURE__ */ import_react5.default.createElement(
|
1488
1517
|
"rect",
|
1489
1518
|
{
|
1490
1519
|
x: "0.5",
|
@@ -1495,14 +1524,14 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1495
1524
|
stroke: "#31B379"
|
1496
1525
|
}
|
1497
1526
|
),
|
1498
|
-
/* @__PURE__ */
|
1527
|
+
/* @__PURE__ */ import_react5.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react5.default.createElement(
|
1499
1528
|
"path",
|
1500
1529
|
{
|
1501
1530
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1502
1531
|
fill: "#31B379"
|
1503
1532
|
}
|
1504
1533
|
)),
|
1505
|
-
/* @__PURE__ */
|
1534
|
+
/* @__PURE__ */ import_react5.default.createElement("defs", null, /* @__PURE__ */ import_react5.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react5.default.createElement(
|
1506
1535
|
"rect",
|
1507
1536
|
{
|
1508
1537
|
width: "22",
|
@@ -1511,12 +1540,12 @@ function RequestPaymentAllInput({ fractalpayClientKey }) {
|
|
1511
1540
|
transform: "translate(19.5 19.0039)"
|
1512
1541
|
}
|
1513
1542
|
)))
|
1514
|
-
), /* @__PURE__ */
|
1543
|
+
), /* @__PURE__ */ import_react5.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react5.default.createElement("h4", null, "Payment link created successfully.")), /* @__PURE__ */ import_react5.default.createElement(import_react_bootstrap2.Modal.Footer, null, /* @__PURE__ */ import_react5.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))), /* @__PURE__ */ import_react5.default.createElement(import_react_toastify.ToastContainer, null));
|
1515
1544
|
}
|
1516
1545
|
|
1517
1546
|
// src/app/components/RequestPayment/RequestPaymentDynamic.tsx
|
1518
|
-
|
1519
|
-
|
1547
|
+
var import_react6 = __toESM(require("react"), 1);
|
1548
|
+
var import_react_bootstrap3 = require("react-bootstrap");
|
1520
1549
|
|
1521
1550
|
// src/app/components/Api/createWidgetOrder.ts
|
1522
1551
|
var createWidgetOrder = (formData) => {
|
@@ -1539,9 +1568,8 @@ var createWidgetOrder = (formData) => {
|
|
1539
1568
|
|
1540
1569
|
// src/app/components/RequestPayment/RequestPaymentDynamic.tsx
|
1541
1570
|
function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orderID }) {
|
1542
|
-
|
1543
|
-
const [
|
1544
|
-
const [show, setShow] = useState3(false);
|
1571
|
+
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
1572
|
+
const [show, setShow] = (0, import_react6.useState)(false);
|
1545
1573
|
const handleClose = () => setShow(false);
|
1546
1574
|
const handleShow = () => setShow(true);
|
1547
1575
|
const sendRequestPayment = () => {
|
@@ -1564,7 +1592,7 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1564
1592
|
console.error("Error:", error);
|
1565
1593
|
});
|
1566
1594
|
};
|
1567
|
-
return /* @__PURE__ */
|
1595
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, /* @__PURE__ */ import_react6.default.createElement(
|
1568
1596
|
"button",
|
1569
1597
|
{
|
1570
1598
|
onClick: sendRequestPayment,
|
@@ -1572,7 +1600,7 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1572
1600
|
className: "paymentBtn"
|
1573
1601
|
},
|
1574
1602
|
isLoading ? "Loading..." : "Request Payment"
|
1575
|
-
), /* @__PURE__ */
|
1603
|
+
), /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal.Body, null, /* @__PURE__ */ import_react6.default.createElement(
|
1576
1604
|
"svg",
|
1577
1605
|
{
|
1578
1606
|
width: "60",
|
@@ -1581,7 +1609,7 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1581
1609
|
fill: "none",
|
1582
1610
|
xmlns: "http://www.w3.org/2000/svg"
|
1583
1611
|
},
|
1584
|
-
/* @__PURE__ */
|
1612
|
+
/* @__PURE__ */ import_react6.default.createElement(
|
1585
1613
|
"rect",
|
1586
1614
|
{
|
1587
1615
|
x: "0.5",
|
@@ -1592,14 +1620,14 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1592
1620
|
stroke: "#31B379"
|
1593
1621
|
}
|
1594
1622
|
),
|
1595
|
-
/* @__PURE__ */
|
1623
|
+
/* @__PURE__ */ import_react6.default.createElement("g", { "clip-path": "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react6.default.createElement(
|
1596
1624
|
"path",
|
1597
1625
|
{
|
1598
1626
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1599
1627
|
fill: "#31B379"
|
1600
1628
|
}
|
1601
1629
|
)),
|
1602
|
-
/* @__PURE__ */
|
1630
|
+
/* @__PURE__ */ import_react6.default.createElement("defs", null, /* @__PURE__ */ import_react6.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react6.default.createElement(
|
1603
1631
|
"rect",
|
1604
1632
|
{
|
1605
1633
|
width: "22",
|
@@ -1608,15 +1636,15 @@ function RequestPaymentDynamic({ fractalpayClientKey, amount, phone_number, orde
|
|
1608
1636
|
transform: "translate(19.5 19.0039)"
|
1609
1637
|
}
|
1610
1638
|
)))
|
1611
|
-
), /* @__PURE__ */
|
1639
|
+
), /* @__PURE__ */ import_react6.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react6.default.createElement("h4", null, "Payment link created successfully.")), /* @__PURE__ */ import_react6.default.createElement(import_react_bootstrap3.Modal.Footer, null, /* @__PURE__ */ import_react6.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))));
|
1612
1640
|
}
|
1613
1641
|
|
1614
1642
|
// src/app/components/RequestPayment/RequestPaymentonClick.tsx
|
1615
|
-
|
1616
|
-
|
1643
|
+
var import_react7 = __toESM(require("react"), 1);
|
1644
|
+
var import_react_bootstrap4 = require("react-bootstrap");
|
1617
1645
|
function RequestPaymentonClick(props) {
|
1618
|
-
const [isLoading, setIsLoading] =
|
1619
|
-
const [show, setShow] =
|
1646
|
+
const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
|
1647
|
+
const [show, setShow] = (0, import_react7.useState)(false);
|
1620
1648
|
const handleClose = () => setShow(false);
|
1621
1649
|
const handleShow = () => setShow(true);
|
1622
1650
|
const { fractalpayClientKey, amount, phone_number, orderID, onSuccess, onError } = props;
|
@@ -1650,7 +1678,7 @@ function RequestPaymentonClick(props) {
|
|
1650
1678
|
console.error("Error:", error);
|
1651
1679
|
});
|
1652
1680
|
};
|
1653
|
-
return /* @__PURE__ */
|
1681
|
+
return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement(RequestPaymentstyles_default, null), /* @__PURE__ */ import_react7.default.createElement(
|
1654
1682
|
"button",
|
1655
1683
|
{
|
1656
1684
|
onClick: sendRequestPayment,
|
@@ -1658,7 +1686,7 @@ function RequestPaymentonClick(props) {
|
|
1658
1686
|
className: "paymentBtn"
|
1659
1687
|
},
|
1660
1688
|
isLoading ? "Loading..." : "Request Payment"
|
1661
|
-
), /* @__PURE__ */
|
1689
|
+
), /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal.Body, null, onSuccess && /* @__PURE__ */ import_react7.default.createElement(
|
1662
1690
|
"svg",
|
1663
1691
|
{
|
1664
1692
|
width: "60",
|
@@ -1667,7 +1695,7 @@ function RequestPaymentonClick(props) {
|
|
1667
1695
|
fill: "none",
|
1668
1696
|
xmlns: "http://www.w3.org/2000/svg"
|
1669
1697
|
},
|
1670
|
-
/* @__PURE__ */
|
1698
|
+
/* @__PURE__ */ import_react7.default.createElement(
|
1671
1699
|
"rect",
|
1672
1700
|
{
|
1673
1701
|
x: "0.5",
|
@@ -1678,14 +1706,14 @@ function RequestPaymentonClick(props) {
|
|
1678
1706
|
stroke: "#31B379"
|
1679
1707
|
}
|
1680
1708
|
),
|
1681
|
-
/* @__PURE__ */
|
1709
|
+
/* @__PURE__ */ import_react7.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react7.default.createElement(
|
1682
1710
|
"path",
|
1683
1711
|
{
|
1684
1712
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1685
1713
|
fill: "#31B379"
|
1686
1714
|
}
|
1687
1715
|
)),
|
1688
|
-
/* @__PURE__ */
|
1716
|
+
/* @__PURE__ */ import_react7.default.createElement("defs", null, /* @__PURE__ */ import_react7.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react7.default.createElement(
|
1689
1717
|
"rect",
|
1690
1718
|
{
|
1691
1719
|
width: "22",
|
@@ -1694,21 +1722,21 @@ function RequestPaymentonClick(props) {
|
|
1694
1722
|
transform: "translate(19.5 19.0039)"
|
1695
1723
|
}
|
1696
1724
|
)))
|
1697
|
-
), onSuccess ? /* @__PURE__ */
|
1725
|
+
), onSuccess ? /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react7.default.createElement("h4", null, onSuccess)) : /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, /* @__PURE__ */ import_react7.default.createElement("h1", null, "Error!"), /* @__PURE__ */ import_react7.default.createElement("h4", null, onError))), /* @__PURE__ */ import_react7.default.createElement(import_react_bootstrap4.Modal.Footer, null, /* @__PURE__ */ import_react7.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))));
|
1698
1726
|
}
|
1699
1727
|
|
1700
1728
|
// src/app/components/RequestPayment/RqstPaymntInputField.tsx
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1729
|
+
var import_react8 = __toESM(require("react"), 1);
|
1730
|
+
var import_react_bootstrap5 = require("react-bootstrap");
|
1731
|
+
var import_react_toastify2 = require("react-toastify");
|
1732
|
+
var import_ReactToastify2 = require("react-toastify/dist/ReactToastify.css");
|
1705
1733
|
function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
1706
|
-
const [isLoading, setIsLoading] =
|
1707
|
-
const [show, setShow] =
|
1708
|
-
const [phoneNumber, setPhoneNumber] =
|
1709
|
-
const [isValidNumber, setIsValidNumber] =
|
1710
|
-
const [errorMessage, setErrorMessage] =
|
1711
|
-
const [submitClicked, setSubmitClicked] =
|
1734
|
+
const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
|
1735
|
+
const [show, setShow] = (0, import_react8.useState)(false);
|
1736
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react8.useState)("");
|
1737
|
+
const [isValidNumber, setIsValidNumber] = (0, import_react8.useState)(true);
|
1738
|
+
const [errorMessage, setErrorMessage] = (0, import_react8.useState)("");
|
1739
|
+
const [submitClicked, setSubmitClicked] = (0, import_react8.useState)(false);
|
1712
1740
|
const handleClose = () => setShow(false);
|
1713
1741
|
const handleShow = () => setShow(true);
|
1714
1742
|
const sendRequestPayment = () => {
|
@@ -1753,7 +1781,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1753
1781
|
}).catch((error) => {
|
1754
1782
|
setIsLoading(false);
|
1755
1783
|
console.error("Error:", error);
|
1756
|
-
|
1784
|
+
import_react_toastify2.toast.error(ErrorText.anerroroccured);
|
1757
1785
|
});
|
1758
1786
|
};
|
1759
1787
|
const handlePhoneNumberChange = (e) => {
|
@@ -1771,7 +1799,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1771
1799
|
setErrorMessage(ErrorText.phonenumbervalid);
|
1772
1800
|
}
|
1773
1801
|
};
|
1774
|
-
return /* @__PURE__ */
|
1802
|
+
return /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("div", { className: "payment-container" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "input-wrapper" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react8.default.createElement(
|
1775
1803
|
"input",
|
1776
1804
|
{
|
1777
1805
|
type: "text",
|
@@ -1781,7 +1809,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1781
1809
|
maxLength: 10,
|
1782
1810
|
className: submitClicked && (!phoneNumber || !isValidNumber) ? "error" : ""
|
1783
1811
|
}
|
1784
|
-
), errorMessage && /* @__PURE__ */
|
1812
|
+
), errorMessage && /* @__PURE__ */ import_react8.default.createElement("div", { className: "error-message text-danger" }, errorMessage))), /* @__PURE__ */ import_react8.default.createElement("div", { className: "button-wrapper" }, /* @__PURE__ */ import_react8.default.createElement(
|
1785
1813
|
"button",
|
1786
1814
|
{
|
1787
1815
|
onClick: sendRequestPayment,
|
@@ -1789,7 +1817,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1789
1817
|
className: "paymentBtn"
|
1790
1818
|
},
|
1791
1819
|
isLoading ? "Loading..." : "Request Payment"
|
1792
|
-
))), /* @__PURE__ */
|
1820
|
+
))), /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal, { className: "payment-suc", show, onHide: handleClose }, /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal.Body, null, /* @__PURE__ */ import_react8.default.createElement(
|
1793
1821
|
"svg",
|
1794
1822
|
{
|
1795
1823
|
width: "60",
|
@@ -1798,7 +1826,7 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1798
1826
|
fill: "none",
|
1799
1827
|
xmlns: "http://www.w3.org/2000/svg"
|
1800
1828
|
},
|
1801
|
-
/* @__PURE__ */
|
1829
|
+
/* @__PURE__ */ import_react8.default.createElement(
|
1802
1830
|
"rect",
|
1803
1831
|
{
|
1804
1832
|
x: "0.5",
|
@@ -1809,14 +1837,14 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1809
1837
|
stroke: "#31B379"
|
1810
1838
|
}
|
1811
1839
|
),
|
1812
|
-
/* @__PURE__ */
|
1840
|
+
/* @__PURE__ */ import_react8.default.createElement("g", { clipPath: "url(#clip0_2659_5018)" }, /* @__PURE__ */ import_react8.default.createElement(
|
1813
1841
|
"path",
|
1814
1842
|
{
|
1815
1843
|
d: "M41.1778 22.248C40.7483 21.8184 40.0518 21.8184 39.6222 22.248L26.4435 35.4268L21.3778 30.3611C20.9483 29.9315 20.2518 29.9316 19.8222 30.3611C19.3926 30.7907 19.3926 31.4871 19.8222 31.9167L25.6657 37.7601C26.0951 38.1897 26.7921 38.1894 27.2213 37.7601L41.1778 23.8036C41.6074 23.3741 41.6074 22.6776 41.1778 22.248Z",
|
1816
1844
|
fill: "#31B379"
|
1817
1845
|
}
|
1818
1846
|
)),
|
1819
|
-
/* @__PURE__ */
|
1847
|
+
/* @__PURE__ */ import_react8.default.createElement("defs", null, /* @__PURE__ */ import_react8.default.createElement("clipPath", { id: "clip0_2659_5018" }, /* @__PURE__ */ import_react8.default.createElement(
|
1820
1848
|
"rect",
|
1821
1849
|
{
|
1822
1850
|
width: "22",
|
@@ -1825,20 +1853,20 @@ function RqstPaymntInputField({ fractalpayClientKey, amount, orderID }) {
|
|
1825
1853
|
transform: "translate(19.5 19.0039)"
|
1826
1854
|
}
|
1827
1855
|
)))
|
1828
|
-
), /* @__PURE__ */
|
1856
|
+
), /* @__PURE__ */ import_react8.default.createElement("h1", null, "Success!"), /* @__PURE__ */ import_react8.default.createElement("h4", null, "Payment link created successfully.")), /* @__PURE__ */ import_react8.default.createElement(import_react_bootstrap5.Modal.Footer, null, /* @__PURE__ */ import_react8.default.createElement("button", { className: "paymentBtn", onClick: handleClose }, "Ok"))), /* @__PURE__ */ import_react8.default.createElement(import_react_toastify2.ToastContainer, null));
|
1829
1857
|
}
|
1830
1858
|
|
1831
1859
|
// src/app/components/Payment/Payment.tsx
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1860
|
+
var import_react10 = __toESM(require("react"), 1);
|
1861
|
+
var import_axios2 = __toESM(require("axios"), 1);
|
1862
|
+
var import_node_forge = __toESM(require("node-forge"), 1);
|
1863
|
+
var import_react_toastify3 = require("react-toastify");
|
1864
|
+
var import_react_bootstrap6 = require("react-bootstrap");
|
1837
1865
|
|
1838
1866
|
// src/app/components/Payment/Paymentstyles.tsx
|
1839
|
-
|
1867
|
+
var import_react9 = __toESM(require("react"), 1);
|
1840
1868
|
function Paymentstyles() {
|
1841
|
-
return /* @__PURE__ */
|
1869
|
+
return /* @__PURE__ */ import_react9.default.createElement("style", null, `
|
1842
1870
|
.paymentBtn {
|
1843
1871
|
background-color: black;
|
1844
1872
|
border: none;
|
@@ -2764,7 +2792,7 @@ input {
|
|
2764
2792
|
// src/app/components/Payment/Payment.tsx
|
2765
2793
|
function Payment() {
|
2766
2794
|
var _a;
|
2767
|
-
const [state, setState] =
|
2795
|
+
const [state, setState] = (0, import_react10.useState)({
|
2768
2796
|
show: false,
|
2769
2797
|
publicKey: "",
|
2770
2798
|
sessionKey: "",
|
@@ -2775,12 +2803,12 @@ function Payment() {
|
|
2775
2803
|
zip: "",
|
2776
2804
|
amount: ""
|
2777
2805
|
});
|
2778
|
-
const [isValid, setIsValid] =
|
2779
|
-
const [isValidMonth, setIsValidMonth] =
|
2780
|
-
const [data, setData] =
|
2806
|
+
const [isValid, setIsValid] = (0, import_react10.useState)(false);
|
2807
|
+
const [isValidMonth, setIsValidMonth] = (0, import_react10.useState)(false);
|
2808
|
+
const [data, setData] = (0, import_react10.useState)(null);
|
2781
2809
|
const handlePaymentClick = async () => {
|
2782
2810
|
try {
|
2783
|
-
const response = await
|
2811
|
+
const response = await import_axios2.default.post(`${baseUrl}generate-session`, {});
|
2784
2812
|
const data2 = response.data;
|
2785
2813
|
if (data2 && (data2 == null ? void 0 : data2.result) === true) {
|
2786
2814
|
setState((prev) => {
|
@@ -2798,12 +2826,12 @@ function Payment() {
|
|
2798
2826
|
};
|
2799
2827
|
const handleSubmitPay = async () => {
|
2800
2828
|
const track2_data = `${state.cardNumber.replace(/\s+/g, "")}=${state.year}${state.month.length > 1 ? state.month : "0" + state.month} ${state.cvv}`;
|
2801
|
-
const publicKey =
|
2829
|
+
const publicKey = import_node_forge.default.pki.publicKeyFromPem(state.publicKey);
|
2802
2830
|
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
2803
|
-
md:
|
2804
|
-
mgf1: { md:
|
2831
|
+
md: import_node_forge.default.md.sha1.create(),
|
2832
|
+
mgf1: { md: import_node_forge.default.md.sha1.create() }
|
2805
2833
|
});
|
2806
|
-
const encryptedBase64 =
|
2834
|
+
const encryptedBase64 = import_node_forge.default.util.encode64(encrypted);
|
2807
2835
|
console.log(encryptedBase64);
|
2808
2836
|
const requestBody = {
|
2809
2837
|
enc_track2_data: encryptedBase64,
|
@@ -2812,14 +2840,14 @@ function Payment() {
|
|
2812
2840
|
};
|
2813
2841
|
const apiUrl = "https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize";
|
2814
2842
|
try {
|
2815
|
-
const response = await
|
2843
|
+
const response = await import_axios2.default.post(apiUrl, requestBody, {
|
2816
2844
|
headers: {
|
2817
2845
|
"x-app-session-key": state == null ? void 0 : state.sessionKey,
|
2818
2846
|
"Content-Type": "application/json"
|
2819
2847
|
}
|
2820
2848
|
});
|
2821
2849
|
if ((response == null ? void 0 : response.status) === 200) {
|
2822
|
-
|
2850
|
+
import_react_toastify3.toast.success("Payment Successful");
|
2823
2851
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
2824
2852
|
show: false,
|
2825
2853
|
publicKey: "",
|
@@ -2929,7 +2957,7 @@ function Payment() {
|
|
2929
2957
|
}
|
2930
2958
|
return "";
|
2931
2959
|
}
|
2932
|
-
return /* @__PURE__ */
|
2960
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react10.default.Fragment, null, /* @__PURE__ */ import_react10.default.createElement(Paymentstyles, null), /* @__PURE__ */ import_react10.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react10.default.createElement(
|
2933
2961
|
"button",
|
2934
2962
|
{
|
2935
2963
|
className: "export-btn",
|
@@ -2937,8 +2965,8 @@ function Payment() {
|
|
2937
2965
|
onClick: () => handlePaymentClick()
|
2938
2966
|
},
|
2939
2967
|
"Payment"
|
2940
|
-
), /* @__PURE__ */
|
2941
|
-
|
2968
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
2969
|
+
import_react_bootstrap6.Modal,
|
2942
2970
|
{
|
2943
2971
|
show: state.show,
|
2944
2972
|
onHide: () => setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -2946,8 +2974,8 @@ function Payment() {
|
|
2946
2974
|
})),
|
2947
2975
|
centered: true
|
2948
2976
|
},
|
2949
|
-
/* @__PURE__ */
|
2950
|
-
/* @__PURE__ */
|
2977
|
+
/* @__PURE__ */ import_react10.default.createElement(import_react_bootstrap6.Modal.Header, { closeButton: true }),
|
2978
|
+
/* @__PURE__ */ import_react10.default.createElement(import_react_bootstrap6.Modal.Body, null, /* @__PURE__ */ import_react10.default.createElement("div", { className: "payment-popup" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "row" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react10.default.createElement("div", { id: "Checkout", className: "inline" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react10.default.createElement("h1", null, "Pay")), /* @__PURE__ */ import_react10.default.createElement("form", { id: "PaymentForm", className: "payment-form" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group", style: { display: "none" } }, /* @__PURE__ */ import_react10.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react10.default.createElement("div", { className: "input-group" }, /* @__PURE__ */ import_react10.default.createElement("span", { className: "input-group-addon" }, "$"), /* @__PURE__ */ import_react10.default.createElement(
|
2951
2979
|
"input",
|
2952
2980
|
{
|
2953
2981
|
type: "text",
|
@@ -2956,13 +2984,13 @@ function Payment() {
|
|
2956
2984
|
className: "form-control",
|
2957
2985
|
id: ""
|
2958
2986
|
}
|
2959
|
-
)), /* @__PURE__ */
|
2987
|
+
)), /* @__PURE__ */ import_react10.default.createElement(
|
2960
2988
|
"span",
|
2961
2989
|
{
|
2962
2990
|
id: "amount-error",
|
2963
2991
|
style: { color: "red", display: "none" }
|
2964
2992
|
}
|
2965
|
-
)), /* @__PURE__ */
|
2993
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react10.default.createElement("label", null, "Name on card"), /* @__PURE__ */ import_react10.default.createElement(
|
2966
2994
|
"input",
|
2967
2995
|
{
|
2968
2996
|
id: "NameOnCard",
|
@@ -2971,13 +2999,13 @@ function Payment() {
|
|
2971
2999
|
maxLength: 100,
|
2972
3000
|
placeholder: "Name"
|
2973
3001
|
}
|
2974
|
-
), /* @__PURE__ */
|
3002
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
2975
3003
|
"span",
|
2976
3004
|
{
|
2977
3005
|
id: "NameOnCard-error",
|
2978
3006
|
style: { color: "red", display: "none" }
|
2979
3007
|
}
|
2980
|
-
)), /* @__PURE__ */
|
3008
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react10.default.createElement(
|
2981
3009
|
"input",
|
2982
3010
|
{
|
2983
3011
|
"data-token": "card_number",
|
@@ -2988,7 +3016,7 @@ function Payment() {
|
|
2988
3016
|
placeholder: "0000 0000 0000 0000",
|
2989
3017
|
onChange: handleCardNumberChange
|
2990
3018
|
}
|
2991
|
-
), state.error && /* @__PURE__ */
|
3019
|
+
), state.error && /* @__PURE__ */ import_react10.default.createElement("div", { style: { color: "red" } }, state.error)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react10.default.createElement(
|
2992
3020
|
"input",
|
2993
3021
|
{
|
2994
3022
|
"data-token": "exp_month",
|
@@ -2999,14 +3027,14 @@ function Payment() {
|
|
2999
3027
|
maxLength: 2,
|
3000
3028
|
onChange: (e) => handleMonthChange(e)
|
3001
3029
|
}
|
3002
|
-
), isValidMonth && /* @__PURE__ */
|
3030
|
+
), isValidMonth && /* @__PURE__ */ import_react10.default.createElement(
|
3003
3031
|
"span",
|
3004
3032
|
{
|
3005
3033
|
id: "card_number-error",
|
3006
3034
|
style: { color: "red", fontSize: "15px" }
|
3007
3035
|
},
|
3008
3036
|
(_a = ErrorText) == null ? void 0 : _a.montherror
|
3009
|
-
)), /* @__PURE__ */
|
3037
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react10.default.createElement(
|
3010
3038
|
"input",
|
3011
3039
|
{
|
3012
3040
|
"data-token": "exp_year",
|
@@ -3017,7 +3045,7 @@ function Payment() {
|
|
3017
3045
|
value: state.year,
|
3018
3046
|
onChange: (e) => handleYearChange(e)
|
3019
3047
|
}
|
3020
|
-
), state.yearError && /* @__PURE__ */
|
3048
|
+
), state.yearError && /* @__PURE__ */ import_react10.default.createElement("span", { id: "exp_year-error", style: { color: "red" } }, state.yearError)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "security-code-group form-group" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react10.default.createElement(
|
3021
3049
|
"input",
|
3022
3050
|
{
|
3023
3051
|
"data-token": "cvv",
|
@@ -3028,7 +3056,7 @@ function Payment() {
|
|
3028
3056
|
placeholder: "CVV",
|
3029
3057
|
onChange: (e) => handleCVVChange(e)
|
3030
3058
|
}
|
3031
|
-
), /* @__PURE__ */
|
3059
|
+
), /* @__PURE__ */ import_react10.default.createElement("i", { id: "cvc", className: "fa fa-question-circle" }), state.cvvError && /* @__PURE__ */ import_react10.default.createElement("span", { id: "cvv-error", style: { color: "red" } }, state.cvvError)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "cvc-preview-container two-card hide" }, /* @__PURE__ */ import_react10.default.createElement("div", { className: "amex-cvc-preview" }), /* @__PURE__ */ import_react10.default.createElement("div", { className: "visa-mc-dis-cvc-preview" }))), /* @__PURE__ */ import_react10.default.createElement("div", { className: "zip-code-group form-group" }, /* @__PURE__ */ import_react10.default.createElement("label", null, "Postal code"), /* @__PURE__ */ import_react10.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react10.default.createElement(
|
3032
3060
|
"input",
|
3033
3061
|
{
|
3034
3062
|
id: "ZIPCode",
|
@@ -3040,7 +3068,7 @@ function Payment() {
|
|
3040
3068
|
value: state.zip,
|
3041
3069
|
onChange: (e) => handleZIP(e)
|
3042
3070
|
}
|
3043
|
-
), /* @__PURE__ */
|
3071
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
3044
3072
|
"a",
|
3045
3073
|
{
|
3046
3074
|
tabIndex: 0,
|
@@ -3050,15 +3078,15 @@ function Payment() {
|
|
3050
3078
|
"data-placement": "left",
|
3051
3079
|
"data-content": "Enter the ZIP/Postal code for your credit card billing address."
|
3052
3080
|
},
|
3053
|
-
/* @__PURE__ */
|
3054
|
-
), /* @__PURE__ */
|
3081
|
+
/* @__PURE__ */ import_react10.default.createElement("i", { className: "fa fa-question-circle" })
|
3082
|
+
), /* @__PURE__ */ import_react10.default.createElement(
|
3055
3083
|
"span",
|
3056
3084
|
{
|
3057
3085
|
id: "ZIPCode-error",
|
3058
3086
|
style: { color: "red", display: "none" }
|
3059
3087
|
},
|
3060
3088
|
ErrorText.fieldrequired
|
3061
|
-
))), /* @__PURE__ */
|
3089
|
+
))), /* @__PURE__ */ import_react10.default.createElement("div", { className: "form-group top-amnt" }, /* @__PURE__ */ import_react10.default.createElement("div", null, /* @__PURE__ */ import_react10.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react10.default.createElement("div", { className: "amount-placeholder" }, /* @__PURE__ */ import_react10.default.createElement(
|
3062
3090
|
"input",
|
3063
3091
|
{
|
3064
3092
|
id: "Amount",
|
@@ -3070,7 +3098,7 @@ function Payment() {
|
|
3070
3098
|
onChange: (e) => handleAmount(e),
|
3071
3099
|
onBlur: handleAmountBlur
|
3072
3100
|
}
|
3073
|
-
))), /* @__PURE__ */
|
3101
|
+
))), /* @__PURE__ */ import_react10.default.createElement("div", { className: "card-row" }, /* @__PURE__ */ import_react10.default.createElement("span", { className: "visa" }), /* @__PURE__ */ import_react10.default.createElement("span", { className: "mastercard" }), /* @__PURE__ */ import_react10.default.createElement("span", { className: "amex" }), /* @__PURE__ */ import_react10.default.createElement("span", { className: "discover" }))), /* @__PURE__ */ import_react10.default.createElement(
|
3074
3102
|
"button",
|
3075
3103
|
{
|
3076
3104
|
type: "button",
|
@@ -3079,7 +3107,7 @@ function Payment() {
|
|
3079
3107
|
className: "btn btn-block btn-success submit-button"
|
3080
3108
|
},
|
3081
3109
|
"Pay"
|
3082
|
-
)), /* @__PURE__ */
|
3110
|
+
)), /* @__PURE__ */ import_react10.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react10.default.createElement(
|
3083
3111
|
"svg",
|
3084
3112
|
{
|
3085
3113
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3087,14 +3115,14 @@ function Payment() {
|
|
3087
3115
|
height: "20",
|
3088
3116
|
viewBox: "0 0 26 26"
|
3089
3117
|
},
|
3090
|
-
/* @__PURE__ */
|
3118
|
+
/* @__PURE__ */ import_react10.default.createElement(
|
3091
3119
|
"path",
|
3092
3120
|
{
|
3093
3121
|
fill: "currentColor",
|
3094
3122
|
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
3095
3123
|
}
|
3096
3124
|
)
|
3097
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */
|
3125
|
+
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react10.default.createElement(
|
3098
3126
|
"img",
|
3099
3127
|
{
|
3100
3128
|
src: "https://ui.fractalpay.com/favicon.ico",
|
@@ -3106,28 +3134,22 @@ function Payment() {
|
|
3106
3134
|
}
|
3107
3135
|
|
3108
3136
|
// src/app/components/Transaction/CompletedTransactions.tsx
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
TableBody,
|
3116
|
-
TableHeader
|
3117
|
-
} from "react-bs-datatable";
|
3118
|
-
import DatePicker from "react-datepicker";
|
3119
|
-
import "react-datepicker/dist/react-datepicker.css";
|
3120
|
-
import { toast as toast4 } from "react-toastify";
|
3137
|
+
var import_react12 = __toESM(require("react"), 1);
|
3138
|
+
var import_react_bootstrap7 = require("react-bootstrap");
|
3139
|
+
var import_react_bs_datatable = require("react-bs-datatable");
|
3140
|
+
var import_react_datepicker = __toESM(require("react-datepicker"), 1);
|
3141
|
+
var import_react_datepicker2 = require("react-datepicker/dist/react-datepicker.css");
|
3142
|
+
var import_react_toastify4 = require("react-toastify");
|
3121
3143
|
|
3122
3144
|
// src/app/components/Pagination/Pagination.tsx
|
3123
|
-
|
3124
|
-
|
3125
|
-
const [currentPage, setCurrentPage] =
|
3126
|
-
const [showPages, setShowPages] =
|
3127
|
-
|
3145
|
+
var import_react11 = __toESM(require("react"), 1);
|
3146
|
+
function PaginationPg({ totalPages, onPageChange, current }) {
|
3147
|
+
const [currentPage, setCurrentPage] = (0, import_react11.useState)(current);
|
3148
|
+
const [showPages, setShowPages] = (0, import_react11.useState)(false);
|
3149
|
+
(0, import_react11.useEffect)(() => {
|
3128
3150
|
setCurrentPage(current);
|
3129
3151
|
}, [current]);
|
3130
|
-
|
3152
|
+
(0, import_react11.useEffect)(() => {
|
3131
3153
|
setTimeout(() => {
|
3132
3154
|
setShowPages(true);
|
3133
3155
|
}, 1e3);
|
@@ -3163,7 +3185,7 @@ var PaginationPgComp = ({ totalPages, onPageChange, current }) => {
|
|
3163
3185
|
if (currentPage > 3) {
|
3164
3186
|
pageNumbers.push(renderPageNumber(1));
|
3165
3187
|
if (currentPage > 4) {
|
3166
|
-
pageNumbers.push(/* @__PURE__ */
|
3188
|
+
pageNumbers.push(/* @__PURE__ */ import_react11.default.createElement("li", { key: "start-break", className: "page-item disabled" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "page-link" }, "...")));
|
3167
3189
|
}
|
3168
3190
|
}
|
3169
3191
|
const startPage = Math.max(currentPage - 1, 1);
|
@@ -3173,17 +3195,16 @@ var PaginationPgComp = ({ totalPages, onPageChange, current }) => {
|
|
3173
3195
|
}
|
3174
3196
|
if (currentPage < totalPages - 2) {
|
3175
3197
|
if (currentPage < totalPages - 3) {
|
3176
|
-
pageNumbers.push(/* @__PURE__ */
|
3198
|
+
pageNumbers.push(/* @__PURE__ */ import_react11.default.createElement("li", { key: "end-break", className: "page-item disabled" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "page-link" }, "...")));
|
3177
3199
|
}
|
3178
3200
|
pageNumbers.push(renderPageNumber(totalPages));
|
3179
3201
|
}
|
3180
3202
|
}
|
3181
3203
|
return pageNumbers;
|
3182
3204
|
};
|
3183
|
-
const renderPageNumber = (pageNumber) => /* @__PURE__ */
|
3184
|
-
return /* @__PURE__ */
|
3185
|
-
}
|
3186
|
-
var PaginationPg = React11.memo(PaginationPgComp);
|
3205
|
+
const renderPageNumber = (pageNumber) => /* @__PURE__ */ import_react11.default.createElement("li", { key: pageNumber, className: `page-item ${currentPage === pageNumber ? "active" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("a", { className: "page-link cursor-pointer", onClick: (e) => handlePageClick(e, pageNumber) }, pageNumber));
|
3206
|
+
return /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("nav", { className: "app-pagination py-2" }, /* @__PURE__ */ import_react11.default.createElement("ul", { className: "pagination justify-content-center" }, /* @__PURE__ */ import_react11.default.createElement("li", { className: `page-item ${currentPage === 1 ? "disabled" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("a", { className: "page-link cursor-pointer", onClick: handlePrevious }, /* @__PURE__ */ import_react11.default.createElement("span", null, "\u2B9C"))), showPages && getPageNumbers(), /* @__PURE__ */ import_react11.default.createElement("li", { className: `page-item ${currentPage === totalPages ? "disabled" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("a", { className: "page-link cursor-pointer", onClick: handleNext }, /* @__PURE__ */ import_react11.default.createElement("span", null, "\u2B9E"))))));
|
3207
|
+
}
|
3187
3208
|
|
3188
3209
|
// src/app/components/Transaction/CompletedTransactions.tsx
|
3189
3210
|
var STORY_HEADERS = [
|
@@ -3220,10 +3241,10 @@ var STORY_HEADERS = [
|
|
3220
3241
|
}
|
3221
3242
|
];
|
3222
3243
|
function CompletedTransactions(props) {
|
3223
|
-
const [dataList, setDataList] =
|
3224
|
-
const [startDate, setStartDate] =
|
3225
|
-
const [endDate, setEndDate] =
|
3226
|
-
const [state, setState] =
|
3244
|
+
const [dataList, setDataList] = (0, import_react12.useState)([]);
|
3245
|
+
const [startDate, setStartDate] = (0, import_react12.useState)(null);
|
3246
|
+
const [endDate, setEndDate] = (0, import_react12.useState)(null);
|
3247
|
+
const [state, setState] = (0, import_react12.useState)({
|
3227
3248
|
page: 1,
|
3228
3249
|
totalPage: 0,
|
3229
3250
|
data: [],
|
@@ -3311,9 +3332,9 @@ function CompletedTransactions(props) {
|
|
3311
3332
|
};
|
3312
3333
|
const handleExport = async () => {
|
3313
3334
|
if (!startDate) {
|
3314
|
-
|
3335
|
+
import_react_toastify4.toast.error("Start date required");
|
3315
3336
|
} else if (!endDate) {
|
3316
|
-
|
3337
|
+
import_react_toastify4.toast.error("End date required");
|
3317
3338
|
} else {
|
3318
3339
|
setState((prev) => __spreadProps(__spreadValues({}, prev), { csvData: true }));
|
3319
3340
|
try {
|
@@ -3346,19 +3367,19 @@ function CompletedTransactions(props) {
|
|
3346
3367
|
}
|
3347
3368
|
}
|
3348
3369
|
};
|
3349
|
-
|
3370
|
+
(0, import_react12.useEffect)(() => {
|
3350
3371
|
fetchData(state.page, startDate, endDate);
|
3351
3372
|
}, [state.page]);
|
3352
3373
|
const handlePageChange = (pageNumber) => {
|
3353
3374
|
setState((prev) => __spreadProps(__spreadValues({}, prev), { page: pageNumber }));
|
3354
3375
|
fetchData(pageNumber, startDate, endDate);
|
3355
3376
|
};
|
3356
|
-
return /* @__PURE__ */
|
3377
|
+
return /* @__PURE__ */ import_react12.default.createElement(import_react12.default.Fragment, null, /* @__PURE__ */ import_react12.default.createElement("style", null, `
|
3357
3378
|
.react-datepicker-wrapper:first-child {
|
3358
3379
|
margin-right: 10px;
|
3359
3380
|
}
|
3360
|
-
`), /* @__PURE__ */
|
3361
|
-
|
3381
|
+
`), /* @__PURE__ */ import_react12.default.createElement("div", { className: "mb-5" }, /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("div", { style: { display: "flex" } }, /* @__PURE__ */ import_react12.default.createElement("div", { style: { display: "flex", marginRight: "10px", marginTop: "25px" } }, /* @__PURE__ */ import_react12.default.createElement(
|
3382
|
+
import_react_datepicker.default,
|
3362
3383
|
{
|
3363
3384
|
selected: startDate,
|
3364
3385
|
onChange: handleStartDateChange,
|
@@ -3368,8 +3389,8 @@ function CompletedTransactions(props) {
|
|
3368
3389
|
placeholderText: "Start Date",
|
3369
3390
|
required: true
|
3370
3391
|
}
|
3371
|
-
), /* @__PURE__ */
|
3372
|
-
|
3392
|
+
), /* @__PURE__ */ import_react12.default.createElement(
|
3393
|
+
import_react_datepicker.default,
|
3373
3394
|
{
|
3374
3395
|
selected: endDate,
|
3375
3396
|
onChange: handleEndDateChange,
|
@@ -3379,8 +3400,8 @@ function CompletedTransactions(props) {
|
|
3379
3400
|
minDate: startDate,
|
3380
3401
|
placeholderText: "End Date"
|
3381
3402
|
}
|
3382
|
-
)), /* @__PURE__ */
|
3383
|
-
DatatableWrapper,
|
3403
|
+
)), /* @__PURE__ */ import_react12.default.createElement("button", { className: "export-btn1", onClick: handleExport }, "Export")), /* @__PURE__ */ import_react12.default.createElement(
|
3404
|
+
import_react_bs_datatable.DatatableWrapper,
|
3384
3405
|
{
|
3385
3406
|
body: dataList,
|
3386
3407
|
headers: STORY_HEADERS,
|
@@ -3391,21 +3412,21 @@ function CompletedTransactions(props) {
|
|
3391
3412
|
}
|
3392
3413
|
}
|
3393
3414
|
},
|
3394
|
-
/* @__PURE__ */
|
3395
|
-
/* @__PURE__ */
|
3396
|
-
/* @__PURE__ */
|
3415
|
+
/* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Row, { className: "mb-4 p-2" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Col, { xs: 12, sm: 6, lg: 4, className: "d-flex flex-col justify-content-lg-start align-items-center justify-content-sm-start mb-2 mb-sm-0" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.PaginationOptions, null)), /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Col, { xs: 12, lg: 4, className: "d-flex flex-col justify-content-end align-items-end" }), /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Col, { xs: 12, sm: 6, lg: 4, className: "d-flex flex-col justify-content-end align-items-end" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.Filter, null))),
|
3416
|
+
/* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Row, null, /* @__PURE__ */ import_react12.default.createElement("div", { className: "responsive-tbl" }, /* @__PURE__ */ import_react12.default.createElement(import_react_bootstrap7.Table, null, /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.TableHeader, null), /* @__PURE__ */ import_react12.default.createElement(import_react_bs_datatable.TableBody, null)))),
|
3417
|
+
/* @__PURE__ */ import_react12.default.createElement(PaginationPg, { totalPages: state.totalPage, onPageChange: handlePageChange, current: state.page })
|
3397
3418
|
))));
|
3398
3419
|
}
|
3399
3420
|
|
3400
3421
|
// src/app/components/Payment/TockenizPay.tsx
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3422
|
+
var import_react13 = __toESM(require("react"), 1);
|
3423
|
+
var import_react_bootstrap8 = require("react-bootstrap");
|
3424
|
+
var import_react_toastify5 = require("react-toastify");
|
3425
|
+
var import_axios3 = __toESM(require("axios"), 1);
|
3426
|
+
var import_node_forge2 = __toESM(require("node-forge"), 1);
|
3427
|
+
var import_credit_card_type = __toESM(require("credit-card-type"), 1);
|
3407
3428
|
function TockenizPay() {
|
3408
|
-
const [state, setState] =
|
3429
|
+
const [state, setState] = (0, import_react13.useState)({
|
3409
3430
|
show: false,
|
3410
3431
|
publicKey: "",
|
3411
3432
|
sessionKey: "",
|
@@ -3416,13 +3437,13 @@ function TockenizPay() {
|
|
3416
3437
|
zip: "",
|
3417
3438
|
amount: ""
|
3418
3439
|
});
|
3419
|
-
const [cardTypeDetail, setCardTypeDetail] =
|
3420
|
-
const [isValid, setIsValid] =
|
3421
|
-
const [isValidMonth, setIsValidMonth] =
|
3422
|
-
const [data, setData] =
|
3440
|
+
const [cardTypeDetail, setCardTypeDetail] = (0, import_react13.useState)(null);
|
3441
|
+
const [isValid, setIsValid] = (0, import_react13.useState)(false);
|
3442
|
+
const [isValidMonth, setIsValidMonth] = (0, import_react13.useState)(false);
|
3443
|
+
const [data, setData] = (0, import_react13.useState)(null);
|
3423
3444
|
const handlePaymentClick = async () => {
|
3424
3445
|
try {
|
3425
|
-
const response = await
|
3446
|
+
const response = await import_axios3.default.post(`${baseUrl}/generate-session`, {});
|
3426
3447
|
const data2 = response.data;
|
3427
3448
|
if (data2 && (data2 == null ? void 0 : data2.result) === true) {
|
3428
3449
|
setState((prev) => {
|
@@ -3441,14 +3462,14 @@ function TockenizPay() {
|
|
3441
3462
|
const handleSubmitPay = async () => {
|
3442
3463
|
var _a, _b, _c, _d, _e;
|
3443
3464
|
let track2_data = `${(_a = state == null ? void 0 : state.cardNumber) == null ? void 0 : _a.replaceAll(" ", "")}=${state.year}${((_b = state == null ? void 0 : state.month) == null ? void 0 : _b.length) > 1 ? state == null ? void 0 : state.month : "0" + (state == null ? void 0 : state.month)} ${state.cvv}`;
|
3444
|
-
const publicKey =
|
3465
|
+
const publicKey = import_node_forge2.default.pki.publicKeyFromPem(state.publicKey);
|
3445
3466
|
const encrypted = publicKey.encrypt(track2_data, "RSA-OAEP", {
|
3446
|
-
md:
|
3467
|
+
md: import_node_forge2.default.md.sha1.create(),
|
3447
3468
|
mgf1: {
|
3448
|
-
md:
|
3469
|
+
md: import_node_forge2.default.md.sha1.create()
|
3449
3470
|
}
|
3450
3471
|
});
|
3451
|
-
const encryptedBase64 =
|
3472
|
+
const encryptedBase64 = import_node_forge2.default.util.encode64(encrypted);
|
3452
3473
|
console.log(encryptedBase64);
|
3453
3474
|
const requestBody = {
|
3454
3475
|
enc_track2_data: encryptedBase64,
|
@@ -3456,7 +3477,7 @@ function TockenizPay() {
|
|
3456
3477
|
algorithm: "RSAES_OAEP_SHA_1"
|
3457
3478
|
};
|
3458
3479
|
try {
|
3459
|
-
const response = await
|
3480
|
+
const response = await import_axios3.default.post(
|
3460
3481
|
"https://m1ao5pku8b.execute-api.us-east-2.amazonaws.com/prod/tokenizer/tokenize",
|
3461
3482
|
requestBody,
|
3462
3483
|
{
|
@@ -3467,7 +3488,7 @@ function TockenizPay() {
|
|
3467
3488
|
}
|
3468
3489
|
);
|
3469
3490
|
if ((response == null ? void 0 : response.status) === 200) {
|
3470
|
-
|
3491
|
+
import_react_toastify5.toast.success("Payment Successful");
|
3471
3492
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
3472
3493
|
show: false,
|
3473
3494
|
publicKey: "",
|
@@ -3482,7 +3503,7 @@ function TockenizPay() {
|
|
3482
3503
|
}
|
3483
3504
|
console.log("response", response);
|
3484
3505
|
} catch (error) {
|
3485
|
-
|
3506
|
+
import_react_toastify5.toast.error((_e = (_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.data) == null ? void 0 : _e.message);
|
3486
3507
|
console.error("Error:", error);
|
3487
3508
|
}
|
3488
3509
|
};
|
@@ -3514,9 +3535,9 @@ function TockenizPay() {
|
|
3514
3535
|
e.preventDefault();
|
3515
3536
|
e.stopPropagation();
|
3516
3537
|
const { value } = e.target;
|
3517
|
-
let cardtyp =
|
3538
|
+
let cardtyp = (0, import_credit_card_type.default)(value)[0];
|
3518
3539
|
const formattedValue = formatCreditCardNumber(value, cardtyp == null ? void 0 : cardtyp.type);
|
3519
|
-
setCardTypeDetail(
|
3540
|
+
setCardTypeDetail((0, import_credit_card_type.default)(value)[0]);
|
3520
3541
|
console.log(formattedValue);
|
3521
3542
|
if (value.match(/[a-zA-Z]/)) {
|
3522
3543
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -3618,8 +3639,7 @@ function TockenizPay() {
|
|
3618
3639
|
}
|
3619
3640
|
return "";
|
3620
3641
|
}
|
3621
|
-
|
3622
|
-
return /* @__PURE__ */ React13.createElement("div", null, /* @__PURE__ */ React13.createElement(ToastContainer3, null), /* @__PURE__ */ React13.createElement(
|
3642
|
+
return /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement(import_react_toastify5.ToastContainer, null), /* @__PURE__ */ import_react13.default.createElement(
|
3623
3643
|
"button",
|
3624
3644
|
{
|
3625
3645
|
className: "export-btn mt-4",
|
@@ -3627,8 +3647,8 @@ function TockenizPay() {
|
|
3627
3647
|
onClick: () => handlePaymentClick()
|
3628
3648
|
},
|
3629
3649
|
"TokenizePay"
|
3630
|
-
), /* @__PURE__ */
|
3631
|
-
|
3650
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3651
|
+
import_react_bootstrap8.Modal,
|
3632
3652
|
{
|
3633
3653
|
show: state.show,
|
3634
3654
|
onHide: () => setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
@@ -3636,8 +3656,8 @@ function TockenizPay() {
|
|
3636
3656
|
})),
|
3637
3657
|
centered: true
|
3638
3658
|
},
|
3639
|
-
/* @__PURE__ */
|
3640
|
-
/* @__PURE__ */
|
3659
|
+
/* @__PURE__ */ import_react13.default.createElement(import_react_bootstrap8.Modal.Header, { closeButton: true }),
|
3660
|
+
/* @__PURE__ */ import_react13.default.createElement(import_react_bootstrap8.Modal.Body, null, /* @__PURE__ */ import_react13.default.createElement("div", { className: "payment-popup" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "row" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "" }, /* @__PURE__ */ import_react13.default.createElement("div", { id: "Checkout", className: "inline" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react13.default.createElement("h1", null, "Pay")), /* @__PURE__ */ import_react13.default.createElement("form", { id: "PaymentForm", className: "payment-form" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", null, "Name on card"), /* @__PURE__ */ import_react13.default.createElement(
|
3641
3661
|
"input",
|
3642
3662
|
{
|
3643
3663
|
id: "NameOnCard",
|
@@ -3646,13 +3666,13 @@ function TockenizPay() {
|
|
3646
3666
|
maxLength: 100,
|
3647
3667
|
placeholder: "Name"
|
3648
3668
|
}
|
3649
|
-
), /* @__PURE__ */
|
3669
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3650
3670
|
"span",
|
3651
3671
|
{
|
3652
3672
|
id: "NameOnCard-error",
|
3653
3673
|
style: { color: "red", display: "none" }
|
3654
3674
|
}
|
3655
|
-
)), /* @__PURE__ */
|
3675
|
+
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3656
3676
|
"input",
|
3657
3677
|
{
|
3658
3678
|
"data-token": "card_number",
|
@@ -3663,7 +3683,7 @@ function TockenizPay() {
|
|
3663
3683
|
placeholder: "0000 0000 0000 0000",
|
3664
3684
|
onChange: handleCardNumberChange
|
3665
3685
|
}
|
3666
|
-
), state.error && /* @__PURE__ */
|
3686
|
+
), state.error && /* @__PURE__ */ import_react13.default.createElement("div", { style: { color: "red" } }, state.error)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3667
3687
|
"input",
|
3668
3688
|
{
|
3669
3689
|
"data-token": "exp_month",
|
@@ -3674,14 +3694,14 @@ function TockenizPay() {
|
|
3674
3694
|
maxLength: 2,
|
3675
3695
|
onChange: (e) => handleMonthChange(e)
|
3676
3696
|
}
|
3677
|
-
), isValidMonth && /* @__PURE__ */
|
3697
|
+
), isValidMonth && /* @__PURE__ */ import_react13.default.createElement(
|
3678
3698
|
"span",
|
3679
3699
|
{
|
3680
3700
|
id: "card_number-error",
|
3681
3701
|
style: { color: "red", fontSize: "15px" }
|
3682
3702
|
},
|
3683
3703
|
"Please write month only 1 to 12"
|
3684
|
-
)), /* @__PURE__ */
|
3704
|
+
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "expiry-date-group form-group" }, /* @__PURE__ */ import_react13.default.createElement(
|
3685
3705
|
"input",
|
3686
3706
|
{
|
3687
3707
|
"data-token": "exp_year",
|
@@ -3692,7 +3712,7 @@ function TockenizPay() {
|
|
3692
3712
|
value: state.year,
|
3693
3713
|
onChange: (e) => handleYearChange(e)
|
3694
3714
|
}
|
3695
|
-
), state.yearError && /* @__PURE__ */
|
3715
|
+
), state.yearError && /* @__PURE__ */ import_react13.default.createElement("span", { id: "exp_year-error", style: { color: "red" } }, state.yearError)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "security-code-group form-group" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react13.default.createElement(
|
3696
3716
|
"input",
|
3697
3717
|
{
|
3698
3718
|
"data-token": "cvv",
|
@@ -3703,7 +3723,7 @@ function TockenizPay() {
|
|
3703
3723
|
placeholder: "CVV",
|
3704
3724
|
onChange: (e) => handleCVVChange(e)
|
3705
3725
|
}
|
3706
|
-
), /* @__PURE__ */
|
3726
|
+
), /* @__PURE__ */ import_react13.default.createElement("i", { id: "cvc", className: "fa fa-question-circle" }), state.cvvError && /* @__PURE__ */ import_react13.default.createElement("span", { id: "cvv-error", style: { color: "red" } }, state.cvvError)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "cvc-preview-container two-card hide" }, /* @__PURE__ */ import_react13.default.createElement("div", { className: "amex-cvc-preview" }), /* @__PURE__ */ import_react13.default.createElement("div", { className: "visa-mc-dis-cvc-preview" }))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "zip-code-group form-group" }, /* @__PURE__ */ import_react13.default.createElement("label", null, "Postal code"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "input-container" }, /* @__PURE__ */ import_react13.default.createElement(
|
3707
3727
|
"input",
|
3708
3728
|
{
|
3709
3729
|
id: "ZIPCode",
|
@@ -3715,7 +3735,7 @@ function TockenizPay() {
|
|
3715
3735
|
value: state.zip,
|
3716
3736
|
onChange: (e) => handleZIP(e)
|
3717
3737
|
}
|
3718
|
-
), /* @__PURE__ */
|
3738
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3719
3739
|
"a",
|
3720
3740
|
{
|
3721
3741
|
tabIndex: 0,
|
@@ -3725,15 +3745,15 @@ function TockenizPay() {
|
|
3725
3745
|
"data-placement": "left",
|
3726
3746
|
"data-content": "Enter the ZIP/Postal code for your credit card billing address."
|
3727
3747
|
},
|
3728
|
-
/* @__PURE__ */
|
3729
|
-
), /* @__PURE__ */
|
3748
|
+
/* @__PURE__ */ import_react13.default.createElement("i", { className: "fa fa-question-circle" })
|
3749
|
+
), /* @__PURE__ */ import_react13.default.createElement(
|
3730
3750
|
"span",
|
3731
3751
|
{
|
3732
3752
|
id: "ZIPCode-error",
|
3733
3753
|
style: { color: "red", display: "none" }
|
3734
3754
|
},
|
3735
3755
|
"This field is required"
|
3736
|
-
))), /* @__PURE__ */
|
3756
|
+
))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "form-group top-amnt" }, /* @__PURE__ */ import_react13.default.createElement("div", null, /* @__PURE__ */ import_react13.default.createElement("label", null, "Payment amount"), /* @__PURE__ */ import_react13.default.createElement("div", { className: "amount-placeholder" }, /* @__PURE__ */ import_react13.default.createElement(
|
3737
3757
|
"input",
|
3738
3758
|
{
|
3739
3759
|
id: "Amount",
|
@@ -3745,7 +3765,7 @@ function TockenizPay() {
|
|
3745
3765
|
onChange: (e) => handleAmount(e),
|
3746
3766
|
onBlur: handleAmountBlur
|
3747
3767
|
}
|
3748
|
-
))), /* @__PURE__ */
|
3768
|
+
))), /* @__PURE__ */ import_react13.default.createElement("div", { className: "card-row" }, /* @__PURE__ */ import_react13.default.createElement("span", { className: "visa" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "mastercard" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "amex" }), /* @__PURE__ */ import_react13.default.createElement("span", { className: "discover" }))), /* @__PURE__ */ import_react13.default.createElement(
|
3749
3769
|
"button",
|
3750
3770
|
{
|
3751
3771
|
type: "button",
|
@@ -3754,7 +3774,7 @@ function TockenizPay() {
|
|
3754
3774
|
className: "btn btn-block btn-success submit-button"
|
3755
3775
|
},
|
3756
3776
|
"Submit"
|
3757
|
-
)), /* @__PURE__ */
|
3777
|
+
)), /* @__PURE__ */ import_react13.default.createElement("div", { className: "powerd-by-part" }, /* @__PURE__ */ import_react13.default.createElement(
|
3758
3778
|
"svg",
|
3759
3779
|
{
|
3760
3780
|
xmlns: "http://www.w3.org/2000/svg",
|
@@ -3762,14 +3782,14 @@ function TockenizPay() {
|
|
3762
3782
|
height: "20",
|
3763
3783
|
viewBox: "0 0 26 26"
|
3764
3784
|
},
|
3765
|
-
/* @__PURE__ */
|
3785
|
+
/* @__PURE__ */ import_react13.default.createElement(
|
3766
3786
|
"path",
|
3767
3787
|
{
|
3768
3788
|
fill: "currentColor",
|
3769
3789
|
d: "M23.633 5.028a1.074 1.074 0 0 0-.777-.366c-2.295-.06-5.199-2.514-7.119-3.477C14.551.592 13.768.201 13.18.098a1.225 1.225 0 0 0-.36.001c-.588.103-1.371.494-2.556 1.087c-1.92.962-4.824 3.416-7.119 3.476a1.08 1.08 0 0 0-.778.366a1.167 1.167 0 0 0-.291.834c.493 10.023 4.088 16.226 10.396 19.831c.164.093.346.141.527.141s.363-.048.528-.141c6.308-3.605 9.902-9.808 10.396-19.831a1.161 1.161 0 0 0-.29-.834zM18.617 8.97l-5.323 7.855c-.191.282-.491.469-.788.469c-.298 0-.629-.163-.838-.372l-3.752-3.753a.656.656 0 0 1 0-.926l.927-.929a.658.658 0 0 1 .926 0l2.44 2.44l4.239-6.257a.657.657 0 0 1 .91-.173l1.085.736a.657.657 0 0 1 .174.91z"
|
3770
3790
|
}
|
3771
3791
|
)
|
3772
|
-
), "Secure payments powered by Fractal", /* @__PURE__ */
|
3792
|
+
), "Secure payments powered by Fractal", /* @__PURE__ */ import_react13.default.createElement(
|
3773
3793
|
"img",
|
3774
3794
|
{
|
3775
3795
|
src: "https://ui.fractalpay.com/favicon.ico",
|
@@ -3781,25 +3801,25 @@ function TockenizPay() {
|
|
3781
3801
|
}
|
3782
3802
|
|
3783
3803
|
// src/app/components/Payment/GetPaymentDynamic.tsx
|
3784
|
-
|
3785
|
-
|
3804
|
+
var import_react15 = __toESM(require("react"), 1);
|
3805
|
+
var import_react_bootstrap9 = require("react-bootstrap");
|
3786
3806
|
|
3787
3807
|
// src/app/components/Loader/MyLoadingAnimation.tsx
|
3788
|
-
|
3808
|
+
var import_react14 = __toESM(require("react"), 1);
|
3789
3809
|
function MyLoadingAnimation() {
|
3790
|
-
return /* @__PURE__ */
|
3810
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react14.default.Fragment, null, /* @__PURE__ */ import_react14.default.createElement(LoaderStyle_default, null), /* @__PURE__ */ import_react14.default.createElement("div", { className: "loading-animation" }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "spinner" })));
|
3791
3811
|
}
|
3792
3812
|
|
3793
3813
|
// src/app/components/Payment/GetPaymentDynamic.tsx
|
3794
3814
|
function GetPaymentDynamic(props) {
|
3795
3815
|
const { amount, fractalpayClientKey, orderID } = props;
|
3796
|
-
const [loading, setLoading] =
|
3797
|
-
const [show, setShow] =
|
3798
|
-
const [iframeLoaded, setIframeLoaded] =
|
3799
|
-
const [phoneNumber, setPhoneNumber] =
|
3800
|
-
const [errorMessage, setErrorMessage] =
|
3801
|
-
const [submitClicked, setSubmitClicked] =
|
3802
|
-
const [isValidNumber, setIsValidNumber] =
|
3816
|
+
const [loading, setLoading] = (0, import_react15.useState)(false);
|
3817
|
+
const [show, setShow] = (0, import_react15.useState)(false);
|
3818
|
+
const [iframeLoaded, setIframeLoaded] = (0, import_react15.useState)(false);
|
3819
|
+
const [phoneNumber, setPhoneNumber] = (0, import_react15.useState)("");
|
3820
|
+
const [errorMessage, setErrorMessage] = (0, import_react15.useState)("");
|
3821
|
+
const [submitClicked, setSubmitClicked] = (0, import_react15.useState)(false);
|
3822
|
+
const [isValidNumber, setIsValidNumber] = (0, import_react15.useState)(true);
|
3803
3823
|
const handleClose = () => {
|
3804
3824
|
setIframeLoaded(false);
|
3805
3825
|
setTimeout(() => {
|
@@ -3814,7 +3834,7 @@ function GetPaymentDynamic(props) {
|
|
3814
3834
|
console.error("Fractalpay client key is missing or empty.");
|
3815
3835
|
}
|
3816
3836
|
};
|
3817
|
-
|
3837
|
+
(0, import_react15.useEffect)(() => {
|
3818
3838
|
if (!fractalpayClientKey) {
|
3819
3839
|
console.error("Fractalpay client key is missing or empty.");
|
3820
3840
|
}
|
@@ -3837,7 +3857,7 @@ function GetPaymentDynamic(props) {
|
|
3837
3857
|
const handleLoad = () => {
|
3838
3858
|
setLoading(false);
|
3839
3859
|
};
|
3840
|
-
|
3860
|
+
(0, import_react15.useEffect)(() => {
|
3841
3861
|
const messageListener = (event) => {
|
3842
3862
|
var _a, _b;
|
3843
3863
|
const response = (_b = (_a = event == null ? void 0 : event.data) == null ? void 0 : _a.other) == null ? void 0 : _b.data;
|
@@ -3852,7 +3872,7 @@ function GetPaymentDynamic(props) {
|
|
3852
3872
|
window.removeEventListener("message", messageListener);
|
3853
3873
|
};
|
3854
3874
|
}, []);
|
3855
|
-
return /* @__PURE__ */
|
3875
|
+
return /* @__PURE__ */ import_react15.default.createElement("div", null, /* @__PURE__ */ import_react15.default.createElement("button", { className: "paymentBtn", onClick: handleShow }, "Pay"), /* @__PURE__ */ import_react15.default.createElement(import_react_bootstrap9.Modal, { show: show && iframeLoaded, id: "modal-pay", className: "modal-lg", onHide: handleClose }, /* @__PURE__ */ import_react15.default.createElement(import_react_bootstrap9.Modal.Header, { closeButton: true }), /* @__PURE__ */ import_react15.default.createElement(import_react_bootstrap9.Modal.Body, null, loading && /* @__PURE__ */ import_react15.default.createElement(MyLoadingAnimation, null), /* @__PURE__ */ import_react15.default.createElement(
|
3856
3876
|
"iframe",
|
3857
3877
|
{
|
3858
3878
|
src: `${baseUrl}widget-form/${amount}?fractalpay_public_key=${fractalpayClientKey}&order_id=${orderID}`,
|
@@ -3863,7 +3883,8 @@ function GetPaymentDynamic(props) {
|
|
3863
3883
|
}
|
3864
3884
|
))));
|
3865
3885
|
}
|
3866
|
-
export
|
3886
|
+
// Annotate the CommonJS export names for ESM import in node:
|
3887
|
+
0 && (module.exports = {
|
3867
3888
|
CompletedTransactions,
|
3868
3889
|
GetPaymentDynamic,
|
3869
3890
|
Payment,
|
@@ -3873,4 +3894,4 @@ export {
|
|
3873
3894
|
RequestPaymentonClick,
|
3874
3895
|
RqstPaymntInputField,
|
3875
3896
|
TockenizPay
|
3876
|
-
};
|
3897
|
+
});
|