first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,384 @@
<?php
/**
* SOTESHOP/stPayment
*
* Ten plik należy do aplikacji stPayment opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stPayment
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: actions.class.php 10 2009-08-24 09:32:18Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>,
*/
/**
* Klasa stPaymentActions
*
* @package stPayment
* @subpackage actions
*/
class stPaymentActions extends stActions
{
/**
* Undocumented variable
*
* @var Order
*/
protected $order;
/**
* Przekierowanie na strone główną sklepu jeżeli nie została wybrana żadna akcja
*/
public function executeIndex()
{
$this->redirect('@homepage');
}
/**
* Aktualizowanie dostawy za pomocą Ajax
*/
public function executeAjaxPaymentTypeUpdate()
{
$paymnetTypeId = $this->getRequestParameter('id');
stPayment::getInstance($this->getContext())->set($paymnetTypeId);
}
/**
* Akcja obsługująca żądanie ręcznego przekierowania do serwisu płatności
*
* @return mixed
* @throws PropelException
* @throws stNotificationException
* @throws sfStopException
*/
public function executePay()
{
$this->order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('id'), $this->getRequestParameter('hash_code'));
$currency = stCurrency::getInstance($this->getContext());
$currency->setByIso($this->order->getOrderCurrency()->getShortcut());
if ($this->order->getIsPayed())
{
return $this->redirect('@stOrderSummary?id=' . $this->order->getId() . '&hash_code=' . $this->order->getHashCode());
}
$paymentType = $this->order->getOrderPayment()->getPaymentType();
if ($paymentType && $paymentType->getApiInstance() instanceof stPaymentTypeInterface)
{
$url = $this->processPayment($paymentType->getApiInstance(), $this->order);
return $this->redirect($url);
}
$this->smarty = new stSmarty($this->getModuleName());
}
/**
* Akcja obsługująca żądanie z automatycznym przekierowaniem do serwisu płatności
*
* @return sfView::NONE
* @throws stPaymentTypeConfigurationException
* @throws PropelException
* @throws stNotificationException
*/
public function executeProcessPayment()
{
$type = $this->getRequestParameter('type');
$orderId = $this->getRequestParameter('order_id');
$orderHash = $this->getRequestParameter('order_hash');
$paymentType = stPaymentType::get($type);
$order = OrderPeer::retrieveByIdAndHashCode($orderId, $orderHash);
return $this->renderJSON([
'redirect' => $this->processPayment($paymentType, $order)
]);
}
/**
* Akcja obsługująca żądania błędów podczas przetwarzania płatności
*
* @return void
* @throws PropelException
* @throws sfViewException
* @throws stPaymentTypeConfigurationException
*/
public function executeFailure()
{
$type = $this->getRequestParameter('type');
$smarty = new stSmarty($this->getModuleName());
$webpage = WebpagePeer::retrieveByState('CONTACT');
if ($webpage)
{
sfLoader::loadHelpers(array('Helper', 'stUrl'));
$smarty->assign('contact_url', st_url_for('stWebpageFrontend/index?url=' . $webpage->getFriendlyUrl()));
}
$paymentType = stPaymentType::get($type);
$smarty->assign('title', $paymentType->getConfiguration()->getName());
$smarty->assign('logo', $paymentType->getLogoPath());
$smarty->assign('message', $this->getContext()->getI18N()->__('Wystąpił błąd podczas przetwarzania płatności.'));
$this->smarty = $smarty;
}
/**
* Akcja obsługująca żądania powrotu klienta do sklepu
*
* @return void
* @throws stPaymentTypeConfigurationException
* @throws PropelException
* @throws sfException
* @throws stNotificationException
*/
public function executeReturn()
{
$type = $this->getRequestParameter('type');
$orderId = $this->getRequestParameter('order_id');
$orderHash = $this->getRequestParameter('order_hash');
$paymentType = stPaymentType::get($type);
$logger = $paymentType->getLogger();
$order = OrderPeer::retrieveByIdAndHashCode($orderId, $orderHash);
if (null === $order)
{
$logger->fatal('Wystąpił nieoczekiwany wyjątek po powrocie klienta do sklepu: `Zamówienie o id **%%id%%** nie istnieje...`', [
'%%id%%' => $orderId,
]);
throw new sfException(sprintf('Zamówienie o id **%%id%% nie istnieje...', $orderId));
}
$ok = $paymentType->return($order, $this->getRequest());
if (false === $ok)
{
$payment = $order->getOrderPayment();
$payment->setCancel(true);
$payment->save();
$logger->info('Płatność dla zamówienia **[%%number%%](%%link%%)** została anulowana na życzenie klienta', [
'%%number%%' => $order->getNumber(),
'%%link%%' => $this->generateBackendUrl('@stOrder?action=edit&id='.$order->getId()),
]);
}
else
{
$logger->info('Klient zakończył opłacanie zamówienia **[%%number%%](%%link%%)** i powrócił do sklepu', [
'%%number%%' => $order->getNumber(),
'%%link%%' => $this->generateBackendUrl('@stOrder?action=edit&id='.$order->getId()),
]);
if (true === $ok)
{
$this->processPayment($paymentType, $order);
}
}
$smarty = new stSmarty($this->getModuleName());
$smarty->assign('title', $paymentType->getConfiguration()->getName());
$smarty->assign('logo', $paymentType->getLogoPath());
$smarty->assign('canceled', false === $ok);
$this->smarty = $smarty;
}
/**
* Akcja obsługująca żądania zmiany statusu płatności
*
* @return string
* @throws stPaymentTypeConfigurationException
* @throws PropelException
* @throws stNotificationException
*/
public function executeStatusNotification()
{
$type = $this->getRequestParameter('type');
$orderId = $this->getRequestParameter('order_id');
$orderHash = $this->getRequestParameter('order_hash');
$securityToken = $this->getRequestParameter('security_token');
$paymentType = stPaymentType::get($type);
$logger = $paymentType->getLogger();
$order = OrderPeer::retrieveByIdAndHashCode($orderId, $orderHash);
$logger->info('Przetwarzanie powiadomienia o statusie płatności');
if (null === $order)
{
$paymentType->getLogger()->fatal('Wystąpił nieoczekiwany wyjątek: `Zamówienie o id **%%id%%** nie istnieje...`', [
'%%id%%' => $orderId,
]);
return sfView::HEADER_ONLY;
}
try
{
if ($securityToken != stPaymentTypeAbstract::generateSecurityToken($order))
{
$paymentType->getLogger()->error('Nieprawidłowy token bezpieczeństwa');
}
else
{
$this->processStatusNotification($paymentType, $order);
}
}
catch (stPaymentTypeException $e)
{
}
return sfView::HEADER_ONLY;
}
public function executePaymentInformation()
{
$type = $this->getRequestParameter('type');
$amount = $this->getRequestParameter('amount');
$currencyAmount = $this->getRequestParameter('currency_amount');
$paymentType = stPaymentType::get($type);
$smarty = new stSmarty($paymentType->getConfiguration()->getFrontendModule());
$parameters = $paymentType->getPaymentInformation(stPrice::round($amount), stPrice::round($currencyAmount));
foreach ($parameters as $name => $value)
{
$smarty->assign($name, $value);
}
return $this->renderText($smarty->fetch('payment_information.html'));
}
/**
* Akcja obsługująca żądanie zwracające listę kanałów płatności
*
* @return void
* @throws PropelException
* @throws sfError404Exception
*/
public function executeSelectChannel()
{
$id = $this->getRequestParameter('id');
/**
* @var stBasket $basket
*/
$basket = $this->getUser()->getBasket();
$amount = $basket->getTotalAmount(true) + stDeliveryFrontend::getInstance($basket)->getTotalDeliveryCost(true);
$payment = PaymentTypePeer::retrieveByPK($id);
if (null === $payment)
{
return $this->forward404();
}
$api = $payment->getApiInstance();
if ($api instanceof stPaymentTypeInterface)
{
$smarty = new stSmarty($api->getConfiguration()->getFrontendModule());
if ($smarty->themeTemplateExists('payment_select_channel.html'))
{
$smarty->register_function('parent', [$this, 'getSelectChannelTemplate']);
}
}
else
{
$smarty = new stSmarty('stPayment');
}
$smarty->assign('amount', $amount);
$smarty->assign('payment', $payment);
$smarty->assign('payment_channels', $payment->getChannels($amount));
$this->smarty = $smarty;
}
public function getSelectChannelTemplate(?array $params, Smarty $currentSmarty)
{
$smarty = new stSmarty($this->getModuleName());
$smarty->_tpl_vars = !empty($params) ? array_merge($currentSmarty->get_template_vars(), $params) : $currentSmarty->get_template_vars();
return $smarty->fetch('payment_select_channel.html');
}
/**
* Metoda przetwarzania płatnośc przed przejściem do serwisu
*
* @param stPaymentTypeInterface $paymentType
* @param Order $order
* @return string
* @throws PropelException
* @throws stNotificationException
*/
protected function processPayment(stPaymentTypeInterface $paymentType, Order $order): string
{
try
{
$paymentType->getLogger()->info('Przetwarzanie płatności dla zamówienia **[%%number%%](%%link%%)**', [
'%%number%%' => $order->getNumber(),
'%%link%%' => $this->generateBackendUrl('@stOrder?action=edit&id='.$order->getId()),
]);
$url = $paymentType->process($order);
$payment = $order->getOrderPayment();
$payment->setInProgress(true);
$payment->save();
$paymentType->getLogger()->info('Przetwarzanie płatności dla zamówienia **[%%number%%](%%link%%)** zakończone pomyślnie, przekierowuję klienta do serwisu płatności <%%url%%>', [
'%%number%%' => $order->getNumber(),
'%%link%%' => $this->generateBackendUrl('@stOrder?action=edit&id='.$order->getId()),
'%%url%%' => $url,
]);
return $url;
}
catch (stPaymentTypeException $e)
{
$paymentType->getLogger()->exception($e);
}
return $paymentType->getFailureUrl($order);
}
protected function processStatusNotification(stPaymentTypeInterface $paymentType, Order $order): bool
{
if ($paymentType->statusNotification($order, $this->getRequest()))
{
$payment = $order->getOrderPayment();
$payment->setStatus(true);
$payment->save();
$paymentType->getLogger()->info('Zamówienie **[%%number%%](%%link%%)** zostało opłacone', [
'%%number%%' => $order->getNumber(),
'%%link%%' => $this->generateBackendUrl('@stOrder?action=edit&id='.$order->getId()),
]);
return true;
}
return false;
}
protected function generateBackendUrl($internalUrl)
{
$this->getRequest()->setScriptNameByApp('backend');
$result = $this->getController()->genUrl($internalUrl);
$this->getRequest()->setScriptNameByApp('frontend');
return $result;
}
}

