Skip to content

Commit

Permalink
Set default currency for some currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bosunolanrewaju committed May 18, 2017
1 parent 55ce8ca commit 75c7960
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions ravepaymentgateway/controllers/hook/displayPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function run ()
}

$currency_order = new Currency($this->context->cart->id_currency);
$country = new Country((int)$address_billing->id_country);
$customer = new Customer($this->context->cart->id_customer);
$this->context->smarty->assign(array(
'pb_key' => Configuration::get('RAVE_PB_KEY'),
Expand All @@ -36,7 +35,7 @@ public function run ()
'logo' => Configuration::get('RAVE_MODAL_LOGO'),
'btntext' => $btntext ? $btntext : 'PAY NOW',
'currency'=> $currency_order->iso_code,
'country' => $country->iso_code,
'country' => $this->_chargeCountry($currency_order->iso_code),
'txref' => "PS_" . $this->context->cart->id . '_' . time(),
'amount' => (float)$this->context->cart->getOrderTotal(true, Cart::BOTH),
'customer_email' => $customer->email,
Expand All @@ -46,4 +45,23 @@ public function run ()
$this->context->controller->addJS($this->_path.'views/js/rave.js');
return $this->module->display($this->file, 'displayPayment.tpl');
}

private function _chargeCountry($currency)
{
$country = 'NG';
switch($currency) {
case 'KES':
$country = 'KE';
break;
case 'GHS':
$country = 'GH';
break;
default:
$country = 'NG';
break;
}

return $country;
}
}

0 comments on commit 75c7960

Please sign in to comment.