first commit
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stPlatnosciPlPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stPlatnosciPlPlugin 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 stPlatnosciPlPlugin
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: actions.class.php 5335 2010-05-28 11:39:59Z michal $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasa stPlatnosciPlFrontendActions
|
||||
*
|
||||
* @package stPlatnosciPlPlugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stPlatnosciPlFrontendActions extends stActions
|
||||
{
|
||||
/**
|
||||
* Pozytywny powrót z płatności
|
||||
*/
|
||||
public function executeReturnSuccess()
|
||||
{
|
||||
if ($this->hasRequestParameter('error'))
|
||||
{
|
||||
return $this->redirect('@stPlatnosciPlPlugin?action=returnFail');
|
||||
}
|
||||
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Negatywny powrót z płatności
|
||||
*/
|
||||
public function executeReturnFail()
|
||||
{
|
||||
$this->smarty = new stSmarty($this->getModuleName());
|
||||
|
||||
$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()
|
||||
{
|
||||
$this->smarty = new stSmarty('stPlatnosciPlFrontend');
|
||||
|
||||
$api = new stPlatnosciPl();
|
||||
$order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('id'), $this->getRequestParameter('hash'));
|
||||
|
||||
try
|
||||
{
|
||||
$url = $api->getOrderFormUrl($order);
|
||||
|
||||
if ($url)
|
||||
{
|
||||
return $this->renderJSON(array('redirect' => $url));
|
||||
}
|
||||
}
|
||||
catch (OpenPayU_Exception $e)
|
||||
{
|
||||
stPlatnosciPl::log("Process Payment - Exception: in file ".$e->getFile().' on line '.$e->getLine().' with message'.$e->getMessage());
|
||||
}
|
||||
|
||||
sfLoader::loadHelpers(array('Helper', 'stUrl'));
|
||||
return $this->renderJSON(array('redirect' => st_url_for('stPlatnosciPlFrontend/returnFail?type=process')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Odbieranie statusu transakcji
|
||||
*/
|
||||
public function executeStatusReport()
|
||||
{
|
||||
$body = file_get_contents('php://input');
|
||||
$data = trim($body);
|
||||
|
||||
stPlatnosciPl::log("Status Report Request: ".$data);
|
||||
|
||||
$api = new stPlatnosciPl();
|
||||
|
||||
try
|
||||
{
|
||||
$order = $api->getOrderNotify($data);
|
||||
} catch (OpenPayU_Exception $e) {
|
||||
stPlatnosciPl::log("Process Payment - Exception: in file ".$e->getFile().' on line '.$e->getLine().' with message'.$e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($order && $order->status == 'COMPLETED')
|
||||
{
|
||||
$payment_id = null;
|
||||
|
||||
if ($this->hasRequestParameter('id'))
|
||||
{
|
||||
$order = OrderPeer::retrieveByIdAndHashCode($this->getRequestParameter('id'), $this->getRequestParameter('hash'));
|
||||
|
||||
if (null !== $order)
|
||||
{
|
||||
$payment = $order->getOrderPayment();
|
||||
|
||||
if (!$payment)
|
||||
{
|
||||
stPlatnosciPl::log("Status Report: Payment for order id {$this->getRequestParameter('id')} does not exist");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stPlatnosciPl::log("Status Report: Order with id {$this->getRequestParameter('id')} does not exist");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
list($id) = explode(':', $order->extOrderId);
|
||||
$payment = PaymentPeer::retrieveByPK($id);
|
||||
|
||||
if (!$payment)
|
||||
{
|
||||
stPlatnosciPl::log("Status Report: Payment with id $id does not exist");
|
||||
}
|
||||
}
|
||||
|
||||
if ($payment)
|
||||
{
|
||||
$payment->setStatus(true);
|
||||
$payment->save();
|
||||
stPlatnosciPl::log("Status Report: Payment with id {$payment->getId()} paid successfully");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->renderText('OK');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stPlatnosciPlPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stPlatnosciPlPlugin 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 stPlatnosciPlPlugin
|
||||
* @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 stPlatnosciPlFrontendComponents
|
||||
*
|
||||
* @package stPlatnosciPlPlugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stPlatnosciPlFrontendComponents extends sfComponents {
|
||||
|
||||
/**
|
||||
* Pokazywanie formularza płatności
|
||||
*/
|
||||
public function executeShowPayment() {
|
||||
$this->smarty = new stSmarty('stPlatnosciPlFrontend');
|
||||
|
||||
$api = new stPlatnosciPl();
|
||||
$order = stPaymentType::getOrderInSummary();
|
||||
|
||||
try
|
||||
{
|
||||
$url = $api->getOrderFormUrl($order);
|
||||
|
||||
if ($url)
|
||||
{
|
||||
return $this->getController()->redirect($url);
|
||||
}
|
||||
}
|
||||
catch (OpenPayU_Exception $e)
|
||||
{
|
||||
stPlatnosciPl::log("stPlatnosciPl::getOrderFormUrl() - Exception:\n".$e->getFile().':'.$e->getLine().':'.$e->getMessage());
|
||||
}
|
||||
|
||||
$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');
|
||||
st_theme_use_stylesheet('stPlatnosciPlPlugin.css');
|
||||
$smarty->display('platnoscipl_show_payment.html');
|
||||
@@ -0,0 +1 @@
|
||||
<?php echo $sig;
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
|
||||
if ($sf_request->getParameter('type') == 'process')
|
||||
{
|
||||
$smarty->display('platnoscipl_show_payment.html');
|
||||
}
|
||||
else
|
||||
{
|
||||
$smarty->display('platnoscipl_return_fail.html');
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
$smarty->display('platnoscipl_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,48 @@
|
||||
<div id="st_frame_platnoscipl">
|
||||
{if $check_configuration == true}
|
||||
<div id="st_txt_platnoscipl">
|
||||
<p>{__ text="Wybierz płatność i kliknij przycisk"} <b>{__ text='"Zapłać"'}</b> {__ text="aby przejść do serwisu PayU."}</p>
|
||||
</div>
|
||||
<div class="st_logo_platnosci">
|
||||
<img src="/images/frontend/theme/default/stPlatnosciPlPlugin/logo.png" alt="Płatności.pl"/>
|
||||
</div>
|
||||
{$form_start}
|
||||
{$hidden_pos_id}
|
||||
{$hidden_pos_auth_key}
|
||||
{$hidden_session_id}
|
||||
{$hidden_amount}
|
||||
{$hidden_desc}
|
||||
{$hidden_order_id}
|
||||
{$hidden_first_name}
|
||||
{$hidden_last_name}
|
||||
{$hidden_street}
|
||||
{$hidden_street_hn}
|
||||
{$hidden_street_an}
|
||||
{$hidden_city}
|
||||
{$hidden_post_code}
|
||||
{$hidden_email}
|
||||
{$hidden_language}
|
||||
{$hidden_client_ip}
|
||||
<script language="JavaScript" type="text/javascript" src="https://www.platnosci.pl/paygw/UTF/js/{$pos_id}/{$md5_first_key}/paytype.js"></script>
|
||||
<script language="JavaScript" type="text/javascript">{$variant_name}</script>
|
||||
{if $payback == true}
|
||||
<br class="st_clear-all" />
|
||||
<div id="st_form-payment-input_tag" class="st_row">
|
||||
{$payback_login_label}
|
||||
<div class="st_field">
|
||||
{$payback_login}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div id="st_form-payment-submit" class="st_button-container">
|
||||
<div class="st_button st_align-right">
|
||||
<div class="st_button-left">
|
||||
{$pay_submit}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{else}
|
||||
{__ text="Płatność została błędnie skonfigurowana."}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
{__ text="OK"}
|
||||
@@ -0,0 +1,26 @@
|
||||
<div id="st_box_payment" class="box roundies">
|
||||
<div class="content">
|
||||
<p><img src="/plugins/stPlatnosciPlPlugin/images/payu.png" alt=""/></p>
|
||||
<p>{__ text="Płatność nie została zrealizowana."}</p>
|
||||
{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}
|
||||
</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,24 @@
|
||||
<div id="st_box_payment" class="box roundies">
|
||||
<div class="content">
|
||||
<p><img src="/plugins/stPlatnosciPlPlugin/images/payu.png" alt=""/></p>
|
||||
<p>{__ text="Dziękujemy za dokonanie płatności."}</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">
|
||||
<img src="/plugins/stPlatnosciPlPlugin/images/payu.png" alt=""/><br />
|
||||
<p style="text-align: center">
|
||||
{__ text="Wystąpił problem z połączeniem się z serwisem PayU."}
|
||||
{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 @@
|
||||
AUTO REDIRECT HTML
|
||||
@@ -0,0 +1,23 @@
|
||||
{set layout="one_column"}
|
||||
<div id="payment">
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="PayU"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<p>
|
||||
<img src="/plugins/stPlatnosciPlPlugin/images/payu.png" alt="" style="width: 150px" />
|
||||
</p>
|
||||
<p>
|
||||
{__ text="Płatność nie została zrealizowana."}<br/>
|
||||
</p>
|
||||
{if $contact_url}
|
||||
<p>
|
||||
<a href="{$contact_url}" class="btn btn-primary">
|
||||
{__ text="Skontaktuj się z nami"}
|
||||
</a>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
{set layout="one_column"}
|
||||
<div id="payment">
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="PayU"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<p>
|
||||
<img src="/plugins/stPlatnosciPlPlugin/images/payu.png" alt="" style="width: 150px" />
|
||||
</p>
|
||||
<p>{__ text="Dziękujemy za dokonanie płatności."}</p>
|
||||
<a href="{$homepage_url}" class="btn btn-primary">{__ text="Wróć do zakupów" langCatalogue="stBasket"}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="PayU"}
|
||||
</div>
|
||||
<div id="payu-panel-body" class="panel-body text-center">
|
||||
<p>
|
||||
<img src="/plugins/stPlatnosciPlPlugin/images/payu.png" alt="" style="width: 150px" />
|
||||
</p>
|
||||
<p>
|
||||
{__ text="Wystąpił problem z połączeniem się z serwisem PayU."}
|
||||
</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