public static function update($paymentType, $value) { Configuration::updateValue(self::bcash . $paymentType, $value); $couponId = Configuration::get(self::prefix . self::bcash . $paymentType); PaymentDiscount::resetActions($couponId); if (!empty($value)) { PaymentDiscount::updateReductionPercent($couponId, $value); PaymentDiscount::enable($couponId); } else { PaymentDiscount::updateReductionPercent($couponId, 0); PaymentDiscount::disable($couponId); } }
private function applyDiscount($paymentType) { $paymentDiscount = new PaymentDiscount(); $simulatedPrice = $paymentDiscount->getSimulatedPrice($this->context->cart, $paymentType); return FormatHelper::monetize($simulatedPrice); }
private function deleteDefaultBcashDiscounts() { $paymentDiscount = new PaymentDiscount(); return $paymentDiscount->deleteDefaultBcashDiscounts(); }
private function calculateDiscounts() { $paymentDiscount = new PaymentDiscount(); $paymentMethodHelper = new PaymentMethodHelper(); $payment_method = $paymentMethodHelper->getById(Tools::getValue('payment-method')); $cart = $this->context->cart; if (PaymentMethodHelper::isCard($payment_method) && Tools::getValue('card-installment') == 1) { $paymentDiscount->apply($cart, 'DESCONTO_CREDITO', $this->context); } else { if (PaymentMethodHelper::isTEF($payment_method)) { $paymentDiscount->apply($cart, 'DESCONTO_TEF', $this->context); } else { if (PaymentMethodHelper::isBankSlip($payment_method)) { $paymentDiscount->apply($cart, 'DESCONTO_BOLETO', $this->context); } } } $totalDiscouts = $paymentDiscount->getAmountOrderDiscounts($cart); return $totalDiscouts; }