@fractalpay/fractalpay-next-dev 0.0.249 → 0.0.250
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +53 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var require_package = __commonJS({
|
|
|
39
39
|
"package.json"(exports, module) {
|
|
40
40
|
module.exports = {
|
|
41
41
|
name: "@fractalpay/fractalpay-next-dev",
|
|
42
|
-
version: "0.0.
|
|
42
|
+
version: "0.0.250",
|
|
43
43
|
private: false,
|
|
44
44
|
type: "module",
|
|
45
45
|
scripts: {
|
|
@@ -1016,9 +1016,10 @@ function RequestPayment(props) {
|
|
|
1016
1016
|
let cash_discount = CalculateCashDiscount(props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge);
|
|
1017
1017
|
setCashDiscount(cash_discount);
|
|
1018
1018
|
}
|
|
1019
|
-
}, [props == null ? void 0 : props.pass_fee]);
|
|
1019
|
+
}, [props == null ? void 0 : props.pass_fee, show]);
|
|
1020
1020
|
const handleClose = () => {
|
|
1021
1021
|
setShow(false);
|
|
1022
|
+
setCashDiscount(0);
|
|
1022
1023
|
setErrors({});
|
|
1023
1024
|
};
|
|
1024
1025
|
const handleShow = () => setShow(true);
|
|
@@ -2416,6 +2417,19 @@ position:relative;
|
|
|
2416
2417
|
border: 0;
|
|
2417
2418
|
border-right: 1px solid #dee2e6;
|
|
2418
2419
|
}
|
|
2420
|
+
|
|
2421
|
+
.frac-fee-text{
|
|
2422
|
+
display: block;
|
|
2423
|
+
padding: 10px 0 4px;
|
|
2424
|
+
font-family: 'IBM Plex Mono', monospace !important;
|
|
2425
|
+
color: #727272 !important;
|
|
2426
|
+
font-size: 12px;
|
|
2427
|
+
line-height: 1.4;
|
|
2428
|
+
}
|
|
2429
|
+
.frac-fee-amount{
|
|
2430
|
+
color: #c62828 !important;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2419
2433
|
` });
|
|
2420
2434
|
}
|
|
2421
2435
|
|
|
@@ -3483,6 +3497,8 @@ function GetPaymentPage(props) {
|
|
|
3483
3497
|
const [selectedCard, setSelectedCard] = useState4();
|
|
3484
3498
|
const [selectedReader, setSelectedReader] = useState4(void 0);
|
|
3485
3499
|
const [cashDiscount, setCashDiscount] = useState4(Number(props == null ? void 0 : props.amount));
|
|
3500
|
+
const [bankAmount, setBankAmount] = useState4(Number(props == null ? void 0 : props.amount));
|
|
3501
|
+
const [bankFeeAmount, setBankFeeAmount] = useState4(0);
|
|
3486
3502
|
const [paymentData, setPaymentData] = useState4();
|
|
3487
3503
|
let [tranId, setTranId] = useState4("");
|
|
3488
3504
|
const tokenizerRef = useRef3(null);
|
|
@@ -3517,7 +3533,25 @@ function GetPaymentPage(props) {
|
|
|
3517
3533
|
useEffect8(() => {
|
|
3518
3534
|
if (show) {
|
|
3519
3535
|
let cash_discount = CalculateCashDiscount(props == null ? void 0 : props.amount, (props == null ? void 0 : props.surcharge) || 0);
|
|
3536
|
+
let bankAmount2 = cash_discount;
|
|
3537
|
+
if ((props == null ? void 0 : props.bankFeeAmount) && Number(props == null ? void 0 : props.bankFeeAmount) > 0) {
|
|
3538
|
+
bankAmount2 = Number(cash_discount) + Number(props == null ? void 0 : props.bankFeeAmount);
|
|
3539
|
+
}
|
|
3540
|
+
setBankAmount(bankAmount2);
|
|
3520
3541
|
setCashDiscount(cash_discount);
|
|
3542
|
+
const cardFeeAmount = Number((Number(props == null ? void 0 : props.amount) - Number(cash_discount || 0)).toFixed(2));
|
|
3543
|
+
const bankFeeAmount2 = Number((props == null ? void 0 : props.bankFeeAmount) || 0);
|
|
3544
|
+
const bankSavingsAmount = Math.max(bankFeeAmount2 > 0 ? cardFeeAmount - bankFeeAmount2 : cardFeeAmount, 0);
|
|
3545
|
+
const bankSavingsText = bankSavingsAmount > 0 ? `Save ${formatUSD(bankSavingsAmount.toFixed(2))}` : "";
|
|
3546
|
+
setBankFeeAmount(bankFeeAmount2);
|
|
3547
|
+
console.log({
|
|
3548
|
+
cash_discount,
|
|
3549
|
+
bankAmount: bankAmount2,
|
|
3550
|
+
cardFeeAmount,
|
|
3551
|
+
bankFeeAmount: bankFeeAmount2,
|
|
3552
|
+
bankSavingsAmount,
|
|
3553
|
+
bankSavingsText
|
|
3554
|
+
});
|
|
3521
3555
|
}
|
|
3522
3556
|
}, [show, props == null ? void 0 : props.pass_fee, props == null ? void 0 : props.amount, props == null ? void 0 : props.surcharge]);
|
|
3523
3557
|
const handleClose = () => {
|
|
@@ -3857,7 +3891,7 @@ function GetPaymentPage(props) {
|
|
|
3857
3891
|
routing_number: achData == null ? void 0 : achData.routingNumber,
|
|
3858
3892
|
bank_name: achData == null ? void 0 : achData.bankName,
|
|
3859
3893
|
account_type: achData == null ? void 0 : achData.accountType,
|
|
3860
|
-
amount: String(
|
|
3894
|
+
amount: String(bankAmount || 0),
|
|
3861
3895
|
isSaveAch: saveACHinfo,
|
|
3862
3896
|
customer_id: props == null ? void 0 : props.customerId,
|
|
3863
3897
|
order_id: props == null ? void 0 : props.orderID,
|
|
@@ -3939,11 +3973,11 @@ function GetPaymentPage(props) {
|
|
|
3939
3973
|
let amount = String(props == null ? void 0 : props.amount);
|
|
3940
3974
|
let card_id = selectedCard == null ? void 0 : selectedCard.id;
|
|
3941
3975
|
let card_type = selectedCard == null ? void 0 : selectedCard.card_type;
|
|
3942
|
-
if (fractalpayPublicKey && order_id && amount &&
|
|
3976
|
+
if (fractalpayPublicKey && order_id && amount && bankAmount) {
|
|
3943
3977
|
if (customer_id) {
|
|
3944
3978
|
if (card_id) {
|
|
3945
3979
|
let chargeobj = __spreadValues({
|
|
3946
|
-
amount: card_type === "Bank" ? `${
|
|
3980
|
+
amount: card_type === "Bank" ? `${bankAmount}` : amount,
|
|
3947
3981
|
order_id,
|
|
3948
3982
|
customer_id,
|
|
3949
3983
|
card_id,
|
|
@@ -4182,22 +4216,21 @@ function GetPaymentPage(props) {
|
|
|
4182
4216
|
/* @__PURE__ */ jsx19("div", { className: "pay-amount-conatiner", children: /* @__PURE__ */ jsx19("small", { className: "pay-payment-amount", children: "Select paymet type" }) }),
|
|
4183
4217
|
/* @__PURE__ */ jsxs11("div", { className: "frac-card-bank-radio-main", children: [
|
|
4184
4218
|
/* @__PURE__ */ jsx19(CardBankRadio, { label: "Card", amount: (_a = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _a.toFixed(2), value: "card", onChange: handletabchange, activetab }),
|
|
4185
|
-
(paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Bank", amount: (_b = Number(
|
|
4219
|
+
(paymentData == null ? void 0 : paymentData.isSkyFiAccount) && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Bank", amount: (_b = Number(bankAmount)) == null ? void 0 : _b.toFixed(2), value: "ach", onChange: handletabchange, activetab }),
|
|
4186
4220
|
(props == null ? void 0 : props.isReader) && (paymentData == null ? void 0 : paymentData.paymentDeviceList) && ((_c = paymentData == null ? void 0 : paymentData.paymentDeviceList) == null ? void 0 : _c.length) > 0 && /* @__PURE__ */ jsx19(CardBankRadio, { label: "Reader", amount: (_d = Number(props == null ? void 0 : props.amount)) == null ? void 0 : _d.toFixed(2), value: "reader", onChange: handletabchange, activetab })
|
|
4187
4221
|
] }),
|
|
4188
|
-
!loading &&
|
|
4189
|
-
/* @__PURE__ */ jsxs11("small", { children: [
|
|
4190
|
-
|
|
4191
|
-
"
|
|
4222
|
+
!loading && /* @__PURE__ */ jsxs11("div", { className: "", children: [
|
|
4223
|
+
activetab == "ach" && bankFeeAmount > 0 && /* @__PURE__ */ jsxs11("small", { className: "frac-fee-text", children: [
|
|
4224
|
+
"There is a processing fee of ",
|
|
4225
|
+
/* @__PURE__ */ jsx19("span", { className: "frac-fee-amount", children: formatUSD(bankFeeAmount.toFixed(2)) }),
|
|
4226
|
+
"."
|
|
4192
4227
|
] }),
|
|
4193
|
-
/* @__PURE__ */
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
/* @__PURE__ */ jsx19("p", { children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) })
|
|
4200
|
-
] }) : null)
|
|
4228
|
+
(activetab === "card" || activetab === "reader") && (props == null ? void 0 : props.pass_fee) && cashDiscount && cashDiscount > 0 && /* @__PURE__ */ jsxs11("small", { className: "frac-fee-text", children: [
|
|
4229
|
+
"Credit cards include a fee amount of ",
|
|
4230
|
+
/* @__PURE__ */ jsx19("span", { className: "frac-fee-amount", children: formatUSD((Number(props.amount) - cashDiscount).toFixed(2)) }),
|
|
4231
|
+
"."
|
|
4232
|
+
] })
|
|
4233
|
+
] })
|
|
4201
4234
|
] })
|
|
4202
4235
|
] }),
|
|
4203
4236
|
/* @__PURE__ */ jsxs11("div", { className: "pay-conatiner-one-last", children: [
|
|
@@ -4502,7 +4535,7 @@ function GetPaymentPage(props) {
|
|
|
4502
4535
|
/* @__PURE__ */ jsx19(CardList, { listHeading: "Banks", paymentGateway: paymentData == null ? void 0 : paymentData.paymentGateway, ListItems: bankList, selectedCard, setSelectedCard, handleDeleteCard, otherButtonLabel: "Pay With Other Bank", otherButtonAction: () => {
|
|
4503
4536
|
setActiveinBank("form");
|
|
4504
4537
|
} }),
|
|
4505
|
-
/* @__PURE__ */ jsx19("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: formatUSD((_n = Number(
|
|
4538
|
+
/* @__PURE__ */ jsx19("div", { className: "form-group", style: { padding: "0" }, children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "0px" }, type: "submit", onClick: handlepayment, children: formatUSD((_n = Number(bankAmount)) == null ? void 0 : _n.toFixed(2)) }) })
|
|
4506
4539
|
] }) : /* @__PURE__ */ jsxs11("form", { id: "ACHPaymentForm", style: { textAlign: "start" }, onSubmit: submitFunc, autoComplete: "off", onKeyDown: (e) => {
|
|
4507
4540
|
if (e.key === "Enter" && loading2) {
|
|
4508
4541
|
e.preventDefault();
|
|
@@ -4630,7 +4663,7 @@ function GetPaymentPage(props) {
|
|
|
4630
4663
|
" to have my permission to charge this bank account for agreed upon purchases in the future."
|
|
4631
4664
|
] }) })
|
|
4632
4665
|
] }),
|
|
4633
|
-
/* @__PURE__ */ jsx19("div", { className: "form-group ", children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: formatUSD((_v = Number(
|
|
4666
|
+
/* @__PURE__ */ jsx19("div", { className: "form-group ", children: /* @__PURE__ */ jsx19("button", { className: "pay-button", style: { margin: "20px 0 0" }, type: "submit", children: formatUSD((_v = Number(bankAmount)) == null ? void 0 : _v.toFixed(2)) }) })
|
|
4634
4667
|
] })
|
|
4635
4668
|
] }),
|
|
4636
4669
|
/* @__PURE__ */ jsxs11("div", { id: "reader", style: { display: activetab === "reader" ? "block" : "none" }, className: "tabcontent", children: [
|