Merge pull request #59 from cameleater/cameleater-patch-1

update monero_payments.php
This commit is contained in:
SerHack 2018-05-18 06:55:10 +02:00 committed by GitHub
commit 01c33481f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -583,7 +583,8 @@ class Monero_Gateway extends WC_Payment_Gateway
public function retriveprice($currency) public function retriveprice($currency)
{ {
$xmr_price = file_get_contents('https://min-api.cryptocompare.com/data/price?fsym=XMR&tsyms=BTC,USD,EUR,CAD,INR,GBP,COP,SGD&extraParams=monero_woocommerce'); $api_link = 'https://min-api.cryptocompare.com/data/price?fsym=XMR&tsyms=BTC,USD,EUR,CAD,INR,GBP,COP,SGD' . ',' . $currency . '&extraParams=monero_woocommerce';
$xmr_price = file_get_contents($api_link);
$price = json_decode($xmr_price, TRUE); $price = json_decode($xmr_price, TRUE);
if (!isset($price)) { if (!isset($price)) {
$this->log->add('Monero_Gateway', '[ERROR] Unable to get the price of Monero'); $this->log->add('Monero_Gateway', '[ERROR] Unable to get the price of Monero');
@ -603,6 +604,8 @@ class Monero_Gateway extends WC_Payment_Gateway
return $price['COP']; return $price['COP'];
case 'SGD': case 'SGD':
return $price['SGD']; return $price['SGD'];
case $currency:
return $price[$currency];
case 'XMR': case 'XMR':
$price = '1'; $price = '1';
return $price; return $price;