Version Notes
Changed extension name: PayU_Account was PayU_PayU
Download this release
Release Info
Developer | PayU |
Extension | PayU_Account |
Version | 0.1.6.4 |
Comparing to | |
See all releases |
Code changes from version 0.1.6.1 to 0.1.6.4
- app/code/local/PayU/Account/Block/Adminhtml/Sales/Order/View.php +2 -2
- app/code/local/PayU/Account/Block/Advertisement.php +1 -1
- app/code/local/PayU/Account/Block/BeforeSummary.php +1 -1
- app/code/local/PayU/Account/Block/Button.php +1 -1
- app/code/local/PayU/Account/Block/Form.php +2 -2
- app/code/local/PayU/Account/Block/Onestep/Checkout.php +1 -1
- app/code/local/PayU/Account/Block/Redirect.php +5 -5
- app/code/local/PayU/Account/Block/UpdateInfo.php +1 -1
- app/code/local/PayU/Account/Helper/Data.php +1 -1
- app/code/local/PayU/Account/Model/Advertisement.php +1 -1
- app/code/local/PayU/Account/Model/Button.php +1 -1
- app/code/local/PayU/Account/Model/Config.php +3 -4
- app/code/local/PayU/Account/Model/Environment.php +1 -1
- app/code/local/PayU/Account/Model/PayU.php +1 -1
- app/code/local/PayU/Account/Model/Payment.php +119 -79
- app/code/local/PayU/Account/Model/Session.php +1 -1
- app/code/local/PayU/Account/Model/Thumbnail.php +1 -1
- app/code/local/PayU/Account/Model/ValidityTime.php +1 -1
- app/code/local/PayU/Account/controllers/Adminhtml/Sales/OrderController.php +1 -1
- app/code/local/PayU/Account/controllers/Checkout/CartController.php +1 -5
- app/code/local/PayU/Account/controllers/PaymentController.php +181 -174
- app/code/local/PayU/Account/etc/config.xml +1 -1
- package.xml +4 -4
app/code/local/PayU/Account/Block/Adminhtml/Sales/Order/View.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Adminhtml Sales Order View
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
@@ -26,7 +26,7 @@ class PayU_Account_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block
|
|
26 |
), 0, 100, 'header', 'header');
|
27 |
|
28 |
$this->_addButton('payu-reject', array(
|
29 |
-
'label' => Mage::helper('payu_account')->__('
|
30 |
'onclick' => 'setLocation(\'' . $this->getRejectPaymentUrl() . '\')',
|
31 |
'class' => ''
|
32 |
), 0, 200, 'header', 'header');
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Adminhtml Sales Order View
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
26 |
), 0, 100, 'header', 'header');
|
27 |
|
28 |
$this->_addButton('payu-reject', array(
|
29 |
+
'label' => Mage::helper('payu_account')->__('Cancel PayU order'),
|
30 |
'onclick' => 'setLocation(\'' . $this->getRejectPaymentUrl() . '\')',
|
31 |
'class' => ''
|
32 |
), 0, 200, 'header', 'header');
|
app/code/local/PayU/Account/Block/Advertisement.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Advertisement Block
|
6 |
* Payment
|
7 |
*
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Advertisement Block
|
6 |
* Payment
|
7 |
*
|
app/code/local/PayU/Account/Block/BeforeSummary.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU BeforeSummary Redirection Block
|
6 |
* Payment
|
7 |
*
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU BeforeSummary Redirection Block
|
6 |
* Payment
|
7 |
*
|
app/code/local/PayU/Account/Block/Button.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Button Block
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Button Block
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Block/Form.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Form Block
|
6 |
* Payment
|
7 |
*
|
@@ -29,7 +29,7 @@ class PayU_Account_Block_Form extends Mage_Payment_Block_Form
|
|
29 |
{
|
30 |
$this->setTemplate('payu_account/form.phtml');
|
31 |
$this->setMethodTitle('');
|
32 |
-
$this->setMethodLabelAfterHtml('<img src="'.Mage::getModel('payu_account/config')->getThumbnailSrc().'" height="20" alt="PayU"/> '.Mage::helper('payu_account')->__('
|
33 |
|
34 |
return parent::_construct();
|
35 |
}
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Form Block
|
6 |
* Payment
|
7 |
*
|
29 |
{
|
30 |
$this->setTemplate('payu_account/form.phtml');
|
31 |
$this->setMethodTitle('');
|
32 |
+
$this->setMethodLabelAfterHtml('<img src="'.Mage::getModel('payu_account/config')->getThumbnailSrc().'" height="20" alt="PayU"/> '.Mage::helper('payu_account')->__('PayU account'));
|
33 |
|
34 |
return parent::_construct();
|
35 |
}
|
app/code/local/PayU/Account/Block/Onestep/Checkout.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU One Step Checkout Block
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU One Step Checkout Block
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Block/Redirect.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Payment Redirect Block
|
6 |
* Payment
|
7 |
*
|
@@ -50,10 +50,10 @@ class PayU_Account_Block_Redirect extends Mage_Core_Block_Abstract
|
|
50 |
->setMethod('GET')
|
51 |
->setUseContainer(true);
|
52 |
|
53 |
-
$form->addField('
|
54 |
-
$form->addField('
|
55 |
-
$form->addField('
|
56 |
-
|
57 |
$html = '<html><body>';
|
58 |
$html.= $form->toHtml();
|
59 |
$html.= '<script type="text/javascript">document.getElementById("payu_checkout").submit();</script>';
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Payment Redirect Block
|
6 |
* Payment
|
7 |
*
|
50 |
->setMethod('GET')
|
51 |
->setUseContainer(true);
|
52 |
|
53 |
+
$form->addField('oauth_token', 'hidden', array('name'=>'oauth_token', 'value'=>$redirectData['oauthToken']));
|
54 |
+
$form->addField('sessionId', 'hidden', array('name'=>'sessionId', 'value'=>$redirectData['sessionId']));
|
55 |
+
$form->addField('lang', 'hidden', array('name'=>'lang', 'value'=>$redirectData['lang']));
|
56 |
+
|
57 |
$html = '<html><body>';
|
58 |
$html.= $form->toHtml();
|
59 |
$html.= '<script type="text/javascript">document.getElementById("payu_checkout").submit();</script>';
|
app/code/local/PayU/Account/Block/UpdateInfo.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Update Info Block
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Update Info Block
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Helper/Data.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Data Helper Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Data Helper Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/Advertisement.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Logo Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Logo Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/Button.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Button Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Button Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/Config.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Config Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
@@ -14,7 +14,7 @@
|
|
14 |
class PayU_Account_Model_Config
|
15 |
{
|
16 |
/** @var string self version */
|
17 |
-
protected $_pluginVersion = '0.1.6.
|
18 |
|
19 |
/** @var string minimum Magento e-commerce version */
|
20 |
protected $_minimumMageVersion = '1.6.0';
|
@@ -29,7 +29,6 @@ class PayU_Account_Model_Config
|
|
29 |
protected $_goodsUrl = "http://openpayu.com/en/goods/json";
|
30 |
|
31 |
/** @var latest version path in goods array */
|
32 |
-
// @todo make it magento not osc, when magento is available
|
33 |
protected $_latestVersionPath = "plugins_magento_1.6.0";
|
34 |
|
35 |
/** @var string latest version url */
|
@@ -146,7 +145,7 @@ class PayU_Account_Model_Config
|
|
146 |
|
147 |
/** @return string advertisement banner url */
|
148 |
public function getAdvertisementSrc(){
|
149 |
-
|
150 |
}
|
151 |
|
152 |
/** @return string one step checkout button url */
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Config Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
14 |
class PayU_Account_Model_Config
|
15 |
{
|
16 |
/** @var string self version */
|
17 |
+
protected $_pluginVersion = '0.1.6.4';
|
18 |
|
19 |
/** @var string minimum Magento e-commerce version */
|
20 |
protected $_minimumMageVersion = '1.6.0';
|
29 |
protected $_goodsUrl = "http://openpayu.com/en/goods/json";
|
30 |
|
31 |
/** @var latest version path in goods array */
|
|
|
32 |
protected $_latestVersionPath = "plugins_magento_1.6.0";
|
33 |
|
34 |
/** @var string latest version url */
|
145 |
|
146 |
/** @return string advertisement banner url */
|
147 |
public function getAdvertisementSrc(){
|
148 |
+
return $this->localize($this->getStoreConfig('payment/payu_account/payuadvertisement'));
|
149 |
}
|
150 |
|
151 |
/** @return string one step checkout button url */
|
app/code/local/PayU/Account/Model/Environment.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
|
4 |
/**
|
5 |
-
* ver. 0.1.6.
|
6 |
* PayU Environment Model
|
7 |
*
|
8 |
* @copyright Copyright (c) 2011-2012 PayU
|
2 |
|
3 |
|
4 |
/**
|
5 |
+
* ver. 0.1.6.4
|
6 |
* PayU Environment Model
|
7 |
*
|
8 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/PayU.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Standard Payment Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Standard Payment Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/Payment.php
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU -Standard Payment Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
8 |
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
9 |
-
*
|
10 |
-
*
|
11 |
-
*
|
12 |
*/
|
13 |
|
14 |
require_once('lib/payu/sdk/openpayu.php');
|
@@ -156,36 +156,71 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
156 |
$orderCurrencyCode = $this->_order->getOrderCurrencyCode();
|
157 |
|
158 |
/** @var string Country Code */
|
159 |
-
$orderCountryCode = $this->_order->
|
160 |
|
161 |
/** @var array assign the shipping info for created order */
|
162 |
$shippingCostList = array();
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
$shippingCostList[] = array(
|
168 |
-
'ShippingCost' => array(
|
169 |
-
'Type' => $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle(),
|
170 |
-
'CountryCode' => $orderCountryCode,
|
171 |
-
'Price' => array(
|
172 |
-
'Gross' => $this->toAmount($rate->getPrice()),
|
173 |
-
'Net' => $this->toAmount($rate->getPrice()),
|
174 |
-
'Tax' => $this->toAmount($this->_order->getShippingTaxAmount()),
|
175 |
-
'TaxRate' => $this->toAmount($this->calculateTaxRate()),
|
176 |
-
'CurrencyCode' => $orderCurrencyCode
|
177 |
-
)
|
178 |
-
)
|
179 |
-
);
|
180 |
-
|
181 |
-
}
|
182 |
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
'ShipToOtherCountry' => 'true',
|
185 |
'ShippingCostList' => $shippingCostList
|
186 |
);
|
187 |
|
188 |
-
//print_r($shippingCost);
|
189 |
|
190 |
/** @var string All items included in the order */
|
191 |
$orderItems = $this->_order->getAllVisibleItems();
|
@@ -194,7 +229,6 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
194 |
$items = array();
|
195 |
|
196 |
foreach ($orderItems as $key => $item) {
|
197 |
-
|
198 |
/** @var array Retrieving item info */
|
199 |
$itemInfo = $item->getData();
|
200 |
|
@@ -215,23 +249,16 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
215 |
)
|
216 |
)
|
217 |
);
|
218 |
-
|
219 |
-
|
220 |
}
|
221 |
-
|
222 |
}
|
223 |
|
224 |
-
|
225 |
// assigning the shopping cart
|
226 |
-
$shoppingCart = array(
|
|
|
227 |
'CurrencyCode' => $orderCurrencyCode,
|
228 |
'ShoppingCartItems' => $items
|
229 |
);
|
230 |
|
231 |
-
/** @var string Check wether the order is virtual or material */
|
232 |
-
$orderType = ($this->_order->getIsVirtual()) ? "VIRTUAL" : "MATERIAL";
|
233 |
-
|
234 |
-
// http://www.payu.com/pl/openpayu/OrderDomainRequest.html#Link18
|
235 |
$orderInfo = array('MerchantPosId' => OpenPayU_Configuration::getMerchantPosId(),
|
236 |
'SessionId' => $sessionid,
|
237 |
'OrderUrl' => $this->_myUrl . 'cancelPayment?order=' . $this->_order->getRealOrderId(), // is url where customer will see in myaccount, and will be able to use to back to shop.
|
@@ -243,22 +270,21 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
243 |
'ValidityTime' => $this->_config->getOrderValidityTime()
|
244 |
);
|
245 |
|
246 |
-
|
247 |
$OCReq = array('ReqId' => md5(rand()),
|
248 |
'CustomerIp' => Mage::app()->getFrontController()->getRequest()->getClientIp(),
|
249 |
'NotifyUrl' => $this->_myUrl . 'orderNotifyRequest', // url where PayU service will send notification with order processing status changes
|
250 |
'OrderCancelUrl' => $this->_myUrl . 'cancelPayment',
|
251 |
'OrderCompleteUrl' => $this->_myUrl . 'completePayment',
|
252 |
'Order' => $orderInfo,
|
253 |
-
'ShippingCost' => array(
|
254 |
-
'AvailableShippingCost' => $shippingCost,
|
255 |
-
'ShippingCostsUpdateUrl' => $this->_myUrl . 'shippingCostRetrieve' // this is url where PayU checkout service will send shipping costs retrieve request
|
256 |
-
)
|
257 |
);
|
258 |
|
259 |
-
|
260 |
-
|
261 |
-
|
|
|
|
|
|
|
262 |
|
263 |
// send message OrderCreateRequest, $result->response = OrderCreateResponse message
|
264 |
$result = OpenPayU_Order::create($OCReq);
|
@@ -266,17 +292,26 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
266 |
if ($result->getSuccess()) {
|
267 |
|
268 |
/** @var array Assigning the redirect form data */
|
269 |
-
$
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
'
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
|
277 |
} else {
|
278 |
/** Something has gone wrong with the $result succession */
|
279 |
-
Mage::throwException(
|
280 |
}
|
281 |
|
282 |
return $ret;
|
@@ -336,7 +371,7 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
336 |
->setCustomerIsGuest(false);
|
337 |
}
|
338 |
|
339 |
-
$checkout->getQuote()->
|
340 |
|
341 |
// presetting the default shipment method
|
342 |
$checkout->saveShippingMethod('flatrate_flatrate');
|
@@ -435,7 +470,7 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
435 |
);
|
436 |
|
437 |
} else {
|
438 |
-
Mage::throwException(Mage::helper('payu_account')->__('There was a problem with the payment initialization, please contact system administrator.') . $result->getError() .' '
|
439 |
}
|
440 |
|
441 |
return $ret;
|
@@ -522,9 +557,8 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
522 |
if (empty($payUPaymentStatus))
|
523 |
$this->updateOrderStatus($payUOrderStatus);
|
524 |
|
525 |
-
if (!empty($orderRetrieveResponse['CustomerRecord'])) {
|
526 |
-
|
527 |
|
|
|
528 |
// update shipping info of the order
|
529 |
$this->updateShippingInfo($orderRetrieveResponse);
|
530 |
|
@@ -572,7 +606,6 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
572 |
// Variable $notification contains array with OrderNotificationRequest message.
|
573 |
$result = OpenPayU_Order::consumeMessage($document);
|
574 |
|
575 |
-
|
576 |
if ($result->getMessage() == 'OrderNotifyRequest') {
|
577 |
|
578 |
/** @var string identify current session Id from document */
|
@@ -616,10 +649,9 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
616 |
|
617 |
$customerRecord = $data['CustomerRecord'];
|
618 |
|
619 |
-
//if($this->_order->getCustomerIsGuest()){
|
620 |
-
|
621 |
$this->_order->setCustomerFirstname($customerRecord['FirstName']);
|
622 |
$this->_order->setCustomerLastname($customerRecord['LastName']);
|
|
|
623 |
|
624 |
$billing = $this->_order->getBillingAddress();
|
625 |
|
@@ -627,30 +659,20 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
627 |
$billing->setLastname($customerRecord['LastName']);
|
628 |
$billing->setTelephone($customerRecord['Phone']);
|
629 |
|
630 |
-
$this->_order->setBillingAddress($billing);
|
631 |
-
|
632 |
-
//}
|
633 |
-
|
634 |
|
635 |
-
if (
|
636 |
|
637 |
$shippingAddress = $data['Shipping']['Address'];
|
638 |
|
639 |
-
/** check if we have guest customer */
|
640 |
-
//if($this->_order->getCustomerIsGuest()){
|
641 |
-
|
642 |
-
// assign billing additional info only to guests
|
643 |
-
|
644 |
$billing = $this->_order->getBillingAddress();
|
645 |
|
646 |
$billing->setCity($shippingAddress['City']);
|
647 |
-
$billing->setStreet($shippingAddress['Street'] . " " . $shippingAddress['HouseNumber'] . " / " . $shippingAddress['ApartmentNumber']);
|
648 |
$billing->setPostcode($shippingAddress['PostalCode']);
|
649 |
$billing->setCountryId($shippingAddress['CountryCode']);
|
650 |
|
651 |
-
$this->_order->setBillingAddress($billing);
|
652 |
-
|
653 |
-
//}
|
654 |
|
655 |
|
656 |
$recipient = explode(" ", $shippingAddress['RecipientName']);
|
@@ -661,22 +683,39 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
661 |
$shipping->setLastname($recipient[1]);
|
662 |
$shipping->setTelephone($customerRecord['Phone']);
|
663 |
$shipping->setCity($shippingAddress['City']);
|
664 |
-
$shipping->setStreet($shippingAddress['Street'] . " " . $shippingAddress['HouseNumber'] . " / " . $shippingAddress['ApartmentNumber']);
|
665 |
$shipping->setPostcode($shippingAddress['PostalCode']);
|
666 |
$shipping->setCountryId($shippingAddress['CountryCode']);
|
667 |
|
668 |
$this->_order->setShippingAddress($shipping)->save();
|
669 |
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
674 |
|
|
|
|
|
|
|
675 |
}
|
676 |
|
677 |
$this->_order->save();
|
678 |
|
679 |
} catch (Error $e) {
|
|
|
680 |
}
|
681 |
|
682 |
}
|
@@ -795,6 +834,7 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
795 |
$payment = $this->_order->getPayment();
|
796 |
$currentState = $payment->getAdditionalInformation('payu_payment_status');
|
797 |
|
|
|
798 |
// change the payment status if needed
|
799 |
if ($currentState != $paymentStatus) {
|
800 |
try {
|
@@ -1003,7 +1043,7 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
1003 |
$payment->setIsTransactionApproved(true);
|
1004 |
$payment->setIsTransactionClosed(true);
|
1005 |
|
1006 |
-
$comment = $this->_order->setState(Mage_Sales_Model_Order::
|
1007 |
->sendOrderUpdateEmail(true, "PayU - " . Mage::helper('payu_account')->__('Thank you.') . " " . Mage::helper('payu_account')->__('The transaction completed successfully.'))
|
1008 |
->save();
|
1009 |
$transaction->save();
|
@@ -1017,7 +1057,7 @@ class PayU_Account_Model_Payment extends Mage_Payment_Model_Method_Abstract
|
|
1017 |
{
|
1018 |
$transaction = $payment->setTransactionId($this->_transactionId);
|
1019 |
|
1020 |
-
$payment->setPreparedMessage('
|
1021 |
->setParentTransactionId($this->_transactionId)
|
1022 |
->registerVoidNotification();
|
1023 |
$comment = $this->_order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true, "PayU - " . Mage::helper('payu_account')->__('The transaction is incorrect.'))
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU -Standard Payment Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
8 |
* @license http://opensource.org/licenses/LGPL-3.0 Open Software License (LGPL 3.0)
|
9 |
+
* http://www.payu.com
|
10 |
+
* http://www.openpayu.com
|
11 |
+
* http://twitter.com/openpayu
|
12 |
*/
|
13 |
|
14 |
require_once('lib/payu/sdk/openpayu.php');
|
156 |
$orderCurrencyCode = $this->_order->getOrderCurrencyCode();
|
157 |
|
158 |
/** @var string Country Code */
|
159 |
+
$orderCountryCode = $this->_order->getBillingAddress()->getCountry();
|
160 |
|
161 |
/** @var array assign the shipping info for created order */
|
162 |
$shippingCostList = array();
|
163 |
|
164 |
+
/** @var string Check wether the order is virtual or material */
|
165 |
+
$orderType = ($this->_order->getIsVirtual()) ? "VIRTUAL" : "MATERIAL";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
+
// if the standard paying method has been selected
|
168 |
+
if(empty($allShippingRates)){
|
169 |
+
|
170 |
+
// normal way of paying
|
171 |
+
$allShippingRates = Mage::getStoreConfig('carriers', Mage::app()->getStore()->getId());
|
172 |
+
|
173 |
+
$methodArr = explode("_",$this->_order->getShippingMethod());
|
174 |
+
|
175 |
+
foreach ($allShippingRates as $key => $rate) {
|
176 |
+
|
177 |
+
if($rate['active'] == 1 && $methodArr[0] == $key){
|
178 |
+
$shippingCostList[] = array(
|
179 |
+
'ShippingCost' => array(
|
180 |
+
'Type' => $rate['title'] . ' - ' . $rate['name'],
|
181 |
+
'CountryCode' => $orderCountryCode,
|
182 |
+
'Price' => array(
|
183 |
+
'Gross' => $this->toAmount($this->_order->getShippingAmount()),
|
184 |
+
'Net' => $this->toAmount($this->_order->getShippingAmount()),
|
185 |
+
'Tax' => $this->toAmount($this->_order->getShippingTaxAmount()),
|
186 |
+
'TaxRate' => $this->toAmount($this->calculateTaxRate()),
|
187 |
+
'CurrencyCode' => $orderCurrencyCode
|
188 |
+
)
|
189 |
+
)
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
}
|
194 |
+
|
195 |
+
$grandTotal = $this->_order->getGrandTotal() - $this->_order->getShippingAmount();
|
196 |
+
|
197 |
+
}else{
|
198 |
+
// assigning the shipping costs list
|
199 |
+
foreach ($allShippingRates as $rate) {
|
200 |
+
$shippingCostList[] = array(
|
201 |
+
'ShippingCost' => array(
|
202 |
+
'Type' => $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle(),
|
203 |
+
'CountryCode' => $orderCountryCode,
|
204 |
+
'Price' => array(
|
205 |
+
'Gross' => $this->toAmount($rate->getPrice()),
|
206 |
+
'Net' => $this->toAmount($rate->getPrice()),
|
207 |
+
'Tax' => $this->toAmount($this->_order->getShippingTaxAmount()),
|
208 |
+
'TaxRate' => $this->toAmount($this->calculateTaxRate()),
|
209 |
+
'CurrencyCode' => $orderCurrencyCode
|
210 |
+
)
|
211 |
+
)
|
212 |
+
);
|
213 |
+
}
|
214 |
+
|
215 |
+
$grandTotal = $this->_order->getGrandTotal();
|
216 |
+
}
|
217 |
+
|
218 |
+
$shippingCost = array(
|
219 |
+
'CountryCode' => $orderCountryCode,
|
220 |
'ShipToOtherCountry' => 'true',
|
221 |
'ShippingCostList' => $shippingCostList
|
222 |
);
|
223 |
|
|
|
224 |
|
225 |
/** @var string All items included in the order */
|
226 |
$orderItems = $this->_order->getAllVisibleItems();
|
229 |
$items = array();
|
230 |
|
231 |
foreach ($orderItems as $key => $item) {
|
|
|
232 |
/** @var array Retrieving item info */
|
233 |
$itemInfo = $item->getData();
|
234 |
|
249 |
)
|
250 |
)
|
251 |
);
|
|
|
|
|
252 |
}
|
|
|
253 |
}
|
254 |
|
|
|
255 |
// assigning the shopping cart
|
256 |
+
$shoppingCart = array(
|
257 |
+
'GrandTotal' => $this->toAmount($grandTotal),
|
258 |
'CurrencyCode' => $orderCurrencyCode,
|
259 |
'ShoppingCartItems' => $items
|
260 |
);
|
261 |
|
|
|
|
|
|
|
|
|
262 |
$orderInfo = array('MerchantPosId' => OpenPayU_Configuration::getMerchantPosId(),
|
263 |
'SessionId' => $sessionid,
|
264 |
'OrderUrl' => $this->_myUrl . 'cancelPayment?order=' . $this->_order->getRealOrderId(), // is url where customer will see in myaccount, and will be able to use to back to shop.
|
270 |
'ValidityTime' => $this->_config->getOrderValidityTime()
|
271 |
);
|
272 |
|
273 |
+
|
274 |
$OCReq = array('ReqId' => md5(rand()),
|
275 |
'CustomerIp' => Mage::app()->getFrontController()->getRequest()->getClientIp(),
|
276 |
'NotifyUrl' => $this->_myUrl . 'orderNotifyRequest', // url where PayU service will send notification with order processing status changes
|
277 |
'OrderCancelUrl' => $this->_myUrl . 'cancelPayment',
|
278 |
'OrderCompleteUrl' => $this->_myUrl . 'completePayment',
|
279 |
'Order' => $orderInfo,
|
|
|
|
|
|
|
|
|
280 |
);
|
281 |
|
282 |
+
if (!$this->_order->getIsVirtual()) {
|
283 |
+
$OCReq['ShippingCost'] = array(
|
284 |
+
'AvailableShippingCost' => $shippingCost,
|
285 |
+
'ShippingCostsUpdateUrl' => $this->_myUrl . 'shippingCostRetrieve' // this is url where PayU checkout service will send shipping costs retrieve request
|
286 |
+
);
|
287 |
+
}
|
288 |
|
289 |
// send message OrderCreateRequest, $result->response = OrderCreateResponse message
|
290 |
$result = OpenPayU_Order::create($OCReq);
|
292 |
if ($result->getSuccess()) {
|
293 |
|
294 |
/** @var array Assigning the redirect form data */
|
295 |
+
$result = OpenPayU_OAuth::accessTokenByClientCredentials();
|
296 |
+
if($result->getSuccess())
|
297 |
+
{
|
298 |
+
$locale = Mage::getStoreConfig('general/locale/code', Mage::app()->getStore()->getId());
|
299 |
+
$lang_code = explode('_', $locale, 2);
|
300 |
+
|
301 |
+
$ret = array(
|
302 |
+
'url' => OpenPayu_Configuration::getSummaryUrl(),
|
303 |
+
'sessionId' => $sessionid,
|
304 |
+
'oauthToken' => $result->getAccessToken(),
|
305 |
+
'lang' => strtolower($lang_code[1])
|
306 |
+
);
|
307 |
+
} else {
|
308 |
+
/** Something has gone wrong with the $result succession */
|
309 |
+
Mage::throwException(Mage::helper('payu_account')->__('There was a problem with initializing the payment, please contact the store administrator. ' . $result->getError() . ' ' . $result->getMessage()));
|
310 |
+
}
|
311 |
|
312 |
} else {
|
313 |
/** Something has gone wrong with the $result succession */
|
314 |
+
Mage::throwException(Mage::helper('payu_account')->__('There was a problem with initializing the payment, please contact the store administrator. ' . $result->getError() . ' ' . $result->getMessage()));
|
315 |
}
|
316 |
|
317 |
return $ret;
|
371 |
->setCustomerIsGuest(false);
|
372 |
}
|
373 |
|
374 |
+
$checkout->getQuote()->getBillingAddress()->setShippingMethod('flatrate_flatrate')->setCollectShippingRates(true);
|
375 |
|
376 |
// presetting the default shipment method
|
377 |
$checkout->saveShippingMethod('flatrate_flatrate');
|
470 |
);
|
471 |
|
472 |
} else {
|
473 |
+
Mage::throwException(Mage::helper('payu_account')->__('There was a problem with the payment initialization, please contact system administrator.') . $result->getError() . ' ' . $result->getMessage());
|
474 |
}
|
475 |
|
476 |
return $ret;
|
557 |
if (empty($payUPaymentStatus))
|
558 |
$this->updateOrderStatus($payUOrderStatus);
|
559 |
|
|
|
|
|
560 |
|
561 |
+
if (!empty($orderRetrieveResponse['CustomerRecord'])) {
|
562 |
// update shipping info of the order
|
563 |
$this->updateShippingInfo($orderRetrieveResponse);
|
564 |
|
606 |
// Variable $notification contains array with OrderNotificationRequest message.
|
607 |
$result = OpenPayU_Order::consumeMessage($document);
|
608 |
|
|
|
609 |
if ($result->getMessage() == 'OrderNotifyRequest') {
|
610 |
|
611 |
/** @var string identify current session Id from document */
|
649 |
|
650 |
$customerRecord = $data['CustomerRecord'];
|
651 |
|
|
|
|
|
652 |
$this->_order->setCustomerFirstname($customerRecord['FirstName']);
|
653 |
$this->_order->setCustomerLastname($customerRecord['LastName']);
|
654 |
+
$this->_order->setCustomerEmail($customerRecord['Email']);
|
655 |
|
656 |
$billing = $this->_order->getBillingAddress();
|
657 |
|
659 |
$billing->setLastname($customerRecord['LastName']);
|
660 |
$billing->setTelephone($customerRecord['Phone']);
|
661 |
|
662 |
+
$this->_order->setBillingAddress($billing)->save();
|
|
|
|
|
|
|
663 |
|
664 |
+
if (isset($data['Shipping'])) {
|
665 |
|
666 |
$shippingAddress = $data['Shipping']['Address'];
|
667 |
|
|
|
|
|
|
|
|
|
|
|
668 |
$billing = $this->_order->getBillingAddress();
|
669 |
|
670 |
$billing->setCity($shippingAddress['City']);
|
671 |
+
$billing->setStreet($shippingAddress['Street'] . " " . $shippingAddress['HouseNumber'] . (isset($shippingAddress['ApartmentNumber']) ? " / " . $shippingAddress['ApartmentNumber'] : ''));
|
672 |
$billing->setPostcode($shippingAddress['PostalCode']);
|
673 |
$billing->setCountryId($shippingAddress['CountryCode']);
|
674 |
|
675 |
+
$this->_order->setBillingAddress($billing)->save();
|
|
|
|
|
676 |
|
677 |
|
678 |
$recipient = explode(" ", $shippingAddress['RecipientName']);
|
683 |
$shipping->setLastname($recipient[1]);
|
684 |
$shipping->setTelephone($customerRecord['Phone']);
|
685 |
$shipping->setCity($shippingAddress['City']);
|
686 |
+
$shipping->setStreet($shippingAddress['Street'] . " " . $shippingAddress['HouseNumber'] . (isset($shippingAddress['ApartmentNumber']) ? " / " . $shippingAddress['ApartmentNumber'] : ''));
|
687 |
$shipping->setPostcode($shippingAddress['PostalCode']);
|
688 |
$shipping->setCountryId($shippingAddress['CountryCode']);
|
689 |
|
690 |
$this->_order->setShippingAddress($shipping)->save();
|
691 |
|
692 |
+
}
|
693 |
+
elseif(isset($data['Invoice']['Billing']))
|
694 |
+
{
|
695 |
+
$billingAddress = $data['Invoice']['Billing'];
|
696 |
+
|
697 |
+
$billing = $this->_order->getBillingAddress();
|
698 |
+
|
699 |
+
$billing->setFirstname('');
|
700 |
+
$billing->setLastname('');
|
701 |
+
$billing->setCompany($billingAddress['RecipientName']);
|
702 |
+
$billing->setCity($billingAddress['City']);
|
703 |
+
$billing->setStreet($billingAddress['Street'] . " " . $billingAddress['HouseNumber'] . (isset($billingAddress['ApartmentNumber']) ? " / " . $billingAddress['ApartmentNumber'] : ''));
|
704 |
+
$billing->setPostcode($billingAddress['PostalCode']);
|
705 |
+
$billing->setCountryId($billingAddress['CountryCode']);
|
706 |
+
|
707 |
+
$this->_order->setBillingAddress($billing)->save();
|
708 |
+
}
|
709 |
|
710 |
+
if (!$this->_order->getEmailSent()) {
|
711 |
+
$this->_order->sendNewOrderEmail();
|
712 |
+
$this->_order->setEmailSent(1);
|
713 |
}
|
714 |
|
715 |
$this->_order->save();
|
716 |
|
717 |
} catch (Error $e) {
|
718 |
+
Mage::logException("Can not update order data: " . $e);
|
719 |
}
|
720 |
|
721 |
}
|
834 |
$payment = $this->_order->getPayment();
|
835 |
$currentState = $payment->getAdditionalInformation('payu_payment_status');
|
836 |
|
837 |
+
|
838 |
// change the payment status if needed
|
839 |
if ($currentState != $paymentStatus) {
|
840 |
try {
|
1043 |
$payment->setIsTransactionApproved(true);
|
1044 |
$payment->setIsTransactionClosed(true);
|
1045 |
|
1046 |
+
$comment = $this->_order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, true, "PayU - " . Mage::helper('payu_account')->__('The transaction completed successfully.'), true)
|
1047 |
->sendOrderUpdateEmail(true, "PayU - " . Mage::helper('payu_account')->__('Thank you.') . " " . Mage::helper('payu_account')->__('The transaction completed successfully.'))
|
1048 |
->save();
|
1049 |
$transaction->save();
|
1057 |
{
|
1058 |
$transaction = $payment->setTransactionId($this->_transactionId);
|
1059 |
|
1060 |
+
$payment->setPreparedMessage("PayU - " . Mage::helper('payu_account')->__('The transaction is incorrect.'))
|
1061 |
->setParentTransactionId($this->_transactionId)
|
1062 |
->registerVoidNotification();
|
1063 |
$comment = $this->_order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true, "PayU - " . Mage::helper('payu_account')->__('The transaction is incorrect.'))
|
app/code/local/PayU/Account/Model/Session.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Session Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Session Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/Thumbnail.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Thumbnail Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Thumbnail Model
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/Model/ValidityTime.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
|
4 |
/**
|
5 |
-
* ver. 0.1.6.
|
6 |
* PayU Validity Time Model
|
7 |
*
|
8 |
* @copyright Copyright (c) 2011-2012 PayU
|
2 |
|
3 |
|
4 |
/**
|
5 |
+
* ver. 0.1.6.4
|
6 |
* PayU Validity Time Model
|
7 |
*
|
8 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/controllers/Adminhtml/Sales/OrderController.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Adminhtml Sales Order Controller
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Adminhtml Sales Order Controller
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
app/code/local/PayU/Account/controllers/Checkout/CartController.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Cart Controller
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
@@ -16,8 +16,4 @@ require_once 'Mage/Checkout/controllers/CartController.php';
|
|
16 |
class PayU_Account_Checkout_CartController extends Mage_Checkout_CartController
|
17 |
{
|
18 |
|
19 |
-
public function indexAction() {
|
20 |
-
$this->loadLayout();
|
21 |
-
$this->renderLayout();
|
22 |
-
}
|
23 |
}
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Cart Controller
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
16 |
class PayU_Account_Checkout_CartController extends Mage_Checkout_CartController
|
17 |
{
|
18 |
|
|
|
|
|
|
|
|
|
19 |
}
|
app/code/local/PayU/Account/controllers/PaymentController.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* ver. 0.1.6.
|
5 |
* PayU Standard Payment Controller
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
@@ -14,181 +14,188 @@
|
|
14 |
|
15 |
class PayU_Account_PaymentController extends Mage_Core_Controller_Front_Action {
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
$this->_order->setState(Mage::getStoreConfig("payment/payu_account/order_status"), true)
|
189 |
->save();
|
190 |
}
|
191 |
}
|
192 |
-
}
|
193 |
-
|
194 |
}
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* ver. 0.1.6.4
|
5 |
* PayU Standard Payment Controller
|
6 |
*
|
7 |
* @copyright Copyright (c) 2011-2012 PayU
|
14 |
|
15 |
class PayU_Account_PaymentController extends Mage_Core_Controller_Front_Action {
|
16 |
|
17 |
+
protected $_session = null;
|
18 |
+
protected $_order = null;
|
19 |
+
protected $_payment = null;
|
20 |
+
|
21 |
+
protected $_allShippingRates = null;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Initializes new One Step Checkout
|
25 |
+
*/
|
26 |
+
public function newOneStepAction() {
|
27 |
+
|
28 |
+
$this->setSession();
|
29 |
+
$this->_order = Mage::getModel('payu_account/payment')->newOneStep();
|
30 |
+
$this->_redirect('payu_account/payment/new');
|
31 |
+
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Create invoice
|
36 |
+
*
|
37 |
+
* @return Mage_Sales_Model_Order_Invoice
|
38 |
+
*/
|
39 |
+
protected function _initInvoice()
|
40 |
+
{
|
41 |
+
$items = array();
|
42 |
+
foreach ($this->_order->getAllItems() as $item) {
|
43 |
+
$items[$item->getId()] = $item->getQtyOrdered();
|
44 |
+
}
|
45 |
+
/* @var $invoice Mage_Sales_Model_Service_Order */
|
46 |
+
$invoice = Mage::getModel('sales/service_order', $this->_order)->prepareInvoice($items);
|
47 |
+
$invoice->setEmailSent(true)->register();
|
48 |
+
|
49 |
+
Mage::register('current_invoice', $invoice);
|
50 |
+
return $invoice;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Initializes new One Page payment
|
55 |
+
*/
|
56 |
+
public function newAction() {
|
57 |
+
$this->setSession();
|
58 |
+
$this->setOrder();
|
59 |
+
$this->forceNewOrderStatus();
|
60 |
+
$this->setPayment(true);
|
61 |
+
$this->_allShippingRates = Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()->getAllShippingRates();
|
62 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('payu_account/redirect')->setAllShippingMethods($this->_allShippingRates)->setOrder($this->_order)->toHtml());
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Before PayU summary action
|
67 |
+
*/
|
68 |
+
public function beforeSummaryAction(){
|
69 |
+
$this->setSession();
|
70 |
+
$this->setOrder();
|
71 |
+
$this->setPayment(true);
|
72 |
+
$this->getResponse()->setBody($this->getLayout()->createBlock('payu_account/beforeSummary')->setOrder($this->_order)->toHtml());
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Processes PayU OrderNotifyRequest
|
77 |
+
*/
|
78 |
+
public function orderNotifyRequestAction(){
|
79 |
+
|
80 |
+
try {
|
81 |
+
Mage::getModel('payu_account/payment')->orderNotifyRequest();
|
82 |
+
} catch (Exception $e) {
|
83 |
+
Mage::logException($e);
|
84 |
+
}
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Shipping cost retrieve
|
89 |
+
*
|
90 |
+
* @todo not functioning yet
|
91 |
+
*/
|
92 |
+
public function shippingCostRetrieveAction(){
|
93 |
+
$this->setSession();
|
94 |
+
$this->setOrder();
|
95 |
+
try {
|
96 |
+
Mage::getModel('payu_account/payment')->shippingCostRetrieve();
|
97 |
+
} catch (Exception $e) {
|
98 |
+
Mage::logException($e);
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Complete payment action
|
105 |
+
*/
|
106 |
+
public function completePaymentAction(){
|
107 |
+
|
108 |
+
|
109 |
+
$this->setSession();
|
110 |
+
$this->setOrder();
|
111 |
+
$this->setPayment();
|
112 |
+
|
113 |
+
if(isset($_GET['error']))
|
114 |
+
{
|
115 |
+
$this->_order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)->save();
|
116 |
+
}
|
117 |
+
elseif (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
|
118 |
+
$this->_order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)->save();
|
119 |
+
} else {
|
120 |
+
$this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
|
121 |
+
}
|
122 |
+
|
123 |
+
Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
|
124 |
+
Mage::getSingleton('checkout/session')->setSuccess( Mage::helper('payu_account')->__('Thank you.') );
|
125 |
+
|
126 |
+
if(isset($_GET['error']))
|
127 |
+
$this->_redirect('checkout/onepage/failure',array('_secure' => true));
|
128 |
+
else
|
129 |
+
$this->_redirect('checkout/onepage/success',array('_secure' => true));
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Cancel payment action
|
135 |
+
*
|
136 |
+
* @todo not yet implemented
|
137 |
+
*/
|
138 |
+
public function cancelPaymentAction(){
|
139 |
+
Mage::getSingleton('checkout/session')->setMessage( Mage::helper('payu_account')->__('The payment has been cancelled.') );
|
140 |
+
$this->_redirect('checkout/cart', array('_secure'=>true));
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Error payment action
|
147 |
+
*
|
148 |
+
* @todo not yet implemented
|
149 |
+
*/
|
150 |
+
public function errorAction() {
|
151 |
+
$this->_redirect('checkout/onepage/failure', array('_secure'=>true));
|
152 |
+
}
|
153 |
+
|
154 |
+
/** Setting checkout session */
|
155 |
+
private function setSession() {
|
156 |
+
$this->_session = Mage::getSingleton('checkout/session');
|
157 |
+
}
|
158 |
+
|
159 |
+
/** Setting the order */
|
160 |
+
private function setOrder() {
|
161 |
+
$id = $this->_session->getLastRealOrderId();
|
162 |
+
$this->_order = Mage::getModel('sales/order')->loadByIncrementId($id);
|
163 |
+
}
|
164 |
+
|
165 |
+
/** Setting the new order */
|
166 |
+
private function setNewOrder() {
|
167 |
+
$this->_order = Mage::getModel('payu_account/payment')->prepareNewOrderByCart();
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Setting the payment
|
172 |
+
*
|
173 |
+
* @param boolean
|
174 |
+
*/
|
175 |
+
private function setPayment($is_order_new = false) {
|
176 |
+
$this->_payment = $this->_order->getPayment();
|
177 |
+
}
|
178 |
+
|
179 |
+
/**
|
180 |
+
* Check if the order is new
|
181 |
+
*
|
182 |
+
* @return boolean
|
183 |
+
*/
|
184 |
+
private function isNewOrder() {
|
185 |
+
return (Mage::getSingleton('checkout/session')->getLastRealOrderId() == $this->_order->getRealOrderId());
|
186 |
+
}
|
187 |
+
|
188 |
+
|
189 |
+
/** Forcing the order to be new */
|
190 |
+
private function forceNewOrderStatus() {
|
191 |
+
if ($this->isNewOrder()) {
|
192 |
+
$status = $this->_order->getStatus();
|
193 |
+
$state = $this->_order->getState();
|
194 |
+
if ($state == Mage_Sales_Model_Order::STATE_NEW && $status != Mage::getStoreConfig("payment/payu_account/order_status")) {
|
195 |
$this->_order->setState(Mage::getStoreConfig("payment/payu_account/order_status"), true)
|
196 |
->save();
|
197 |
}
|
198 |
}
|
199 |
+
}
|
200 |
+
|
201 |
}
|
app/code/local/PayU/Account/etc/config.xml
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
|
4 |
<modules>
|
5 |
<PayU_Account>
|
6 |
-
<version>0.1.6.
|
7 |
</PayU_Account>
|
8 |
</modules>
|
9 |
|
3 |
|
4 |
<modules>
|
5 |
<PayU_Account>
|
6 |
+
<version>0.1.6.4</version>
|
7 |
</PayU_Account>
|
8 |
</modules>
|
9 |
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>PayU_Account</name>
|
4 |
-
<version>0.1.6.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/LGPL-3.0">LGPL 3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>PayU account is a new tool for making payments for items bought in several places on the Internet. By choosing it, you will increase transaction security and speed up the shopping process, as the time of waiting for funds from buyers is reduced to the minimum. The PayU account allows a buyer to define his favourite payment channels as well as save in one place personal and contact details needed to make payment for shopping. If a buyer uses a payment card, he may also save its details on the PayU account and afterwards, pay with one click, while data for delivery will be completed automatically. As a result, a payment is made within not more than a few seconds. An additional functionality for registered users of the PayU account is access to the whole transaction history in shops which have made this payment method available. Moreover, a special searcher allows you to sort items bought by such criteria as: date, transaction status, amount.</description>
|
11 |
<notes>Changed extension name: PayU_Account was PayU_PayU</notes>
|
12 |
<authors><author><name>PayU</name><user>PayU</user><email>openpayu@payu.pl</email></author></authors>
|
13 |
-
<date>2012-
|
14 |
-
<time>13:
|
15 |
-
<contents><target name="magelocal"><dir name="PayU"><dir name="Account"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.4.7</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>PayU_Account</name>
|
4 |
+
<version>0.1.6.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/LGPL-3.0">LGPL 3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>PayU account is a new tool for making payments for items bought in several places on the Internet. By choosing it, you will increase transaction security and speed up the shopping process, as the time of waiting for funds from buyers is reduced to the minimum. The PayU account allows a buyer to define his favourite payment channels as well as save in one place personal and contact details needed to make payment for shopping. If a buyer uses a payment card, he may also save its details on the PayU account and afterwards, pay with one click, while data for delivery will be completed automatically. As a result, a payment is made within not more than a few seconds. An additional functionality for registered users of the PayU account is access to the whole transaction history in shops which have made this payment method available. Moreover, a special searcher allows you to sort items bought by such criteria as: date, transaction status, amount.</description>
|
11 |
<notes>Changed extension name: PayU_Account was PayU_PayU</notes>
|
12 |
<authors><author><name>PayU</name><user>PayU</user><email>openpayu@payu.pl</email></author></authors>
|
13 |
+
<date>2012-11-14</date>
|
14 |
+
<time>13:02:27</time>
|
15 |
+
<contents><target name="magelocal"><dir name="PayU"><dir name="Account"><dir name="Block"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="View.php" hash="78d5fe2b5db54a72397fe9fbcdf09870"/></dir></dir></dir><file name="Advertisement.php" hash="5f92a639cf826451ae0f0ad33b437430"/><file name="BeforeSummary.php" hash="6a22a785802b023e5e4cbaa661e495f4"/><file name="Button.php" hash="d58d6dca1549577b6c25b29b2002c0da"/><file name="Form.php" hash="a3a061bafc2506617add1b5ed7b7fbc0"/><dir name="Onestep"><file name="Checkout.php" hash="99082b76c1ddca31ea0de0d52d75acda"/></dir><file name="Redirect.php" hash="0b7c8afc6d9273bcd0088b2827881b8f"/><file name="UpdateInfo.php" hash="37f961118a682a6114bc9f7ea85e4439"/></dir><dir name="Helper"><file name="Data.php" hash="3babb751fa8f3bfd47beba419873a63a"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="Sales"><file name="Order.php" hash="faf6a7c3551674bbc4050d82b6900ae7"/></dir></dir><file name="Advertisement.php" hash="5f494e6e5e8cdf8be59f1c93bbbca721"/><file name="Button.php" hash="81780cfe63dd29838c53e1b3946fb1dd"/><file name="Config.php" hash="b20096d3e5ae882b10f2b038d40c6e43"/><file name="Environment.php" hash="59bf8b60d42d25dc60e2bb2ba0b48074"/><file name="PayU.php" hash="f47f6ad90761d172a63fbf07038796c9"/><file name="Payment.php" hash="64cb2a8f24111ea685fa39a081cac598"/><file name="Session.php" hash="73da02bb9d1bcd5578dfa9908c172a1e"/><file name="Thumbnail.php" hash="f9a6949fdd3e167d0d5b818673b54519"/><file name="ValidityTime.php" hash="f97193bc723a9c19f316f1f3529915ed"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><file name="OrderController.php" hash="7397b5391b9a026793efb6413f672a1d"/></dir></dir><dir name="Checkout"><file name="CartController.php" hash="8cb6683d1878b706aa436a2e389b01fb"/></dir><file name="PaymentController.php" hash="531a33b9e2a5b448c8fab54192b0690e"/></dir><dir name="etc"><file name="config.xml" hash="33a89ac656d08ccdc148d429c3e51aba"/><file name="system.xml" hash="8ffc666f06d061ba72a632e65406b5c8"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payu_account.xml" hash="433c0d85f093a87658cca04fa2dcddd4"/></dir><dir name="template"><dir name="payu_account"><file name="advertisement.phtml" hash="2fc6547dc439c7a5c65b190b0b3bbd26"/><file name="form.phtml" hash="9dd9fd37672b2f249cd5b8701b8ce511"/><dir name="info"><file name="payu_account.phtml" hash="89ff5f164123bad98d94beafd8138532"/></dir><dir name="onestep"><file name="checkout.phtml" hash="e4149c323496f479233b48442ef99212"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PayU_Account.xml" hash="aa06ac3ab552c6069423bcafd5c0140d"/></dir></target><target name="magelocale"><dir name="pl_PL"><file name="PayU_Account.csv" hash="34fc527b4638b12062a17e8fa35a9565"/></dir></target><target name="magelib"><dir name="payu"><dir name="sdk"><dir name="OpenPayU"><file name="Configuration.php" hash="247d5b8eee40df9f2328e44a513b302d"/><file name="OAuth.php" hash="22a906bd9ffd37a7f9720ac12efd3117"/><file name="OpenPayU.php" hash="4013d4d8aaa4b985a2a26e01ee97312d"/><file name="OpenPayUBase.php" hash="8ff7b263a1463d749fc14c5b5f02659c"/><file name="OpenPayUNetwork.php" hash="a6090839643a7279459f358ae2a0e410"/><file name="OpenPayUOAuth.php" hash="701a2c75af0b9f0df8471e7f108e389a"/><file name="Order.php" hash="20f94d108ab5d27c3ec3fbef3d647729"/><file name="Result.php" hash="6ad2be85b87dfc7410c11ed3a507079e"/><file name="ResultOAuth.php" hash="b7ac42eb16a0be6bd38f3b3310025a5b"/></dir><file name="openpayu.php" hash="04068271490f87c9bdd7f280c5da34d6"/><file name="openpayu_domain.php" hash="b38e5963a8ad5e515bca8864851722d6"/></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>5.4.7</max></php></required></dependencies>
|
18 |
</package>
|