PaysonCheckout2 - Version 1.0.0.2

Version Notes

New modul paysonCheckout2

Download this release

Release Info

Developer Oscar Villegas
Extension PaysonCheckout2
Version 1.0.0.2
Comparing to
See all releases


Code changes from version 1.0.0.1 to 1.0.0.2

app/code/community/Payson/Checkout2/Helper/Order.php CHANGED
@@ -9,6 +9,9 @@ class Payson_Checkout2_Helper_Order extends Mage_Core_Helper_Abstract
9
  protected $_api;
10
  protected $controlKey;
11
 
 
 
 
12
  public function checkout() {
13
  $order = $this->getOrder();
14
 
@@ -207,8 +210,9 @@ class Payson_Checkout2_Helper_Order extends Mage_Core_Helper_Abstract
207
  $confirmationUri = Mage::getUrl('checkout2/express/return', array('_secure' => true));
208
  $notificationUri = Mage::getUrl('checkout2/notification/notify', array('_secure' => true));
209
  $termsUri = $this->getConfig()->getTermsUrl();
 
210
 
211
- return new PaysonEmbedded\Merchant($checkoutUri, $confirmationUri, $notificationUri, $termsUri, 1);
212
  }
213
 
214
  /**
@@ -586,14 +590,20 @@ class Payson_Checkout2_Helper_Order extends Mage_Core_Helper_Abstract
586
  return $this->_session;
587
  }
588
 
589
- public function convertQuoteToOrder() {
590
  $quote = Mage::getSingleton('checkout/cart')->getQuote();
591
 
592
  if (is_null($quote)) {
593
  return null;
594
  }
595
 
596
- $quote->collectTotals();
 
 
 
 
 
 
597
  $service = Mage::getModel('sales/service_quote', $quote);
598
  $service->submitAll();
599
  $order = $service->getOrder();
@@ -634,4 +644,16 @@ class Payson_Checkout2_Helper_Order extends Mage_Core_Helper_Abstract
634
  $quote->getPayment()->setMethod('checkout2');
635
  $quote->setTotalsCollectedFlag(false)->collectTotals();
636
  }
 
 
 
 
 
 
 
 
 
 
 
 
637
  }
9
  protected $_api;
10
  protected $controlKey;
11
 
12
+ const MODULE_NAME = 'PaysonCheckout2.0_magento';
13
+ const MODULE_VERSION = '1.0.0.1';
14
+
15
  public function checkout() {
16
  $order = $this->getOrder();
17
 
210
  $confirmationUri = Mage::getUrl('checkout2/express/return', array('_secure' => true));
211
  $notificationUri = Mage::getUrl('checkout2/notification/notify', array('_secure' => true));
212
  $termsUri = $this->getConfig()->getTermsUrl();
213
+ $paysonModuleInfo = self::MODULE_NAME . '|' . self::MODULE_VERSION . '|' . Mage::getVersion();
214
 
215
+ return new PaysonEmbedded\Merchant($checkoutUri, $confirmationUri, $notificationUri, $termsUri, 1, $paysonModuleInfo);
216
  }
217
 
218
  /**
590
  return $this->_session;
591
  }
592
 
593
+ public function convertQuoteToOrder($paysonCustomer) {
594
  $quote = Mage::getSingleton('checkout/cart')->getQuote();
595
 
596
  if (is_null($quote)) {
597
  return null;
598
  }
599
 
600
+ $addressData = $this->_udateShippingAddress($paysonCustomer);
601
+
602
+ //Add address array to both billing AND shipping address.
603
+ $quote->getBillingAddress()->addData($addressData);
604
+ $quote->getShippingAddress()->addData($addressData);
605
+
606
+ $quote->collectTotals()->save();
607
  $service = Mage::getModel('sales/service_quote', $quote);
608
  $service->submitAll();
609
  $order = $service->getOrder();
644
  $quote->getPayment()->setMethod('checkout2');
645
  $quote->setTotalsCollectedFlag(false)->collectTotals();
646
  }
647
+
648
+ private function _udateShippingAddress($paysonCustomer) {
649
+ return array(
650
+ 'firstname' => $paysonCustomer->firstName,
651
+ 'lastname' => $paysonCustomer->lastName,
652
+ 'street' => $paysonCustomer->street,
653
+ 'city' => $paysonCustomer->city,
654
+ 'postcode'=> $paysonCustomer->postalCode,
655
+ 'telephone' => $paysonCustomer->phone,
656
+ 'country_id' => $paysonCustomer->countryCode,
657
+ );
658
+ }
659
  }
app/code/community/Payson/Checkout2/controllers/ExpressController.php CHANGED
@@ -53,7 +53,7 @@ class Payson_Checkout2_ExpressController extends Mage_Core_Controller_Front_Acti
53
  case 'readyToShip':
54
  Mage::getSingleton('core/session')->setCheckoutId($checkoutId);
55
 
56
- $order = $this->_getOrderHelper()->convertQuoteToOrder();
57
  $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
58
 
59
  // Send order reference to Payson
@@ -73,7 +73,7 @@ class Payson_Checkout2_ExpressController extends Mage_Core_Controller_Front_Acti
73
 
74
  case 'created':
75
  case 'processingPayment':
76
- $order = $this->_getOrderHelper()->convertQuoteToOrder();
77
  $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
78
 
79
  // Send order reference to Payson
53
  case 'readyToShip':
54
  Mage::getSingleton('core/session')->setCheckoutId($checkoutId);
55
 
56
+ $order = $this->_getOrderHelper()->convertQuoteToOrder($checkout->customer);
57
  $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
58
 
59
  // Send order reference to Payson
73
 
74
  case 'created':
75
  case 'processingPayment':
76
+ $order = $this->_getOrderHelper()->convertQuoteToOrder($checkout->customer);
77
  $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true);
78
 
79
  // Send order reference to Payson
app/design/frontend/base/default/template/payson/Payson/standard_form.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $helper = Mage::Helper('payson');
3
+ $code = $this->getMethodCode();
4
+ $this->_config = Mage::getModel('payson/config');
5
+
6
+ ?>
7
+ <fieldset class="form-list">
8
+ <label for="p_method_<?php echo($code); ?>" style="float: none"><img src="<?php echo(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN)); ?>frontend/base/default/Payson/Payson/payson.png" alt="Payson" style="margin: 10px 0; display: block" /></label>
9
+ <p id="payment_form_<?php echo($code); ?>" style="display: none">
10
+ <?php
11
+ echo($helper->__('A payment window will be generated for your order'));
12
+ echo '<br /><br />'; ?>
13
+ </p>
14
+ </fieldset>
15
+
js/payson/checkout2/express.js CHANGED
@@ -74,5 +74,5 @@
74
  payson.contentWindow.postMessage('release', '*');
75
  isUpdating = false;
76
  }
77
- })($j, window.PaysonSettings = window.PaysonSettings || {});
78
 
74
  payson.contentWindow.postMessage('release', '*');
75
  isUpdating = false;
76
  }
77
+ })(jQuery, window.PaysonSettings = window.PaysonSettings || {});
78
 
modman ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ app/code/community/Payson/Checkout2 app/code/community/Payson/Checkout2
2
+ app/design/frontend/base/default/layout/* app/design/frontend/base/default/layout
3
+ app/design/frontend/base/default/template/* app/design/frontend/base/default/template
4
+ app/design/adminhtml/default/default/layout/* app/design/adminhtml/default/default/layout
5
+ app/etc/modules/Payson_Checkout2.xml app/etc/modules/Payson_Checkout2.xml
6
+ app/locale/sv_SE/* app/locale/sv_SE
7
+ skin/frontend/base/default/css/* skin/frontend/base/default/css/
8
+ js/payson/checkout2/* js/payson/checkout2/
9
+ lib/* lib
package.xml CHANGED
@@ -1,22 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PaysonCheckout2</name>
4
- <version>1.0.0.1</version>
5
  <stability>stable</stability>
6
- <license uri="https://opensource.org/licenses/bsd-license.php">BSD licence</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Payson offers a simple way to receive payments from your customers using Visa, MasterCard, Direct bank transfer and WyWallet with one contract.</summary>
10
- <description>Payson offers a simple way to receive payments from your customers using Visa, MasterCard, Direct bank transfer and WyWallet with one contract. You may additionally apply for the Payson Invoice service to give Swedish customers the opportunity to pay later and in installments as Payson will handle the whole process of credit checks, invoice delivery, reminders, etc. Payments can be processed in SEK and EUR and the services are available in Swedish, Finnish and English. Each transaction will be registered to your Payson account immediately and you may withdraw the funds in your Payson account balance to your bank account at any time for a small charge. &#xD;
11
- &#xD;
12
- There are currently two versions of the PaysonCheckout available, the first (1.0) will let the customer choose payment method with corresponding buttons and can be modified with the payment methods you decide. The second one (2.0) will also manage the customer address and will present the quickest payment option for that customer. This version requires all payment methods to be enabled with Payson. &#xD;
13
- &#xD;
14
- For more information please contact Payson or look to the Payson Terms / Agreement.</description>
15
  <notes>New modul paysonCheckout2</notes>
16
- <authors><author><name>Oscar</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
17
- <date>2016-12-06</date>
18
- <time>13:48:17</time>
19
- <contents><target name="magecommunity"><dir name="Payson"><dir name="Checkout2"><dir name="Block"><dir name="Form"><file name="Checkout2.php" hash="2b67b75d9478b60388df76b60cbee459"/></dir><dir name="Info"><file name="Checkout2.php" hash="d577097f022794f5cd7a12fa88b17933"/></dir><file name="Payment.php" hash="9d9fd75b69580db7cccd60b225553690"/></dir><dir name="Helper"><file name="Data.php" hash="766f354fc4bccd415301b787b0fbd4f9"/><file name="Order.php" hash="9ca9486999de387069556bf4777cbfdf"/></dir><dir name="Model"><file name="Config.php" hash="98791c265d914dfc8fa2d3bde5cbbdc1"/><dir name="Method"><file name="Checkout2.php" hash="d68ba56d9de974b77cc23a38df10c5a2"/></dir><file name="Notification.php" hash="7f7466bb8ce9ecdfc84f53a986c040c4"/><file name="Observer.php" hash="d5bc3717b51265d4b7b335debd23395c"/><file name="Order.php" hash="7caf0306a00499dbce2c756eeb7fdbc0"/><file name="Themes.php" hash="30c39fad25db4883bfbed8c79687958f"/><file name="VerificationTypes.php" hash="e8a9bccb0203a2af8140b3858684be56"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="1c8aeb17a1e55816fd1736d26224bb58"/></dir></dir></dir><file name="ExpressController.php" hash="4f7871835f0cdad74455a77a4150d56e"/><file name="NotificationController.php" hash="f3cba6067ac6fe9cc5060f1ce52eca6a"/><file name="PaymentController.php" hash="e70cfe80ef6aed32f6aba51d03a092ee"/></dir><dir name="etc"><file name="config.xml" hash="908d9295cdcdf73d85462f1d09e7eea6"/><file name="system.xml" hash="d2b161347c5c7cd4cf5d22080e141f26"/></dir><dir name="sql"><dir name="payson_checkout2_setup"><file name="mysql4-install-1.0.0.php" hash="c4139a6d4e830aa554b6d7cd106e4e25"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payson_checkout2.xml" hash="22b3bc15951f0c383c5e6f96d7949fad"/></dir><dir name="template"><dir name="payson"><dir name="checkout2"><dir name="elements"><file name="button.phtml" hash="1f63ccf569ff10d35e51616a413955d7"/><file name="minicartbutton.phtml" hash="a575c64a333be672cb8fc6aec89382d8"/></dir><dir name="form"><file name="checkout2.phtml" hash="99419617856e6c5ea93c3cf88ae4d490"/><file name="review.phtml" hash="2908826635a38b1dfd5640a1c6feba54"/><file name="shipping.phtml" hash="abd612bee8e11baf89c8468f76b00615"/></dir><dir name="page"><file name="blank.phtml" hash="509893c584213ad7d78e17a1a53249d1"/></dir><dir name="payment"><file name="confirmation.phtml" hash="d73bb16ae4b6d2b1d333079e84aa9b55"/><file name="express.phtml" hash="6d2757865efe818d2ab213992ffe40f3"/><file name="standard.phtml" hash="0da3b1e0080df8f31d808061939b430e"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payson_Checkout2.xml" hash="dcbe0d3d1f1cad514c719d0a79f213e0"/></dir></target><target name="magelocale"><dir name="sv_SE"><file name="payson_checkout2.csv" hash="4555f2b2f86dffe56ccbe8e7ad373866"/></dir></target><target name="magelib"><dir name="Payson"><dir name="Checkout2"><dir name="PaysonCheckout2PHP"><file name="README.md" hash="bb8c8d92c7e18353d4d9d5a496a566da"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><dir name="example"><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="config.php" hash="45966251b3cef234834cc1d2dc966e90"/><file name="confirmation.php" hash="7a50c9e9772ccc123c6d84cc8e2fe7f3"/><file name="index.php" hash="1b3081faa0d1835641c7259db5cf3837"/><file name="notification.php" hash="d80a0d41e083fb43cce844c7d23b7338"/><file name="update_order.php" hash="ad2367147e72a88428808dfaab231366"/><file name="validate.php" hash="436f44544aa97ef039e28977ca1f6380"/></dir><dir name="lib"><file name="account.php" hash="22acb8e56a837dfaf200252d99bc023f"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="confirmation.php" hash="e23740168f2941741ffeb308cfa6aaa9"/><file name="customer.php" hash="34f1f9d76b729938118e72721cacd8af"/><file name="gui.php" hash="e234c46d3a046fd0989ecd535c1d9eb1"/><file name="index.php" hash="eb59320117f2668f615a19ee892fcf09"/><file name="orderitem.php" hash="3081930512e0d0ae705b361a5a5c104b"/><file name="paydata.php" hash="718479d8f056d6393e89c3de85d7526e"/><file name="paysonapi.php" hash="44665885f35c04edf78405159d01a4ff"/><file name="paysonapierror.php" hash="e3712bd19b64c3fbb5b64015ce944563"/><file name="paysonapiexception.php" hash="ee5a2ddad8fc7870b5dc121386ac3ef0"/><file name="paysoncheckout.php" hash="31efedcb1d197b3e230fcea9a9deef93"/><file name="paysonmerchant.php" hash="126ad5956d6efebedf4c2d6b35de1dff"/><file name="update_order.php" hash="500f71b5fb1fb31660626e4e12d113c7"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="payson"><dir name="checkout2"><file name="express.js" hash="8185c0ef8c7f4bd006e561df0602e3c2"/></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="payson_checkout2"><file name="style.css" hash="f70e8d8d166a189383d5795620c162e3"/></dir></dir></dir></dir></dir></target></contents>
20
  <compatible/>
21
- <dependencies><required><php><min>5.3.0</min><max>5.6.28</max></php></required></dependencies>
22
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>PaysonCheckout2</name>
4
+ <version>1.0.0.2</version>
5
  <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/bsd-license.php">BCD licence</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>Official Payson module for Magento.</summary>
10
+ <description>Official Payson module for Magento. Use this to be able to handle invoice, card and direct bank transfers.</description>
 
 
 
 
11
  <notes>New modul paysonCheckout2</notes>
12
+ <authors><author><name>PaysonAB</name><user>PaysonAB</user><email>integration@payson.se</email></author></authors>
13
+ <date>2017-04-10</date>
14
+ <time>12:36:56</time>
15
+ <contents><target name="magecommunity"><dir name="Payson"><dir name="Checkout2"><dir name="Block"><dir name="Form"><file name="Checkout2.php" hash="2b67b75d9478b60388df76b60cbee459"/></dir><dir name="Info"><file name="Checkout2.php" hash="d577097f022794f5cd7a12fa88b17933"/></dir><file name="Payment.php" hash="9d9fd75b69580db7cccd60b225553690"/></dir><dir name="Helper"><file name="Data.php" hash="766f354fc4bccd415301b787b0fbd4f9"/><file name="Order.php" hash="f57be6bc9efb958a0316c32b02f6c94c"/></dir><dir name="Model"><file name="Config.php" hash="98791c265d914dfc8fa2d3bde5cbbdc1"/><dir name="Method"><file name="Checkout2.php" hash="d68ba56d9de974b77cc23a38df10c5a2"/></dir><file name="Notification.php" hash="7f7466bb8ce9ecdfc84f53a986c040c4"/><file name="Observer.php" hash="d5bc3717b51265d4b7b335debd23395c"/><file name="Order.php" hash="7caf0306a00499dbce2c756eeb7fdbc0"/><file name="Themes.php" hash="30c39fad25db4883bfbed8c79687958f"/><file name="VerificationTypes.php" hash="e8a9bccb0203a2af8140b3858684be56"/></dir><dir name="controllers"><dir name="Adminhtml"><dir name="Sales"><dir name="Order"><file name="ShipmentController.php" hash="1c8aeb17a1e55816fd1736d26224bb58"/></dir></dir></dir><file name="ExpressController.php" hash="19dc4319c4b6efea079f11dd35ab09dd"/><file name="NotificationController.php" hash="f3cba6067ac6fe9cc5060f1ce52eca6a"/><file name="PaymentController.php" hash="e70cfe80ef6aed32f6aba51d03a092ee"/></dir><dir name="etc"><file name="config.xml" hash="908d9295cdcdf73d85462f1d09e7eea6"/><file name="system.xml" hash="d2b161347c5c7cd4cf5d22080e141f26"/></dir><dir name="sql"><dir name="payson_checkout2_setup"><file name="mysql4-install-1.0.0.php" hash="c4139a6d4e830aa554b6d7cd106e4e25"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payson_checkout2.xml" hash="22b3bc15951f0c383c5e6f96d7949fad"/></dir><dir name="template"><dir name="payson"><dir name="Payson"><file name="standard_form.phtml" hash="beaa2ec0d6b576b22a18cabe2254e6c6"/></dir><dir name="checkout2"><dir name="elements"><file name="button.phtml" hash="1f63ccf569ff10d35e51616a413955d7"/><file name="minicartbutton.phtml" hash="a575c64a333be672cb8fc6aec89382d8"/></dir><dir name="form"><file name="checkout2.phtml" hash="99419617856e6c5ea93c3cf88ae4d490"/><file name="review.phtml" hash="2908826635a38b1dfd5640a1c6feba54"/><file name="shipping.phtml" hash="abd612bee8e11baf89c8468f76b00615"/></dir><dir name="page"><file name="blank.phtml" hash="509893c584213ad7d78e17a1a53249d1"/></dir><dir name="payment"><file name="confirmation.phtml" hash="d73bb16ae4b6d2b1d333079e84aa9b55"/><file name="express.phtml" hash="6d2757865efe818d2ab213992ffe40f3"/><file name="standard.phtml" hash="0da3b1e0080df8f31d808061939b430e"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Payson_Checkout2.xml" hash="dcbe0d3d1f1cad514c719d0a79f213e0"/></dir></target><target name="magelocale"><dir name="sv_SE"><file name="payson_checkout2.csv" hash="4555f2b2f86dffe56ccbe8e7ad373866"/></dir></target><target name="magelib"><dir name="Payson"><dir name="Checkout2"><dir name="PaysonCheckout2PHP"><file name="README.md" hash="bb8c8d92c7e18353d4d9d5a496a566da"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><dir name="example"><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="config.php" hash="45966251b3cef234834cc1d2dc966e90"/><file name="confirmation.php" hash="7a50c9e9772ccc123c6d84cc8e2fe7f3"/><file name="index.php" hash="1b3081faa0d1835641c7259db5cf3837"/><file name="notification.php" hash="d80a0d41e083fb43cce844c7d23b7338"/><file name="update_order.php" hash="ad2367147e72a88428808dfaab231366"/><file name="validate.php" hash="436f44544aa97ef039e28977ca1f6380"/></dir><dir name="lib"><file name="account.php" hash="22acb8e56a837dfaf200252d99bc023f"/><file name="cancel_order.php" hash="094352d0bff59f9fed593707b8596679"/><file name="confirmation.php" hash="e23740168f2941741ffeb308cfa6aaa9"/><file name="customer.php" hash="34f1f9d76b729938118e72721cacd8af"/><file name="gui.php" hash="e234c46d3a046fd0989ecd535c1d9eb1"/><file name="index.php" hash="eb59320117f2668f615a19ee892fcf09"/><file name="orderitem.php" hash="3081930512e0d0ae705b361a5a5c104b"/><file name="paydata.php" hash="718479d8f056d6393e89c3de85d7526e"/><file name="paysonapi.php" hash="44665885f35c04edf78405159d01a4ff"/><file name="paysonapierror.php" hash="e3712bd19b64c3fbb5b64015ce944563"/><file name="paysonapiexception.php" hash="ee5a2ddad8fc7870b5dc121386ac3ef0"/><file name="paysoncheckout.php" hash="31efedcb1d197b3e230fcea9a9deef93"/><file name="paysonmerchant.php" hash="126ad5956d6efebedf4c2d6b35de1dff"/><file name="update_order.php" hash="500f71b5fb1fb31660626e4e12d113c7"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="payson_checkout2"><file name="style.css" hash="f70e8d8d166a189383d5795620c162e3"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="."><file name="modman" hash="db5bef690345b40b09d58087ef9a3447"/></dir></target><target name="mageweb"><dir name="js"><dir name="payson"><dir name="checkout2"><file name="express.js" hash="47c95b1edf225fb3bc1c396bf0f4eb27"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>5.6.9</max></php></required></dependencies>
18
  </package>