Additional fixes for exporting
This commit is contained in:
@@ -3255,6 +3255,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>md_payment_types</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>md_referral_sources</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -9,6 +9,7 @@ import { auth } from "../../firebase/firebase.utils";
|
||||
import { UPDATE_BILLS } from "../../graphql/bills.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import _ from "lodash";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -72,43 +73,49 @@ export function PayableExportAll({
|
||||
}
|
||||
|
||||
console.log("handleQbxml -> PartnerResponse", PartnerResponse);
|
||||
const failedTransactions = PartnerResponse.data.filter((r) => !r.success);
|
||||
const successfulTransactions = PartnerResponse.data.filter(
|
||||
(r) => r.success
|
||||
);
|
||||
if (failedTransactions.length > 0) {
|
||||
//Uh oh. At least one was no good.
|
||||
failedTransactions.map((ft) =>
|
||||
notification["error"]({
|
||||
message: t("bills.errors.exporting", {
|
||||
error: ft.errorMessage || "",
|
||||
}),
|
||||
})
|
||||
);
|
||||
}
|
||||
if (successfulTransactions.length > 0) {
|
||||
const billUpdateResponse = await updateBill({
|
||||
variables: {
|
||||
billIdList: successfulTransactions.map((st) => st.id),
|
||||
bill: {
|
||||
exported: true,
|
||||
exported_at: new Date(),
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!!!billUpdateResponse.errors) {
|
||||
notification["success"]({
|
||||
message: t("bills.successes.exported"),
|
||||
});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("bills.errors.exporting", {
|
||||
error: JSON.stringify(billUpdateResponse.error),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
const groupedData = _.groupBy(PartnerResponse.data, "id");
|
||||
const proms = [];
|
||||
Object.keys(groupedData).forEach((key) => {
|
||||
proms.push(
|
||||
(async () => {
|
||||
const failedTransactions = groupedData[key].filter((r) => !r.success);
|
||||
|
||||
if (failedTransactions.length > 0) {
|
||||
//Uh oh. At least one was no good.
|
||||
failedTransactions.map((ft) =>
|
||||
notification["error"]({
|
||||
message: t("bills.errors.exporting", {
|
||||
error: ft.errorMessage || "",
|
||||
}),
|
||||
})
|
||||
);
|
||||
} else {
|
||||
const billUpdateResponse = await updateBill({
|
||||
variables: {
|
||||
billIdList: [key],
|
||||
bill: {
|
||||
exported: true,
|
||||
exported_at: new Date(),
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!!!billUpdateResponse.errors) {
|
||||
notification["success"]({
|
||||
message: t("bills.successes.exported"),
|
||||
});
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("bills.errors.exporting", {
|
||||
error: JSON.stringify(billUpdateResponse.error),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
})()
|
||||
);
|
||||
});
|
||||
|
||||
await Promise.all(proms);
|
||||
if (!!completedCallback) completedCallback([]);
|
||||
if (!!loadingCallback) loadingCallback(false);
|
||||
setLoading(false);
|
||||
|
||||
@@ -107,16 +107,11 @@ export function PaymentFormComponent({
|
||||
]}
|
||||
>
|
||||
<Select disabled={disabled}>
|
||||
<Select.Option value="Visa">Visa</Select.Option>
|
||||
<Select.Option value="Master Card">Mastercard</Select.Option>
|
||||
<Select.Option value="American Express">
|
||||
American Express
|
||||
</Select.Option>
|
||||
<Select.Option value="Discover">Discover</Select.Option>
|
||||
<Select.Option value="Cash">Cash</Select.Option>
|
||||
<Select.Option value="Cheque">Cheque</Select.Option>
|
||||
<Select.Option value="Interac Debit">Interac Debit</Select.Option>
|
||||
<Select.Option value="EFT">EFT</Select.Option>
|
||||
{bodyshop.md_payment_types.map((v, idx) => (
|
||||
<Select.Option key={idx} value={v}>
|
||||
{v}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
@@ -570,6 +570,19 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
||||
}}
|
||||
</Form.List>
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
name={["md_payment_types"]}
|
||||
label={t("bodyshop.fields.md_payment_types")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="tags" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_classes"]}
|
||||
label={t("bodyshop.fields.md_classes")}
|
||||
|
||||
@@ -45,7 +45,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<strong>{t("bodyshop.labels.responsibilitycenters.title")}</strong>=
|
||||
<strong>{t("bodyshop.labels.responsibilitycenters.title")}</strong>
|
||||
<div>
|
||||
<strong>{t("bodyshop.labels.responsibilitycenters.costs")}</strong>
|
||||
<Form.List name={["md_responsibility_centers", "costs"]}>
|
||||
@@ -1350,7 +1350,6 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
<InputNumber precision={2} />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.ar")}
|
||||
@@ -1415,7 +1414,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.ar")}
|
||||
label={t("bodyshop.fields.responsibilitycenters.ap")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@@ -1475,6 +1474,68 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenters.refund")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "refund", "name"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountnumber")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "refund", "accountnumber"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountname")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "refund", "accountname"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountdesc")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "refund", "accountdesc"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label={t("bodyshop.fields.responsibilitycenter_accountitem")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
name={["md_responsibility_centers", "refund", "accountitem"]}
|
||||
>
|
||||
<Input />
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -78,6 +78,7 @@ export const QUERY_BODYSHOP = gql`
|
||||
default_adjustment_rate
|
||||
workingdays
|
||||
use_fippa
|
||||
md_payment_types
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
@@ -154,6 +155,7 @@ export const UPDATE_SHOP = gql`
|
||||
default_adjustment_rate
|
||||
workingdays
|
||||
use_fippa
|
||||
md_payment_types
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
|
||||
@@ -214,6 +214,7 @@
|
||||
"md_categories": "Categories",
|
||||
"md_classes": "Classes",
|
||||
"md_ins_cos": "Insurance Companies",
|
||||
"md_payment_types": "Payment Types",
|
||||
"md_referral_sources": "Referral Sources",
|
||||
"messaginglabel": "Messaging Preset Label",
|
||||
"messagingtext": "Messaging Preset Text",
|
||||
|
||||
@@ -214,6 +214,7 @@
|
||||
"md_categories": "",
|
||||
"md_classes": "",
|
||||
"md_ins_cos": "",
|
||||
"md_payment_types": "",
|
||||
"md_referral_sources": "",
|
||||
"messaginglabel": "",
|
||||
"messagingtext": "",
|
||||
|
||||
@@ -214,6 +214,7 @@
|
||||
"md_categories": "",
|
||||
"md_classes": "",
|
||||
"md_ins_cos": "",
|
||||
"md_payment_types": "",
|
||||
"md_referral_sources": "",
|
||||
"messaginglabel": "",
|
||||
"messagingtext": "",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."bodyshops" DROP COLUMN "md_payment_types";
|
||||
type: run_sql
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
cascade: false
|
||||
read_only: false
|
||||
sql: ALTER TABLE "public"."bodyshops" ADD COLUMN "md_payment_types" jsonb NOT
|
||||
NULL DEFAULT jsonb_build_array();
|
||||
type: run_sql
|
||||
@@ -0,0 +1,78 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- accountingconfig
|
||||
- address1
|
||||
- address2
|
||||
- appt_alt_transport
|
||||
- appt_colors
|
||||
- appt_length
|
||||
- bill_tax_rates
|
||||
- city
|
||||
- country
|
||||
- created_at
|
||||
- default_adjustment_rate
|
||||
- deliverchecklist
|
||||
- email
|
||||
- enforce_class
|
||||
- federal_tax_id
|
||||
- id
|
||||
- imexshopid
|
||||
- inhousevendorid
|
||||
- insurance_vendor_id
|
||||
- intakechecklist
|
||||
- logo_img_path
|
||||
- md_categories
|
||||
- md_classes
|
||||
- md_ins_cos
|
||||
- md_labor_rates
|
||||
- md_messaging_presets
|
||||
- md_notes_presets
|
||||
- md_order_statuses
|
||||
- md_parts_locations
|
||||
- md_rbac
|
||||
- md_referral_sources
|
||||
- md_responsibility_centers
|
||||
- md_ro_statuses
|
||||
- messagingservicesid
|
||||
- phone
|
||||
- prodtargethrs
|
||||
- production_config
|
||||
- region_config
|
||||
- schedule_end_time
|
||||
- schedule_start_time
|
||||
- scoreboard_target
|
||||
- shopname
|
||||
- shoprates
|
||||
- speedprint
|
||||
- ssbuckets
|
||||
- state
|
||||
- state_tax_id
|
||||
- stripe_acct_id
|
||||
- target_touchtime
|
||||
- template_header
|
||||
- textid
|
||||
- updated_at
|
||||
- use_fippa
|
||||
- workingdays
|
||||
- zip_post
|
||||
computed_fields: []
|
||||
filter:
|
||||
associations:
|
||||
bodyshop:
|
||||
associations:
|
||||
user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,79 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- accountingconfig
|
||||
- address1
|
||||
- address2
|
||||
- appt_alt_transport
|
||||
- appt_colors
|
||||
- appt_length
|
||||
- bill_tax_rates
|
||||
- city
|
||||
- country
|
||||
- created_at
|
||||
- default_adjustment_rate
|
||||
- deliverchecklist
|
||||
- email
|
||||
- enforce_class
|
||||
- federal_tax_id
|
||||
- id
|
||||
- imexshopid
|
||||
- inhousevendorid
|
||||
- insurance_vendor_id
|
||||
- intakechecklist
|
||||
- logo_img_path
|
||||
- md_categories
|
||||
- md_classes
|
||||
- md_ins_cos
|
||||
- md_labor_rates
|
||||
- md_messaging_presets
|
||||
- md_notes_presets
|
||||
- md_order_statuses
|
||||
- md_parts_locations
|
||||
- md_payment_types
|
||||
- md_rbac
|
||||
- md_referral_sources
|
||||
- md_responsibility_centers
|
||||
- md_ro_statuses
|
||||
- messagingservicesid
|
||||
- phone
|
||||
- prodtargethrs
|
||||
- production_config
|
||||
- region_config
|
||||
- schedule_end_time
|
||||
- schedule_start_time
|
||||
- scoreboard_target
|
||||
- shopname
|
||||
- shoprates
|
||||
- speedprint
|
||||
- ssbuckets
|
||||
- state
|
||||
- state_tax_id
|
||||
- stripe_acct_id
|
||||
- target_touchtime
|
||||
- template_header
|
||||
- textid
|
||||
- updated_at
|
||||
- use_fippa
|
||||
- workingdays
|
||||
- zip_post
|
||||
computed_fields: []
|
||||
filter:
|
||||
associations:
|
||||
bodyshop:
|
||||
associations:
|
||||
user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,71 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- accountingconfig
|
||||
- address1
|
||||
- address2
|
||||
- appt_alt_transport
|
||||
- appt_colors
|
||||
- appt_length
|
||||
- bill_tax_rates
|
||||
- city
|
||||
- country
|
||||
- created_at
|
||||
- default_adjustment_rate
|
||||
- deliverchecklist
|
||||
- email
|
||||
- enforce_class
|
||||
- federal_tax_id
|
||||
- id
|
||||
- inhousevendorid
|
||||
- insurance_vendor_id
|
||||
- intakechecklist
|
||||
- logo_img_path
|
||||
- md_categories
|
||||
- md_classes
|
||||
- md_ins_cos
|
||||
- md_labor_rates
|
||||
- md_messaging_presets
|
||||
- md_notes_presets
|
||||
- md_order_statuses
|
||||
- md_parts_locations
|
||||
- md_rbac
|
||||
- md_referral_sources
|
||||
- md_responsibility_centers
|
||||
- md_ro_statuses
|
||||
- phone
|
||||
- prodtargethrs
|
||||
- production_config
|
||||
- schedule_end_time
|
||||
- schedule_start_time
|
||||
- scoreboard_target
|
||||
- shopname
|
||||
- shoprates
|
||||
- speedprint
|
||||
- ssbuckets
|
||||
- state
|
||||
- state_tax_id
|
||||
- target_touchtime
|
||||
- updated_at
|
||||
- use_fippa
|
||||
- workingdays
|
||||
- zip_post
|
||||
filter:
|
||||
associations:
|
||||
bodyshop:
|
||||
associations:
|
||||
user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,72 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
- args:
|
||||
permission:
|
||||
columns:
|
||||
- accountingconfig
|
||||
- address1
|
||||
- address2
|
||||
- appt_alt_transport
|
||||
- appt_colors
|
||||
- appt_length
|
||||
- bill_tax_rates
|
||||
- city
|
||||
- country
|
||||
- created_at
|
||||
- default_adjustment_rate
|
||||
- deliverchecklist
|
||||
- email
|
||||
- enforce_class
|
||||
- federal_tax_id
|
||||
- id
|
||||
- inhousevendorid
|
||||
- insurance_vendor_id
|
||||
- intakechecklist
|
||||
- logo_img_path
|
||||
- md_categories
|
||||
- md_classes
|
||||
- md_ins_cos
|
||||
- md_labor_rates
|
||||
- md_messaging_presets
|
||||
- md_notes_presets
|
||||
- md_order_statuses
|
||||
- md_parts_locations
|
||||
- md_payment_types
|
||||
- md_rbac
|
||||
- md_referral_sources
|
||||
- md_responsibility_centers
|
||||
- md_ro_statuses
|
||||
- phone
|
||||
- prodtargethrs
|
||||
- production_config
|
||||
- schedule_end_time
|
||||
- schedule_start_time
|
||||
- scoreboard_target
|
||||
- shopname
|
||||
- shoprates
|
||||
- speedprint
|
||||
- ssbuckets
|
||||
- state
|
||||
- state_tax_id
|
||||
- target_touchtime
|
||||
- updated_at
|
||||
- use_fippa
|
||||
- workingdays
|
||||
- zip_post
|
||||
filter:
|
||||
associations:
|
||||
bodyshop:
|
||||
associations:
|
||||
user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -755,6 +755,7 @@ tables:
|
||||
- md_notes_presets
|
||||
- md_order_statuses
|
||||
- md_parts_locations
|
||||
- md_payment_types
|
||||
- md_rbac
|
||||
- md_referral_sources
|
||||
- md_responsibility_centers
|
||||
@@ -820,6 +821,7 @@ tables:
|
||||
- md_notes_presets
|
||||
- md_order_statuses
|
||||
- md_parts_locations
|
||||
- md_payment_types
|
||||
- md_rbac
|
||||
- md_referral_sources
|
||||
- md_responsibility_centers
|
||||
|
||||
@@ -37,10 +37,8 @@ exports.default = async (req, res) => {
|
||||
const isThreeTier = bodyshop.accountingconfig.tiers === 3;
|
||||
const twoTierPref = bodyshop.accountingconfig.twotierpref;
|
||||
|
||||
|
||||
const QbXmlToExecute = [];
|
||||
payments.map((i) => {
|
||||
|
||||
if (isThreeTier) {
|
||||
QbXmlToExecute.push({
|
||||
id: i.id,
|
||||
@@ -48,7 +46,7 @@ exports.default = async (req, res) => {
|
||||
qbxml: QbxmlReceivables.generateSourceCustomerQbxml(i.job, bodyshop), // Create the source customer.
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
QbXmlToExecute.push({
|
||||
id: i.id,
|
||||
okStatusCodes: ["0", "3100"],
|
||||
@@ -60,7 +58,7 @@ exports.default = async (req, res) => {
|
||||
twoTierPref
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
QbXmlToExecute.push({
|
||||
id: i.id,
|
||||
okStatusCodes: ["0", "3100"],
|
||||
@@ -73,8 +71,6 @@ exports.default = async (req, res) => {
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
|
||||
QbXmlToExecute.push({
|
||||
id: i.id,
|
||||
okStatusCodes: ["0"],
|
||||
@@ -91,49 +87,96 @@ exports.default = async (req, res) => {
|
||||
|
||||
const generatePayment = (payment) => {
|
||||
console.log("generatePayment -> payment", payment);
|
||||
const paymentQbxmlObj = {
|
||||
QBXML: {
|
||||
QBXMLMsgsRq: {
|
||||
"@onError": "continueOnError",
|
||||
ReceivePaymentAddRq: {
|
||||
ReceivePaymentAdd: {
|
||||
CustomerRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.accountingconfig.tiers === 3
|
||||
? `${generateSourceTier(payment.job)}:${generateOwnerTier(
|
||||
payment.job
|
||||
)}:${generateJobTier(payment.job)}`
|
||||
: `${generateOwnerTier(payment.job)}:${generateJobTier(
|
||||
payment.job
|
||||
)}`,
|
||||
let paymentQbxmlObj;
|
||||
if (payment.amount > 0) {
|
||||
paymentQbxmlObj = {
|
||||
QBXML: {
|
||||
QBXMLMsgsRq: {
|
||||
"@onError": "continueOnError",
|
||||
ReceivePaymentAddRq: {
|
||||
ReceivePaymentAdd: {
|
||||
CustomerRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.accountingconfig.tiers === 3
|
||||
? `${generateSourceTier(payment.job)}:${generateOwnerTier(
|
||||
payment.job
|
||||
)}:${generateJobTier(payment.job)}`
|
||||
: `${generateOwnerTier(payment.job)}:${generateJobTier(
|
||||
payment.job
|
||||
)}`,
|
||||
},
|
||||
ARAccountRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.md_responsibility_centers.ar.accountname,
|
||||
},
|
||||
TxnDate: moment(payment.date).format("YYYY-MM-DD"), //Trim String
|
||||
RefNumber:
|
||||
payment.paymentnum || payment.stripeid || payment.transactionid,
|
||||
TotalAmount: Dinero({
|
||||
amount: Math.round(payment.amount * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
PaymentMethodRef: {
|
||||
FullName: payment.type,
|
||||
},
|
||||
Memo: `RO ${payment.job.ro_number || ""} OWNER ${
|
||||
payment.job.ownr_fn || ""
|
||||
} ${payment.job.ownr_ln || ""} ${payment.job.ownr_co_nm || ""} ${
|
||||
payment.stripeid || ""
|
||||
} ${payment.payer ? ` PAID BY ${payment.payer}` : ""}`,
|
||||
IsAutoApply: true,
|
||||
// AppliedToTxnAdd:{
|
||||
// T
|
||||
// }
|
||||
},
|
||||
ARAccountRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.md_responsibility_centers.ar.accountname,
|
||||
},
|
||||
TxnDate: moment(payment.date).format("YYYY-MM-DD"), //Trim String
|
||||
RefNumber:
|
||||
payment.paymentnum || payment.stripeid || payment.transactionid,
|
||||
TotalAmount: Dinero({
|
||||
amount: Math.round(payment.amount * 100),
|
||||
}).toFormat(DineroQbFormat),
|
||||
PaymentMethodRef: {
|
||||
FullName: payment.type,
|
||||
},
|
||||
Memo: `RO ${payment.job.ro_number || ""} OWNER ${
|
||||
payment.job.ownr_fn || ""
|
||||
} ${payment.job.ownr_ln || ""} ${payment.job.ownr_co_nm || ""} ${
|
||||
payment.stripeid || ""
|
||||
} ${payment.payer ? ` PAID BY ${payment.payer}` : ""}`,
|
||||
IsAutoApply: true,
|
||||
// AppliedToTxnAdd:{
|
||||
// T
|
||||
// }
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
} else {
|
||||
paymentQbxmlObj = {
|
||||
QBXML: {
|
||||
QBXMLMsgsRq: {
|
||||
"@onError": "continueOnError",
|
||||
CreditMemoAddRq: {
|
||||
CreditMemoAdd: {
|
||||
CustomerRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.accountingconfig.tiers === 3
|
||||
? `${generateSourceTier(payment.job)}:${generateOwnerTier(
|
||||
payment.job
|
||||
)}:${generateJobTier(payment.job)}`
|
||||
: `${generateOwnerTier(payment.job)}:${generateJobTier(
|
||||
payment.job
|
||||
)}`,
|
||||
},
|
||||
ARAccountRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.md_responsibility_centers.ar.accountname,
|
||||
},
|
||||
TxnDate: moment(payment.date).format("YYYY-MM-DD"), //Trim String
|
||||
RefNumber:
|
||||
payment.paymentnum || payment.stripeid || payment.transactionid,
|
||||
|
||||
CreditMemoLineAdd: [
|
||||
{
|
||||
ItemRef: {
|
||||
FullName:
|
||||
payment.job.bodyshop.md_responsibility_centers.refund
|
||||
.accountitem,
|
||||
},
|
||||
Desc: payment.memo,
|
||||
Amount: Dinero({
|
||||
amount: Math.round(payment.amount * 100 * -1),
|
||||
}).toFormat(DineroQbFormat),
|
||||
SalesTaxCodeRef: { FullName: "E" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
var paymentQbxmlPartial = builder
|
||||
.create(paymentQbxmlObj, {
|
||||
|
||||
Reference in New Issue
Block a user