Skip to content

Commit

Permalink
bug: correção na baixa de pagamento PIX com desconto
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelo-machado-gn committed Oct 31, 2023
1 parent fd97287 commit 8fe4da6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions efi/gerencianet_lib/Gerencianet_WHMCS_Interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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);


}

Expand Down

0 comments on commit 8fe4da6

Please sign in to comment.