Payair_gate - Version 4.0.0.31

Version Notes

delivery method issue resolved

Download this release

Release Info

Developer Christian Sanchez
Extension Payair_gate
Version 4.0.0.31
Comparing to
See all releases


Code changes from version 4.0.0.27 to 4.0.0.31

app/code/community/Payair/Gate/Block/Paymentjs.php CHANGED
@@ -11,7 +11,8 @@ class Payair_Gate_Block_Paymentjs extends Mage_Core_Block_Template
11
  */
12
 
13
  protected function _toHtml() {
14
- $js = '<script type="text/javascript" src="'.$this->getSkinUrl("js/payair/payaircheckout.js").'"></script>';
 
15
 
16
  return $js;
17
  }
11
  */
12
 
13
  protected function _toHtml() {
14
+ //$js = '<script type="text/javascript" src="'.$this->getSkinUrl("js/payair/payaircheckout.js").'"></script>';
15
+ $js = '';
16
 
17
  return $js;
18
  }
app/code/community/Payair/Gate/controllers/IndexController.php CHANGED
@@ -53,7 +53,7 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
53
  "attributes" => $this->getAttributes($product_obj)
54
  );
55
 
56
- $related_products_id_array = $product_obj->getRelatedProductIds(); // Get Related Products
57
  if ( count($related_products_id_array) > 0 ) {
58
  foreach ( $related_products_id_array as $related_product_id ) {
59
  $related_product = $this->loadProduct($related_product_id); // Load related Product by Product Id
@@ -72,7 +72,7 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
72
  "sortOrder" => "1"
73
  );
74
  }
75
- }
76
 
77
  $response_array = array(
78
  "statusCode" => "SUCCESS",
@@ -85,12 +85,6 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
85
  $this->sendResponse($response_json, 'item Action');
86
  }
87
 
88
- private function sendResponse($data, $controller_name) {
89
- Mage::log("\n send response from " . $controller_name . "\n" . print_r($data, true), null, $this->log_file);
90
- $this->getResponse()->setHeader('Content-type', 'application/json', true);
91
- echo $data;
92
- }
93
-
94
  /**
95
  * The function which take control over the web service request for Cart sync
96
  */
@@ -229,15 +223,13 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
229
  $address->implodeStreetAddress();
230
  $quoteObj->getShippingAddress()->setCollectShippingRates(true)->collectShippingRates();
231
  $available_shipping_methods = $quoteObj->getShippingAddress()->getShippingRatesCollection();
 
 
