Skip to content

Commit b1d42ec

Browse files
Merge pull request #17 from chrismadufor/master
Added fees to the addInvoicePayment function
2 parents 6029750 + f165c28 commit b1d42ec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

modules/gateways/callback/paystack.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,17 @@ function paystackshutdownFunction(){
299299
checkCbTransID($trxref);
300300

301301
$amount = floatval($txStatus->amount)/100;
302+
$fees = floatval($txStatus->fees)/100;
302303
if ($gatewayParams['convertto']) {
303304
$result = select_query("tblclients", "tblinvoices.invoicenum,tblclients.currency,tblcurrencies.code", array("tblinvoices.id" => $invoiceId), "", "", "", "tblinvoices ON tblinvoices.userid=tblclients.id INNER JOIN tblcurrencies ON tblcurrencies.id=tblclients.currency");
304305
$data = mysql_fetch_array($result);
305306
$invoice_currency_id = $data['currency'];
306307

307308
$converto_amount = convertCurrency($amount, $gatewayParams['convertto'], $invoice_currency_id);
309+
$converto_fees = convertCurrency($fees, $gatewayParams['convertto'], $invoice_currency_id);
310+
308311
$amount = format_as_currency($converto_amount);
312+
$fees = format_as_currency($converto_fees);
309313
}
310314

311315
/**
@@ -319,7 +323,7 @@ function paystackshutdownFunction(){
319323
* @param float $paymentFee Payment fee (optional)
320324
* @param string $gatewayModule Gateway module name
321325
*/
322-
addInvoicePayment($invoiceId, $trxref, $amount, 0, $gatewayModuleName);
326+
addInvoicePayment($invoiceId, $trxref, $amount, $fees, $gatewayModuleName);
323327

324328
// load invoice
325329
$isSSL = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443);

0 commit comments

Comments
 (0)