View File

@@ -0,0 +1,225 @@
<?php
/**
* SOTESHOP/stPayment
*
* Ten plik należy do aplikacji stPayment opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stPayment
* @subpackage actions
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: components.class.php 13721 2011-06-20 14:13:12Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>,
*/
/**
* Klasa stPaymentComponents
*
* @package stPayment
* @subpackage actions
* @property Order $order
* @property Product $product
*/
class stPaymentComponents extends sfComponents
{
public function executePaymentInfoButton()
{
if (!$this->payment_type instanceof stPaymentTypeInterface)
{
return sfView::NONE;
}
$smarty = new stSmarty('stPayment');
$smarty->assign('amount', $this->amount);
$smarty->assign('payment_type', $this->payment_type);
$smarty->assign('init', $this->getUser()->getParameter('payment_info_button.init', false, 'soteshop/stPayment'));
$smarty->assign('type', $this->payment_type->getConfiguration()->getId());
$smarty->assign('title', isset($this->title) ? $this->title : null);
$smarty->assign('button_label', isset($this->button_label) ? $this->button_label : $this->payment_type->getPaymentInformationTitle());
$this->getUser()->setParameter('payment_info_button.init', true, 'soteshop/stPayment');
return $smarty;
}
/**
* Wyświetlenie listy płatności
*/
public function executeSelectPaymentType()
{
$this->smarty = new stSmarty('stPayment');
$c = new Criteria();
$c->add(PaymentTypePeer::ACTIVE, 1);
$this->paymentTypes = PaymentTypePeer::doSelect($c);
$paymentTypes = $this->paymentTypes;
foreach ($paymentTypes as $key => $paymentType)
{
if(class_exists($paymentType->getModuleName()))
{
$moduleName = $paymentType->getModuleName();
$obj = new $moduleName;
if(method_exists($obj, 'checkPaymentConfiguration'))
{
if (!$obj->checkPaymentConfiguration())
{
unset($this->paymentTypes[$key]);
}
}
}
}
$this->hasPaymentType = false;
if (count($this->paymentTypes) > 0)
{
$this->hasPaymentType = true;
}
$this->checked = 0;
$paymentType = stPayment::getInstance($this->getContext());
if(is_object($paymentType->get())) $this->checked = $paymentType->get()->getId();
}
/**
* Pokazanie płatności w podsumowaniu zamówienia
* @deprecated 8.0.9.0
*/
public function executeShowPayment()
{
$this->smarty = new stSmarty('stPayment');
$this->paymentType = null;
$this->paymentTypeName = null;
if (!isset($this->order))
{
$this->order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('id'), $this->getRequestParameter('hash_code'));
}
if (null === $this->order)
{
return sfView::NONE;
}
$payment = $this->order->getOrderPayment();
if (!$payment)
{
return sfView::NONE;
}
$this->paymentType = $payment->getPaymentType()->getModuleName();
$this->paymentTypeName = $payment->getPaymentType()->getName();
if(!$this->getController()->componentExists($this->paymentType.'Frontend', 'showPayment'))
{
return sfView::NONE;
}
}
public function executeProcessPayment()
{
if (!$this->order->showPayment())
{
return sfView::NONE;
}
$paymentType = $this->order->getOrderPayment()->getPaymentType();
$api = $paymentType->getApiInstance();
if ($api && $api instanceof stPaymentTypeInterface && $api->isAutoRedirectEnabled())
{
$action = $this->getController()->genUrl('@stPayment?action=processPayment&order_id='.$this->order->getId().'&order_hash='.$this->order->getHashCode().'&type='.$api->getConfiguration()->getId());
}
elseif(!$this->getController()->actionExists($paymentType->getModuleName().'Frontend', 'processPayment'))
{
return sfView::NONE;
}
else
{
$action = $this->getController()->genUrl($paymentType->getModuleName().'Frontend/processPayment?id='.$this->order->getId().'&hash='.$this->order->getHashCode());
}
$this->smarty = new stSmarty('stPayment');
$this->smarty->assign('api', $paymentType->getApiInstance());
$this->smarty->assign('action', $action);
}
/**
* Pokazywanie informacji na karcie produktu
*/
public function executeShowInfoInProduct()
{
if ($this->product && !$this->product->isPriceVisible())
{
return sfView::NONE;
}
$i18n = $this->getContext()->getI18N();
$config = stConfig::getInstance('stProduct');
if ($config->get('show_available_payments'))
{
$c = new Criteria();
$c->addJoin(PaymentTypePeer::ID, DeliveryHasPaymentTypePeer::PAYMENT_TYPE_ID);
$c->addJoin(DeliveryHasPaymentTypePeer::DELIVERY_ID, DeliveryPeer::ID);
$c->add(DeliveryPeer::ACTIVE, true);
$c->add(PaymentTypePeer::ACTIVE, true);
$c->addGroupByColumn(PaymentTypePeer::ID);
$payments = PaymentTypePeer::doSelectWithI18n($c);
}
else
{
$payments = [];
}
$this->smarty = new stSmarty('stPayment');
$this->smarty->assign('payments', $payments);
$this->smarty->assign('highlighted', $this->getHighlighted($payments, $this->product));
$this->smarty->assign('payments_label', $i18n->__('Płatności'));
$this->smarty->assign('lukas', stLukas::isActive());
$this->smarty->assign('amount', stPrice::round($this->product->getPriceBrutto(true)));
}
/**
* Zwraca listę wyróżnionych płatności
*
* @param PaymentType[] $paymentTypes
* @param Product $product
* @return array
* @todo Dostosowanie stPrzelewy24 do stPaymentTypeInterface
*/
protected function getHighlighted(array $paymentTypes, Product $product): array
{
$results = [];
$amount = $product->getPriceBrutto(true);
$api = new stPrzelewy24();
if ($api->checkPaymentConfiguration() && $api->getChannels())
{
$types = $api->getBasketPaymentTypes();
foreach ($api->getHighlightedPaymentsForProduct() as $type => $params)
{
if (isset($types[$type]))
{
$results[$type] = $params;
}
}
}
foreach ($paymentTypes as $paymentType)
{
if ($paymentType->getApiInstance() && method_exists($paymentType->getApiInstance(), 'getHighlightedPaymentsForProduct') && $paymentType->checkPaymentConfiguration($amount))
{
$results = array_merge($results, call_user_func([$paymentType->getApiInstance(), 'getHighlightedPaymentsForProduct'], $this->getContext()->getI18N(), $amount));
}
}
return $results;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/**
* SOTESHOP/stPayment
*
* Ten plik należy do aplikacji stPayment opartej na licencji (Professional License SOTE).
* Nie zmieniaj tego pliku, jeśli chcesz korzystać z automatycznych aktualizacji oprogramowania.
* Jeśli chcesz wprowadzać swoje modyfikacje do programu, zapoznaj się z dokumentacją, jak zmieniać
* oprogramowanie bez zmiany kodu bazowego http://www.sote.pl/modifications
*
* @package stPayment
* @subpackage configs
* @copyright SOTE (www.sote.pl)
* @license http://www.sote.pl/license/sote (Professional License SOTE)
* @version $Id: config.php 10 2009-08-24 09:32:18Z michal $
* @author Michal Prochowski <michal.prochowski@sote.pl>
*/
/**
* Dodawania routingów
*/
stPluginHelper::addRouting('stPayment', '/payment/:action/*', 'stPayment', 'index', 'frontend');
stPluginHelper::addRouting('stPaymentPay', '/payment/pay/:id/:hash_code', 'stPayment', 'pay', 'frontend');
stPluginHelper::addRouting('stPaymentStatusNotification', '/payment/notification/:type/:order_id/:order_hash/:security_token', 'stPayment', 'statusNotification', 'frontend');
stPluginHelper::addRouting('stPaymentReturn', '/payment/return/:type/:order_id/:order_hash', 'stPayment', 'return', 'frontend');
stPluginHelper::addRouting('stPaymentFailure', '/payment/failure/:type/:order_id/:order_hash', 'stPayment', 'failure', 'frontend');
stNotificationConfiguration::addGroup('stPayment');
/**
* Dodawanie zapisywania płatności
*/
$dispatcher->connect('stOrderActions.postExecuteSave', array('stPaymentListener', 'saveOrder'));

View File

@@ -0,0 +1,7 @@
all:
.layout:
name: layout1
container_left:
display: [stProduct.specialForCategory]
container_right:
display: []

View File

@@ -0,0 +1,3 @@
<?php
$smarty->display('process_payment.html');

View File

@@ -0,0 +1,22 @@
<?php
st_theme_use_stylesheet('stPayment.css');
use_helper('stTooltip');
$smarty->assign("hasPaymentType",$hasPaymentType);
$results=array();
if ($hasPaymentType)
{
foreach ($paymentTypes as $paymentType)
{
$row['radio'] = radiobutton_tag('payment_type', $paymentType->getId(), $paymentType->getId() == $checked, array("onclick" => remote_function(array('url' => 'stPayment/ajaxPaymentTypeUpdate', 'with' => "'id=' + this.value", 'script' => true))));
$row['name'] = $paymentType->getName();
$row['description'] = $paymentType->getDescription();
$row['moduleName'] = $paymentType->getModuleName();
$row['paymentTypeSocket'] = stSocketView::openComponents('stPayment_show_'.$paymentType->getModuleName().'_info');
$results[]=$row;
}
$smarty->assign('results',$results);
}
$smarty->display("payment_select_type.html");
?>

View File

@@ -0,0 +1,6 @@
<?php
$smarty->assign('id', $product->getId());
$smarty->assign('product', $product);
$smarty->assign('amount', $product->getPriceBrutto(true));
$smarty->display('payment_show_info_in_product.html');
?>

View File

@@ -0,0 +1,4 @@
<?php
$smarty->assign("show_payment", st_get_component($paymentType.'Frontend', 'showPayment', array('order' => $order)));
$smarty->assign("payment_name", $paymentTypeName);
$smarty->display("payment_show.html");

View File

@@ -0,0 +1,4 @@
<?php
st_theme_use_stylesheet('stPayment.css');
$smarty->display('payment_failure.html');

View File

@@ -0,0 +1,3 @@
<?php
$smarty->assign('show_payment', st_get_component('stPayment', 'showPayment', array('order' => $order)));
$smarty->display('payment_pay.html');

View File

@@ -0,0 +1,5 @@
<?php
st_theme_use_stylesheet('stPayment.css');
$smarty->display('payment_return.html');

View File

@@ -0,0 +1,3 @@
<?php
$smarty->display('payment_select_channel.html');

View File

@@ -0,0 +1,19 @@
<div id="st_component-st_payment-list" class="st_payment-list-table">
{if $hasPaymentType}
<h5 class="st_title">{__ text="Płatności"}</h5>
<ul>
{foreach key=row item=payment from=$results}
<li class="payment">
{$payment.radio} {$payment.name}
<p style="margin-left: 25px">{$payment.description}</p>
<p style="margin-left: 25px">{$payment.paymentTypeSocket}</p>
</li>
{/foreach}
</ul>
{else}
<h5 class="st_title">{__ text="Płatności"}</h5>
<ul>
<li class="payment">{__ text="Brak dostępnych form płatności."}</li>
</ul>
{/if}
</div>

View File

@@ -0,0 +1,7 @@
<br />
<div class="st_application">
<h1 class="st_title">{__ text="Płatność"}</h1>
<p style="text-align: center">
{$show_payment}
</p>
</div>

View File

@@ -0,0 +1,2 @@
{include_st_component module="stZagielFrontend" component="calculate" params="id=$id"}
{include_st_component module="stLukasFrontend" component="calculate" params="id=$id"}

View File

@@ -0,0 +1,6 @@
{set layout="one_column_layout"}
<div id="order_payment" class="box roundies">
<div class="content">
{$show_payment}
</div>
</div>

View File

@@ -0,0 +1,19 @@
<div id="st_component-st_payment-list" class="st_payment-list-table">
{if $hasPaymentType}
<h3>{__ text="Płatności"}</h3>
<ul>
{foreach key=row item=payment from=$results}
<li class="payment">
{$payment.radio} {$payment.name}
<p style="margin-left: 25px">{$payment.description}</p>
<p style="margin-left: 25px">{$payment.paymentTypeSocket}</p>
</li>
{/foreach}
</ul>
{else}
<h3>{__ text="Płatności"}</h3>
<ul>
<li class="payment">{__ text="Brak dostępnych form płatności."}</li>
</ul>
{/if}
</div>

View File

@@ -0,0 +1,7 @@
<div id="order_payment" class="roundies box_form">
<h3>{$payment_name}</h3>
<div class="content">
{$show_payment}
</div>
</div>
<br class="clear" />

View File

@@ -0,0 +1,8 @@
{if $santander}
<li id="eraty-santander-calculate">
{st_get_component module="stSantanderFrontend" component="calculate" id=$id product=$product amount=$amount}
</li>
{/if}
{if $lukas}
{st_get_component module="stLukasFrontend" component="calculate" id=$id product=$product amount=$amount}
{/if}

View File

@@ -0,0 +1,19 @@
<div id="payment">
<div class="panel panel-default center-block">
<div id="payu-panel-body" class="panel-body text-center">
<p>
<img src="{$logo}" style="max-width: 200px" alt="{$title}">
</p>
<p>
{$message}
</p>
{if $contact_url}
<p>
<a href="{$contact_url}" class="btn btn-default">
{__ text="Skontaktuj się z nami"}
</a>
</p>
{/if}
</div>
</div>
</div>

View File

@@ -0,0 +1,69 @@
{assign var='payment_info_url' value=$payment_type->getPaymentInformationUrl($amount)}
{assign var='payment_configuration' value=$payment_type->getConfiguration()}
{if $payment_info_url}
<a class="btn btn-default payment-window-open-trigger" href="{$payment_info_url}" rel="nofollow" target="_blank" data-width="{$payment_configuration->getOption('payment_info.width')}" data-height="{$payment_configuration->getOption('payment_info.height')}">{$button_label}</a>
{else}
<a class="btn btn-default" href="#payment-info-modal" data-toggle="modal" data-type="{$type}" data-action="{urlfor internal='@stPayment?action=paymentInformation'}" data-amount="{$amount}" data-title="{$title}">{$button_label}</a>
{/if}
{if !$init}
<div id="payment-info-modal" class="modal fade text-left" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<div class="preloader"></div>
</div>
</div>
</div>
</div>
{literal}
<script>
jQuery(function($) {
$('.payment-window-open-trigger').click(function() {
const link = $(this);
let width = link.data('width') ? link.data('width') : 520;
let height = link.data('height') ? link.data('height') : 500;
let left = 0;
let top = 0;
if (width > screen.width) {
width = screen.width;
height = screen.height;
} else {
left = (screen.width - width) / 2;
top = (screen.height - height) / 4;
}
const popup = window.open(link.attr('href'),
'Policz_rate',
'width='+width+',height='+height+',directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,left='+left+',top='+top);
return false;
});
$('#payment-info-modal').on('show.bs.modal', function(event) {
const modal = $(this);
const trigger = $(event.relatedTarget);
modal.find('.modal-title').html(trigger.data('title') ? trigger.data('title') : trigger.html());
const params = {'type': trigger.data('type'), 'amount': trigger.data('amount')};
$.get(trigger.data('action'), params, function(response) {
modal.find('.modal-body').html(response);
});
}).on('hide.bs.modal', function() {
const modal = $(this);
modal.find('.modal-body').html('<div class="preloader"></div>');
});
});
</script>
{/literal}
{/if}

View File

@@ -0,0 +1,4 @@
{set layout="one_column"}
<div id="payment">
{$show_payment}
</div>

View File

@@ -0,0 +1,16 @@
<div id="payment">
<div class="panel panel-default center-block">
<div id="payu-panel-body" class="panel-body text-center">
<p>
<img src="{$logo}" alt="" style="max-width: 150px" />
</p>
<p>
{if $canceled}
<p>{__ text="Płatność anulowana" catalogue="stPayment"}</p>
{else}
<p>{__ text="Dziękujemy za dokonanie płatności." catalogue="stPayment"}</p>
{/if}
</p>
</div>
</div>
</div>

View File

@@ -0,0 +1,60 @@
{if $payment_channels}
<div id="payment-select-channel" data-id="{$payment->getId()}">
{foreach from=$payment_channels item=channel}
<a class="payment-channel" href="#" data-channel="{json_encode data=$channel escape=true}">
<img src="{$channel.logo}" alt="{$channel.name}">
{if $channel.show_name}
<span class="payment-channel-name">{$channel.name}</span>
{/if}
</a>
{/foreach}
</div>
{literal}
<script>
jQuery(function($) {
const selectPaymentChannel = $('#payment-select-channel');
function update(channel) {
const paymentMethod = $('#shopping-cart-payment .payment-method[data-id='+selectPaymentChannel.data('id')+']');
const modal = selectPaymentChannel.closest('.modal');
const jsonChannelData = JSON.stringify(channel);
let selectedChannelTpl = '<img src="'+channel.logo+'" alt="'+channel.name+'">';
if (channel.show_name)
{
selectedChannelTpl += ' ' + channel.name;
}
paymentMethod.find('.selected-payment-channel').html(selectedChannelTpl);
$('#payment_channel').val(JSON.stringify(jsonChannelData));
modal.modal('hide');
paymentRadio = paymentMethod.find('.payment-radio')
.prop('checked', true)
.data('channel', channel)
.change();
}
selectPaymentChannel.find('.payment-channel').click(function() {
const selected = $(this);
let channel = selected.data('channel');
let needUpdate = selectPaymentChannel.triggerHandler('change', channel);
if (false !== needUpdate) {
update(channel);
}
selectPaymentChannel.find('.payment-channel.selected').removeClass('selected');
selected.addClass('selected');
return false;
});
selectPaymentChannel.on('update', function(e, channel) {
update(channel);
});
});
</script>
{/literal}
{else}
{__ text="Wystąpił problem przy próbie połaczenia z serwisem płatności zamknij okno i spróbuj ponownie."}
{/if}

View File

@@ -0,0 +1,19 @@
<div id="st_component-st_payment-list" class="st_payment-list-table">
{if $hasPaymentType}
<h3>{__ text="Płatności"}</h3>
<ul>
{foreach key=row item=payment from=$results}
<li class="payment">
{$payment.radio} {$payment.name}
<p style="margin-left: 25px">{$payment.description}</p>
<p style="margin-left: 25px">{$payment.paymentTypeSocket}</p>
</li>
{/foreach}
</ul>
{else}
<h3>{__ text="Płatności"}</h3>
<ul>
<li class="payment">{__ text="Brak dostępnych form płatności."}</li>
</ul>
{/if}
</div>

View File

@@ -0,0 +1 @@
{$show_payment}

View File

@@ -0,0 +1,38 @@
{if $payments}
<li class="highlighted-payment">
<span class="payment-logo">{image src="payment/payments.svg" alt=$payments_label}</span>
<span class="payment-name">
{foreach from=$payments item=payment name=payments}
{$payment}{if !$smarty.foreach.payments.last}, {/if}
{/foreach}
</span>
</li>
{/if}
{foreach from=$highlighted item=current key=id}
<li class="highlighted-payment">
<span class="payment-logo">
{if $current.logo}
<img src="{$current.logo}" alt="{$current.name}">
{else}
{image src="payment/$id.svg" alt=$current.name}
{/if}
</span>
<span class="payment-name">{$current.description}</span>
{if $current.show_info}
{st_get_component module="stPayment" component="paymentInfoButton" amount=$amount payment_type=$current.payment_type}
{/if}
</li>
{/foreach}
{if $lukas}
{st_get_component module="stLukasFrontend" component="calculate" id=$id product=$product amount=$amount}
{/if}
{capture name="name" assign="inbank"}
{st_get_component module="stInBankFrontend" component="calculate" product=$product amount=$amount}
{/capture}
{if $inbank}
<li style="margin-top: 12px">{$inbank}</li>
{/if}

View File

@@ -0,0 +1,69 @@
<div class="modal fade modal-vertical-centered" id="order-payment-process-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false" data-action="{$action}" data-autoredirect="{$api->isAutoRedirectEnabled()}">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<p class="text-center"><img src="{$api->getLogoPath()}" style="max-width: 150px" alt=""></p>
<p class="text-center">{__ text="Za chwilę nastąpi przekierowanie na stronę płatności. Proszę czekać."}</p>
<p class="text-center"><strong data-countdown-value="3" data-countdown-unit="{__ text="sek."}"></strong></p>
<div class="preloader"></div>
</div>
</div>
</div>
</div>
<div id="order-payment-process-container" class="hidden"></div>
{literal}
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function () {
var modal = $('#order-payment-process-modal');
function redirect()
{
$.get(modal.data('action'), function(response) {
if (response && response.redirect) {
window.location = response.redirect;
} else if (response && response.content) {
var container = $('#order-payment-process-container');
container.html(response.content);
container.find('form').submit();
}
});
}
modal.on('shown.bs.modal', function() {
if (modal.data('autoredirect')) {
var countdownContainer = modal.find('[data-countdown-value]');
var countdown = countdownContainer.data('countdown-value');
var unit = countdownContainer.data('countdown-unit');
countdownContainer.html(countdown + ' ' + unit);
var timer = setInterval(function() {
countdownContainer.html(countdown + ' ' + unit);
if (countdown == 0) {
clearInterval(timer);
redirect();
}
countdown--;
}, 1000);
} else {
redirect();
}
})
if (modal.data('autoredirect'))
{
modal.modal({ show: true });
}
$('#order-pay-btn').click(function() {
modal.modal({ show: true });
return false;
});
});
});
</script>
{/literal}