taply - Version 1.0.4

Version Notes

fix taply button

Download this release

Release Info

Developer taply
Extension taply
Version 1.0.4
Comparing to
See all releases


Code changes from version 1.0.2 to 1.0.4

app/code/local/Taply/Paybutton/Block/Button/Pay.php CHANGED
@@ -9,12 +9,10 @@ class Taply_Paybutton_Block_Button_Pay extends Mage_Core_Block_Template
9
  }
10
 
11
  protected function _toHtml(){
12
- $isExtensionEnabled = Mage::getStoreConfigFlag('payment/paybutton/active');
13
  if (isset($this->config['active']) && $this->config['active']) {
14
  return parent::_toHtml();
15
  }
16
  return '';
17
- $result = parent::_beforeToHtml();
18
  }
19
 
20
  public function getCartArray(){
@@ -26,13 +24,16 @@ class Taply_Paybutton_Block_Button_Pay extends Mage_Core_Block_Template
26
  $product = $item->getProduct();
27
  $arrItems[] = array(
28
  'item_prod_id' => $product->getId(),
29
- 'item_prod_attr' => unserialize($product->getCustomOption('attributes')->getValue()) ,//json_encode( $helper->getOptions($item) ),
30
  'item_name' => $product->getName(),
31
  'item_img' => (string)Mage::helper('catalog/image')->init($product, 'thumbnail'),
32
  'item_description' => Mage::getModel('catalog/product')->load($product->getId())->getShortDescription(),
33
  'item_qty' => $item->getQty(),
34
- 'item_price' => $product->getPrice(),
35
  );
 
 
 
 
36
  }
37
 
38
  return array('merchant' => $this->config['merchant_id'],'description' => $this->config['description'],'currency'=>'USD','items' => $arrItems);
9
  }
10
 
11
  protected function _toHtml(){
 
12
  if (isset($this->config['active']) && $this->config['active']) {
13
  return parent::_toHtml();
14
  }
15
  return '';
 
16
  }
17
 
18
  public function getCartArray(){
24
  $product = $item->getProduct();
25
  $arrItems[] = array(
26
  'item_prod_id' => $product->getId(),
 
27
  'item_name' => $product->getName(),
28
  'item_img' => (string)Mage::helper('catalog/image')->init($product, 'thumbnail'),
29
  'item_description' => Mage::getModel('catalog/product')->load($product->getId())->getShortDescription(),
30
  'item_qty' => $item->getQty(),
31
+ 'item_price' => $product->getFinalPrice(),
32
  );
33
+ $objAttr = $product->getCustomOption('attributes');
34
+ if($objAttr){
35
+ $arrItems['item_prod_attr'] = unserialize($objAttr->getValue());
36
+ }
37
  }
38
 
39
  return array('merchant' => $this->config['merchant_id'],'description' => $this->config['description'],'currency'=>'USD','items' => $arrItems);
app/code/local/Taply/Paybutton/controllers/GetshippingController.php CHANGED
@@ -29,11 +29,11 @@ class Taply_Paybutton_GetshippingController extends Mage_Core_Controller_Front_A
29
  if (is_string($result)) {
30
  // Error of adding product to card
31
  // @todo Log exception into DB and skip
32
- throw new Exception($result);
33
  }
34
  } else {
35
  // Error of load product by id
36
- throw new Exception("Cant load product");
37
  // @todo Log exception into DB and skip
38
  }
39
  }
29
  if (is_string($result)) {
30
  // Error of adding product to card
31
  // @todo Log exception into DB and skip
32
+ throw new Exception("{error: '$result'}");
33
  }
34
  } else {
35
  // Error of load product by id
36
+ throw new Exception("{error: 'Cant load product'}");
37
  // @todo Log exception into DB and skip
38
  }
39
  }
app/code/local/Taply/Paybutton/controllers/SuccessController.php CHANGED
@@ -1,36 +1,36 @@
1
  <?php
