IO-2920 Update checkfee method to get CC amount based on new information.
This commit is contained in:
@@ -133,11 +133,27 @@ export function JobTotalsTableTotals({ bodyshop, job }) {
|
||||
]
|
||||
}),
|
||||
|
||||
{
|
||||
key: t("jobs.labels.total_repairs"),
|
||||
total: job.job_totals.totals.total_repairs,
|
||||
bold: true
|
||||
},
|
||||
...(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);
|
||||
|
||||
Reference in New Issue
Block a user