From e3059b41ae782908d1aeffd227b232fa41496dd5 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Wed, 18 Sep 2024 11:19:43 -0700 Subject: [PATCH] IO-2933 Resolve PR comments. --- .../card-payment-modal.component..jsx | 8 +------- .../payments-generate-link.component.jsx | 2 +- server/email/tasksEmails.js | 7 +++---- server/intellipay/intellipay.js | 12 +++++------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/client/src/components/card-payment-modal/card-payment-modal.component..jsx b/client/src/components/card-payment-modal/card-payment-modal.component..jsx index e5059d14a..29a95b87b 100644 --- a/client/src/components/card-payment-modal/card-payment-modal.component..jsx +++ b/client/src/components/card-payment-modal/card-payment-modal.component..jsx @@ -337,13 +337,7 @@ const CardPaymentModalComponent = ({ message.success(t("general.actions.copied")); }} > -
{ - //Copy the link. - }} - > - {paymentLink} -
+
{paymentLink}
)} diff --git a/client/src/components/payments-generate-link/payments-generate-link.component.jsx b/client/src/components/payments-generate-link/payments-generate-link.component.jsx index 5d19556c8..b0f4b26b9 100644 --- a/client/src/components/payments-generate-link/payments-generate-link.component.jsx +++ b/client/src/components/payments-generate-link/payments-generate-link.component.jsx @@ -35,7 +35,7 @@ export function PaymentsGenerateLink({ bodyshop, currentUser, callback, job, ope try { p = parsePhoneNumber(job.ownr_ph1 || "", "CA"); } catch (error) { - console.log("Unable to part phone number"); + console.log("Unable to parse phone number"); } setLoading(true); const response = await axios.post("/intellipay/generate_payment_url", { diff --git a/server/email/tasksEmails.js b/server/email/tasksEmails.js index 292d7c92e..a106085f7 100644 --- a/server/email/tasksEmails.js +++ b/server/email/tasksEmails.js @@ -95,8 +95,8 @@ const formatPriority = (priority) => { * @returns {{header, body: string, subHeader: string}} */ -function getEndpoints() { - const endPoints = InstanceManager({ +const getEndpoints = () => + InstanceManager({ imex: process.env?.NODE_ENV === "test" ? "https://test.imex.online" : "https://imex.online", rome: bodyshop.convenient_company === "promanager" @@ -107,8 +107,7 @@ function getEndpoints() { ? "https//test.romeonline.io" : "https://romeonline.io" }); - return endPoints; -} + const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId) => { const endPoints = getEndpoints(); return { diff --git a/server/intellipay/intellipay.js b/server/intellipay/intellipay.js index 831ade65c..f798bc0bd 100644 --- a/server/intellipay/intellipay.js +++ b/server/intellipay/intellipay.js @@ -172,12 +172,9 @@ exports.postback = async (req, res) => { //Adding in the user email to the short pay email. //Need to check this to ensure backwards compatibility for clients that don't update. - let partialPayments; - if (!Array.isArray(parsedComment)) { - partialPayments = parsedComment.payments; - } else { - partialPayments = parsedComment; - } + + const partialPayments = Array.isArray(parsedComment) ? parsedComment : parsedComment.payments; + const jobs = await gqlClient.request(queries.GET_JOBS_BY_PKS, { ids: partialPayments.map((p) => p.jobid) }); @@ -207,7 +204,7 @@ exports.postback = async (req, res) => { iprequest: values, paymentResult }); - res.sendStatus(200); + if (values.origin === "OneLink" && parsedComment.userEmail) { //Send an email, it was a text to pay link. const endPoints = getEndpoints(); @@ -226,6 +223,7 @@ exports.postback = async (req, res) => { .join("
") }) }); + res.sendStatus(200); } } else if (values.invoice) { //This is a link email that's been sent out.