2
  class Taply_Paybutton_SuccessController extends Mage_Core_Controller_Front_Action{
3
- const TAPLY_API_URL = "https://api.paybytaply.com/payment/";
4
 
5
 
6
  protected $_methodType = 'taply';
7
 
8
  protected function _callApiMethod($strMethod, $arrParams = array()){
9
 
10
- $arrResponse = array();
11
- $process = curl_init(self::TAPLY_API_URL . $strMethod);
12
- curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
13
- curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
14
- curl_setopt($process, CURLOPT_SSL_VERIFYHOST, false);
15
- curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
16
- curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
17
- if (!empty($arrParams)){
18
- curl_setopt($process, CURLOPT_POST, 1);
19
- curl_setopt($process, CURLOPT_POSTFIELDS, http_build_query($arrParams));
20
- }
21
- $strResponseJson = curl_exec( $process );
22
- curl_close($process);
23
- if($strResponseJson){
24
- $arrResponse = json_decode( $strResponseJson, TRUE );
25
-
26
- }
27
- return $arrResponse;
28
- }
29
-
30
-
31
- public function indexAction()
32
- {
33
- $_params = $this->getRequest()->getParams();
34
  $config = Mage::getStoreConfig('payment/taply');
35
  $arrResponse = $this->_callApiMethod('get-payment-info', array('payment' => $_params['payment'], 'merchantid' => $config['merchant_id'] ));
36
 
@@ -40,10 +40,11 @@ class Taply_Paybutton_SuccessController extends Mage_Core_Controller_Front_Actio
40
  }
41
  $sOrderCartJson = $arrResponse['result']['cart'];
42
  $sOrderTransaction = $arrResponse['result']['transaction'];
43
- $arrOrderCart = json_decode($sOrderCartJson, TRUE);
44
- $arrOrderTransaction = json_decode( $sOrderTransaction, TRUE);
45
  if(isset($arrResponse['result']['order_id']) && $arrResponse['result']['order_id']){
46
  $order = Mage::getModel('sales/order')->load($arrResponse['result']['order_id']);
 
47
  if($order->getId()){
48
  echo json_encode( array('order_id' => $order->getId(), 'redirect_url' => Mage::getUrl() . '/taply/success/thanks/order/' . $order->getId()) );
49
  exit;
@@ -63,10 +64,12 @@ class Taply_Paybutton_SuccessController extends Mage_Core_Controller_Front_Actio
63
 
64
  $product = Mage::getModel('catalog/product')->load($item['item_prod_id']);
65
  $product->setPrice($item['item_price']);
66
- $product->addCustomOption('attributes', serialize($item['item_prod_attr']));
67
  $request = new Varien_Object();
68
  $request->setQty($item['item_qty']);
69
- $request->setSuperAttribute($item['item_prod_attr']);
 
 
 
70
  if ($product->getId()) {
71
  // Add product to card
72
  $result = $quote->addProduct($product, $request);
@@ -160,7 +163,7 @@ class Taply_Paybutton_SuccessController extends Mage_Core_Controller_Front_Actio
160
  } catch (Exception $e){
161
  $quote = $customer = $service = null;
162
  echo json_encode( array('error' => $e->getMessage()) );
163
- }
164
 
165
  }
166
 
@@ -171,4 +174,4 @@ class Taply_Paybutton_SuccessController extends Mage_Core_Controller_Front_Actio
171
  $this->_redirect('sales/order/view/', array('order_id' => $_params['order']));
172
 
173
  }
174
- }
1
  <?php
2
  class Taply_Paybutton_SuccessController extends Mage_Core_Controller_Front_Action{
3
+ const TAPLY_API_URL = "https://njs-api.paybytaply.com/payment/";
4
 
5
 
6
  protected $_methodType = 'taply';
7
 
8
  protected function _callApiMethod($strMethod, $arrParams = array()){
9
 
10
+ $arrResponse = array();
11
+ $process = curl_init(self::TAPLY_API_URL . $strMethod);
12
+ curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
13
+ curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
14
+ curl_setopt($process, CURLOPT_SSL_VERIFYHOST, false);
15
+ curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
16
+ curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
17
+ if (!empty($arrParams)){
18
+ curl_setopt($process, CURLOPT_POST, 1);
19
+ curl_setopt($process, CURLOPT_POSTFIELDS, http_build_query($arrParams));
20
+ }
21
+ $strResponseJson = curl_exec( $process );
22
+ curl_close($process);
23
+ if($strResponseJson){
24
+ $arrResponse = json_decode( $strResponseJson, TRUE );
25
+
26
+ }
27
+ return $arrResponse;
28
+ }
29
+
30
+
31
+ public function indexAction()
32
+ {
33
+ $_params = $this->getRequest()->getParams();
34
  $config = Mage::getStoreConfig('payment/taply');
35
  $arrResponse = $this->_callApiMethod('get-payment-info', array('payment' => $_params['payment'], 'merchantid' => $config['merchant_id'] ));
36
 
40
  }
41
  $sOrderCartJson = $arrResponse['result']['cart'];
42
  $sOrderTransaction = $arrResponse['result']['transaction'];
43
+ $arrOrderCart = is_string($sOrderCartJson)? json_decode($sOrderCartJson, TRUE) : $sOrderCartJson;
44
+ $arrOrderTransaction = is_string($sOrderTransaction)? json_decode( $sOrderTransaction, TRUE) : $sOrderTransaction;
45
  if(isset($arrResponse['result']['order_id']) && $arrResponse['result']['order_id']){
46
  $order = Mage::getModel('sales/order')->load($arrResponse['result']['order_id']);
47
+
48
  if($order->getId()){
49
  echo json_encode( array('order_id' => $order->getId(), 'redirect_url' => Mage::getUrl() . '/taply/success/thanks/order/' . $order->getId()) );
50
  exit;
64
 
65
  $product = Mage::getModel('catalog/product')->load($item['item_prod_id']);
66
  $product->setPrice($item['item_price']);
 
67
  $request = new Varien_Object();
68
  $request->setQty($item['item_qty']);
69
+ if($item['item_prod_attr']){
70
+ $product->addCustomOption('attributes', serialize($item['item_prod_attr']));
71
+ $request->setSuperAttribute($item['item_prod_attr']);
72
+ }
73
  if ($product->getId()) {
74
  // Add product to card
75
  $result = $quote->addProduct($product, $request);
163
  } catch (Exception $e){
164
  $quote = $customer = $service = null;
165
  echo json_encode( array('error' => $e->getMessage()) );
166
+ }
167
 
168
  }
169
 
174
  $this->_redirect('sales/order/view/', array('order_id' => $_params['order']));
175
 
176
  }
177
+ }
app/code/local/Taply/Paybutton/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Taply_Paybutton>
5
- <version>1.0.2</version>
6
  </Taply_Paybutton>
