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
|
BabelEdit project file
|
||||||
@@ -20702,6 +20702,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</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>
|
<concept_node>
|
||||||
<name>total</name>
|
<name>total</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -21874,6 +21895,48 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>columns</name>
|
<name>columns</name>
|
||||||
<children>
|
<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>
|
<concept_node>
|
||||||
<name>duration</name>
|
<name>duration</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -31809,6 +31872,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</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>
|
<concept_node>
|
||||||
<name>towin</name>
|
<name>towin</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -36358,6 +36442,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</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>
|
<concept_node>
|
||||||
<name>total_sales</name>
|
<name>total_sales</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<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"),
|
? [
|
||||||
total: job.job_totals.totals.total_repairs,
|
{
|
||||||
bold: true
|
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"),
|
key: t("jobs.fields.ded_amt"),
|
||||||
total: job.job_totals.totals.custPayable.deductible
|
total: job.job_totals.totals.custPayable.deductible
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import { selectBodyshop } from "../../redux/user/user.selectors";
|
|||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop
|
bodyshop: selectBodyshop
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({});
|
||||||
});
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobTotalsCashDiscount);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobTotalsCashDiscount);
|
||||||
|
|
||||||
export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
||||||
@@ -23,14 +22,16 @@ export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
|||||||
let response;
|
let response;
|
||||||
try {
|
try {
|
||||||
response = await axios.post("/intellipay/checkfee", {
|
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")
|
amount: Dinero(amountDinero).toFormat("0.00")
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response?.data?.error) {
|
if (response?.data?.error) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "error",
|
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 {
|
} else {
|
||||||
setFee(response.data?.fee || 0);
|
setFee(response.data?.fee || 0);
|
||||||
@@ -38,7 +39,9 @@ export function JobTotalsCashDiscount({ bodyshop, amountDinero }) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
notification.open({
|
notification.open({
|
||||||
type: "error",
|
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 {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ require("dotenv").config({
|
|||||||
path: path.resolve(process.cwd(), `.env.${process.env.NODE_ENV || "development"}`)
|
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 { SecretsManagerClient, GetSecretValueCommand } = require("@aws-sdk/client-secrets-manager");
|
||||||
const { InstanceRegion } = require("../utils/instanceMgr");
|
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
|
//Reference: https://intellipay.com/dist/webapi26.html#operation/fee
|
||||||
exports.checkfee = async (req, res) => {
|
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);
|
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.
|
//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",
|
method: "fee",
|
||||||
...shopCredentials,
|
...shopCredentials,
|
||||||
amount: req.body.amount,
|
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.
|
{ sort: false } //ColdFusion Query Strings depend on order. This preserves it.
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user