first commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
|
||||
class stSantanderRatyFrontendActions extends stActions
|
||||
{
|
||||
public function executeAccepted()
|
||||
{
|
||||
$this->smarty = new stSmarty('stSantanderRatyFrontend');
|
||||
$this->smarty->assign('id_wniosku', $this->getRequestParameter('id_wniosku'));
|
||||
}
|
||||
|
||||
public function executeCanceled()
|
||||
{
|
||||
$this->smarty = new stSmarty('stSantanderRatyFrontend');
|
||||
}
|
||||
|
||||
public function executePay()
|
||||
{
|
||||
$smarty = new stSmarty('stSantanderRatyFrontend');
|
||||
$paymentType = stPaymentType::get($this->getRequestParameter('type'));
|
||||
$order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('order_id'), $this->getRequestParameter('order_hash'));
|
||||
$totalQuantity = count($order->getOrderProducts());
|
||||
|
||||
if ($order->getOrderDelivery()->getCostBrutto(true) > 0)
|
||||
{
|
||||
$totalQuantity += 1;
|
||||
}
|
||||
|
||||
$smarty->assign('order', $order);
|
||||
$smarty->assign('order_total_amount', $order->getTotalAmountWithDelivery(true, true));
|
||||
$smarty->assign('order_total_quantity', $totalQuantity);
|
||||
$smarty->assign('payment_type', $order->getOrderPayment()->getPaymentType());
|
||||
$smarty->assign('shop_number', stConfig::getInstance('stSantanderRatyBackend')->get('shop_number'));
|
||||
$smarty->assign('order_delivery', $order->getOrderDelivery()->getName());
|
||||
$smarty->assign('client', array(
|
||||
'name' => $order->getOrderUserDataBilling()->getName(),
|
||||
'surname' => $order->getOrderUserDataBilling()->getSurname(),
|
||||
'email' => $order->getOptClientEmail(),
|
||||
));
|
||||
$smarty->assign('url_accepted', $paymentType->getReturnUrl($order).'?id=');
|
||||
$smarty->assign('url_canceled', $paymentType->getReturnUrl($order).'?canceled=1&id=');
|
||||
|
||||
$this->smarty = $smarty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
class stSantanderRatyFrontendComponents extends sfComponents
|
||||
{
|
||||
public function executeShowPayment()
|
||||
{
|
||||
$smarty = new stSmarty('stSantanderRatyFrontend');
|
||||
|
||||
$order = stPaymentType::getOrderInSummary();
|
||||
|
||||
$totalQuantity = count($order->getOrderProducts());
|
||||
|
||||
if ($order->getOrderDelivery()->getCostBrutto(true) > 0)
|
||||
{
|
||||
$totalQuantity += 1;
|
||||
}
|
||||
|
||||
$smarty->assign('order', $order);
|
||||
$smarty->assign('order_total_amount', $order->getTotalAmountWithDelivery(true, true));
|
||||
$smarty->assign('order_total_quantity', $totalQuantity);
|
||||
$smarty->assign('shop_number', stConfig::getInstance('stSantanderRatyBackend')->get('shop_number'));
|
||||
$smarty->assign('order_delivery', $order->getOrderDelivery()->getName());
|
||||
$smarty->assign('client', array(
|
||||
'name' => $order->getOrderUserDataBilling()->getName(),
|
||||
'surname' => $order->getOrderUserDataBilling()->getSurname(),
|
||||
'email' => $order->getOptClientEmail(),
|
||||
));
|
||||
$smarty->assign('url_accepted', $this->getController()->genUrl('@stSantanderRatyFrontend?action=accepted', true).'?id=');
|
||||
$smarty->assign('url_canceled', $this->getController()->genUrl('@stSantanderRatyFrontend?action=canceled', true).'?id=');
|
||||
|
||||
return $smarty;
|
||||
}
|
||||
|
||||
public function executeCalculate()
|
||||
{
|
||||
$config = stConfig::getInstance(sfContext::getInstance(), 'stSantanderRatyBackend');
|
||||
if ($this->amount < 100 || !$config->get('shop_number')){
|
||||
return sfView::NONE;
|
||||
}
|
||||
|
||||
$smarty = new stSmarty('stSantanderRatyFrontend');
|
||||
|
||||
$smarty->assign('url', stSantander::getCalculateRateUrl($this->amount));
|
||||
$smarty->assign('is_ajax', isset($this->is_ajax) ? $this->is_ajax: false);
|
||||
$smarty->assign('small', isset($this->small) ? $this->small: false);
|
||||
|
||||
return $smarty;
|
||||
}
|
||||
|
||||
public function executeCalculateInBasket()
|
||||
{
|
||||
sfLoader::loadHelpers(array('Helper', 'stPartial'));
|
||||
echo st_get_component('stSantanderRatyFrontend', 'calculate', array('amount' => $this->getUser()->getBasket()->getTotalAmount(true, true), 'small' => true));
|
||||
|
||||
return sfView::NONE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user