From a8b69cd6a6cfc4905bd71666bd36d9ff5c32fb2b Mon Sep 17 00:00:00 2001 From: Dillon Date: Sun, 19 Mar 2023 22:16:42 +0800 Subject: [PATCH] Sync code for bug fixes at Shipping Portal --- .../Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php | 7 +++++-- .../Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php index b595a86f..ba0c2755 100644 --- a/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php +++ b/app/Classes/Modules/PerfexCRM/Services/CreatesPerfexCRMInvoice.php @@ -16,14 +16,17 @@ class CreatesPerfexCRMInvoice */ public function execute(InvoicePerfexCRMObject $invoicePerfexCRMObject) { try{ + $subtotal = floor($invoicePerfexCRMObject->getSubTotal() * 100) / 100; + $total = floor($invoicePerfexCRMObject->getTotal() * 100) / 100; + $data = [ 'clientid' => $invoicePerfexCRMObject->getClientId(), 'number' => $invoicePerfexCRMObject->getNumber(), 'date' => $invoicePerfexCRMObject->getDate(), 'duedate' => $invoicePerfexCRMObject->getDueDate(), 'currency' => $invoicePerfexCRMObject->getCurrency(), - 'subtotal' => number_format($invoicePerfexCRMObject->getSubTotal(), 2, '.', ''), - 'total' => number_format($invoicePerfexCRMObject->getTotal(), 2, '.', ''), + 'subtotal' => number_format($subtotal, 2, '.', ''), + 'total' => number_format($total, 2, '.', ''), 'billing_street' => $invoicePerfexCRMObject->getBillingStreet(), 'project_id' => $invoicePerfexCRMObject->getProjectId(), 'allowed_payment_modes[0]' => 1, diff --git a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php index 5240d931..e5e5088b 100644 --- a/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php +++ b/app/Classes/Modules/PerfexCRM/Services/UpdatesPerfexCRMInvoice.php @@ -35,6 +35,9 @@ class UpdatesPerfexCRMInvoice array_push($newInvoiceItems,$item); } + $allowedPaymentModes = []; + array_push($allowedPaymentModes, 1, 2); + $data = [ 'number' => $invoice->number, 'date' => $invoice->date, @@ -46,7 +49,7 @@ class UpdatesPerfexCRMInvoice 'shipping_street' => $invoice->billing_street, 'project_id' => $projectId, 'items' => $newInvoiceItems, - 'allowed_payment_modes' => $invoice->allowed_payment_modes, + 'allowed_payment_modes' => $allowedPaymentModes, ]; $response = Http::asJson()->withHeaders([