IO-2920 Update checkfee method to get CC amount based on new information.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<babeledit_project version="1.2" be_version="2.7.1">
|
||||
<babeledit_project be_version="2.7.1" version="1.2">
|
||||
<!--
|
||||
|
||||
BabelEdit project file
|
||||
@@ -20702,6 +20702,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>time</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>total</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -21874,6 +21895,48 @@
|
||||
<folder_node>
|
||||
<name>columns</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>average_human_readable</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>average_value</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>duration</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -31809,6 +31872,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>tlos_ind</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>towin</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -36358,6 +36442,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>total_repairs_cash_discount</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>total_sales</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -133,11 +133,27 @@ export function JobTotalsTableTotals({ bodyshop, job }) {
|
||||
]
|
||||
}),
|
||||
|
||||
...(bodyshop.intellipay_config?.enable_cash_discount
|
||||
? [
|
||||
{
|
||||
key: t("jobs.labels.total_repairs_cash_discount"),
|
||||
total: job.job_totals.totals.total_repairs,
|
||||
bold: true
|
||||
},
|
||||
{
|
||||
key: t("jobs.labels.total_repairs"),
|
||||
render: <JobTotalsCashDiscount amountDinero={job.job_totals.totals.total_repairs} />,
|
||||
bold: true
|
||||
}
|
||||
]
|
||||
: [
|
||||
{
|
||||
key: t("jobs.labels.total_repairs"),
|
||||
total: job.job_totals.totals.total_repairs,
|
||||
bold: true
|
||||
},
|
||||
}
|
||||
]),
|
||||
|
||||
{
|
||||
key: t("jobs.fields.ded_amt"),
|
||||
total: job.job_totals.totals.custPayable.deductible
|
||||
|
||||
@@ -9,8 +9,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobTotalsCashDiscount);
|
||||
|
||||
export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
||||
@@ -23,14 +22,16 @@ export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
||||
let response;
|
||||
try {
|
||||
response = await axios.post("/intellipay/checkfee", {
|
||||
bodyshop: { id: bodyshop.id, imexshopid: bodyshop.imexshopid },
|
||||
bodyshop: { id: bodyshop.id, imexshopid: bodyshop.imexshopid, state: bodyshop.state },
|
||||
amount: Dinero(amountDinero).toFormat("0.00")
|
||||
});
|
||||
|
||||
if (response?.data?.error) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: response.data?.error || "Error encountered contacting IntelliPay service."
|
||||
message:
|
||||
response.data?.error ||
|
||||
"Error encountered when contacting IntelliPay service to determine cash discounted price."
|
||||
});
|
||||
} else {
|
||||
setFee(response.data?.fee || 0);
|
||||
@@ -38,7 +39,9 @@ export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
||||
} catch (error) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: error.response?.data?.error || "Error encountered contacting IntelliPay service."
|
||||
message:
|
||||
error.response?.data?.error ||
|
||||
"Error encountered when contacting IntelliPay service to determine cash discounted price."
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -2114,6 +2114,7 @@
|
||||
"total_cust_payable": "Total Customer Amount Payable",
|
||||
"total_cust_payable_cash_discount": "$t(jobs.labels.total_cust_payable) (Cash Discounted)",
|
||||
"total_repairs": "Total Repairs",
|
||||
"total_repairs_cash_discount": "Total Repairs (Cash Discounted)",
|
||||
"total_sales": "Total Sales",
|
||||
"total_sales_tax": "Total Sales Tax",
|
||||
"totals": "Totals",
|
||||
|
||||
@@ -2114,6 +2114,7 @@
|
||||
"total_cust_payable": "",
|
||||
"total_cust_payable_cash_discount": "",
|
||||
"total_repairs": "",
|
||||
"total_repairs_cash_discount": "",
|
||||
"total_sales": "",
|
||||
"total_sales_tax": "",
|
||||
"totals": "",
|
||||
|
||||
@@ -2114,6 +2114,7 @@
|
||||
"total_cust_payable": "",
|
||||
"total_cust_payable_cash_discount": "",
|
||||
"total_repairs": "",
|
||||
"total_repairs_cash_discount": "",
|
||||
"total_sales": "",
|
||||
"total_sales_tax": "",
|
||||
"totals": "",
|
||||
|
||||
@@ -14,7 +14,7 @@ require("dotenv").config({
|
||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
||||
});
|
||||
|
||||
const domain = process.env.NODE_ENV ? "secure" : "test";
|
||||
const domain = process.env.NODE_ENV ? "secure" : "secure";
|
||||
|
||||
const { SecretsManagerClient, GetSecretValueCommand } = require("@aws-sdk/client-secrets-manager");
|
||||
const { InstanceRegion } = require("../utils/instanceMgr");
|
||||
@@ -151,6 +151,7 @@ exports.generate_payment_url = async (req, res) => {
|
||||
|
||||
//Reference: https://intellipay.com/dist/webapi26.html#operation/fee
|
||||
exports.checkfee = async (req, res) => {
|
||||
// Requires amount, bodyshop.imexshopid, and state? to get data.
|
||||
logger.log("intellipay-fee-check", "DEBUG", req.user?.email, null, null);
|
||||
|
||||
//If there's no amount, there can't be a fee. Skip the call.
|
||||
@@ -171,7 +172,12 @@ exports.checkfee = async (req, res) => {
|
||||
method: "fee",
|
||||
...shopCredentials,
|
||||
amount: req.body.amount,
|
||||
paymenttype: `"CC"`
|
||||
paymenttype: `CC`,
|
||||
cardnum: "4111111111111111", //Not needed per documentation, but incorrect values come back without it.
|
||||
state:
|
||||
req.body.bodyshop?.state && req.body.bodyshop.state?.length === 2
|
||||
? req.body.bodyshop.state.toUpperCase()
|
||||
: "ZZ" //Same as above
|
||||
},
|
||||
{ sort: false } //ColdFusion Query Strings depend on order. This preserves it.
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user