From 8fe4da60566ff3c7a17a3b2a480aaeca25cfb2ff Mon Sep 17 00:00:00 2001 From: Marcelo Machado Date: Tue, 31 Oct 2023 14:37:05 -0300 Subject: [PATCH] =?UTF-8?q?bug:=20corre=C3=A7=C3=A3o=20na=20baixa=20de=20p?= =?UTF-8?q?agamento=20PIX=20com=20desconto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- efi/gerencianet_lib/Gerencianet_WHMCS_Interface.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/efi/gerencianet_lib/Gerencianet_WHMCS_Interface.php b/efi/gerencianet_lib/Gerencianet_WHMCS_Interface.php index 4ccbc58..b1dbde6 100644 --- a/efi/gerencianet_lib/Gerencianet_WHMCS_Interface.php +++ b/efi/gerencianet_lib/Gerencianet_WHMCS_Interface.php @@ -53,6 +53,8 @@ function extra_amounts_Gerencianet_WHMCS($invoiceId, $descontoBoleto, $discountT if($descontoBoleto == 0) return null; + $where = array('invoiceid' => $invoiceId); + $order = selectCob('tblorders', $where, '*'); $where = array('id' => $invoiceId); $invoice = selectCob('tblinvoices', $where, '*'); $userid = $invoice['userid']; @@ -85,6 +87,14 @@ function extra_amounts_Gerencianet_WHMCS($invoiceId, $descontoBoleto, $discountT insertCob('tblinvoiceitems', $dataDiscount); + $newOrderAmount = $order['amount'] + $amount; + $newInvoiceSubTotal = $invoice['subtotal'] + $amount; + $newInvoiceTotal = $invoice['total'] + $amount; + + $updateAmountOrder = updateCob('tblorders', array('invoiceid' => $invoiceId), array('amount' => $newOrderAmount)); + $updateData = array('total' => $newInvoiceTotal, 'subtotal' => $newInvoiceSubTotal); + $updateAmountInvoice = updateCob('tblinvoices', array('id' => $invoiceId), $updateData); + }