Payson - Version 1.2.6.1

Version Notes

Enhanced return status mangagement

Download this release

Release Info

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


Code changes from version 1.2.6 to 1.2.6.1

app/code/community/Payson/Payson/Helper/Api.php CHANGED
@@ -417,11 +417,8 @@ class Payson_Payson_Helper_Api {
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,13 +518,18 @@ LIMIT
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']) !==
@@ -540,7 +542,8 @@ LIMIT
540
  //Changes the status of the order from pending_payment to processing
541
  $order->setState(
542
  Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, $this->_config->get('test_mode') ? $this->_helper->__('Payson test completed the order payment') : $this->_helper->__('Payson completed the order payment'));
543
-
 
544
  //It creates the invoice to the order
545
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
546
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
@@ -563,7 +566,10 @@ LIMIT
563
  //Changes the status of the order from pending to processing
564
  $order->setState(
565
  Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, $this->_config->get('test_mode') ? $this->_helper->__('Payson test created an invoice') : $this->_helper->__('Payson created an invoice'));
566
-
 
 
 
567
 
568
 
569
  if (isset($ipn_response->shippingAddress)) {
@@ -851,6 +857,8 @@ LIMIT
851
  } else {
852
  $order->addStatusHistoryComment(sprintf(
853
  $this->_helper->__('Payson pinged the order with status %s'), $ipn_response->status));
 
 
854
  }
855
 
856
  break;
417
  * @param string $content_type
418
  * @return object $this
419
  */
420
+
421
+
 
 
 
422
  public function Validate($http_body, $content_type) {
423
 
424
  // Parse request done by Payson to our IPN controller
518
  Mage::throwException('Order is no longer active');
519
  }
520
 
521
+ $receivers = $ipn_response->receiverList->receiver->ToArray();
522
+ $investigatefee = $order['base_payson_invoice_fee'];
523
+
524
+ $new_receivers = array();
525
+ foreach ($receivers as $item) {
526
+ foreach ($item as $key => $value) {
527
+ $new_receivers[$key] = $value;
528
+ }
529
+ }
530
+ $currentAmount = $new_receivers['amount'];
531
  $newAmount = $currentAmount += $investigatefee;
532
+
 
 
533
  /* Verify payment amount. floor() since there might be a precision
534
  difference */
535
  if (floor((float) $receivers[0]['amount']) !==
542
  //Changes the status of the order from pending_payment to processing
543
  $order->setState(
544
  Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, $this->_config->get('test_mode') ? $this->_helper->__('Payson test completed the order payment') : $this->_helper->__('Payson completed the order payment'));
545
+ $order['payson_invoice_fee']= 0;
546
+ $order['base_payson_invoice_fee']=0;
547
  //It creates the invoice to the order
548
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
549
  $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
566
  //Changes the status of the order from pending to processing
567
  $order->setState(
568
  Mage_Sales_Model_Order::STATE_PROCESSING, Mage_Sales_Model_Order::STATE_PROCESSING, $this->_config->get('test_mode') ? $this->_helper->__('Payson test created an invoice') : $this->_helper->__('Payson created an invoice'));
569
+ $order->setBaseGrandTotal($newAmount);
570
+ $order->setGrandTotal($newAmount);
571
+ $order->setTotalDue($newAmount);
572
+ $order->save();
573
 
574
 
575
  if (isset($ipn_response->shippingAddress)) {
857
  } else {
858
  $order->addStatusHistoryComment(sprintf(
859
  $this->_helper->__('Payson pinged the order with status %s'), $ipn_response->status));
860
+ $order['payson_invoice_fee']= 0;
861
+ $order['base_payson_invoice_fee']=0;
862
  }
863
 
864
  break;
app/code/community/Payson/Payson/controllers/CheckoutController.php CHANGED
@@ -153,7 +153,6 @@ class Payson_Payson_CheckoutController extends Mage_Core_Controller_Front_Action
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
 
153
  }
154
  case 'ERROR': {
155
  $errorMessage = Mage::helper('payson')->__('The payment was denied by Payson. Please, try a different payment method');
 
156
  Mage::getSingleton('core/session')->addError($errorMessage);
157
  $this->cancelOrder($errorMessage);
158
 
app/locale/sv_SE/Payson_Payson.csv CHANGED
@@ -6,6 +6,7 @@
6
  "If you choose to pay by Paysoninvoice so there is a fee. Payment terms are 14 days and the invoice will be sent separately by email to the email address you specify. To pay by Paysoninvoice You must be 18 years old and be registered in Sweden as well as authorized in the credit assessment carried out at purchase.","Om du väljer att betala med Paysonfaktura så tillkommer ovanstående avgift. Betalningsvillkor är 14 dagar och fakturan kommer att sändas separat med e-post till den e-postadress Du anger. För att betala mot Paysonfaktura måste Du ha fyllt 18 år och vara folkbokförd i Sverige samt godkännas i den kreditprövning som genomförs vid köpet."
7
  "The payment was denied by Payson. Please, try a different payment method", "Betalningen blev nekad. Vänligen, försök med en annan betalningsmetod."
8
  "Something went wrong with the payment. Please, try a different payment method", "Något gick fel med betalningen. Vänligen, försök en annan betalningsmetod."
 
9
 
10
  "Order was activated at Payson","Order aktiverades hos Payson"
11
  "Payment was credited at Payson","Betalningen krediterades hos Payson"
6
  "If you choose to pay by Paysoninvoice so there is a fee. Payment terms are 14 days and the invoice will be sent separately by email to the email address you specify. To pay by Paysoninvoice You must be 18 years old and be registered in Sweden as well as authorized in the credit assessment carried out at purchase.","Om du väljer att betala med Paysonfaktura så tillkommer ovanstående avgift. Betalningsvillkor är 14 dagar och fakturan kommer att sändas separat med e-post till den e-postadress Du anger. För att betala mot Paysonfaktura måste Du ha fyllt 18 år och vara folkbokförd i Sverige samt godkännas i den kreditprövning som genomförs vid köpet."
7
  "The payment was denied by Payson. Please, try a different payment method", "Betalningen blev nekad. Vänligen, försök med en annan betalningsmetod."
8
  "Something went wrong with the payment. Please, try a different payment method", "Något gick fel med betalningen. Vänligen, försök en annan betalningsmetod."
9
+ "Your payment is being processed by Payson", "Er betalning är under behandling hos Payson"
10
 
11
  "Order was activated at Payson","Order aktiverades hos Payson"
12
  "Payment was credited at Payson","Betalningen krediterades hos Payson"
package.xml CHANGED
@@ -1,7 +1,7 @@
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>
@@ -10,9 +10,9 @@
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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payson</name>
4
+ <version>1.2.6.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/bsd-license.php">BSD licence</license>
7
  <channel>community</channel>
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-04</date>
14
+ <time>09:46:44</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="68722e505dd9e5da88f69ffe2699bbc0"/><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="fdd2789ebe8d158cbaa6976f0b17c3ac"/><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="ecc9f124508770be3300661d6ab92330"/></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>