7
  </modules>
8
  <frontend>
2
  <config>
3
  <modules>
4
  <Taply_Paybutton>
5
+ <version>1.0.4</version>
6
  </Taply_Paybutton>
7
  </modules>
8
  <frontend>
app/etc/modules/Taply_Paybutton.xml CHANGED
@@ -4,7 +4,7 @@
4
  <Taply_Paybutton>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
- <version>1.0.2</version>
8
  </Taply_Paybutton>
9
  </modules>
10
  </config>
4
  <Taply_Paybutton>
5
  <active>true</active>
6
  <codePool>local</codePool>
7
+ <version>1.0.4</version>
8
  </Taply_Paybutton>
9
  </modules>
10
  </config>
js/taply/taply.1.1.js CHANGED
@@ -227,7 +227,7 @@
227
  }
228
  };
229
  w.Taply = {
230
- apiurl: "https://api.paybytaply.com/payment",
231
  btnClass: 'taply-block',
232
  modules: [],
233
  mask: '(___) ___-____',
@@ -442,4 +442,4 @@
442
  css.innerHTML = ".pay-module .taply-apply-pay {background: url( //www.paybytaply.com/static/img/asset/pay-by-taply-btn-dark-wide.png ) no-repeat;display: block;float: right;height: 53px;margin-bottom: 10px;font-size: 0;width: 248px;}@media only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) {.pay-module .taply-apply-pay { background-image: url( //www.paybytaply.com/static/img/asset/pay-by-taply-btn-dark-2x.png );background-size: 248px 62px;}}.pay-module a {color: #6a0fa5; text-decoration: none; } .pay-module a:hover {text-decoration: underline; }.pay-module p {color: #959595; font-size: 16px; clear: both;}.pay-module h4 {color: #595959; font-size: 16px; margin-bottom: 10px; }.taply-modal button { box-shadow: none; }";
443
  d.getElementsByTagName("head")[0].appendChild(css);
444
  w.addEventListener('load', w.Taply.init.bind(w), false);
445
- })(window,document);
227
  }
228
  };
229
  w.Taply = {
230
+ apiurl: "https://njs-api.paybytaply.com/payment",
231
  btnClass: 'taply-block',
232
  modules: [],
233
  mask: '(___) ___-____',
442
  css.innerHTML = ".pay-module .taply-apply-pay {background: url( //www.paybytaply.com/static/img/asset/pay-by-taply-btn-dark-wide.png ) no-repeat;display: block;float: right;height: 53px;margin-bottom: 10px;font-size: 0;width: 248px;}@media only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2) {.pay-module .taply-apply-pay { background-image: url( //www.paybytaply.com/static/img/asset/pay-by-taply-btn-dark-2x.png );background-size: 248px 62px;}}.pay-module a {color: #6a0fa5; text-decoration: none; } .pay-module a:hover {text-decoration: underline; }.pay-module p {color: #959595; font-size: 16px; clear: both;}.pay-module h4 {color: #595959; font-size: 16px; margin-bottom: 10px; }.taply-modal button { box-shadow: none; }";
443
  d.getElementsByTagName("head")[0].appendChild(css);
444
  w.addEventListener('load', w.Taply.init.bind(w), false);
445
+ })(window,document);
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>taply</name>
4
- <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
@@ -9,11 +9,11 @@
9
  <summary>Securely checkout using Apple Pay</summary>
