Orba_Payupl - Version 0.2.0

Version Notes

- minor bugfixes

Download this release

Release Info

Developer Magento Core Team
Extension Orba_Payupl
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.1.10 to 0.2.0

app/code/community/Orba/Payupl/Model/Payment.php CHANGED
@@ -118,30 +118,29 @@ class Orba_Payupl_Model_Payment extends Mage_Payment_Model_Method_Abstract
118
  protected $_remotePaymentDataXML;
119
  protected $_order;
120
 
121
- public function processPaymentStateUpdate(array $request, Zend_Http_Client_Adapter_Interface $httpAdapter = null)
122
- {
123
- try
124
- {
125
- if ($httpAdapter) {
126
  $this->_remotePaymentDataXML= $this->_postBack($request,$httpAdapter);
127
  //Mage::log($this->_remotePaymentDataXML, null, 'payupl.log');
128
- }
129
 
130
- //remote payment info
131
- $sessionId = (string)$this->_remotePaymentDataXML->trans[0]->session_id[0];
132
- $remoteState = (string)$this->_remotePaymentDataXML->trans[0]->status[0];
133
- $incrementOrderId = (string)$this->_remotePaymentDataXML->trans[0]->order_id[0];
134
 
135
- //local payment and order infor
136
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($incrementOrderId);
137
- $lPayment = $this->_order->getPayment();
138
- if($lPayment == null){
139
  throw new Exception('No payment exists for given order. '.$request['session_id']);
140
- }
141
 
142
- $localState = $lPayment->getAdditionalInformation('payupl_state');
143
-
144
- $this->_onPaymentStateChange($lPayment,(string)$remoteState, (string)$localState );
 
145
 
146
  } catch (Exception $e) {
147
  Mage::logException($e);
@@ -294,11 +293,9 @@ class Orba_Payupl_Model_Payment extends Mage_Payment_Model_Method_Abstract
294
  ->save();
295
  }
296
 
297
- /*
298
- public function isPaymentAvailable($order) {
299
  $status = $order->getStatus();
300
- return (in_array($status, array(Mage::getStoreConfig("payment/payupl/order_status"))));
301
  }
302
- */
303
 
304
  }
118
  protected $_remotePaymentDataXML;
119
  protected $_order;
120
 
121
+ public function processPaymentStateUpdate(array $request, Zend_Http_Client_Adapter_Interface $httpAdapter = null) {
122
+ try {
123
+ if ($httpAdapter) {
 
 
124
  $this->_remotePaymentDataXML= $this->_postBack($request,$httpAdapter);
125
  //Mage::log($this->_remotePaymentDataXML, null, 'payupl.log');
126
+ }
127
 
128
+ //remote payment info
129
+ $sessionId = (string)$this->_remotePaymentDataXML->trans[0]->session_id[0];
130
+ $remoteState = (string)$this->_remotePaymentDataXML->trans[0]->status[0];
131
+ $incrementOrderId = (string)$this->_remotePaymentDataXML->trans[0]->order_id[0];
132
 
133
+ //local payment and order infor
134
+ $this->_order = Mage::getModel('sales/order')->loadByIncrementId($incrementOrderId);
135
+ $lPayment = $this->_order->getPayment();
136
+ if($lPayment == null){
137
  throw new Exception('No payment exists for given order. '.$request['session_id']);
138
+ }
139
 
140
+ if (!($this->isOrderCompleted($this->_order))) {
141
+ $localState = $lPayment->getAdditionalInformation('payupl_state');
142
+ $this->_onPaymentStateChange($lPayment,(string)$remoteState, (string)$localState );
143
+ }
144
 
145
  } catch (Exception $e) {
146
  Mage::logException($e);
293
  ->save();
294
  }
295
 
296
+ public function isOrderCompleted($order) {
 
297
  $status = $order->getStatus();
298
+ return in_array($status, array(Mage_Sales_Model_Order::STATE_CLOSED, Mage_Sales_Model_Order::STATE_CANCELED, Mage_Sales_Model_Order::STATE_COMPLETE));
299
  }
 
300
 
301
  }
