Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion modules/gateways/callback/paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,17 @@ function paystackshutdownFunction(){
checkCbTransID($trxref);

$amount = floatval($txStatus->amount)/100;
$fees = floatval($txStatus->fees)/100;
if ($gatewayParams['convertto']) {
$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");
$data = mysql_fetch_array($result);
$invoice_currency_id = $data['currency'];

$converto_amount = convertCurrency($amount, $gatewayParams['convertto'], $invoice_currency_id);
$converto_fees = convertCurrency($fees, $gatewayParams['convertto'], $invoice_currency_id);

$amount = format_as_currency($converto_amount);
$fees = format_as_currency($converto_fees);
}

/**
Expand All @@ -319,7 +323,7 @@ function paystackshutdownFunction(){
* @param float $paymentFee Payment fee (optional)
* @param string $gatewayModule Gateway module name
*/
addInvoicePayment($invoiceId, $trxref, $amount, 0, $gatewayModuleName);
addInvoicePayment($invoiceId, $trxref, $amount, $fees, $gatewayModuleName);

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