10
  <description>Securely checkout using Apple Pay with only a tap of your finger and never enter your billing or shipping information again.&#xD;
11
  taply allows you to use Apple Pay for an incredibly fast, secure, and seamless online checkout. Go anywhere online that has the taply button, enter your mobile number, then use the taply app to complete the purchase using Touch ID.</description>
12
- <notes>Securely checkout using Apple Pay</notes>
13
  <authors><author><name>taply</name><user>taply</user><email>admin@paybytaply.com</email></author></authors>
14
- <date>2015-08-12</date>
15
- <time>08:25:38</time>
16
- <contents><target name="magelocal"><dir><dir name="Taply"><dir name="Paybutton"><dir name="Block"><dir name="Button"><file name="Pay.php" hash="96e03a2a96daeb5e217b7071bd67dd78"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8404ec959ddf4bf9fbee31fc2314d34"/></dir><dir name="Model"><file name="Payment.php" hash="4af32846253babe72e11551003a2662c"/><file name="Viewtype.php" hash="c39cf7f525e11ab1de3f10a939caf494"/></dir><dir name="controllers"><file name="GetshippingController.php" hash="692474af6dda396e61d7a09b58cf8e3a"/><file name="SuccessController.php" hash="f7fc1975164ebc6e89164b03898ebf94"/></dir><dir name="etc"><file name="config.xml" hash="088d52f5b81700cf7260b04ec72e4d27"/><file name="system.xml" hash="520313dbaf29da8a44325f1a2880d30a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Taply_Paybutton.xml" hash="d7671c3fa6a0558055229c42c4e930f1"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="taply.xml" hash="bc7a785448a0e2b2754e46fa786a5b3d"/></dir><dir name="template"><dir name="taply"><file name="button.phtml" hash="b6541c278d428eea006a782e11abe2e3"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="taply"><file name="taply.1.1.js" hash="ee5176b63f1ce1a1610ddf7827650c36"/></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.4.0</min><max>5.6.999</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>taply</name>
4
+ <version>1.0.4</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
  <channel>community</channel>
9
  <summary>Securely checkout using Apple Pay</summary>
10
  <description>Securely checkout using Apple Pay with only a tap of your finger and never enter your billing or shipping information again.&#xD;
11
  taply allows you to use Apple Pay for an incredibly fast, secure, and seamless online checkout. Go anywhere online that has the taply button, enter your mobile number, then use the taply app to complete the purchase using Touch ID.</description>
12
+ <notes>fix taply button</notes>
13
  <authors><author><name>taply</name><user>taply</user><email>admin@paybytaply.com</email></author></authors>
14
+ <date>2015-09-23</date>
15
+ <time>08:30:43</time>
16
+ <contents><target name="magelocal"><dir><dir name="Taply"><dir name="Paybutton"><dir name="Block"><dir name="Button"><file name="Pay.php" hash="667bb6ad961f4b4a4b861815f7399224"/></dir></dir><dir name="Helper"><file name="Data.php" hash="c8404ec959ddf4bf9fbee31fc2314d34"/></dir><dir name="Model"><file name="Payment.php" hash="4af32846253babe72e11551003a2662c"/><file name="Viewtype.php" hash="c39cf7f525e11ab1de3f10a939caf494"/></dir><dir name="controllers"><file name="GetshippingController.php" hash="eddc9190345dffefbfcfcd59035af51d"/><file name="SuccessController.php" hash="403d9213201003191a2bf2a98aa055d6"/></dir><dir name="etc"><file name="config.xml" hash="609a44c8d30d748b8840400e37666dba"/><file name="system.xml" hash="520313dbaf29da8a44325f1a2880d30a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Taply_Paybutton.xml" hash="2c4c33fa727a3fe1d863353583e1dfa0"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="taply.xml" hash="bc7a785448a0e2b2754e46fa786a5b3d"/></dir><dir name="template"><dir name="taply"><file name="button.phtml" hash="b6541c278d428eea006a782e11abe2e3"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="taply"><file name="taply.1.1.js" hash="167a2e41fd6a28d4e723cf94dd99be12"/></dir></dir></target></contents>
17
  <compatible/>
18
  <dependencies><required><php><min>5.4.0</min><max>5.6.999</max></php></required></dependencies>
19
  </package>