232
  if ( is_array( $this->getRequestCollection('chosenDeliveryMethod') ) && count ( $this->getRequestCollection('chosenDeliveryMethod') > 0 ) ) {
233
  $chosenDeliveryMethod = $this->getRequestCollection('chosenDeliveryMethod'); // get chosen delivery method data from payair request array
234
- } else {
235
- $chosenDeliveryMethod = '';
236
- $chosenDeliveryMethodName = '';
237
- }
238
-
239
  if ( is_array( $chosenDeliveryMethod ) && ( count( $chosenDeliveryMethod ) > 0 ) ) {
240
- $chosenDeliveryMethodId = $chosenDeliveryMethod['customIdentifier'];
241
  $chosenDeliveryMethodName = $chosenDeliveryMethod['name'];
242
 
243
  /*Load the Shipping Rate Model by its ID*/
@@ -319,7 +311,7 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
319
  $totalVat = $this->request->totalVat;
320
  $deliveryMethods = $this->getRequestCollection('chosenDeliveryMethod'); // get delivery methods for request array
321
 
322
- $method_id = $deliveryMethods['customIdentifier']; // get method id
323
 
324
  if ( empty( $method_id ) ) {
325
  // Get the very first shipping method ID
@@ -555,6 +547,11 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
555
 
556
  $receipt_msg_top = Mage::getStoreConfig('payment/gate/gate_order_info_top', $this->getStoreId());
557
  $receipt_msg_bottom = Mage::getStoreConfig('payment/gate/gate_order_info_bottom', $this->getStoreId());
 
 
 
 
 
558
 
559
  $response_array = array(
560
  "statusCode" => "SUCCESS",
@@ -563,8 +560,7 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
563
  "transactionStatusMessage" => $transactionStatusMessage,
564
  "payairExternalReference" => $payairExternalReference,
565
  "orderReference" => $orderReference,
566
- "receiptMsgTop" => $receipt_msg_top,
567
- "receiptMsgBottom" => $receipt_msg_bottom,
568
  "payairReference" => $payairReference,
569
  "cart" => $products,
570
  "chosenDeliveryMethods" => $deliveryMethods
@@ -666,6 +662,7 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
666
  return ($fp) ? $flocal->read($_fileToImportLocal) : '';
667
  }
668
 
 
669
  /**
670
  * handle JSON request from the payair server
671
  *
@@ -674,11 +671,24 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
674
  */
675
  private function getServiceRequest() {
676
  $json = file_get_contents('php://input');
677
- //$json = '{"reference":"14","user":{"firstName":"Deepak","lastName":"Kumar","email":"deepakk@chetu.com","address1":"Dragarbrunnsgatan","city":"Anchorage","zip":"99501","country":"US","phoneNr":"9990976911","state":"Alaska","locale":"en_GB"},"cart":[]}';
678
  $json = utf8_encode($json);
679
  Mage::log("\n Request JSON is : \n" . print_r($json, true), null, $this->log_file);
680
  return json_decode($json);
681
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
682
 
683
  /**
684
  * The function Return the first method ID
@@ -1482,12 +1492,12 @@ class Payair_Gate_IndexController extends Mage_Core_Controller_Front_Action {
1482
 
1483
  $deliveryMethodArray[] = array(
1484
  "name" => $method['carrier_title'], //$method['carrier']
1485
- "description" => $method['carrier_title'],
1486
  "amount" => $this->getFormattedPrice($method['price']),
1487
  "vatPercent" => 0,
1488
  "type" => "OTHER",
1489
  "vat" => 0,
1490
- "customIdentifier" => $method['rate_id'],
1491
  "chosen" => $chosen,
1492
  "sortOrder" => ( $sort_order > 0 ) ? $sort_order : 1
1493
  );
53
  "attributes" => $this->getAttributes($product_obj)
54
  );
55
 
56
+ /*$related_products_id_array = $product_obj->getRelatedProductIds(); // Get Related Products
57
  if ( count($related_products_id_array) > 0 ) {
58
  foreach ( $related_products_id_array as $related_product_id ) {
59
  $related_product = $this->loadProduct($related_product_id); // Load related Product by Product Id
72
  "sortOrder" => "1"
73
  );
74
  }
75
+ } */
76
 
77
  $response_array = array(
78
  "statusCode" => "SUCCESS",
85
  $this->sendResponse($response_json, 'item Action');
86
  }
87
 
 
 
 
 
 
 
88
  /**
89
  * The function which take control over the web service request for Cart sync
90
  */
223
  $address->implodeStreetAddress();
224
  $quoteObj->getShippingAddress()->setCollectShippingRates(true)->collectShippingRates();
225
  $available_shipping_methods = $quoteObj->getShippingAddress()->getShippingRatesCollection();
226
+ $chosenDeliveryMethod = '';
227
+ $chosenDeliveryMethodName = '';
228
  if ( is_array( $this->getRequestCollection('chosenDeliveryMethod') ) && count ( $this->getRequestCollection('chosenDeliveryMethod') > 0 ) ) {
229
  $chosenDeliveryMethod = $this->getRequestCollection('chosenDeliveryMethod'); // get chosen delivery method data from payair request array
230
+ }
 
 
 
 
231
  if ( is_array( $chosenDeliveryMethod ) && ( count( $chosenDeliveryMethod ) > 0 ) ) {
232
+ $chosenDeliveryMethodId = (int)$chosenDeliveryMethod['description'];
233
  $chosenDeliveryMethodName = $chosenDeliveryMethod['name'];
234
 
235
  /*Load the Shipping Rate Model by its ID*/
311
  $totalVat = $this->request->totalVat;
312
  $deliveryMethods = $this->getRequestCollection('chosenDeliveryMethod'); // get delivery methods for request array
313
 
314
+ $method_id = $deliveryMethods['description']; // get method id
315
 
316
  if ( empty( $method_id ) ) {
317
  // Get the very first shipping method ID
547
 
548
  $receipt_msg_top = Mage::getStoreConfig('payment/gate/gate_order_info_top', $this->getStoreId());
549
  $receipt_msg_bottom = Mage::getStoreConfig('payment/gate/gate_order_info_bottom', $this->getStoreId());
550
+ $receipt_data = array(
551
+ array("name" => "infoTop", "value" => $receipt_msg_top),
552
+ array("name" => "infoBottom", "value" => $receipt_msg_bottom)
553
+ );
554
+
555
 
556
  $response_array = array(
557
  "statusCode" => "SUCCESS",
560
  "transactionStatusMessage" => $transactionStatusMessage,
561
  "payairExternalReference" => $payairExternalReference,
562
  "orderReference" => $orderReference,
563
+ "customReceiptData" => $receipt_data,
 
564
  "payairReference" => $payairReference,
565
  "cart" => $products,
566
  "chosenDeliveryMethods" => $deliveryMethods
662
  return ($fp) ? $flocal->read($_fileToImportLocal) : '';
663
  }
664
 
665
+
666
  /**
667
  * handle JSON request from the payair server
668
  *
671
  */
672
  private function getServiceRequest() {
673
  $json = file_get_contents('php://input');
 
674
  $json = utf8_encode($json);
675
  Mage::log("\n Request JSON is : \n" . print_r($json, true), null, $this->log_file);
676
  return json_decode($json);
677
  }
678
+
679
+
680
+ /**
681
+ * send JSON request to the payair server
682
+ *
683
+ * @param string $data, $controller_name
684
+ * @return
685
+ */
686
+
687
+ private function sendResponse($data, $controller_name) {
688
+ Mage::log("\n send response from " . $controller_name . "\n" . print_r($data, true), null, $this->log_file);
689
+ $this->getResponse()->setHeader('Content-type', 'application/json', true);
690
+ echo $data;
691
+ }
692
 
693
  /**
694
  * The function Return the first method ID
1492
 
1493
  $deliveryMethodArray[] = array(
1494
  "name" => $method['carrier_title'], //$method['carrier']
1495
+ "description" => $method['rate_id'],
1496
  "amount" => $this->getFormattedPrice($method['price']),
1497
  "vatPercent" => 0,
1498
  "type" => "OTHER",
1499
  "vat" => 0,
1500
+ "customIdentifier" => $method['carrier'],
1501
  "chosen" => $chosen,
1502
  "sortOrder" => ( $sort_order > 0 ) ? $sort_order : 1
1503
  );
js/payair/category.js CHANGED
@@ -338,7 +338,7 @@ function drawPayairButton()
338
  }
339
  else
340
  {
341
- text = '<img onMouseOver="this.style.opacity = 0.75;" onmouseout="this.style.opacity = 1;" src="' + getPayairLocation() + 'img/payair_button.png" onClick="redirectByProduct(); return false;" style="cursor: pointer;">';
342
  }
343
  // Apply string to target:
344
  document.getElementById(target).innerHTML=text;
@@ -359,9 +359,9 @@ function getStoreFallback() {
359
  return fallbackUrl;
360
  }
361
 
362
- function redirectByProduct() {
363
 
364
- var varStatus = Payair_DATA.getVarStatus();
365
  var v_id;
366
 
367
  if (varStatus[0] === '0') {
338
  }
339
  else
340
  {
341
+ text = '<img onMouseOver="this.style.opacity = 0.75;" onmouseout="this.style.opacity = 1;" src="' + getPayairLocation() + 'img/payair_button.png" onClick="redirectByProduct('+Payair_DATA.articleID+'); return false;" style="cursor: pointer;">';
342
  }
343
  // Apply string to target:
344
  document.getElementById(target).innerHTML=text;
359
  return fallbackUrl;
360
  }
361
 
362
+ function redirectByProduct(articleID) {
363
 
364
+ var varStatus = Payair_DATA.getVarStatus(articleID);
365
  var v_id;
366
 
367
  if (varStatus[0] === '0') {
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payair_gate</name>
4
- <version>4.0.0.27</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Payair payment gateway version 4</summary>
10
  <description>Simplified and secure shopping solution for your customers. Allows checkout in less than 10 seconds.</description>
11
- <notes>All issues fixed. Added product list Payair button functionality.</notes>
12
  <authors><author><name>Christian Sanchez</name><user>payair</user><email>christian.sanchez@payair.com</email></author></authors>
13
- <date>2013-10-01</date>
14
- <time>17:47:40</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Payair_Gate.xml" hash="ab09c7de9ca9ce3629379a8375ae7fc3"/><file name="Payair_Adminhtml.xml" hash="051013e3888ebf812048921073dae688"/></dir></target><target name="magecommunity"><dir name="Payair"><dir name="Gate"><dir name="Block"><file name="Paycheckout.php" hash="80d88175ae9a5e5070e9c18e40bb6249"/><file name="Paymentjs.php" hash="0b609f0c6f4eee18661d0bbb789c9d58"/><file name="Payproduct.php" hash="aa7ae8f31495bdc5a86c4a5103affd9f"/></dir><dir name="Helper"><file name="Data.php" hash="d57a44055ef38461cb28fe3879db9d4b"/></dir><dir name="Model"><file name="Checkout.php" hash="393cb22fb500e95d79ab254c0464b56f"/><file name="Display.php" hash="9f7c3918df8535f1256759271e50f86e"/><file name="Environment.php" hash="f131e5aa46136420acbaffcbef41a10b"/><file name="Observer.php" hash="65a788233ddee12440477d940d8ca927"/><dir name="Order"><dir name="Api"><file name="V2.php" hash="918fdca710f1e424093bc6e8f386bf3c"/></dir><file name="Api.php" hash="73bf707e89776d73fb7acba455bb157e"/></dir><file name="Payair.php" hash="99d39c96bbfdb533249f7746f882c057"/><file name="RestConnect_Model_Oauth_Client.php" hash="2b25cd997acb20d8b67cb2443357bb5c"/></dir><dir name="controllers"><file name="IndexController.php" hash="3c5bab8c0377069be5caf0d8aa492899"/></dir><dir name="etc"><file name="config.xml" hash="cf1b4df4baf2e1d7fec1fe995f8fa4d3"/><file name="system.xml" hash="5fda863ccaf4ccc70e92f00fbfc7bc2f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="gate"><file name="button.phtml" hash="fae99d344c5a3900c6bf52104b633e17"/><file name="checkout.phtml" hash="06b37288aafb0a4da7d735dc89c93804"/><file name="product.phtml" hash="cac4a0d9dbc33f80086042c8868e5918"/></dir></dir><dir name="layout"><file name="payair.xml" hash="6f4ee086cddac14e810cec8503a7fb3e"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="payair.css" hash="9faab5311b422d70708626ac641251ea"/></dir><dir name="js"><dir name="payair"><file name="payaircheckout.js" hash="d37d8ae1ddb2dee75ced96bc1db970c9"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="payair"><file name="android_video_thumb_small.png" hash="21253916e7b3141eaf6993e6962bc798"/><file name="express_checkout_banner_v3.png" hash="e5ea47cbd4545abd43e4fae504ebdea2"/><file name="express_checkout_bg_383.png" hash="72de32e7645b966296c321a421ccee84"/><file name="test.html" hash="bbc041d0154bebdd5413af6fe993a2ee"/></dir></target><target name="mageweb"><dir name="js"><dir name="payair"><file name="category.js" hash="8876366398c0efe0c4a9769e4d6c81cd"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Payair_gate</name>
4
+ <version>4.0.0.31</version>
5
  <stability>stable</stability>
6
  <license>GPL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Payair payment gateway version 4</summary>
10
  <description>Simplified and secure shopping solution for your customers. Allows checkout in less than 10 seconds.</description>
11
+ <notes>delivery method issue resolved</notes>
12
  <authors><author><name>Christian Sanchez</name><user>payair</user><email>christian.sanchez@payair.com</email></author></authors>
13
+ <date>2013-10-14</date>
14
+ <time>12:32:50</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Payair_Gate.xml" hash="ab09c7de9ca9ce3629379a8375ae7fc3"/><file name="Payair_Adminhtml.xml" hash="051013e3888ebf812048921073dae688"/></dir></target><target name="magecommunity"><dir name="Payair"><dir name="Gate"><dir name="Block"><file name="Paycheckout.php" hash="80d88175ae9a5e5070e9c18e40bb6249"/><file name="Paymentjs.php" hash="5159d42ec21867f00f6df5cb9164e3a9"/><file name="Payproduct.php" hash="aa7ae8f31495bdc5a86c4a5103affd9f"/></dir><dir name="Helper"><file name="Data.php" hash="d57a44055ef38461cb28fe3879db9d4b"/></dir><dir name="Model"><file name="Checkout.php" hash="393cb22fb500e95d79ab254c0464b56f"/><file name="Display.php" hash="9f7c3918df8535f1256759271e50f86e"/><file name="Environment.php" hash="f131e5aa46136420acbaffcbef41a10b"/><file name="Observer.php" hash="65a788233ddee12440477d940d8ca927"/><dir name="Order"><dir name="Api"><file name="V2.php" hash="918fdca710f1e424093bc6e8f386bf3c"/></dir><file name="Api.php" hash="73bf707e89776d73fb7acba455bb157e"/></dir><file name="Payair.php" hash="99d39c96bbfdb533249f7746f882c057"/><file name="RestConnect_Model_Oauth_Client.php" hash="2b25cd997acb20d8b67cb2443357bb5c"/></dir><dir name="controllers"><file name="IndexController.php" hash="c322cabcb99eca7ed2ef8c01a6ad5516"/></dir><dir name="etc"><file name="config.xml" hash="cf1b4df4baf2e1d7fec1fe995f8fa4d3"/><file name="system.xml" hash="5fda863ccaf4ccc70e92f00fbfc7bc2f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="gate"><file name="button.phtml" hash="fae99d344c5a3900c6bf52104b633e17"/><file name="checkout.phtml" hash="06b37288aafb0a4da7d735dc89c93804"/><file name="product.phtml" hash="cac4a0d9dbc33f80086042c8868e5918"/></dir></dir><dir name="layout"><file name="payair.xml" hash="6f4ee086cddac14e810cec8503a7fb3e"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><file name="payair.css" hash="9faab5311b422d70708626ac641251ea"/></dir><dir name="js"><dir name="payair"><file name="payaircheckout.js" hash="d37d8ae1ddb2dee75ced96bc1db970c9"/></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="payair"><file name="android_video_thumb_small.png" hash="21253916e7b3141eaf6993e6962bc798"/><file name="express_checkout_banner_v3.png" hash="e5ea47cbd4545abd43e4fae504ebdea2"/><file name="express_checkout_bg_383.png" hash="72de32e7645b966296c321a421ccee84"/><file name="test.html" hash="bbc041d0154bebdd5413af6fe993a2ee"/></dir></target><target name="mageweb"><dir name="js"><dir name="payair"><file name="category.js" hash="1a85e88186f9e917494c618630e955e7"/></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>