first commit
This commit is contained in:
39
plugins/stDotpayPlugin/config/config.php
Normal file
39
plugins/stDotpayPlugin/config/config.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stDotpayPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stDotpayPlugin 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 stDotpayPlugin
|
||||
* @subpackage configs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: config.php 8015 2010-08-31 11:32:34Z michal $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Dodanie informacji o istnieniu płatności
|
||||
*/
|
||||
|
||||
stPluginHelper::addConfigValue('stPaymentType', 'stDotpayPlugin', array('name' => 'stDotpay', 'description' => 'Płatność przez serwis dotpay.pl'));
|
||||
|
||||
|
||||
if (SF_APP == 'backend'){
|
||||
|
||||
stPluginHelper::addEnableModule('stDotpayBackend');
|
||||
stPluginHelper::addRouting('stDotpayPlugin', '/dotpay/:action/*', 'stDotpayBackend', 'index', 'backend');
|
||||
stConfiguration::addModule('stDotpayPlugin', 'group_3', 1);
|
||||
}
|
||||
|
||||
|
||||
if (SF_APP == 'frontend'){
|
||||
|
||||
stPluginHelper::addEnableModule('stDotpayFrontend');
|
||||
stPluginHelper::addRouting('stDotpayPlugin', '/dotpay/:action/*', 'stDotpayFrontend', 'config', 'frontend');
|
||||
stSecurity::addCSPException('*.dotpay.pl');
|
||||
}
|
||||
332
plugins/stDotpayPlugin/lib/stDotpay.class.php
Normal file
332
plugins/stDotpayPlugin/lib/stDotpay.class.php
Normal file
@@ -0,0 +1,332 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stDotpayPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stDotpayPlugin 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 stDotpayPlugin
|
||||
* @subpackage libs
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: stDotpay.class.php 12828 2011-05-17 14:03:05Z michal $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
/**
|
||||
* Adres url płatności Dotpay
|
||||
*/
|
||||
define('DOTPAY_URL', 'https://ssl.dotpay.pl/t2');
|
||||
|
||||
/**
|
||||
* Klasa stDotpay
|
||||
*
|
||||
* @package stDotpayPlugin
|
||||
* @subpackage libs
|
||||
*/
|
||||
class stDotpay
|
||||
{
|
||||
/**
|
||||
* Tablica z konfiguracją
|
||||
* @var array
|
||||
*/
|
||||
private $config = array();
|
||||
|
||||
/**
|
||||
* Konstruktor - ładownianie konfiguracji
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = stPaymentType::getConfiguration(__CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsługa funkcji call
|
||||
*
|
||||
* @param $method
|
||||
* @param $arguments
|
||||
* @return mixed string/bool
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
return stPaymentType::call($method, $this->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Przeliczanie kwoty zamówień i zwracanie jej w ustalonym formacie
|
||||
*
|
||||
* @param float $orderAmountBrutto
|
||||
* @return integer
|
||||
*/
|
||||
public function getOrderAmount( $orderAmountBrutto )
|
||||
{
|
||||
return number_format($orderAmountBrutto,2, '.', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwracanie adresu url serwisu dotpay.pl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return !$this->getTest() ? 'https://ssl.dotpay.pl/t2/' : 'https://ssl.dotpay.pl/test_payment/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwracanie adresów ip serwisu dotpay.pl
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getIpAddresses()
|
||||
{
|
||||
return $this->ipAddresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwracanie kanałów płatności
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getChannels()
|
||||
{
|
||||
$i18n = sfContext::getInstance()->getI18N();
|
||||
$channels = array();
|
||||
foreach($this->channels as $channel)
|
||||
{
|
||||
$channels[] = $i18n->__($channel);
|
||||
}
|
||||
return $channels;
|
||||
}
|
||||
|
||||
public function getParams(Order $order)
|
||||
{
|
||||
$controller = sfContext::getInstance()->getController();
|
||||
$lang = strtolower(stPaymentType::getLanguage());
|
||||
$user = $order->getOrderUserDataBilling();
|
||||
$params = array(
|
||||
'api_version' => 'dev',
|
||||
'id' => $this->getDotpayId(),
|
||||
'amount' => $this->getOrderAmount(stPayment::getUnpayedAmountByOrder($order)),
|
||||
'currency' => $order->getOrderCurrency()->getShortcut(),
|
||||
'description'=> __('Zamówienie nr', null, 'stDotpayFrontend').' '.$order->getNumber(),
|
||||
'lang' => $lang,
|
||||
// 'channel' => $this->getDefaultChannel(),
|
||||
// 'ch_lock' => $this->getLockChannel(),
|
||||
// 'onlinetransfer' => $this->getCheckChannel(),
|
||||
'URL' => $controller->genUrl('@stDotpayPlugin?action=return', true),
|
||||
'type' => '3',
|
||||
'buttontext' => $this->getButtonBackText(),
|
||||
'URLC' => $controller->genUrl('@stDotpayPlugin?action=statusReport&order_id='.$order->getId().'&hash='.$order->getHashCode(), true),
|
||||
'firstname' => $user->getName(),
|
||||
'lastname' => $user->getSurname(),
|
||||
'email' => $order->getGuardUser()->getUsername(),
|
||||
'street' => $user->getStreet(),
|
||||
'street_n1' => $user->getHouse(),
|
||||
'street_n2' => $user->getFlat(),
|
||||
'city' => $user->getTown(),
|
||||
'postcode' => $user->getCode(),
|
||||
'country' => $user->getCountry()->getIsoA3(),
|
||||
'p_info' => htmlspecialchars($this->getShopName()),
|
||||
);
|
||||
|
||||
$params['chk'] = $this->generateChk($this->getPin(), $params);
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
public function verifySignature(sfRequest $request)
|
||||
{
|
||||
|
||||
$sign=
|
||||
$this->getPin().
|
||||
$request->getParameter('id', '').
|
||||
$request->getParameter('operation_number', '').
|
||||
$request->getParameter('operation_type', '').
|
||||
$request->getParameter('operation_status', '').
|
||||
$request->getParameter('operation_amount', '').
|
||||
$request->getParameter('operation_currency', '').
|
||||
$request->getParameter('operation_withdrawal_amount', '').
|
||||
$request->getParameter('operation_commission_amount', '').
|
||||
$request->getParameter('operation_original_amount', '').
|
||||
$request->getParameter('operation_original_currency', '').
|
||||
$request->getParameter('operation_datetime', '').
|
||||
$request->getParameter('operation_related_number', '').
|
||||
$request->getParameter('control', '').
|
||||
$request->getParameter('description', '').
|
||||
$request->getParameter('email', '').
|
||||
$request->getParameter('p_info', '').
|
||||
$request->getParameter('p_email', '').
|
||||
$request->getParameter('credit_card_issuer_identification_
|
||||
number', '').
|
||||
$request->getParameter('credit_card_masked_number', '').
|
||||
$request->getParameter('credit_card_brand_codename', '').
|
||||
$request->getParameter('credit_card_brand_code', '').
|
||||
$request->getParameter('credit_card_id', '').
|
||||
$request->getParameter('channel', '').
|
||||
$request->getParameter('channel_country', '').
|
||||
$request->getParameter('geoip_country', '');
|
||||
return $request->getParameter('signature') == hash('sha256', $sign);
|
||||
}
|
||||
|
||||
public function generateChk($DotpayPin, $ParametersArray)
|
||||
{
|
||||
$ChkParametersChain =
|
||||
$DotpayPin.
|
||||
(isset($ParametersArray['api_version']) ?
|
||||
$ParametersArray['api_version'] : null).
|
||||
(isset($ParametersArray['charset']) ?
|
||||
$ParametersArray['charset'] : null).
|
||||
(isset($ParametersArray['lang']) ?
|
||||
$ParametersArray['lang'] : null).
|
||||
(isset($ParametersArray['id']) ?
|
||||
$ParametersArray['id'] : null).
|
||||
(isset($ParametersArray['amount']) ?
|
||||
$ParametersArray['amount'] : null).
|
||||
(isset($ParametersArray['currency']) ?
|
||||
$ParametersArray['currency'] : null).
|
||||
(isset($ParametersArray['description']) ?
|
||||
$ParametersArray['description'] : null).
|
||||
(isset($ParametersArray['control']) ?
|
||||
$ParametersArray['control'] : null).
|
||||
(isset($ParametersArray['channel']) ?
|
||||
$ParametersArray['channel'] : null).
|
||||
(isset($ParametersArray['credit_card_brand']) ?
|
||||
$ParametersArray['credit_card_brand'] : null).
|
||||
(isset($ParametersArray['ch_lock']) ?
|
||||
$ParametersArray['ch_lock'] : null).
|
||||
(isset($ParametersArray['channel_groups']) ?
|
||||
$ParametersArray['channel_groups'] : null).
|
||||
(isset($ParametersArray['onlinetransfer']) ?
|
||||
$ParametersArray['onlinetransfer'] : null).
|
||||
(isset($ParametersArray['URL']) ?
|
||||
$ParametersArray['URL'] : null).
|
||||
(isset($ParametersArray['type']) ?
|
||||
$ParametersArray['type'] : null).
|
||||
(isset($ParametersArray['buttontext']) ?
|
||||
$ParametersArray['buttontext'] : null).
|
||||
(isset($ParametersArray['URLC']) ?
|
||||
$ParametersArray['URLC'] : null).
|
||||
(isset($ParametersArray['firstname']) ?
|
||||
$ParametersArray['firstname'] : null).
|
||||
(isset($ParametersArray['lastname']) ?
|
||||
$ParametersArray['lastname'] : null).
|
||||
(isset($ParametersArray['email']) ?
|
||||
$ParametersArray['email'] : null).
|
||||
(isset($ParametersArray['street']) ?
|
||||
$ParametersArray['street'] : null).
|
||||
(isset($ParametersArray['street_n1']) ?
|
||||
$ParametersArray['street_n1'] : null).
|
||||
(isset($ParametersArray['street_n2']) ?
|
||||
$ParametersArray['street_n2'] : null).
|
||||
(isset($ParametersArray['state']) ?
|
||||
$ParametersArray['state'] : null).
|
||||
(isset($ParametersArray['addr3']) ?
|
||||
$ParametersArray['addr3'] : null).
|
||||
(isset($ParametersArray['city']) ?
|
||||
$ParametersArray['city'] : null).
|
||||
(isset($ParametersArray['postcode']) ?
|
||||
$ParametersArray['postcode'] : null).
|
||||
(isset($ParametersArray['phone']) ?
|
||||
$ParametersArray['phone'] : null).
|
||||
(isset($ParametersArray['country']) ?
|
||||
$ParametersArray['country'] : null).
|
||||
(isset($ParametersArray['code']) ?
|
||||
$ParametersArray['code'] : null).
|
||||
(isset($ParametersArray['p_info']) ?
|
||||
htmlspecialchars_decode($ParametersArray['p_info']) : null).
|
||||
(isset($ParametersArray['p_email']) ?
|
||||
$ParametersArray['p_email'] : null).
|
||||
(isset($ParametersArray['n_email']) ?
|
||||
$ParametersArray['n_email'] : null).
|
||||
(isset($ParametersArray['expiration_date']) ?
|
||||
$ParametersArray['expiration_date'] : null).
|
||||
(isset($ParametersArray['recipient_account_number']) ?
|
||||
$ParametersArray['recipient_account_number'] : null).
|
||||
(isset($ParametersArray['recipient_company']) ?
|
||||
$ParametersArray['recipient_company'] : null).
|
||||
(isset($ParametersArray['recipient_first_name']) ?
|
||||
$ParametersArray['recipient_first_name'] : null).
|
||||
(isset($ParametersArray['recipient_last_name']) ?
|
||||
$ParametersArray['recipient_last_name'] : null).
|
||||
(isset($ParametersArray['recipient_address_street']) ?
|
||||
$ParametersArray['recipient_address_street'] : null).
|
||||
(isset($ParametersArray['recipient_address_building']) ?
|
||||
$ParametersArray['recipient_address_building'] : null).
|
||||
(isset($ParametersArray['recipient_address_apartment']) ?
|
||||
$ParametersArray['recipient_address_apartment'] : null).
|
||||
(isset($ParametersArray['recipient_address_postcode']) ?
|
||||
$ParametersArray['recipient_address_postcode'] : null).
|
||||
(isset($ParametersArray['recipient_address_city']) ?
|
||||
$ParametersArray['recipient_address_city'] : null).
|
||||
(isset($ParametersArray['warranty']) ?
|
||||
$ParametersArray['warranty'] : null).
|
||||
(isset($ParametersArray['bylaw']) ?
|
||||
$ParametersArray['bylaw'] : null).
|
||||
(isset($ParametersArray['personal_data']) ?
|
||||
$ParametersArray['personal_data'] : null).
|
||||
(isset($ParametersArray['credit_card_number']) ?
|
||||
$ParametersArray['credit_card_number'] : null).
|
||||
(isset($ParametersArray['credit_card_expiration_date_year']) ?
|
||||
$ParametersArray['credit_card_expiration_date_year'] : null).
|
||||
(isset($ParametersArray['credit_card_expiration_date_month']) ?
|
||||
$ParametersArray['credit_card_expiration_date_month'] : null).
|
||||
(isset($ParametersArray['credit_card_security_code']) ?
|
||||
$ParametersArray['credit_card_security_code'] : null).
|
||||
(isset($ParametersArray['credit_card_store']) ?
|
||||
$ParametersArray['credit_card_store'] : null).
|
||||
(isset($ParametersArray['credit_card_store_security_code']) ?
|
||||
$ParametersArray['credit_card_store_security_code'] : null).
|
||||
(isset($ParametersArray['credit_card_customer_id']) ?
|
||||
$ParametersArray['credit_card_customer_id'] : null).
|
||||
(isset($ParametersArray['credit_card_id']) ?
|
||||
$ParametersArray['credit_card_id'] : null).
|
||||
(isset($ParametersArray['blik_code']) ?
|
||||
$ParametersArray['blik_code'] : null).
|
||||
(isset($ParametersArray['credit_card_registration']) ?
|
||||
$ParametersArray['credit_card_registration'] : null).
|
||||
(isset($ParametersArray['recurring_frequency']) ?
|
||||
$ParametersArray['recurring_frequency'] : null).
|
||||
(isset($ParametersArray['recurring_interval']) ?
|
||||
$ParametersArray['recurring_interval'] : null).
|
||||
(isset($ParametersArray['recurring_start']) ?
|
||||
$ParametersArray['recurring_start'] : null).
|
||||
(isset($ParametersArray['recurring_count']) ?
|
||||
$ParametersArray['recurring_count'] : null);
|
||||
|
||||
// throw new Exception($ChkParametersChain);
|
||||
|
||||
|
||||
return hash('sha256', $ChkParametersChain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sprawdzenie czy płatność została skonfiguraowana
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkPaymentConfiguration()
|
||||
{
|
||||
if (!$this->hasDotpayId()) return false;
|
||||
if (!$this->hasPin()) return false;
|
||||
if (SF_APP == 'frontend')
|
||||
{
|
||||
$currencies = array('PLN', 'EUR', 'USD', 'GBP', 'JPY', 'CZK', 'SEK');
|
||||
if (!in_array(stCurrency::getInstance(sfContext::getInstance())->get()->getShortcut(), $currencies)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getButtonBackText() {
|
||||
$config = stConfig::getInstance('stDotpayBackend');
|
||||
$config->setCulture(sfContext::getInstance()->getUser()->getCulture());
|
||||
return $config->get('button_back_text', null, true);
|
||||
}
|
||||
|
||||
public function getShopName() {
|
||||
$config = stConfig::getInstance('stDotpayBackend');
|
||||
$config->setCulture(sfContext::getInstance()->getUser()->getCulture());
|
||||
return $config->get('shop_name', null, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stDotpayPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stDotpayPlugin 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 stDotpayPlugin
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: actions.class.php 7193 2010-08-02 12:43:35Z marek $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasa stDotpayBackendActions
|
||||
*
|
||||
* @package stDotpayPlugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stDotpayBackendActions extends stActions
|
||||
{
|
||||
public function executeIndex()
|
||||
{
|
||||
$this->stDotpay = new stDotpay();
|
||||
|
||||
$i18n = $this->getContext()->getI18N();
|
||||
$this->config = stConfig::getInstance($this->getContext(), array('culture' => $this->getRequestParameter('culture', stLanguage::getOptLanguage())));
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
$this->config->setFromRequest('config');
|
||||
$this->config->save();
|
||||
$this->setFlash('notice', $i18n->__('Twoje zmiany zostały zapisane', null, 'stAdminGeneratorPlugin'));
|
||||
}
|
||||
$this->config->load();
|
||||
|
||||
$this->labels = $this->getLabels();
|
||||
}
|
||||
|
||||
public function validateIndex()
|
||||
{
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function handleErrorIndex()
|
||||
{
|
||||
$this->stDotpay = new stDotpay();
|
||||
|
||||
$this->config = stConfig::getInstance($this->getContext());
|
||||
|
||||
$this->labels = $this->getLabels();
|
||||
|
||||
return sfView::SUCCESS;
|
||||
}
|
||||
|
||||
public function getLabels()
|
||||
{
|
||||
return array('config{dotpay_id}' => 'Identyfikator', 'config{pin}' => 'Numer PIN do weryfikacji płatności');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class stDotpayBackendComponents extends sfComponents
|
||||
{
|
||||
|
||||
public function executeListMenu()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,19 @@
|
||||
<div class="list-menu">
|
||||
<ul>
|
||||
|
||||
<li class="selected">
|
||||
<?php echo link_to(__('Dotpay'),'stDotpayBackend/index')?>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<?php if (sfContext::getInstance()->getUser()->getCulture() == 'pl_PL'): ?>
|
||||
<a href="https://www.sote.pl/docs/dotpay" target="_blank"><?php echo __('Dokumentacja'); ?></a>
|
||||
<?php else: ?>
|
||||
<a href="https://www.soteshop.com/docs/dotpay" target="_blank"><?php echo __('Documentation'); ?></a>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="clr"></div>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php use_helper('I18N', 'stAdminGenerator', 'Validation') ?>
|
||||
<?php echo st_get_admin_head('stDotpayPlugin', __('Dotpay'), array('culture' => $config->getCulture()), array('stPayment')) ?>
|
||||
<?php st_view_slot_start('application-menu') ?>
|
||||
<?php st_include_component('stDotpayBackend', 'listMenu') ?>
|
||||
<?php st_view_slot_end() ?>
|
||||
|
||||
<?php st_include_partial('stAdminGenerator/message', array('labels' => $labels));?>
|
||||
|
||||
<?php echo form_tag('dotpay/index?culture='.$config->getCulture(), array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form', 'class' => 'admin_form'));?>
|
||||
<fieldset>
|
||||
<div class="content">
|
||||
<?php if (SF_ENVIRONMENT == 'dev' || $sf_request->hasParameter('debug')): ?>
|
||||
<?php echo st_admin_get_form_field('config[test]', __('Tryb testowy'), 1, 'checkbox_tag', array('checked' => $config->get('test'))) ?>
|
||||
<?php endif ?>
|
||||
<?php echo st_admin_get_form_field('config[dotpay_id]', __('Identyfikator'), $config->get('dotpay_id'), 'input_tag', array('required' => true)) ?>
|
||||
<?php echo st_admin_get_form_field('config[pin]', __('Numer PIN do weryfikacji płatności'), $config->get('pin'), 'input_password_tag', array('required' => true)) ?>
|
||||
<?php echo st_admin_get_form_field('config[shop_name]', __('Nazwa sklepu'), $config->get('shop_name')) ?>
|
||||
<?php echo st_admin_get_form_field('config[button_back_text]', __('Tekst przycisku powrotu do sklepu'), $config->get('button_back_text')) ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<?php echo st_get_admin_actions_head('style="margin-top: 10px; float: right"') ?>
|
||||
<?php echo st_get_admin_action('save', __('Zapisz', array(), 'stAdminGeneratorPlugin'), null, array('name' => 'save')) ?>
|
||||
<?php echo st_get_admin_actions_foot() ?>
|
||||
</form>
|
||||
|
||||
|
||||
<?php echo st_get_admin_foot() ?>
|
||||
@@ -0,0 +1,7 @@
|
||||
fields:
|
||||
config{dotpay_id}:
|
||||
required:
|
||||
msg: Proszę uzupełnić pole.
|
||||
config{pin}:
|
||||
required:
|
||||
msg: Proszę uzupełnić pole.
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stDotpayPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stDotpayPlugin 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 stDotpayPlugin
|
||||
* @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 stDotpayFrontendActions
|
||||
*
|
||||
* @package stDotpayPlugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stDotpayFrontendActions extends stActions
|
||||
{
|
||||
/**
|
||||
* Pozytywny powrót z płatności
|
||||
*/
|
||||
public function executeReturn()
|
||||
{
|
||||
if ($this->getRequest()->hasParameter('status'))
|
||||
{
|
||||
if($this->getRequest()->getParameter('status') == 'OK')
|
||||
{
|
||||
$this->forward('stDotpayFrontend', 'returnSuccess');
|
||||
}
|
||||
}
|
||||
$this->forward('stDotpayFrontend', 'returnFail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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($this->getModuleName());
|
||||
$this->contactPage = WebpagePeer::retrieveByState('CONTACT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Odbieranie statusu transakcji
|
||||
*/
|
||||
public function executeStatusReport()
|
||||
{
|
||||
$api = new stDotpay();
|
||||
|
||||
if ($api->verifySignature($this->getRequest()))
|
||||
{
|
||||
$order_id = $this->getRequestParameter('order_id');
|
||||
$order_hash = $this->getRequestParameter('hash');
|
||||
|
||||
$order = OrderPeer::retrieveByIdAndHashCode($order_id, $order_hash);
|
||||
|
||||
if (null !== $order)
|
||||
{
|
||||
$payment = $order->getOrderPayment();
|
||||
|
||||
if (null !== $payment)
|
||||
{
|
||||
if ($this->getRequestParameter('operation_status') == 'completed')
|
||||
{
|
||||
$payment->setStatus(true);
|
||||
$payment->save();
|
||||
stPayment::log('dotpay', "Status Report (order_id: $order_id) - Order paid successfully");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stPayment::log('dotpay', "Status Report (order_id: $order_id) - Missing payment instance");
|
||||
|
||||
return $this->renderText('Missing payment instance');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stPayment::log('dotpay', "Status Report (order_id: $order_id) - Missing order instance");
|
||||
|
||||
return $this->renderText('Missing order instance');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
stPayment::log('dotpay', "Status Report (order_id: $order_id) - Wrong signature for params: " . var_export($this->getRequest()->getParameterHolder()->getAll(), true));
|
||||
|
||||
return $this->renderText('Wrong signature');
|
||||
}
|
||||
|
||||
return $this->renderText('OK');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* SOTESHOP/stDotpayPlugin
|
||||
*
|
||||
* Ten plik należy do aplikacji stDotpayPlugin 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 stDotpayPlugin
|
||||
* @subpackage actions
|
||||
* @copyright SOTE (www.sote.pl)
|
||||
* @license http://www.sote.pl/license/sote (Professional License SOTE)
|
||||
* @version $Id: components.class.php 15922 2011-11-03 08:43:32Z michal $
|
||||
* @author Michal Prochowski <michal.prochowski@sote.pl>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Klasa stDotpayFrontendComponents
|
||||
*
|
||||
* @package stDotpayPlugin
|
||||
* @subpackage actions
|
||||
*/
|
||||
class stDotpayFrontendComponents extends sfComponents
|
||||
{
|
||||
/**
|
||||
* Pokazywanie formularza płatności
|
||||
*/
|
||||
public function executeShowPayment()
|
||||
{
|
||||
$this->smarty = new stSmarty('stDotpayFrontend');
|
||||
|
||||
$api = new stDotpay();
|
||||
|
||||
$this->smarty->assign('params', $api->getParams($this->order));
|
||||
$this->smarty->assign('url', $api->getUrl());
|
||||
$this->smarty->assign('check_configuration', $api->checkPaymentConfiguration());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
$smarty->display("dotpay_show_payment.html");
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
$smarty->assign('contactLink', is_object($contactPage) ? url_for('stWebpageFrontend/index?url='.$contactPage->getFriendlyUrl()) : null);
|
||||
$smarty->display("dotpay_return_fail.html");
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
st_theme_use_stylesheet('stPayment.css');
|
||||
$smarty->display("dotpay_return_success.html");
|
||||
@@ -0,0 +1 @@
|
||||
<?php $smarty->display("dotpay_status_report.html");
|
||||
@@ -0,0 +1,4 @@
|
||||
<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,4 @@
|
||||
<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,42 @@
|
||||
{if $check_configuration}
|
||||
<div id="st_box_payment">
|
||||
<p>{__ text="Kliknij przycisk"} <b>{__ text='"Zapłać"'}</b> {__ text="aby przejść do serwisu Dotpay."}</p>
|
||||
<p><img id="st_home" src="/images/frontend/theme/default/stDotpayPlugin/logo.jpg" alt=""/></p>
|
||||
{$form_start}
|
||||
{$input_id}
|
||||
{$input_currency}
|
||||
{$input_amount}
|
||||
{$input_description}
|
||||
{$input_lang}
|
||||
{$input_channel}
|
||||
{$input_ch_lock}
|
||||
{$input_onlinetransfer}
|
||||
{$input_url}
|
||||
{$input_type}
|
||||
{$input_buttontext}
|
||||
{$input_urlc}
|
||||
{$input_control}
|
||||
{$input_firstname}
|
||||
{$input_lastname}
|
||||
{$input_email}
|
||||
{$input_street}
|
||||
{$input_street_n1}
|
||||
{$input_street_n2}
|
||||
{$input_city}
|
||||
{$input_postcode}
|
||||
{$input_phone}
|
||||
{$input_country}
|
||||
{$input_p_info}
|
||||
{$input_p_email}
|
||||
<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>
|
||||
</div>
|
||||
{else}
|
||||
{__ text="Płatność została błędnie skonfigurowana."}
|
||||
{/if}
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,8 @@
|
||||
<div id="stPayment_return" class="box roundies">
|
||||
<div class="title">
|
||||
<h2>{__ text="Płatność"}</h2>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{__ text="Płatność nie została zrealizowana."}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
<div id="stPayment_return" class="box roundies">
|
||||
<div class="title">
|
||||
<h2>{__ text="Płatność"}</h2>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>{__ text="Dziękujemy za dokonanie płatności."}</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
{if $check_configuration}
|
||||
<div id="st_box_payment">
|
||||
<img id="st_home" src="/images/frontend/theme/default2/stDotpayPlugin/logo.jpg" alt=""/><br />
|
||||
<span>
|
||||
{$description}
|
||||
</span>
|
||||
<form action="{$url}" method="post">
|
||||
{foreach key=name item=value from=$params}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/foreach}
|
||||
<div class="buttons right">
|
||||
<button type="submit" class="important roundies">
|
||||
<span class="arrow_right">{__ text="Zapłać"}</span>
|
||||
</button>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
</form>
|
||||
</div>
|
||||
{else}
|
||||
{__ text="Płatność została błędnie skonfigurowana."}
|
||||
{/if}
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,20 @@
|
||||
{set layout="one_column"}
|
||||
<div id="payment">
|
||||
<div class="title">
|
||||
<h1>{__ text="Płatność"}</h1>
|
||||
</div>
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="Dotpay"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<p>
|
||||
{__ text="Płatność nie została zrealizowana."}<br/>
|
||||
{__ text="Skontaktuj się z nami." langCatalogue="stPayment"}
|
||||
</p>
|
||||
{if $contactLink}
|
||||
<a href="{$contactLink}" class="btn btn-primary">{__ text="Kontakt" langCatalogue="stPayment"}</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
{set layout="one_column"}
|
||||
<div id="payment">
|
||||
<div class="title">
|
||||
<h1>{__ text="Płatność"}</h1>
|
||||
</div>
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="Dotpay"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<p>{__ text="Dziękujemy za dokonanie płatności."}</p>
|
||||
<a href="/" class="btn btn-primary">{__ text="Wróć do zakupów" langCatalogue="stPayment"}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,23 @@
|
||||
<div class="panel panel-default center-block">
|
||||
<div class="panel-heading">
|
||||
{__ text="Dotpay"}
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
{if $check_configuration}
|
||||
<img src="/images/frontend/theme/default2/stDotpayPlugin/logo.jpg" alt="{__ text="Dotpay"}"/><br />
|
||||
<span>
|
||||
{$description}
|
||||
</span>
|
||||
<form action="{$url}" method="post">
|
||||
{foreach key=name item=value from=$params}
|
||||
<input type="hidden" name="{$name}" value="{$value}" />
|
||||
{/foreach}
|
||||
<button type="submit" class="btn btn-primary pull-right">
|
||||
{__ text="Zapłać"}
|
||||
</button>
|
||||
</form>
|
||||
{else}
|
||||
{__ text="Płatność została błędnie skonfigurowana."}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
Reference in New Issue
Block a user