Version Notes
.
Download this release
Release Info
Developer | BlueMedia |
Extension | BlueMedia_BluePayment |
Version | 1.3.4 |
Comparing to | |
See all releases |
Version 1.3.4
- app/code/community/BlueMedia/BluePayment/Block/Form.php +49 -0
- app/code/community/BlueMedia/BluePayment/Block/Redirect.php +41 -0
- app/code/community/BlueMedia/BluePayment/Helper/Data.php +50 -0
- app/code/community/BlueMedia/BluePayment/Model/Abstract.php +408 -0
- app/code/community/BlueMedia/BluePayment/Model/Session.php +30 -0
- app/code/community/BlueMedia/BluePayment/controllers/ProcessingController.php +169 -0
- app/code/community/BlueMedia/BluePayment/etc/config.xml +89 -0
- app/code/community/BlueMedia/BluePayment/etc/system.xml +79 -0
- app/design/frontend/base/default/layout/bluepayment.xml +33 -0
- app/design/frontend/base/default/template/bluepayment/back.phtml +20 -0
- app/design/frontend/base/default/template/bluepayment/empty.phtml +20 -0
- app/design/frontend/base/default/template/bluepayment/form.phtml +31 -0
- app/design/frontend/base/default/template/bluepayment/redirect.phtml +26 -0
- app/etc/modules/BlueMedia_BluePayment.xml +12 -0
- app/locale/pl_PL/BlueMedia_BluePayment.csv +8 -0
- package.xml +26 -0
- skin/frontend/base/default/images/bluepayment/logo.png +0 -0
app/code/community/BlueMedia/BluePayment/Block/Form.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Blue Media
|
13 |
+
* @package BlueMedia_BluePayment
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Blok formularza z metodą płatności bluepayment
|
20 |
+
*
|
21 |
+
* @category BlueMedia
|
22 |
+
* @package BlueMedia_BluePayment
|
23 |
+
*/
|
24 |
+
class BlueMedia_BluePayment_Block_Form extends Mage_Payment_Block_Form
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Konstruktor. Ustawienie szablonu formularza.
|
28 |
+
*/
|
29 |
+
protected function _construct()
|
30 |
+
{
|
31 |
+
$this->setTemplate('bluepayment/form.phtml');
|
32 |
+
$this->setMethodTitle(Mage::helper('bluepayment')->__('Online payment BM'));
|
33 |
+
|
34 |
+
return parent::_construct();
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Zwraca adres do logo firmy
|
39 |
+
*
|
40 |
+
* @return string|bool
|
41 |
+
*/
|
42 |
+
public function getLogoSrc()
|
43 |
+
{
|
44 |
+
$logo_src = $this->getSkinUrl('images/bluepayment/logo.png');
|
45 |
+
|
46 |
+
return $logo_src != '' ? $logo_src : false;
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
app/code/community/BlueMedia/BluePayment/Block/Redirect.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Blue Media
|
13 |
+
* @package BlueMedia_BluePayment
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Blok przekierowania
|
20 |
+
*
|
21 |
+
* @category BlueMedia
|
22 |
+
* @package BlueMedia_BluePayment
|
23 |
+
*/
|
24 |
+
class BlueMedia_BluePayment_Block_Redirect extends Mage_Core_Block_Template
|
25 |
+
{
|
26 |
+
public function getForm() {
|
27 |
+
$abstract_model = Mage::getModel('bluepayment/abstract');
|
28 |
+
|
29 |
+
$form = new Varien_Data_Form();
|
30 |
+
$form->setAction($abstract_model->getUrlGateway())
|
31 |
+
->setId('bluepayment_checkout')
|
32 |
+
->setName('bluepayment_checkout')
|
33 |
+
->setMethod('GET')
|
34 |
+
->setUseContainer(true);
|
35 |
+
|
36 |
+
foreach ($abstract_model->getFormRedirectFields($this->getOrder()) as $field => $value) {
|
37 |
+
$form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
|
38 |
+
}
|
39 |
+
return $form->toHtml();
|
40 |
+
}
|
41 |
+
}
|
app/code/community/BlueMedia/BluePayment/Helper/Data.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category BlueMedia
|
13 |
+
* @package BlueMedia_BluePayment
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Funkcje pomocnicze
|
20 |
+
*
|
21 |
+
* @category BlueMedia
|
22 |
+
* @package BlueMedia_BluePayment
|
23 |
+
*/
|
24 |
+
class BlueMedia_BluePayment_Helper_Data extends Mage_Payment_Helper_Data
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Generuje i zwraca klucz hash na podstawie wartości pól z tablicy
|
28 |
+
*
|
29 |
+
* @param array $data
|
30 |
+
* @return string
|
31 |
+
*/
|
32 |
+
public function generateAndReturnHash($data)
|
33 |
+
{
|
34 |
+
$algorithm = Mage::getStoreConfig("payment/bluepayment/hash_algorithm");
|
35 |
+
|
36 |
+
$separator = Mage::getStoreConfig("payment/bluepayment/hash_separator");
|
37 |
+
|
38 |
+
$values_array = array_values($data);
|
39 |
+
|
40 |
+
$values_array_filter = array_filter(($values_array));
|
41 |
+
|
42 |
+
$comma_separated = implode(",", $values_array_filter);
|
43 |
+
|
44 |
+
$replaced = str_replace(",", $separator, $comma_separated);
|
45 |
+
|
46 |
+
$hash = hash($algorithm, $replaced);
|
47 |
+
|
48 |
+
return $hash;
|
49 |
+
}
|
50 |
+
}
|
app/code/community/BlueMedia/BluePayment/Model/Abstract.php
ADDED
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* BlueMedia_BluePayment extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category BlueMedia
|
14 |
+
* @package BlueMedia_BluePayment
|
15 |
+
* @copyright Copyright (c) 2015
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Abstrakcyjny model
|
21 |
+
*
|
22 |
+
* @category BlueMedia
|
23 |
+
* @package BlueMedia_BluePayment
|
24 |
+
*/
|
25 |
+
class BlueMedia_BluePayment_Model_Abstract extends Mage_Payment_Model_Method_Abstract {
|
26 |
+
|
27 |
+
private $_checkHashArray = [];
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Stałe statusów płatności
|
31 |
+
*/
|
32 |
+
const PAYMENT_STATUS_PENDING = 'PENDING';
|
33 |
+
const PAYMENT_STATUS_SUCCESS = 'SUCCESS';
|
34 |
+
const PAYMENT_STATUS_FAILURE = 'FAILURE';
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Stałe potwierdzenia autentyczności transakcji
|
38 |
+
*/
|
39 |
+
const TRANSACTION_CONFIRMED = "CONFIRMED";
|
40 |
+
const TRANSACTION_NOTCONFIRMED = "NOTCONFIRMED";
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Unikatowy wewnętrzy identyfikator metody płatności
|
44 |
+
*
|
45 |
+
* @var string [a-z0-9_]
|
46 |
+
*/
|
47 |
+
protected $_code = 'bluepayment';
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Blok z formularza płatności
|
51 |
+
*
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
protected $_formBlockType = 'bluepayment/form';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Czy ta opcja płatności może być pokazywana na stronie
|
58 |
+
* płatności w zakupach typu 'checkout' ?
|
59 |
+
*
|
60 |
+
* @var boolean
|
61 |
+
*/
|
62 |
+
protected $_canUseCheckout = true;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Czy stosować tą metodę płatności dla opcji multi-dostaw ?
|
66 |
+
*
|
67 |
+
* @var boolean
|
68 |
+
*/
|
69 |
+
protected $_canUseForMultishipping = false;
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Czy ta metoda płatności jest bramką (online auth/charge) ?
|
73 |
+
*
|
74 |
+
* @var boolean
|
75 |
+
*/
|
76 |
+
protected $_isGateway = false;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Możliwość użycia formy płatności z panelu administracyjnego
|
80 |
+
*
|
81 |
+
* @var boolean
|
82 |
+
*/
|
83 |
+
protected $_canUseInternal = false;
|
84 |
+
|
85 |
+
/**
|
86 |
+
* Czy wymagana jest inicjalizacja ?
|
87 |
+
*
|
88 |
+
* @var boolean
|
89 |
+
*/
|
90 |
+
protected $_isInitializeNeeded = true;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Zwraca adres url kontrolera do przekierowania po potwierdzeniu zamówienia
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function getOrderPlaceRedirectUrl() {
|
98 |
+
return Mage::getUrl('bluepayment/processing/create', array('_secure' => true));
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Zwraca adres bramki
|
103 |
+
*
|
104 |
+
* @return string
|
105 |
+
*/
|
106 |
+
public function getUrlGateway() {
|
107 |
+
// Aktywny tryb usługi
|
108 |
+
$mode = $this->getConfigData('test_mode');
|
109 |
+
|
110 |
+
if ($mode) {
|
111 |
+
return Mage::getStoreConfig("payment/bluepayment/test_address_url");
|
112 |
+
}
|
113 |
+
|
114 |
+
return Mage::getStoreConfig("payment/bluepayment/prod_address_url");
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Tablica z parametrami do wysłania metodą GET do bramki
|
119 |
+
* @param object $order
|
120 |
+
*
|
121 |
+
* @return array
|
122 |
+
*/
|
123 |
+
public function getFormRedirectFields($order) {
|
124 |
+
// Id zamówienia
|
125 |
+
$orderId = $order->getRealOrderId();
|
126 |
+
|
127 |
+
// Suma zamówienia
|
128 |
+
$amount = number_format(round($order->getGrandTotal(), 2), 2, '.', '');
|
129 |
+
|
130 |
+
// Dane serwisu partnera
|
131 |
+
// Indywidualny numer serwisu
|
132 |
+
$serviceId = $this->getConfigData('service_id');
|
133 |
+
|
134 |
+
// Klucz współdzielony
|
135 |
+
$sharedKey = $this->getConfigData('shared_key');
|
136 |
+
|
137 |
+
// Adres email klienta
|
138 |
+
$customerEmail = $order->getCustomerEmail();
|
139 |
+
|
140 |
+
// Tablica danych z których wygenerować hash
|
141 |
+
$hashData = array($serviceId, $orderId, $amount, $customerEmail, $sharedKey);
|
142 |
+
|
143 |
+
// Klucz hash
|
144 |
+
$hashLocal = Mage::helper('bluepayment')->generateAndReturnHash($hashData);
|
145 |
+
|
146 |
+
// Tablica z parametrami do formularza
|
147 |
+
$params = array(
|
148 |
+
'ServiceID' => $serviceId,
|
149 |
+
'OrderID' => $orderId,
|
150 |
+
'Amount' => $amount,
|
151 |
+
'CustomerEmail' => $customerEmail,
|
152 |
+
'Hash' => $hashLocal
|
153 |
+
);
|
154 |
+
|
155 |
+
return $params;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Ustawia odpowiedni status transakcji/płatności zgodnie z uzyskaną informacją
|
160 |
+
* z akcji 'statusAction'
|
161 |
+
*
|
162 |
+
* @param array $transactions
|
163 |
+
* @param string $hash
|
164 |
+
*/
|
165 |
+
public function processStatusPayment($response) {
|
166 |
+
if ($this->_validAllTransaction($response)) {
|
167 |
+
$transaction_xml = $response->transactions->transaction;
|
168 |
+
// Aktualizacja statusu zamówienia i transakcji
|
169 |
+
$this->updateStatusTransactionAndOrder($transaction_xml);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Waliduje zgodność otrzymanego XML'a
|
175 |
+
* @param XML $response
|
176 |
+
* @return boolen
|
177 |
+
*/
|
178 |
+
public function _validAllTransaction($response) {
|
179 |
+
|
180 |
+
$service_id = $this->getConfigData('service_id');
|
181 |
+
// Klucz współdzielony
|
182 |
+
$shared_key = $this->getConfigData('shared_key');
|
183 |
+
|
184 |
+
$algorithm = Mage::getStoreConfig("payment/bluepayment/hash_algorithm");
|
185 |
+
|
186 |
+
$separator = Mage::getStoreConfig("payment/bluepayment/hash_separator");
|
187 |
+
|
188 |
+
if ($service_id != $response->serviceID)
|
189 |
+
return false;
|
190 |
+
$this->_checkHashArray = [];
|
191 |
+
$hash = (string) $response->hash;
|
192 |
+
$this->_checkHashArray[] = (string) $response->serviceID;
|
193 |
+
|
194 |
+
foreach ($response->transactions->transaction as $trans) {
|
195 |
+
$this->_checkInList($trans);
|
196 |
+
}
|
197 |
+
$this->_checkHashArray[] = $shared_key;
|
198 |
+
return hash($algorithm, implode($separator, $this->_checkHashArray)) == $hash;
|
199 |
+
}
|
200 |
+
|
201 |
+
private function _checkInList($list) {
|
202 |
+
foreach ((array) $list as $row) {
|
203 |
+
if (is_object($row)) {
|
204 |
+
$this->_checkInList($row);
|
205 |
+
} else {
|
206 |
+
$this->_checkHashArray[] = $row;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
/**
|
212 |
+
* Sprawdza czy zamówienie zostało zakończone, zamknięte, lub anulowane
|
213 |
+
*
|
214 |
+
* @param object $order
|
215 |
+
*
|
216 |
+
* @return boolean
|
217 |
+
*/
|
218 |
+
public function isOrderCompleted($order) {
|
219 |
+
$status = $order->getStatus();
|
220 |
+
$stateOrderTab = array(
|
221 |
+
Mage_Sales_Model_Order::STATE_CLOSED,
|
222 |
+
Mage_Sales_Model_Order::STATE_CANCELED,
|
223 |
+
Mage_Sales_Model_Order::STATE_COMPLETE
|
224 |
+
);
|
225 |
+
|
226 |
+
return in_array($status, $stateOrderTab);
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Potwierdzenie w postaci xml o prawidłowej/nieprawidłowej transakcji
|
231 |
+
*
|
232 |
+
* @param string $orderId
|
233 |
+
* @param string $confirmation
|
234 |
+
*
|
235 |
+
* @return XML
|
236 |
+
*/
|
237 |
+
protected function returnConfirmation($orderId, $confirmation) {
|
238 |
+
// Id serwisu partnera
|
239 |
+
$serviceId = $this->getConfigData('service_id');
|
240 |
+
|
241 |
+
// Klucz współdzielony
|
242 |
+
$sharedKey = $this->getConfigData('shared_key');
|
243 |
+
|
244 |
+
// Tablica danych z których wygenerować hash
|
245 |
+
$hashData = array($serviceId, $orderId, $confirmation, $sharedKey);
|
246 |
+
|
247 |
+
// Klucz hash
|
248 |
+
$hashConfirmation = Mage::helper('bluepayment')->generateAndReturnHash($hashData);
|
249 |
+
|
250 |
+
$dom = new DOMDocument('1.0', 'UTF-8');
|
251 |
+
|
252 |
+
$confirmationList = $dom->createElement('confirmationList');
|
253 |
+
|
254 |
+
$domServiceID = $dom->createElement('serviceID', $serviceId);
|
255 |
+
$confirmationList->appendChild($domServiceID);
|
256 |
+
|
257 |
+
$transactionsConfirmations = $dom->createElement('transactionsConfirmations');
|
258 |
+
$confirmationList->appendChild($transactionsConfirmations);
|
259 |
+
|
260 |
+
$domTransactionConfirmed = $dom->createElement('transactionConfirmed');
|
261 |
+
$transactionsConfirmations->appendChild($domTransactionConfirmed);
|
262 |
+
|
263 |
+
$domOrderID = $dom->createElement('orderID', $orderId);
|
264 |
+
$domTransactionConfirmed->appendChild($domOrderID);
|
265 |
+
|
266 |
+
$domConfirmation = $dom->createElement('confirmation', $confirmation);
|
267 |
+
$domTransactionConfirmed->appendChild($domConfirmation);
|
268 |
+
|
269 |
+
$domHash = $dom->createElement('hash', $hashConfirmation);
|
270 |
+
$confirmationList->appendChild($domHash);
|
271 |
+
|
272 |
+
$dom->appendChild($confirmationList);
|
273 |
+
|
274 |
+
echo $dom->saveXML();
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Aktualizacja statusu zamówienia, transakcji oraz wysyłka maila do klienta
|
279 |
+
*
|
280 |
+
* @param $transaction
|
281 |
+
* @throws Exception
|
282 |
+
*/
|
283 |
+
protected function updateStatusTransactionAndOrder($transaction) {
|
284 |
+
// Status płatności
|
285 |
+
$paymentStatus = $transaction->paymentStatus;
|
286 |
+
|
287 |
+
// Id transakcji nadany przez bramkę
|
288 |
+
$remoteId = $transaction->remoteID;
|
289 |
+
|
290 |
+
// Id zamówienia
|
291 |
+
$orderId = $transaction->orderID;
|
292 |
+
|
293 |
+
// Objekt zamówienia
|
294 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
|
295 |
+
|
296 |
+
// Obiekt płatności zamówienia
|
297 |
+
$orderPayment = $order->getPayment();
|
298 |
+
|
299 |
+
// Stan płatności w zamówieniu
|
300 |
+
$orderPaymentState = $orderPayment->getAdditionalInformation('bluepayment_state');
|
301 |
+
|
302 |
+
// Suma zamówienia
|
303 |
+
$amount = number_format(round($order->getGrandTotal(), 2), 2, '.', '');
|
304 |
+
|
305 |
+
$orderConfig = $order->getConfig();
|
306 |
+
|
307 |
+
// Statusy i stany zamówienia
|
308 |
+
// TODO: zastanowić się nad możliwością ustawiania "własnego" stanu zamówienia
|
309 |
+
if ($this->getConfigData('status_waiting_payment') != '') {
|
310 |
+
$statusWaitingPayment = $this->getConfigData('status_waiting_payment');
|
311 |
+
if (method_exists($orderConfig, 'getStatusStates')) {
|
312 |
+
$orderStatusWaitingStates = $order->getConfig()->getStatusStates($statusWaitingPayment);
|
313 |
+
$keyWaiting = array_search($statusWaitingPayment, $orderStatusWaitingStates);
|
314 |
+
$orderStatusWaitingState = $keyWaiting != '' ? $orderStatusWaitingStates[$keyWaiting] : Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
315 |
+
} else {
|
316 |
+
$orderStatusWaitingState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
317 |
+
}
|
318 |
+
} else {
|
319 |
+
$statusWaitingPayment = $order->getConfig()->getStateDefaultStatus(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT);
|
320 |
+
}
|
321 |
+
|
322 |
+
if ($this->getConfigData('status_accept_payment') != '') {
|
323 |
+
$statusAcceptPayment = $this->getConfigData('status_accept_payment');
|
324 |
+
if (method_exists($orderConfig, 'getStatusStates')) {
|
325 |
+
$orderStatusAcceptStates = $order->getConfig()->getStatusStates($statusAcceptPayment);
|
326 |
+
$keyAccept = array_search($statusAcceptPayment, $orderStatusAcceptStates);
|
327 |
+
$orderStatusAcceptState = $keyAccept != '' ? $orderStatusAcceptStates[$keyAccept] : Mage_Sales_Model_Order::STATE_PROCESSING;
|
328 |
+
} else {
|
329 |
+
$orderStatusAcceptState = Mage_Sales_Model_Order::STATE_PROCESSING;
|
330 |
+
}
|
331 |
+
} else {
|
332 |
+
$statusAcceptPayment = $order->getConfig()->getStateDefaultStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
|
333 |
+
}
|
334 |
+
|
335 |
+
if ($this->getConfigData('status_error_payment') != '') {
|
336 |
+
$statusErrorPayment = $this->getConfigData('status_error_payment');
|
337 |
+
if (method_exists($orderConfig, 'getStatusStates')) {
|
338 |
+
$orderStatusErrorStates = $order->getConfig()->getStatusStates($statusErrorPayment);
|
339 |
+
$keyError = array_search($statusErrorPayment, $orderStatusErrorStates);
|
340 |
+
$orderStatusErrorState = $keyError != '' ? $orderStatusErrorStates[$keyError] : Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
|
341 |
+
} else {
|
342 |
+
$statusErrorPayment = Mage_Sales_Model_Order::STATE_NEW;
|
343 |
+
}
|
344 |
+
} else {
|
345 |
+
$statusErrorPayment = $order->getConfig()->getStateDefaultStatus(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW);
|
346 |
+
}
|
347 |
+
|
348 |
+
$paymentStatus = (string) $paymentStatus;
|
349 |
+
|
350 |
+
try {
|
351 |
+
// Jeśli zamówienie jest otwarte i status płatności zamówienia jest różny od statusu płatności z bramki
|
352 |
+
if (!($this->isOrderCompleted($order)) && $orderPaymentState != $paymentStatus) {
|
353 |
+
switch ($paymentStatus) {
|
354 |
+
// Jeśli transakcja została rozpoczęta
|
355 |
+
case self::PAYMENT_STATUS_PENDING:
|
356 |
+
// Jeśli aktualny status zamówienia jest różny od ustawionego jako "oczekiwanie na płatność"
|
357 |
+
if ($paymentStatus != $orderPaymentState) {
|
358 |
+
$transaction = $orderPayment->setTransactionId((string) $remoteId);
|
359 |
+
$transaction->setPreparedMessage('[' . self::PAYMENT_STATUS_PENDING . ']')
|
360 |
+
->save();
|
361 |
+
// Powiadomienie mailowe dla klienta
|
362 |
+
$order->setState($orderStatusWaitingState, $statusWaitingPayment, '', true)
|
363 |
+
->sendOrderUpdateEmail(true)
|
364 |
+
->save();
|
365 |
+
}
|
366 |
+
break;
|
367 |
+
// Jeśli transakcja została zakończona poprawnie
|
368 |
+
case self::PAYMENT_STATUS_SUCCESS:
|
369 |
+
|
370 |
+
$transaction = $orderPayment->setTransactionId((string) $remoteId);
|
371 |
+
$transaction->setPreparedMessage('[' . self::PAYMENT_STATUS_SUCCESS . ']')
|
372 |
+
->registerAuthorizationNotification($amount)
|
373 |
+
->setIsTransactionApproved(true)
|
374 |
+
->setIsTransactionClosed(true)
|
375 |
+
->save();
|
376 |
+
// Powiadomienie mailowe dla klienta
|
377 |
+
$order->setState($orderStatusAcceptState, $statusAcceptPayment, '', true)
|
378 |
+
->sendOrderUpdateEmail(true)
|
379 |
+
->save();
|
380 |
+
break;
|
381 |
+
// Jeśli transakcja nie została zakończona poprawnie
|
382 |
+
case self::PAYMENT_STATUS_FAILURE:
|
383 |
+
|
384 |
+
// Jeśli aktualny status zamówienia jest równy ustawionemu jako "oczekiwanie na płatność"
|
385 |
+
if ($orderPaymentState != $paymentStatus) {
|
386 |
+
$transaction = $orderPayment->setTransactionId((string) $remoteId);
|
387 |
+
$transaction->setPreparedMessage('[' . self::PAYMENT_STATUS_FAILURE . ']')
|
388 |
+
->registerCaptureNotification()
|
389 |
+
->save();
|
390 |
+
// Powiadomienie mailowe dla klienta
|
391 |
+
$order->setState($orderStatusErrorState, $statusErrorPayment, '', true)
|
392 |
+
->sendOrderUpdateEmail(true)
|
393 |
+
->save();
|
394 |
+
}
|
395 |
+
break;
|
396 |
+
default:
|
397 |
+
break;
|
398 |
+
}
|
399 |
+
}
|
400 |
+
$orderPayment->setAdditionalInformation('bluepayment_state', $paymentStatus);
|
401 |
+
$orderPayment->save();
|
402 |
+
$this->returnConfirmation($orderId, self::TRANSACTION_CONFIRMED);
|
403 |
+
} catch (Exception $e) {
|
404 |
+
Mage::logException($e);
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
}
|
app/code/community/BlueMedia/BluePayment/Model/Session.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category BlueMedia
|
13 |
+
* @package BlueMedia_BluePayment
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Sesyjny model
|
20 |
+
*
|
21 |
+
* @category BlueMedia
|
22 |
+
* @package BlueMedia_BluePayment
|
23 |
+
*/
|
24 |
+
class BlueMedia_BluePayment_Model_Session extends Mage_Core_Model_Session_Abstract
|
25 |
+
{
|
26 |
+
public function __construct()
|
27 |
+
{
|
28 |
+
$this->init('bluepayment');
|
29 |
+
}
|
30 |
+
}
|
app/code/community/BlueMedia/BluePayment/controllers/ProcessingController.php
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* BlueMedia_BluePayment extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category BlueMedia
|
14 |
+
* @package BlueMedia_BluePayment
|
15 |
+
* @copyright Copyright (c) 2015
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Kontroler przetwarzania
|
21 |
+
*
|
22 |
+
* @category BlueMedia
|
23 |
+
* @package BlueMedia_BluePayment
|
24 |
+
*/
|
25 |
+
class BlueMedia_BluePayment_ProcessingController extends Mage_Core_Controller_Front_Action {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Zwraca singleton dla Checkout Session Model
|
29 |
+
*
|
30 |
+
* @return Mage_Checkout_Model_Session
|
31 |
+
*/
|
32 |
+
protected function _getCheckout() {
|
33 |
+
return Mage::getSingleton('checkout/session');
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Rozpoczęcie procesu płatności
|
38 |
+
*/
|
39 |
+
public function createAction() {
|
40 |
+
try {
|
41 |
+
// Sesja
|
42 |
+
$session = $this->_getCheckout();
|
43 |
+
|
44 |
+
// Id kolejki modułu w sesji
|
45 |
+
$quoteModuleId = $session->getBluePaymentQuoteId();
|
46 |
+
|
47 |
+
// Zapis do sesji
|
48 |
+
$session->setQuoteId($quoteModuleId);
|
49 |
+
|
50 |
+
// Id ostatniego zamówienia z sesji
|
51 |
+
$sessionLastRealOrderSessionId = $session->getLastRealOrderId();
|
52 |
+
|
53 |
+
// Obiekt zamówienia
|
54 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($sessionLastRealOrderSessionId);
|
55 |
+
|
56 |
+
// Jeśli zamówienie nie posiada numeru id, wyświetl wyjątek
|
57 |
+
if (!$order->getId()) {
|
58 |
+
Mage::log('Zamówienie bez identyfikatora');
|
59 |
+
}
|
60 |
+
|
61 |
+
$statusWaitingPayment = Mage::getStoreConfig("payment/bluepayment/status_waiting_payment");
|
62 |
+
|
63 |
+
// Jeśli ustawiono własny status
|
64 |
+
if ($statusWaitingPayment != '') {
|
65 |
+
$orderConfig = $order->getConfig();
|
66 |
+
if (method_exists($orderConfig, 'getStatusStates')) {
|
67 |
+
$orderStatusWaitingStates = $orderConfig->getStatusStates($statusWaitingPayment);
|
68 |
+
$keyWaiting = array_search($statusWaitingPayment, $orderStatusWaitingStates);
|
69 |
+
$orderStatusWaitingState = $keyWaiting != '' ? $orderStatusWaitingStates[$keyWaiting] : Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
|
70 |
+
} else {
|
71 |
+
$orderStatusWaitingState = Mage_Sales_Model_Order::STATE_NEW;
|
72 |
+
}
|
73 |
+
|
74 |
+
$order->setState($orderStatusWaitingState, Mage::getStoreConfig("payment/bluepayment/status_waiting_payment"))
|
75 |
+
->save();
|
76 |
+
} else {
|
77 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, Mage_Sales_Model_Order::STATE_PENDING_PAYMENT)
|
78 |
+
->save();
|
79 |
+
}
|
80 |
+
|
81 |
+
$order->sendNewOrderEmail();
|
82 |
+
|
83 |
+
// Załadowanie layout
|
84 |
+
$this->loadLayout();
|
85 |
+
$this->getLayout()->getBlock('bluepayment_child')->setOrder($order);
|
86 |
+
$this->renderLayout();
|
87 |
+
} catch (Exception $e) {
|
88 |
+
Mage::logException($e);
|
89 |
+
parent::_redirect('checkout/cart');
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Sprawdzenie danych po powrocie z bramki płatniczej
|
95 |
+
*
|
96 |
+
* @throws Exception
|
97 |
+
*/
|
98 |
+
public function backAction() {
|
99 |
+
try {
|
100 |
+
// Parametry z request
|
101 |
+
$params = $this->getRequest()->getParams();
|
102 |
+
|
103 |
+
if (array_key_exists('Hash', $params)) {
|
104 |
+
// Id serwisu partnera
|
105 |
+
$serviceId = Mage::getStoreConfig("payment/bluepayment/service_id");
|
106 |
+
|
107 |
+
// Id zamówienia
|
108 |
+
$orderId = $params['OrderID'];
|
109 |
+
|
110 |
+
// Hash
|
111 |
+
$hash = $params['Hash'];
|
112 |
+
|
113 |
+
// Klucz współdzielony
|
114 |
+
$sharedKey = Mage::getStoreConfig("payment/bluepayment/shared_key");
|
115 |
+
|
116 |
+
// Tablica danych z których wygenerować hash
|
117 |
+
$hashData = array($serviceId, $orderId, $sharedKey);
|
118 |
+
|
119 |
+
// Klucz hash
|
120 |
+
$hashLocal = Mage::helper('bluepayment')->generateAndReturnHash($hashData);
|
121 |
+
|
122 |
+
// Sprawdzenie zgodności hash-y oraz reszty parametrów
|
123 |
+
if ($hash == $hashLocal) {
|
124 |
+
$this->_redirect('checkout/onepage/success', array('_secure' => true));
|
125 |
+
} else {
|
126 |
+
Mage::log('Klucz autoryzacji transakcji jest nieprawidłowy');
|
127 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
128 |
+
}
|
129 |
+
} else {
|
130 |
+
Mage::log('Klucz autoryzacji transakcji nie istnieje');
|
131 |
+
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
|
132 |
+
}
|
133 |
+
} catch (Mage_Core_Exception $e) {
|
134 |
+
$this->_getCheckout()->addError($e->getMessage());
|
135 |
+
Mage::logException($e);
|
136 |
+
parent::_redirect('checkout/cart');
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* ITN - sprawdzenie statusu natychmiastowego powiadomienia o transakcji
|
142 |
+
*
|
143 |
+
* @throws Exception
|
144 |
+
*/
|
145 |
+
public function statusAction() {
|
146 |
+
try {
|
147 |
+
// Parametry z request
|
148 |
+
$params = $this->getRequest()->getParams();
|
149 |
+
|
150 |
+
// Jeśli parametr 'transactions' istnieje w tablicy $params,
|
151 |
+
// wykonaj operacje zmiany statusu płatności zamówienia
|
152 |
+
if (array_key_exists('transactions', $params)) {
|
153 |
+
// Zakodowany parametr transakcje
|
154 |
+
$paramTransactions = $params['transactions'];
|
155 |
+
|
156 |
+
// Odkodowanie parametru transakcji
|
157 |
+
$base64transactions = base64_decode($paramTransactions);
|
158 |
+
// Odczytanie parametrów z xml-a
|
159 |
+
$simpleXml = simplexml_load_string($base64transactions);
|
160 |
+
|
161 |
+
$abstract = Mage::getModel('bluepayment/abstract');
|
162 |
+
$abstract->processStatusPayment($simpleXml);
|
163 |
+
}
|
164 |
+
} catch (Exception $e) {
|
165 |
+
Mage::logException($e);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
}
|
app/code/community/BlueMedia/BluePayment/etc/config.xml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<BlueMedia_BluePayment>
|
5 |
+
<version>1.3.6</version>
|
6 |
+
</BlueMedia_BluePayment>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<bluepayment>
|
11 |
+
<class>BlueMedia_BluePayment_Block</class>
|
12 |
+
</bluepayment>
|
13 |
+
</blocks>
|
14 |
+
<models>
|
15 |
+
<bluepayment>
|
16 |
+
<class>BlueMedia_BluePayment_Model</class>
|
17 |
+
</bluepayment>
|
18 |
+
</models>
|
19 |
+
<helpers>
|
20 |
+
<bluepayment>
|
21 |
+
<class>BlueMedia_BluePayment_Helper</class>
|
22 |
+
</bluepayment>
|
23 |
+
</helpers>
|
24 |
+
<resources>
|
25 |
+
<bluepayment_setup>
|
26 |
+
<setup>
|
27 |
+
<module>BlueMedia_BluePayment</module>
|
28 |
+
</setup>
|
29 |
+
<connection>
|
30 |
+
<use>core_setup</use>
|
31 |
+
</connection>
|
32 |
+
</bluepayment_setup>
|
33 |
+
</resources>
|
34 |
+
</global>
|
35 |
+
<frontend>
|
36 |
+
<routers>
|
37 |
+
<bluepayment>
|
38 |
+
<use>standard</use>
|
39 |
+
<args>
|
40 |
+
<module>BlueMedia_BluePayment</module>
|
41 |
+
<frontName>bluepayment</frontName>
|
42 |
+
</args>
|
43 |
+
</bluepayment>
|
44 |
+
</routers>
|
45 |
+
<translate>
|
46 |
+
<modules>
|
47 |
+
<BlueMedia_BluePayment>
|
48 |
+
<files>
|
49 |
+
<default>BlueMedia_BluePayment.csv</default>
|
50 |
+
</files>
|
51 |
+
</BlueMedia_BluePayment>
|
52 |
+
</modules>
|
53 |
+
</translate>
|
54 |
+
<layout>
|
55 |
+
<updates>
|
56 |
+
<bluepayment>
|
57 |
+
<file>bluepayment.xml</file>
|
58 |
+
</bluepayment>
|
59 |
+
</updates>
|
60 |
+
</layout>
|
61 |
+
</frontend>
|
62 |
+
<adminhtml>
|
63 |
+
<translate>
|
64 |
+
<modules>
|
65 |
+
<BlueMedia_BluePayment>
|
66 |
+
<files>
|
67 |
+
<default>BlueMedia_BluePayment.csv</default>
|
68 |
+
</files>
|
69 |
+
</BlueMedia_BluePayment>
|
70 |
+
</modules>
|
71 |
+
</translate>
|
72 |
+
</adminhtml>
|
73 |
+
<default>
|
74 |
+
<payment>
|
75 |
+
<bluepayment>
|
76 |
+
<active>0</active>
|
77 |
+
<model>bluepayment/abstract</model>
|
78 |
+
<encoding>UTF</encoding>
|
79 |
+
<title>Online payment BM</title>
|
80 |
+
<payment_action>authorize</payment_action>
|
81 |
+
<allowspecific>0</allowspecific>
|
82 |
+
<test_address_url>https://pay-accept.bm.pl/payment</test_address_url>
|
83 |
+
<prod_address_url>https://pay.bm.pl/payment</prod_address_url>
|
84 |
+
<hash_algorithm>sha256</hash_algorithm>
|
85 |
+
<hash_separator>|</hash_separator>
|
86 |
+
</bluepayment>
|
87 |
+
</payment>
|
88 |
+
</default>
|
89 |
+
</config>
|
app/code/community/BlueMedia/BluePayment/etc/system.xml
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<payment>
|
5 |
+
<groups>
|
6 |
+
<bluepayment translate="label" module="bluepayment">
|
7 |
+
<label>Online payment BM</label>
|
8 |
+
<sort_order>670</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>0</show_in_store>
|
12 |
+
<fields>
|
13 |
+
<active translate="label">
|
14 |
+
<label>Enabled</label>
|
15 |
+
<frontend_type>select</frontend_type>
|
16 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
17 |
+
<sort_order>1</sort_order>
|
18 |
+
<show_in_default>1</show_in_default>
|
19 |
+
<show_in_website>1</show_in_website>
|
20 |
+
<show_in_store>0</show_in_store>
|
21 |
+
</active>
|
22 |
+
<test_mode translate="label">
|
23 |
+
<label>Test mode</label>
|
24 |
+
<frontend_type>select</frontend_type>
|
25 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
26 |
+
<sort_order>2</sort_order>
|
27 |
+
<show_in_default>1</show_in_default>
|
28 |
+
<show_in_website>1</show_in_website>
|
29 |
+
<show_in_store>0</show_in_store>
|
30 |
+
</test_mode>
|
31 |
+
<service_id translate="label">
|
32 |
+
<label>Service partner ID</label>
|
33 |
+
<frontend_type>text</frontend_type>
|
34 |
+
<sort_order>3</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>0</show_in_store>
|
38 |
+
</service_id>
|
39 |
+
<shared_key translate="label">
|
40 |
+
<label>Shared key</label>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>4</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>1</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
</shared_key>
|
47 |
+
<status_waiting_payment translate="label">
|
48 |
+
<label>Status waiting payment</label>
|
49 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
50 |
+
<frontend_type>select</frontend_type>
|
51 |
+
<sort_order>5</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>0</show_in_store>
|
55 |
+
</status_waiting_payment>
|
56 |
+
<status_accept_payment translate="label">
|
57 |
+
<label>Status accept payment</label>
|
58 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<sort_order>6</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>0</show_in_store>
|
64 |
+
</status_accept_payment>
|
65 |
+
<status_error_payment translate="label">
|
66 |
+
<label>Status error payment</label>
|
67 |
+
<source_model>adminhtml/system_config_source_order_status</source_model>
|
68 |
+
<frontend_type>select</frontend_type>
|
69 |
+
<sort_order>7</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>0</show_in_store>
|
73 |
+
</status_error_payment>
|
74 |
+
</fields>
|
75 |
+
</bluepayment>
|
76 |
+
</groups>
|
77 |
+
</payment>
|
78 |
+
</sections>
|
79 |
+
</config>
|
app/design/frontend/base/default/layout/bluepayment.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* BlueMedia_BluePayment extension
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the MIT License
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/mit-license.php
|
12 |
+
*
|
13 |
+
* @category Design
|
14 |
+
* @package Layout
|
15 |
+
* @copyright Copyright (c) 2015
|
16 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
17 |
+
*/
|
18 |
+
|
19 |
+
-->
|
20 |
+
<layout version="0.1.0">
|
21 |
+
<bluepayment_processing_create>
|
22 |
+
<reference name="root">
|
23 |
+
<action method="setTemplate"><template>bluepayment/empty.phtml</template></action>
|
24 |
+
<block type="bluepayment/redirect" name="bluepayment_child" template="bluepayment/redirect.phtml" />
|
25 |
+
</reference>
|
26 |
+
</bluepayment_processing_create>
|
27 |
+
<bluepayment_processing_back>
|
28 |
+
<reference name="root">
|
29 |
+
<action method="setTemplate"><template>bluepayment/empty.phtml</template></action>
|
30 |
+
<block type="core/template" name="bluepayment_child" template="bluepayment/back.phtml" />
|
31 |
+
</reference>
|
32 |
+
</bluepayment_processing_back>
|
33 |
+
</layout>
|
app/design/frontend/base/default/template/bluepayment/back.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Design
|
13 |
+
* @package Template
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
-->
|
19 |
+
|
20 |
+
<?php echo $this->getMessage(); ?>
|
app/design/frontend/base/default/template/bluepayment/empty.phtml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Design
|
13 |
+
* @package Template
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
-->
|
19 |
+
|
20 |
+
<?php echo $this->getChildHtml('bluepayment_child'); ?>
|
app/design/frontend/base/default/template/bluepayment/form.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Design
|
13 |
+
* @package Template
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
-->
|
19 |
+
|
20 |
+
<!--Unikatowy identyfikator-->
|
21 |
+
<?php $code = $this->getMethodCode(); ?>
|
22 |
+
|
23 |
+
<!--Adres do pliku z logo firmy-->
|
24 |
+
<?php $img = $this->getLogoSrc(); ?>
|
25 |
+
|
26 |
+
<ul class="form-list" id="payment_form_<?php echo $code ?>" style="display:none;">
|
27 |
+
<?php if ($img): ?>
|
28 |
+
<img src="<?php echo $img ?>"alt="Blue Media Logo" /><br />
|
29 |
+
<?php endif; ?>
|
30 |
+
<li class="form-alt"><?php echo $this->__('You will be redirected to the Blue Media secure service payment after submitting the order.'); ?></li>
|
31 |
+
</ul>
|
app/design/frontend/base/default/template/bluepayment/redirect.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--
|
2 |
+
/**
|
3 |
+
* BlueMedia_BluePayment extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the MIT License
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/mit-license.php
|
11 |
+
*
|
12 |
+
* @category Design
|
13 |
+
* @package Template
|
14 |
+
* @copyright Copyright (c) 2015
|
15 |
+
* @license http://opensource.org/licenses/mit-license.php MIT License
|
16 |
+
*/
|
17 |
+
|
18 |
+
-->
|
19 |
+
|
20 |
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
21 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
|
22 |
+
<body>
|
23 |
+
<?php echo $this->getForm(); ?>
|
24 |
+
<script type="text/javascript">document.getElementById("bluepayment_checkout").submit();</script>
|
25 |
+
</body>
|
26 |
+
</html>
|
app/etc/modules/BlueMedia_BluePayment.xml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<BlueMedia_BluePayment>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<depends>
|
8 |
+
<Mage_Payment />
|
9 |
+
</depends>
|
10 |
+
</BlueMedia_BluePayment>
|
11 |
+
</modules>
|
12 |
+
</config>
|
app/locale/pl_PL/BlueMedia_BluePayment.csv
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Online payment BM","Płatności online BM"
|
2 |
+
"You will be redirected to the Blue Media secure service payment after submitting the order.","Po złożeniu zamówienia zostaniesz przekierowany do bezpiecznego serwisu płatności Blue Media."
|
3 |
+
"Test mode","Tryb testowy"
|
4 |
+
"Service partner ID","Identyfikator serwisu partnera"
|
5 |
+
"Shared key","Klucz współdzielony"
|
6 |
+
"Status waiting payment", "Status oczekiwania na płatność"
|
7 |
+
"Status accept payment", "Status prawidłowej płatności"
|
8 |
+
"Status error payment", "Status nieprawidłowej płatności"
|
package.xml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>BlueMedia_BluePayment</name>
|
4 |
+
<version>1.3.4</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/GPL-3.0">GPL-3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Moduł obsługuje płatności internetowe realizowane przez bramkę płatniczą firmy Blue Media.</summary>
|
10 |
+
<description>Narzędzia do obsługi płatności online powstały w oparciu o sprawdzone technologie. Blue Media ma wieloletnie doświadczenie w obsłudze transakcji Internetowych. Za pomocą systemów płatniczych Blue Media zaimplementowanych w serwisach typu eBOK największych dostawców mediów i operatorów komunikacyjnych, regularnie opłaca swoje rachunki ponad 6 mln klientów. Wdrożony w ponad 70 Bankach w Polsce System Płatności BlueCash obsłużył już ponad 2,5 mln transakcji. 
|
11 |
+
Dzięki tym doświadczeniom firma może zaproponować nowe na rynku eCommerce funkcjonalności, z których skorzystają zarówno sklepy jak i ich klienci.
|
12 |
+
Rozliczenia płatności w czasie rzeczywistym sprawiają, że sklep natychmiast dostaje zapłatę za swoje produkty lub usługi – nie musi „kredytować” zakupu, co w przypadku dużych sklepów i platform eCommerce ma niebagatelne znaczenie. 
|
13 |
+
Model płatności 1:1 księguje poszczególne transakcje osobno – co pozwala na lepszą kontrolę i łatwiejszą obsługę zwrotów. 
|
14 |
+
Rozwiązania typy Mass Collect umożliwiają pobieranie i zarządzanie płatnościami masowymi i cyklicznymi. Pozwalają oznaczać wpłaty od poszczególnych klientów i dzięki temu skutecznie monitorować płatności.
|
15 |
+
Obsługa płatności rekurencyjnych – czyli cyklicznych. Mogą być one wykorzystywane przez średniej wielkości wystawców faktur, takich jak uczelnie, wspólnoty mieszkaniowe i inne podmioty, które nie posiadają własnych serwisów typu eBOK. Do tego oferowana jest w wersji white label – może być wizualnie dostosowana do potrzeb Klienta. 
|
16 |
+
Narzędzia do obsługi płatności online od Blue Media stworzone są w technologii RWD. Dostosowuje się więc do rozdzielczości kanałów mobilnych, będących przyszłością eCommerce. Opcja zapamiętywania formy ostatniej płatności ułatwia robienie zakupów i zachęca do powrotu do danego sklepu.
|
17 |
+

|
18 |
+
https://platnosci.bm.pl/</description>
|
19 |
+
<notes>.</notes>
|
20 |
+
<authors><author><name>BlueMedia</name><user>bm</user><email>info@bm.pl</email></author></authors>
|
21 |
+
<date>2016-01-13</date>
|
22 |
+
<time>22:29:59</time>
|
23 |
+
<contents><target name="magecommunity"><dir><dir name="BlueMedia"><dir name="BluePayment"><dir><dir name="Block"><file name="Form.php" hash="8a42da36e6090e1d174cc8559269c751"/><file name="Redirect.php" hash="612654c2576c5dd6d4d118619ee7be5e"/></dir><dir name="Helper"><file name="Data.php" hash="1eab95dcbea1417506bc3a7d29a25fc3"/></dir><dir name="Model"><file name="Abstract.php" hash="c147e495a27ab8db5d8325783ef40713"/><file name="Session.php" hash="08908bf96a936d6b23673c12816d6b94"/></dir><dir name="controllers"><file name="ProcessingController.php" hash="b921db1cd1ee4dfd6e325663781daf73"/></dir><dir name="etc"><file name="config.xml" hash="bb9b9c3d37bd68c852b173eadf21315b"/><file name="system.xml" hash="35c241e04ca5edc7ff49991724a9c97b"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="bluepayment"><file name="logo.png" hash="7b141c8794ad03d8f54fa50bd20fc878"/></dir></dir></dir></dir></dir></dir></target><target name="magedesign"><dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bluepayment.xml" hash="37eca646b5c597490a88ecb3a73f3381"/></dir><dir name="template"><dir name="bluepayment"><file name="back.phtml" hash="144b7d50c1ebb3492ce8ecc31cb3eb2e"/><file name="empty.phtml" hash="48469c141f887c78b2650b93f0039468"/><file name="form.phtml" hash="eafcd3f3708f7055abb9657089f542c9"/><file name="redirect.phtml" hash="1329dd050dc3b7823b7136d588d00ec7"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir><dir name="pl_PL"><file name="BlueMedia_BluePayment.csv" hash="c6d48894b3098714b039555ca54e27fa"/></dir></dir></target><target name="mageetc"><dir><dir name="modules"><file name="BlueMedia_BluePayment.xml" hash="cbcbf1534c6dd269dbf5eed1211b0579"/></dir></dir></target></contents>
|
24 |
+
<compatible/>
|
25 |
+
<dependencies><required><php><min>5.3.0</min><max>5.5.0</max></php><package><name>Mage_Core_Modules</name><channel>community</channel><min>1.5.0.0</min><max>1.9.2.0</max></package></required></dependencies>
|
26 |
+
</package>
|
skin/frontend/base/default/images/bluepayment/logo.png
ADDED
Binary file
|