first commit
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stPrzelewy24Plugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stPrzelewy24Plugin 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 stPrzelewy24Plugin
|
||||
* @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 stPrzelewy24FrontendActions
|
||||
*
|
||||
* @package stPrzelewy24Plugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stPrzelewy24FrontendActions extends stActions
|
||||
{
|
||||
|
||||
/**
|
||||
* Pozytywny powrót z płatności
|
||||
*/
|
||||
public function executeReturnSuccess()
|
||||
{
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Negatywny powrót z płatności
|
||||
*/
|
||||
public function executeReturnFail()
|
||||
{
|
||||
$this->smarty = new stSmarty('stPrzelewy24Frontend');
|
||||
|
||||
$webpage = WebpagePeer::retrieveByState('CONTACT');
|
||||
|
||||
if ($webpage)
|
||||
{
|
||||
sfLoader::loadHelpers(array('Helper', 'stUrl'));
|
||||
$this->smarty->assign('contact_url', st_url_for('stWebpageFrontend/index?url='.$webpage->getFriendlyUrl()));
|
||||
}
|
||||
}
|
||||
|
||||
public function executeProcessPayment()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('id'), $this->getRequestParameter('hash'));
|
||||
|
||||
if ($order)
|
||||
{
|
||||
$this->api = new stPrzelewy24();
|
||||
|
||||
try
|
||||
{
|
||||
$url = $this->api->getPaymentUrl($order);
|
||||
|
||||
stPayment::log("przelewy24", "Generate payment url for order with id {$order->getId()}: $url");
|
||||
|
||||
if ($url)
|
||||
{
|
||||
return $this->renderJSON(array('redirect' => $url));
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
stPayment::log("przelewy24", "Generate payment url exception for order with id {$order->getId()}: {$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->renderJSON(array('redirect' => $this->getController()->genUrl('stPrzelewy24Frontend/returnFail')));
|
||||
}
|
||||
|
||||
public function executeStatus()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$order = OrderPeer::retrieveByIdAndHashCode($request->getParameter('id'), $request->getParameter('hash'));
|
||||
|
||||
if ($order)
|
||||
{
|
||||
$api = new stPrzelewy24();
|
||||
|
||||
try
|
||||
{
|
||||
if ($api->verify($order, $request))
|
||||
{
|
||||
$payment = $order->getOrderPayment();
|
||||
|
||||
if ($payment)
|
||||
{
|
||||
$payment->setStatus(true);
|
||||
$payment->save();
|
||||
|
||||
stPayment::log("przelewy24", "Payment status update for order with id {$order->getId()}: successful");
|
||||
}
|
||||
else
|
||||
{
|
||||
stPayment::log("przelewy24", "Payment status update: Payment for order with id {$order->getId()} does not exist");
|
||||
}
|
||||
}
|
||||
} catch (Exception $e)
|
||||
{
|
||||
stPayment::log("przelewy24", "Payment status update exception for order with id {$order->getId()}: ". $e->getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stPayment::log("przelewy24", "Payment status update: Order with id {$request->getParameter('id')} does not exist");
|
||||
}
|
||||
|
||||
return $this->renderText("OK");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stPrzelewy24Plugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stPrzelewy24Plugin 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 stPrzelewy24Plugin
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: components.class.php 10 2009-08-24 09:32:18Z michal $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasa stPrzelewy24Components
|
||||
*
|
||||
* @package stPrzelewy24Plugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stPrzelewy24FrontendComponents extends sfComponents
|
||||
{
|
||||
/**
|
||||
* Pokazywanie formularza płatności
|
||||
*/
|
||||
public function executeShowPayment()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
if ($this->order)
|
||||
{
|
||||
$this->api = new stPrzelewy24();
|
||||
|
||||
try
|
||||
{
|
||||
$url = $this->api->getPaymentUrl($this->order);
|
||||
|
||||
stPayment::log("przelewy24", "Generate payment url for order with id {$this->order->getId()}: $url");
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
stPayment::log("przelewy24", "Generate payment url exception for order with id {$this->order->getId()}: {$e->getMessage()}");
|
||||
}
|
||||
|
||||
if ($url)
|
||||
{
|
||||
$this->getContext()->getController()->redirect($url);
|
||||
throw new sfStopException();
|
||||
}
|
||||
}
|
||||
|
||||
$this->smarty = new stSmarty('stPrzelewy24Frontend');
|
||||
|
||||
$webpage = WebpagePeer::retrieveByState('CONTACT');
|
||||
|
||||
if ($webpage)
|
||||
{
|
||||
sfLoader::loadHelpers(array('Helper', 'stUrl'));
|
||||
$this->smarty->assign('contact_url', st_url_for('stWebpageFrontend/index?url='.$webpage->getFriendlyUrl()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
|
||||
$smarty->display('przelewy24_show_payment.html');
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
$smarty->display('przelewy24_show_payment.html');
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
$smarty->display('przelewy24_return_success.html');
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="st_application">
|
||||
<h1 class="st_title">
|
||||
{__ text="Płatność"}
|
||||
</h1>
|
||||
<p style="text-align: center; margin-bottom: 20px;">
|
||||
{__ text="Płatność nie została zrealizowana."}
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<div class="st_application">
|
||||
<h1 class="st_title">
|
||||
{__ text="Płatność"}
|
||||
</h1>
|
||||
<p style="text-align: center; margin-bottom: 20px;">
|
||||
{__ text="Dziękujemy za dokonanie płatności."}
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,38 @@
|
||||
<div id="st_frame_przelewy24">
|
||||
{if $check_configuration == true}
|
||||
<div id="st_txt_przelewy24">
|
||||
<p>{__ text="Kliknij przycisk"} <b>{__ text='"Zapłać"'}</b> {__ text="aby przejść do serwisu Przelewy24."}</p>
|
||||
</div>
|
||||
<div class="st_logo_przelewy24">
|
||||
<img src="/images/frontend/theme/default/stPrzelewy24Plugin/logo.jpg" alt="Przelewy24.pl"/>
|
||||
</div>
|
||||
{$form_start}
|
||||
{$hidden_p24_session_id}
|
||||
{$hidden_p24_id_sprzedawcy}
|
||||
{$hidden_p24_kwota}
|
||||
{$hidden_p24_klient}
|
||||
{$hidden_p24_adres}
|
||||
{$hidden_p24_kod}
|
||||
{$hidden_p24_miasto}
|
||||
{$hidden_p24_kraj}
|
||||
{$hidden_p24_email}
|
||||
{$hidden_p24_return_url_ok}
|
||||
{$hidden_p24_return_url_error}
|
||||
{$hidden_p24_opis}
|
||||
{if $show_payment_table}
|
||||
<script type="text/javascript" src="https://secure.przelewy24.pl/external/formy.php?id={$p24_id_sprzedawcy}&encoding=utf-8&style=0&opis=0&cols={$payment_table_cols}&lang={$lang}"></script>
|
||||
<script type="text/javascript">m_formy();</script>
|
||||
{/if}
|
||||
{$hidden_p24_language}
|
||||
<div id="st_form-payment-submit" class="st_button-container">
|
||||
<div class="st_button st_align-right">
|
||||
<div class="st_button-left">
|
||||
{$submit_button}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{else}
|
||||
{__ text="Płatność została błędnie skonfigurowana."}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
<div id="st_box_payment" class="box roundies">
|
||||
<div class="content">
|
||||
<p><img src="/plugins/stPrzelewy24Plugin/images/logo.png" /></p>
|
||||
<p>{__ text="Trwa przetwarzanie płatności w systemie Przelewy24. Status płatności zostanie wysłany w wiadomości e-mail."}</p>
|
||||
<form action="{$homepage_url}" class="buttons" method="get">
|
||||
<p>
|
||||
<button type="submit" class="important roundies">
|
||||
<span>{__ text="Wróć do zakupów" langCatalogue="stBasket"}</span>
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('#st_box_payment form').submit(function() {
|
||||
var form = $(this);
|
||||
window.location = form.attr('action');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
@@ -0,0 +1,26 @@
|
||||
<div id="st_box_payment" style="text-align: center">
|
||||
<p><img src="/plugins/stPrzelewy24Plugin/images/logo.png" alt="Przelewy24.pl" /></p>
|
||||
<p style="text-align: center">
|
||||
{__ text="Wystąpił problem z połączeniem się z serwisem Przelewy24."}
|
||||
{if $contact_url}
|
||||
<form action="{$contact_url}" class="buttons" method="get">
|
||||
<p>
|
||||
<button type="submit" class="important roundies">
|
||||
<span class="arrow_right">{__ text="Skontaktuj się z nami"}</span>
|
||||
</button>
|
||||
</p>
|
||||
</form>
|
||||
{/if}
|
||||
</p>
|
||||
</div>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('#st_box_payment form').submit(function() {
|
||||
var form = $(this);
|
||||
window.location = form.attr('action');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/literal}
|
||||
@@ -0,0 +1,13 @@
|
||||
{set layout="one_column"}
|
||||
<div id="payment">
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="Przelewy24"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<p><img src="/plugins/stPrzelewy24Plugin/images/logo.png" alt="" /></p>
|
||||
<p>{__ text="Trwa przetwarzanie płatności w systemie Przelewy24. Status płatności zostanie wysłany w wiadomości e-mail."}</p>
|
||||
<a href="{$homepage_url}" class="btn btn-primary">{__ text="Wróć do zakupów" catalogue="stBasket"}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="Przelewy24"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<p><img src="/plugins/stPrzelewy24Plugin/images/logo.png" alt="" /></p>
|
||||
<p>{__ text="Wystąpił problem z połączeniem się z serwisem Przelewy24."}</p>
|
||||
{if $contact_url}
|
||||
<p>
|
||||
<a href="{$contact_url}" class="btn btn-primary">
|
||||
{__ text="Skontaktuj się z nami"}
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user