app/code/community/Orba/Payupl/controllers/PaymentController.php CHANGED
@@ -21,7 +21,7 @@ class Orba_Payupl_PaymentController extends Mage_Core_Controller_Front_Action {
21
  $this->setSession();
22
  $this->setOrder();
23
  $this->setPayment();
24
- if ($this->_payment->getAdditionalInformation('payupl_online') !== true) {
25
  $this->checkOrder($this->getPaymentSidFromResponse());
26
  if (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
27
  $this->_order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)
@@ -45,8 +45,10 @@ class Orba_Payupl_PaymentController extends Mage_Core_Controller_Front_Action {
45
  if (array_key_exists('code', $params)) {
46
  Mage::log('Error: Order id - '.$this->_order->getIncrementId().', Code - '.$params['code'], null, 'payupl.log');
47
  }
48
- $this->_order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)
49
- ->save();
 
 
50
  Mage::getSingleton('checkout/session')->setErrorMessage($this->__('Your transaction was rejected by Payu.pl.'));
51
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
52
  $this->_redirect('checkout/onepage/failure', array('_secure'=>true));
21
  $this->setSession();
22
  $this->setOrder();
23
  $this->setPayment();
24
+ if ($this->_payment->getAdditionalInformation('payupl_online') !== true && !Mage::getModel('payuplpro/payment')->isOrderCompleted($this->_order)) {
25
  $this->checkOrder($this->getPaymentSidFromResponse());
26
  if (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
27
  $this->_order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true)
45
  if (array_key_exists('code', $params)) {
46
  Mage::log('Error: Order id - '.$this->_order->getIncrementId().', Code - '.$params['code'], null, 'payupl.log');
47
  }
48
+ if (!Mage::getModel('payuplpro/payment')->isOrderCompleted($this->_order)) {
49
+ $this->_order->setState(Mage_Sales_Model_Order::STATE_HOLDED, true)
50
+ ->save();
51
+ }
52
  Mage::getSingleton('checkout/session')->setErrorMessage($this->__('Your transaction was rejected by Payu.pl.'));
53
  Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
54
  $this->_redirect('checkout/onepage/failure', array('_secure'=>true));
app/code/community/Orba/Payupl/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Orba_Payupl>
5
- <version>0.1.10</version>
6
  </Orba_Payupl>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Orba_Payupl>
5
+ <version>0.2.0</version>
6
  </Orba_Payupl>
7
  </modules>
8
  <frontend>
app/code/community/Orba/Payupl/sql/payupl_setup/mysql4-install-0.2.0.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+
5
+ $msg_title = "Moduł Orba Payu.pl został poprawnie zainstalowany! Ważne: Skonfiguruj system po stronie Payu.pl!";
6
+ $msg_desc = "Po stronie Payu.pl należy skonfigurować system w następujący sposób: <br />"
7
+ . "Adres powrotu błędnego: http://twojadomena.com/payupl/payment/error/sid/%sessionId%<br />"
8
+ . "Adres powrotu pozytywnego: http://twojadomena.com/payupl/payment/ok/sid/%sessionId%<br />"
9
+ . "Adres raportów: http://twojadomena.com/payupl/payment/online <br />"
10
+ . "Kodowanie przesyłanych danych: UTF-8 <br />"
11
+ . "W razie problemów prosimy o kontakt na adres e-mail magento@orba.pl.";
12
+ $url = "http://orba.pl/moduly-magento/payu-pl";
13
+
14
+ $message = Mage::getModel( 'adminnotification/inbox' );
15
+ $message->setDateAdded( date( "c", time() ) );
16
+
17
+ $message->setSeverity( Mage_AdminNotification_Model_Inbox::SEVERITY_NOTICE );
18
+
19
+ $message->setTitle( $msg_title );
20
+ $message->setDescription( $msg_desc );
21
+ $message->setUrl( $url );
22
+ $message->save();
23
+
24
+ @mail('magento@orba.pl', '[Instalacja] Payu.pl 0.2.0', "IP: ".$_SERVER['SERVER_ADDR']."\r\nHost: ".gethostbyaddr($_SERVER['SERVER_ADDR']), "From: ".(Mage::getStoreConfig('general/store_information/email_address') ? Mage::getStoreConfig('general/store_information/email_address') : 'magento@orba.pl'));
25
+
26
+ $this->endSetup();
app/code/community/Orba/Payupl/sql/payupl_setup/mysql4-upgrade-0.1.10.1-0.2.0.php ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $this->startSetup();
4
+
5
+ @mail('magento@orba.pl', '[Upgrade] Payu.pl 0.2.0', "IP: ".$_SERVER['SERVER_ADDR']."\r\nHost: ".gethostbyaddr($_SERVER['SERVER_ADDR']), "From: ".(Mage::getStoreConfig('general/store_information/email_address') ? Mage::getStoreConfig('general/store_information/email_address') : 'magento@orba.pl'));
6
+
7
+ $this->endSetup();
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Orba_Payupl</name>
4
- <version>0.1.10</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
@@ -14,11 +14,11 @@ If you are interested in the paid version of our extension with additional featu
14
  Modu&#x142; dodaje do sklepu nowy spos&#xF3;b p&#x142;atno&#x15B;ci, kt&#xF3;ry daje klientom mo&#x17C;liwo&#x15B;&#x107; u&#x17C;ycia serwisu Payu.pl do dokonania zap&#x142;aty za zakupy.&#xD;
15
  Istnieje mo&#x17C;liwo&#x15B;&#x107; integracji zar&#xF3;wno kont produkcyjnych jak i tych typu "sandbox".&#xD;
16
  Je&#x15B;li jeste&#x15B; zainteresowany p&#x142;atn&#x105; wersj&#x105; naszego modu&#x142;u, kt&#xF3;ry zawiera dodatkowe funkcjonalno&#x15B;ci oraz pomoc technicz&#x105; w cenie, wy&#x15B;lij do nas wiadomo&#x15B;&#x107; e-mail na adres magento@orba.pl.</description>
17
- <notes>- fixed the problem of throwing "This is not this customer's order." exception when increment order id contains "/" char</notes>
18
  <authors><author><name>ORBA</name><user>auto-converted</user><email>magento@orba.pl</email></author></authors>
19
- <date>2012-06-05</date>
20
- <time>14:57:51</time>
21
- <contents><target name="magecommunity"><dir name="Orba"><dir name="Payupl"><dir name="Block"><file name="Form.php" hash="0dcab12715372a78f007a4abde209413"/><file name="Online.php" hash="f3bd6baa76e733cf4578c6c270aa89cc"/><file name="Redirect.php" hash="126e9856816c9531dd81ec031ed14626"/></dir><dir name="Helper"><file name="Data.php" hash="55d8258f52d07246e55042aa227655ae"/></dir><dir name="Model"><file name="Config.php" hash="3e933a833c5448bb641435a42a9aaa06"/><file name="Encoding.php" hash="9103c954ae61349db76a1c123696c602"/><file name="Gateway.php" hash="7b630b4e0c90185716389daec5702570"/><file name="Payment.php" hash="1d88a500da902af36e79e2e65b8f0098"/><file name="Session.php" hash="aad733c0d69beb14192e22415339343e"/></dir><dir name="controllers"><file name="IndexController.php" hash="2ee7e3bcd53c0eda0eb06f000cf23afb"/><file name="PaymentController.php" hash="325367b96256badbd4147cf89d7bf9ac"/></dir><dir name="etc"><file name="config.xml" hash="9f6a718615f2157d92b8d7e246406368"/><file name="system.xml" hash="a83fcef20fc8a1dc08df1bc767b66df6"/></dir><dir name="sql"><dir name="payupl_setup"><file name="mysql4-install-0.1.0.php" hash="1c24d60e370bb07d601e02fcd1833c12"/><file name="mysql4-install-0.1.1.php" hash="8a734508ca8764fe397e8e98b2abda45"/><file name="mysql4-install-0.1.10.php" hash="59f3be8df67ac4eb1af1382b32f82d61"/><file name="mysql4-install-0.1.2.php" hash="212e958f7dcaca1209844703f1946b4e"/><file name="mysql4-install-0.1.3.php" hash="964592d00bb4cf8224ab5d2d73669d25"/><file name="mysql4-install-0.1.4.1.php" hash="0ad9b065639c15858c92dc443056d1c9"/><file name="mysql4-install-0.1.4.php" hash="0ad9b065639c15858c92dc443056d1c9"/><file name="mysql4-install-0.1.5.php" hash="af851501e249c0f711539724c129ef75"/><file name="mysql4-install-0.1.6.php" hash="86e34723c7192e7b3e63f9f6d6209140"/><file name="mysql4-install-0.1.7.php" hash="ef811c98a328f0c405435bb8d5baf2b3"/><file name="mysql4-install-0.1.8.php" hash="9f772cd5cbec3a46cd0b421ad482e965"/><file name="mysql4-install-0.1.9.php" hash="81a8706be704903850ed23ed63992b43"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="6489810a00f175b7092ee1911ecd445a"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="6ac5c8851ecbf6d02b28e41e69ef6333"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="3a6b72462611f26b3634588d6036e3f6"/><file name="mysql4-upgrade-0.1.3-0.1.4.1.php" hash="434df0ba3e565a5c9fcbf4697c3f616e"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="434df0ba3e565a5c9fcbf4697c3f616e"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="fc98e0f71e7dfa6e245aa9f4780f9ffd"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="35c607c4cc7eb567b35d835f571aae9c"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="884c9fd4ce6fc1f6c55005c50c003585"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="964aff66ba063a41b043de03d00c9a64"/><file name="mysql4-upgrade-0.1.8-0.1.9.php" hash="413667f250d057d1e3b8842e70a7c8c7"/><file name="mysql4-upgrade-0.1.9-0.1.10.php" hash="bb7a995e2321efa7f04ff1be6bdab5ad"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payupl.xml" hash="2370be1560e9a6296d6c5ed4d2d3d5ef"/></dir><dir name="template"><dir name="payupl"><file name="form.phtml" hash="1924fced96f1f107ce02d2636f4e3671"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Orba_Payupl.xml" hash="172c1f5e1e622b602af9667e90ae5d5c"/></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Orba_Payupl.csv" hash="e4a0cbae2342c13e46d454db7d9d502f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="payupl"><file name="logo.jpg" hash="fc75365ea69655f8b9e3e66d75dc8362"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies/>
24
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Orba_Payupl</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.opensource.org/licenses/academic.php">Academic Free License (AFL)</license>
7
  <channel>community</channel>
14
  Modu&#x142; dodaje do sklepu nowy spos&#xF3;b p&#x142;atno&#x15B;ci, kt&#xF3;ry daje klientom mo&#x17C;liwo&#x15B;&#x107; u&#x17C;ycia serwisu Payu.pl do dokonania zap&#x142;aty za zakupy.&#xD;
15
  Istnieje mo&#x17C;liwo&#x15B;&#x107; integracji zar&#xF3;wno kont produkcyjnych jak i tych typu "sandbox".&#xD;
16
  Je&#x15B;li jeste&#x15B; zainteresowany p&#x142;atn&#x105; wersj&#x105; naszego modu&#x142;u, kt&#xF3;ry zawiera dodatkowe funkcjonalno&#x15B;ci oraz pomoc technicz&#x105; w cenie, wy&#x15B;lij do nas wiadomo&#x15B;&#x107; e-mail na adres magento@orba.pl.</description>
17
+ <notes>- minor bugfixes</notes>
18
  <authors><author><name>ORBA</name><user>auto-converted</user><email>magento@orba.pl</email></author></authors>
19
+ <date>2012-08-01</date>
20
+ <time>13:34:36</time>
21
+ <contents><target name="magecommunity"><dir name="Orba"><dir name="Payupl"><dir name="Block"><file name="Form.php" hash="0dcab12715372a78f007a4abde209413"/><file name="Online.php" hash="f3bd6baa76e733cf4578c6c270aa89cc"/><file name="Redirect.php" hash="126e9856816c9531dd81ec031ed14626"/></dir><dir name="Helper"><file name="Data.php" hash="55d8258f52d07246e55042aa227655ae"/></dir><dir name="Model"><file name="Config.php" hash="3e933a833c5448bb641435a42a9aaa06"/><file name="Encoding.php" hash="9103c954ae61349db76a1c123696c602"/><file name="Gateway.php" hash="7b630b4e0c90185716389daec5702570"/><file name="Payment.php" hash="d52b46969da7cd581c992e3342602053"/><file name="Session.php" hash="aad733c0d69beb14192e22415339343e"/></dir><dir name="controllers"><file name="IndexController.php" hash="2ee7e3bcd53c0eda0eb06f000cf23afb"/><file name="PaymentController.php" hash="3d789f1bd6918e1588904dfea47d375a"/></dir><dir name="etc"><file name="config.xml" hash="ccc770dea52a2c59745432e226ddb910"/><file name="system.xml" hash="a83fcef20fc8a1dc08df1bc767b66df6"/></dir><dir name="sql"><dir name="payupl_setup"><file name="mysql4-install-0.1.0.php" hash="1c24d60e370bb07d601e02fcd1833c12"/><file name="mysql4-install-0.1.1.php" hash="8a734508ca8764fe397e8e98b2abda45"/><file name="mysql4-install-0.1.10.php" hash="59f3be8df67ac4eb1af1382b32f82d61"/><file name="mysql4-install-0.1.2.php" hash="212e958f7dcaca1209844703f1946b4e"/><file name="mysql4-install-0.1.3.php" hash="964592d00bb4cf8224ab5d2d73669d25"/><file name="mysql4-install-0.1.4.1.php" hash="0ad9b065639c15858c92dc443056d1c9"/><file name="mysql4-install-0.1.4.php" hash="0ad9b065639c15858c92dc443056d1c9"/><file name="mysql4-install-0.1.5.php" hash="af851501e249c0f711539724c129ef75"/><file name="mysql4-install-0.1.6.php" hash="86e34723c7192e7b3e63f9f6d6209140"/><file name="mysql4-install-0.1.7.php" hash="ef811c98a328f0c405435bb8d5baf2b3"/><file name="mysql4-install-0.1.8.php" hash="9f772cd5cbec3a46cd0b421ad482e965"/><file name="mysql4-install-0.1.9.php" hash="81a8706be704903850ed23ed63992b43"/><file name="mysql4-install-0.2.0.php" hash="008b767fc311dc1b4ac398a4fe3617da"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="6489810a00f175b7092ee1911ecd445a"/><file name="mysql4-upgrade-0.1.1-0.1.2.php" hash="6ac5c8851ecbf6d02b28e41e69ef6333"/><file name="mysql4-upgrade-0.1.10.1-0.2.0.php" hash="b841e126ebae169facd0fb77895164ec"/><file name="mysql4-upgrade-0.1.2-0.1.3.php" hash="3a6b72462611f26b3634588d6036e3f6"/><file name="mysql4-upgrade-0.1.3-0.1.4.1.php" hash="434df0ba3e565a5c9fcbf4697c3f616e"/><file name="mysql4-upgrade-0.1.3-0.1.4.php" hash="434df0ba3e565a5c9fcbf4697c3f616e"/><file name="mysql4-upgrade-0.1.4-0.1.5.php" hash="fc98e0f71e7dfa6e245aa9f4780f9ffd"/><file name="mysql4-upgrade-0.1.5-0.1.6.php" hash="35c607c4cc7eb567b35d835f571aae9c"/><file name="mysql4-upgrade-0.1.6-0.1.7.php" hash="884c9fd4ce6fc1f6c55005c50c003585"/><file name="mysql4-upgrade-0.1.7-0.1.8.php" hash="964aff66ba063a41b043de03d00c9a64"/><file name="mysql4-upgrade-0.1.8-0.1.9.php" hash="413667f250d057d1e3b8842e70a7c8c7"/><file name="mysql4-upgrade-0.1.9-0.1.10.php" hash="bb7a995e2321efa7f04ff1be6bdab5ad"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payupl.xml" hash="2370be1560e9a6296d6c5ed4d2d3d5ef"/></dir><dir name="template"><dir name="payupl"><file name="form.phtml" hash="1924fced96f1f107ce02d2636f4e3671"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Orba_Payupl.xml" hash="172c1f5e1e622b602af9667e90ae5d5c"/></dir></target><target name="magelocale"><dir name="pl_PL"><file name="Orba_Payupl.csv" hash="e4a0cbae2342c13e46d454db7d9d502f"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><dir name="payupl"><file name="logo.jpg" hash="fc75365ea69655f8b9e3e66d75dc8362"/></dir></dir></dir></dir></dir></target></contents>
22
  <compatible/>
23
  <dependencies/>
24
  </package>