function getPriceTrial($node, $payment, $osePaymentCurrency) { $a1 = oseObject::getValue($payment, 'a1'); $p1 = oseObject::getValue($payment, 'p1'); $t1 = oseObject::getValue($payment, 't1'); $primaryCurrency = oseRegistry::call('msc')->getConfigItem('primary_currency', 'currency', 'obj'); $priceSystem = new osePaymentPrice($primaryCurrency->value, oseJson::decode($primaryCurrency->default)); $priceSystem->setSelectedCurrency($osePaymentCurrency); $a1 = $priceSystem->pricing($a1, $osePaymentCurrency, oseObject::getValue($node, 'id'), oseObject::getValue($payment, 'id')); $trial_price = $a1; $node = oseObject::setValue($node, 'trial_raw_price', $trial_price); $node = oseObject::setValue($node, 'trial_price', $osePaymentCurrency . ' ' . $trial_price); if ($p1 > 1) { $t1 .= 's'; } $node = oseObject::setValue($node, 'trial_recurrence', $p1 . ' ' . JText::_(strtoupper($t1))); return $node; }
function countDiscount($price, $payment) { $newPrice = 0; if (empty($payment->discount)) { return $price; } if ($payment->discount_unit == 'rate') { $newPrice = osePaymentPrice::discountByRate($payment->discount, $price); } else { $newPrice = osePaymentPrice::discountByNum($payment->discount, $price); } return $newPrice; }