Payson - Version 1.2.6

Version Notes

Enhanced return status mangagement

Download this release

Release Info

Developer Oscar Villegas
Extension Payson
Version 1.2.6
Comparing to
See all releases


Code changes from version 1.2.4 to 1.2.6

app/code/community/Payson/Payson/Helper/Api.php CHANGED
@@ -13,7 +13,7 @@ class Payson_Payson_Helper_Api {
13
  const PAY_FORWARD_URL = '%s://%s%s.payson.%s/paySecure/';
14
  const APPLICATION_ID = 'Magento';
15
  const MODULE_NAME = 'payson_magento';
16
- const MODULE_VERSION = '1.2.3';
17
  const DEBUG_MODE_MAIL = 'testagent-1@payson.se';
18
  const DEBUG_MODE_AGENT_ID = '1';
19
  const DEBUG_MODE_MD5 = 'fddb19ac-7470-42b6-a91d-072cb1495f0a';
@@ -417,6 +417,11 @@ class Payson_Payson_Helper_Api {
417
  * @param string $content_type
418
  * @return object $this
419
  */
 
 
 
 
 
420
  public function Validate($http_body, $content_type) {
421
 
422
  // Parse request done by Payson to our IPN controller
@@ -516,8 +521,13 @@ LIMIT
516
  Mage::throwException('Order is no longer active');
517
  }
518
 
519
- $receivers = $ipn_response->receiverList->receiver->ToArray();
520
-
 
 
 
 
 
521
  /* Verify payment amount. floor() since there might be a precision
522
  difference */
523
  if (floor((float) $receivers[0]['amount']) !==
13
  const PAY_FORWARD_URL = '%s://%s%s.payson.%s/paySecure/';
14
  const APPLICATION_ID = 'Magento';
15
  const MODULE_NAME = 'payson_magento';
16
+ const MODULE_VERSION = '1.2.6';
17
  const DEBUG_MODE_MAIL = 'testagent-1@payson.se';
18
  const DEBUG_MODE_AGENT_ID = '1';
19
  const DEBUG_MODE_MD5 = 'fddb19ac-7470-42b6-a91d-072cb1495f0a';
417
  * @param string $content_type
418
  * @return object $this
419
  */
420
+
421
+ function logIt($what){
422
+ $content = print_r($what, true);
423
+ file_put_contents("c:\php\log\markolog3.txt", date("H:i:s") . "\n" . $content, FILE_APPEND);
424
+ }
425
  public function Validate($http_body, $content_type) {
426
 
427
  // Parse request done by Payson to our IPN controller
521
  Mage::throwException('Order is no longer active');
522
  }
523
 
524
+ $amount = $ipn_response->receiverList->receiver->amount->ToArray();
525
+ $investigatefee = $order['base_payson_invoice_fee'];
526
+ $this->logIt('$amount '.$amount);
527
+ $newAmount = $currentAmount += $investigatefee;
528
+ $this->logIt('$currentAmount '.$currentAmount);
529
+ $this->logIt(' $ipn_response ');
530
+ $this->logIt($newAmount);
531
  /* Verify payment amount. floor() since there might be a precision
532
  difference */
533
  if (floor((float) $receivers[0]['amount']) !==
app/code/community/Payson/Payson/controllers/CheckoutController.php CHANGED
@@ -116,11 +116,10 @@ class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action
116
  case 'PENDING':
117
  case 'PROCESSING':
118
  case 'CREDITED': {
119
- $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
120
- $order->sendNewOrderEmail()->save();
121
-
122
- //It creates the invoice to the order
123
- if ($paymentDetailsResponse->type != 'INVOICE' && $paymentDetailsResponse->status == 'COMPLETED') {
124
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
125
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
126
  $invoice->register();
@@ -128,12 +127,33 @@ class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action
128
  ->addObject($invoice)
129
  ->addObject($invoice->getOrder());
130
  $transactionSave->save();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  }
132
- $this->_redirect('checkout/onepage/success');
133
- break;
134
  }
135
  case 'ERROR': {
136
  $errorMessage = Mage::helper('payson')->__('The payment was denied by Payson. Please, try a different payment method');
 
137
  Mage::getSingleton('core/session')->addError($errorMessage);
138
  $this->cancelOrder($errorMessage);
139
 
116
  case 'PENDING':
117
  case 'PROCESSING':
118
  case 'CREDITED': {
119
+
120
+ if ($paymentDetailsResponse->type !== 'INVOICE' && $paymentDetailsResponse->status === 'COMPLETED') {
121
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
122
+ $order->sendNewOrderEmail()->save();
 
123
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
124
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
125
  $invoice->register();
127
  ->addObject($invoice)
128
  ->addObject($invoice->getOrder());
129
  $transactionSave->save();
130
+
131
+ $this->_redirect('checkout/onepage/success');
132
+ break;
133
+ }
134
+
135
+
136
+ if ($paymentDetailsResponse->type !== 'INVOICE' && $paymentDetailsResponse->status === 'PROCESSING') {
137
+ $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
138
+ Mage::getSingleton('core/session')->addError(sprintf(Mage::helper('payson')->__('Your payment is being processed by Payson')));
139
+ $this->_redirect('checkout/onepage/success');
140
+ break;
141
+ }
142
+ if ($paymentDetailsResponse->type !== 'INVOICE' && $paymentDetailsResponse->status === 'PENDING') {
143
+ Mage::getSingleton('core/session')->addError(sprintf(Mage::helper('payson')->__('Something went wrong with the payment. Please, try a different payment method')));
144
+ $this->_redirect('checkout/onepage/failure');
145
+ break;
146
+ }
147
+ if ($paymentDetailsResponse->type === 'INVOICE') {
148
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
149
+ $order->sendNewOrderEmail()->save();
150
+ $this->_redirect('checkout/onepage/success');
151
+ break;
152
  }
 
 
153
  }
154
  case 'ERROR': {
155
  $errorMessage = Mage::helper('payson')->__('The payment was denied by Payson. Please, try a different payment method');
156
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
157
  Mage::getSingleton('core/session')->addError($errorMessage);
158
  $this->cancelOrder($errorMessage);
159
 
app/code/community/Payson/Payson/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Payson_Payson>
5
- <version>1.2.2</version>
6
  </Payson_Payson>
7
  </modules>
8
  <admin>
2
  <config>
3
  <modules>
4
  <Payson_Payson>
5
+ <version>1.2.6</version>
6
  </Payson_Payson>
7
  </modules>
8
  <admin>
app/etc/modules/Payson_Payson.xml CHANGED
@@ -4,7 +4,7 @@
4
  <Payson_Payson>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- <version>1.2.3</version>
8
  <depends>
9
  <Mage_Payment />
10
  </depends>
4
  <Payson_Payson>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <version>1.2.5</version>
8
  <depends>
9
  <Mage_Payment />
10
  </depends>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payson</name>
4
- <version>1.2.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/bsd-license.php">BSD licence</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Official Payson module for Magento. </summary>
10
  <description>This module integrates with Payson and allows you to charge your customers via Invoice, Card and direct bank transfers.</description>
11
- <notes>Supports Magento 1.9</notes>
12
- <authors><author><name>Oscar Villegas</name><user>PaysonAB</user><email>integration@payson.se</email></author><author><name>Karl Brundin</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
13
- <date>2014-09-04</date>
14
- <time>07:25:54</time>
15
- <contents><target name="magecommunity"><dir name="Payson"><dir name="Payson"><dir name="Block"><file name="Form.php" hash="74a8967879fbb6af999f0e513bc91323"/><dir name="Invoice"><file name="Form.php" hash="0d16d91e26b31691267c0a7bdc2a516d"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="3e8566e634d68d8df9bb70f597916980"/></dir></dir><dir name="Standard"><file name="Form.php" hash="c715cbec95494a9a26d261992429dff0"/></dir></dir><dir name="Helper"><dir name="Api"><dir name="Response"><file name="Interface.php" hash="51d0ffe7eefaa12eb9b4f2551e9f4259"/><dir name="Standard"><file name="Parameters.php" hash="6965b8259867c23a5e1e682e14491eb2"/></dir><file name="Standard.php" hash="cef827896629364fee49671af879adc3"/><file name="Validate.php" hash="34fb6626af3a6ac06e987c9e10a95796"/></dir></dir><file name="Api.php" hash="e9844eb1ad786f0f95da6b44fef57097"/><file name="Data.php" hash="83ff59b1588c0b0ff8d2f7341589ea59"/></dir><dir name="Model"><file name="Config.php" hash="2886124eac6b444fce7944e06ebf9faf"/><dir name="Method"><file name="Abstract.php" hash="6ea3385160ce437933da158b5d3e0d65"/><file name="Invoice.php" hash="ecfd2883a9f2dc24a6e43f04b6f098e8"/><file name="Standard.php" hash="e79bc4044be332dba6b1bcb28ffd6654"/></dir><dir name="Mysql4"><file name="Setup.php" hash="3075fa047af3d56d6eac609004e6e1cc"/></dir><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Invoice.php" hash="0073a5e3617542107713e4155faa07fe"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Invoice.php" hash="2a2bb0752543535b27c29668113b67e0"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Invoice.php" hash="d85f0abf040163920659d18e16d84a9e"/></dir></dir></dir><file name="Standard.php" hash="2e7fa64c2e561d2fbbd3735935edad43"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Paysondirectmethod.php" hash="23549b49797c4ef2ee312fc4fc5f5000"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="18d1c17c341f97c233b8ad63f8c321cb"/></dir></dir></dir><file name="CheckoutController.php" hash="1db99c07df583828380c48b34e78b167"/><file name="IpnController.php" hash="e7b092cdd0011a3a1359a084bbaf14ad"/></dir><dir name="etc"><file name="config.xml" hash="6eb00bd85327753783bab794f955ae7d"/><file name="system.xml" hash="0f9f27e8576e37d108dd5b109940c7c2"/></dir><dir name="sql"><dir name="payson_setup"><file name="mysql4-install-0.1.0.php" hash="21cd9fd3436ba1eb2fc20eaaadb42106"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="5bbcb930748e3a87a220c0e9f8448a15"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="Payson.xml" hash="1ace2a646cd9a33521e7b392b6c5f3f1"/></dir><dir name="template"><dir name="Payson"><dir name="Payson"><file name="total.phtml" hash="795e38fb672ffd23f38ed28578c7ee2f"/></dir></dir></dir><dir name="Payson"><dir name="Payson"><file name="total.phtml" hash="e35a3824cd0f3127e8cf7d03a229fb1a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Payson.xml" hash="22b9b9ae0cc9b1c70f79d690fbb4db41"/></dir><dir name="template"><dir name="Payson"><dir name="Payson"><file name="standard_form.phtml" hash="781286055d322d532496af6c5e320034"/><file name="invoice_form.phtml" hash="ed7af0a7cfb2bd59695659e8f26609cc"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payson_Payson.xml" hash="9118f2a12f9a78438b37b4c9bc5c5198"/></dir></target><target name="magelocale"><dir name="sv_SE"><file name="Payson_Payson.csv" hash="df54d1d5b4b2de1ba6c22d4c3fecd566"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="Payson"><dir name="Payson"><file name="payson.gif" hash="638d0055cbc1a4bdc32e9fa1156b722a"/><file name="payson.png" hash="308916345711a4520313c94218c5bda7"/><file name="payson_faktura.png" hash="fa218c9949c05c6f3452d9f4c541da2c"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
- <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php><package><name>Mage_Core_modules</name><channel>community</channel><min>1.8.0</min><max>1.9</max></package></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payson</name>
4
+ <version>1.2.6</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/bsd-license.php">BSD licence</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Official Payson module for Magento. </summary>
10
  <description>This module integrates with Payson and allows you to charge your customers via Invoice, Card and direct bank transfers.</description>
11
+ <notes>Enhanced return status mangagement</notes>
12
+ <authors><author><name>Karl Brundin</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
13
+ <date>2015-02-02</date>
14
+ <time>16:41:19</time>
15
+ <contents><target name="magecommunity"><dir name="Payson"><dir name="Payson"><dir name="Block"><file name="Form.php" hash="74a8967879fbb6af999f0e513bc91323"/><dir name="Invoice"><file name="Form.php" hash="0d16d91e26b31691267c0a7bdc2a516d"/></dir><dir name="Order"><dir name="Totals"><file name="Fee.php" hash="3e8566e634d68d8df9bb70f597916980"/></dir></dir><dir name="Standard"><file name="Form.php" hash="c715cbec95494a9a26d261992429dff0"/></dir></dir><dir name="Helper"><dir name="Api"><dir name="Response"><file name="Interface.php" hash="51d0ffe7eefaa12eb9b4f2551e9f4259"/><dir name="Standard"><file name="Parameters.php" hash="6965b8259867c23a5e1e682e14491eb2"/></dir><file name="Standard.php" hash="cef827896629364fee49671af879adc3"/><file name="Validate.php" hash="34fb6626af3a6ac06e987c9e10a95796"/></dir></dir><file name="Api.php" hash="0611af3a7372273204ea23bc13f3f0c9"/><file name="Data.php" hash="83ff59b1588c0b0ff8d2f7341589ea59"/></dir><dir name="Model"><file name="Config.php" hash="2886124eac6b444fce7944e06ebf9faf"/><dir name="Method"><file name="Abstract.php" hash="6ea3385160ce437933da158b5d3e0d65"/><file name="Invoice.php" hash="ecfd2883a9f2dc24a6e43f04b6f098e8"/><file name="Standard.php" hash="e79bc4044be332dba6b1bcb28ffd6654"/></dir><dir name="Mysql4"><file name="Setup.php" hash="3075fa047af3d56d6eac609004e6e1cc"/></dir><dir name="Order"><dir name="Creditmemo"><dir name="Total"><file name="Invoice.php" hash="0073a5e3617542107713e4155faa07fe"/></dir></dir><dir name="Invoice"><dir name="Total"><file name="Invoice.php" hash="2a2bb0752543535b27c29668113b67e0"/></dir></dir></dir><dir name="Quote"><dir name="Address"><dir name="Total"><file name="Invoice.php" hash="d85f0abf040163920659d18e16d84a9e"/></dir></dir></dir><file name="Standard.php" hash="2e7fa64c2e561d2fbbd3735935edad43"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Paysondirectmethod.php" hash="23549b49797c4ef2ee312fc4fc5f5000"/></dir></dir></dir></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="18d1c17c341f97c233b8ad63f8c321cb"/></dir></dir></dir><file name="CheckoutController.php" hash="9dba62332c6d0ff5b90f3b00a29dcaf8"/><file name="IpnController.php" hash="e7b092cdd0011a3a1359a084bbaf14ad"/></dir><dir name="etc"><file name="config.xml" hash="78707c880ace8f0c5ab57aaf3b6e9b03"/><file name="system.xml" hash="0f9f27e8576e37d108dd5b109940c7c2"/></dir><dir name="sql"><dir name="payson_setup"><file name="mysql4-install-0.1.0.php" hash="21cd9fd3436ba1eb2fc20eaaadb42106"/><file name="mysql4-upgrade-0.1.0-0.1.2.php" hash="5bbcb930748e3a87a220c0e9f8448a15"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="Payson.xml" hash="1ace2a646cd9a33521e7b392b6c5f3f1"/></dir><dir name="template"><dir name="Payson"><dir name="Payson"><file name="total.phtml" hash="795e38fb672ffd23f38ed28578c7ee2f"/></dir></dir></dir><dir name="Payson"><dir name="Payson"><file name="total.phtml" hash="e35a3824cd0f3127e8cf7d03a229fb1a"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="Payson.xml" hash="22b9b9ae0cc9b1c70f79d690fbb4db41"/></dir><dir name="template"><dir name="Payson"><dir name="Payson"><file name="standard_form.phtml" hash="781286055d322d532496af6c5e320034"/><file name="invoice_form.phtml" hash="ed7af0a7cfb2bd59695659e8f26609cc"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payson_Payson.xml" hash="6049f2399ab8b1b4620a8ccd62fb9efe"/></dir></target><target name="magelocale"><dir name="sv_SE"><file name="Payson_Payson.csv" hash="df54d1d5b4b2de1ba6c22d4c3fecd566"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="Payson"><dir name="Payson"><file name="payson.gif" hash="638d0055cbc1a4bdc32e9fa1156b722a"/><file name="payson.png" hash="308916345711a4520313c94218c5bda7"/><file name="payson_faktura.png" hash="fa218c9949c05c6f3452d9f4c541da2c"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>