mirror of
https://git.wownero.com/wownero/wownerowp.git
synced 2024-08-15 01:03:16 +00:00
Fix bug with discount
This commit is contained in:
parent
5cb6d1756b
commit
33a982107f
1 changed files with 13 additions and 4 deletions
|
@ -523,11 +523,20 @@ class Monero_Gateway extends WC_Payment_Gateway
|
|||
{
|
||||
$xmr_live_price = $this->retriveprice($currency);
|
||||
$live_for_storing = $xmr_live_price * 100; //This will remove the decimal so that it can easily be stored as an integer
|
||||
$new_amount = $amount / $xmr_live_price;
|
||||
$rounded_amount = round($new_amount, 12);
|
||||
|
||||
$wpdb->query("INSERT INTO $payment_id (rate)
|
||||
VALUES ($live_for_storing)");
|
||||
$wpdb->query("INSERT INTO $payment_id (rate) VALUES ($live_for_storing)");
|
||||
if(isset($this->discount))
|
||||
{
|
||||
$new_amount = $amount / $xmr_live_price;
|
||||
$discount = $new_amount * $this->discount / 100;
|
||||
$discounted_price = $new_amount - $discount;
|
||||
$rounded_amount = round($discounted_price, 12);
|
||||
}
|
||||
else
|
||||
{
|
||||
$new_amount = $amount / $xmr_live_price;
|
||||
$rounded_amount = round($new_amount, 12);
|
||||
}
|
||||
}
|
||||
|
||||
return $rounded_amount;
|
||||
|
|
Loading…
Reference in a new issue