Cardpay_Payeezy - Version 1.0.2

Version Notes

Minor bug fixes

Download this release

Release Info

Developer Brian McGowan
Extension Cardpay_Payeezy
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

app/code/community/Cardpay/.DS_Store DELETED
Binary file
app/code/community/Cardpay/Payeezy/Helper/Data.php CHANGED
@@ -80,7 +80,11 @@ class Cardpay_Payeezy_Helper_Data extends Mage_Core_Helper_Abstract
80
  '7' => 'Cardholder name incorrect, billing address matches',
81
  '8' => 'Cardholder name, billing address, and postal code are all incorrect'
82
  );
83
- return $avsResponses[$code];
 
 
 
 
84
  }
85
 
86
  /**
@@ -100,6 +104,10 @@ class Cardpay_Payeezy_Helper_Data extends Mage_Core_Helper_Abstract
100
  'U' => 'Issuer is not certified and/or has not provided visa encryption keys',
101
  'I' => 'CVV2 code is invalid or empty'
102
  );
103
- return $cvvResponses[$code];
 
 
 
 
104
  }
105
  }
80
  '7' => 'Cardholder name incorrect, billing address matches',
81
  '8' => 'Cardholder name, billing address, and postal code are all incorrect'
82
  );
83
+ if (array_key_exists($code, $avsResponses)) {
84
+ return $avsResponses[$code];
85
+ } else {
86
+ return '';
87
+ }
88
  }
89
 
90
  /**
104
  'U' => 'Issuer is not certified and/or has not provided visa encryption keys',
105
  'I' => 'CVV2 code is invalid or empty'
106
  );
107
+ if (array_key_exists($code, $cvvResponses)) {
108
+ return $cvvResponses[$code];
109
+ } else {
110
+ return '';
111
+ }
112
  }
113
  }
app/code/community/Cardpay/Payeezy/Model/PaymentMethod.php CHANGED
@@ -69,7 +69,6 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
69
  public function authorize(Varien_Object $payment, $amount)
70
  {
71
  $post = Mage::app()->getRequest()->getPost();
72
- $saveCard = $post['payment']['save_card'];
73
  $payload = $this->getPayload($payment, $amount, "authorize");
74
  $headerArray = $this->hmacAuthorizationToken($payload);
75
  $response = json_decode($this->postTransaction($payload, $headerArray));
@@ -81,7 +80,7 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
81
  ->setParentTransactionId(null)
82
  ->setCcAvsStatus(Mage::helper('payeezy')->getAvsResponse($response->avs))
83
  ->setCcCidStatus(Mage::helper('payeezy')->getCvvResponse($response->cvv2));
84
- if ($saveCard) {
85
  $this->saveCard($payment, $response->token->token_data->value);
86
  }
87
  return $this;
@@ -144,7 +143,6 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
144
  public function purchase(Varien_Object $payment, $amount)
145
  {
146
  $post = Mage::app()->getRequest()->getPost();
147
- $saveCard = $post['payment']['save_card'];
148
  $payload = $this->getPayload($payment, $amount, "purchase");
149
  $headerArray = $this->hmacAuthorizationToken($payload);
150
  $response = json_decode($this->postTransaction($payload, $headerArray));
@@ -156,7 +154,7 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
156
  ->setParentTransactionId(null)
157
  ->setCcAvsStatus(Mage::helper('payeezy')->getAvsResponse($response->avs))
158
  ->setCcCidStatus(Mage::helper('payeezy')->getCvvResponse($response->cvv2));
159
- if ($saveCard) {
160
  $this->saveCard($payment, $response->token->token_data->value);
161
  }
162
  return $this;
@@ -326,9 +324,8 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
326
  public function getPayload(Varien_Object $payment, $amount, $transactionType)
327
  {
328
  $post = Mage::app()->getRequest()->getPost();
329
- $token = $post['payment']['token'];
330
- if ($token) {
331
- $card = $this->getSavedCard($token);
332
  $payment->setCcExpYear($card->getCcExpYear())
333
  ->setCcExpMonth($card->getCcExpMonth())
334
  ->setCcType($card->getCcType())
@@ -354,7 +351,7 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
354
  }
355
 
356
  if ($transactionType == "authorize" || $transactionType == "purchase") {
357
- if ($token) {
358
  $data = array(
359
  'merchant_ref' => $this->processInput($orderId),
360
  'transaction_type' => $this->processInput($transactionType),
@@ -371,11 +368,11 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
371
  )
372
  ),
373
  'billing_address' => array(
374
- 'street' => $this->processInput($billing->getStreet(1)),
375
- 'zip_postal_code' => $this->processInput($billing->getPostcode())
376
  ),
377
  'level2' => array(
378
- 'tax1_amount' => $this->processInput($order->getTaxAmount()),
379
  'customer_ref' => $this->processInput($orderId)
380
  )
381
  );
@@ -394,11 +391,11 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
394
  'cvv' => $this->processInput($payment->getCcCid())
395
  ),
396
  'billing_address' => array(
397
- 'street' => $this->processInput($billing->getStreet(1)),
398
- 'zip_postal_code' => $this->processInput($billing->getPostcode())
399
  ),
400
  'level2' => array(
401
- 'tax1_amount' => $this->processInput($order->getTaxAmount()),
402
  'customer_ref' => $this->processInput($orderId)
403
  )
404
  );
@@ -428,7 +425,7 @@ class Cardpay_Payeezy_Model_PaymentMethod extends Mage_Payment_Model_Method_Cc
428
  public function getTokenPayload($card)
429
  {
430
  $yr = substr($card->getCcExpYear(), -2);
431
- $expDate = sprintf('%02d%02d', $card->getCcExpMonth, $yr);
432
  $testMode = $this->getConfigData('test_mode');
433
  $data = '';
434
 
69
  public function authorize(Varien_Object $payment, $amount)
70
  {
71
  $post = Mage::app()->getRequest()->getPost();
 
72
  $payload = $this->getPayload($payment, $amount, "authorize");
73
  $headerArray = $this->hmacAuthorizationToken($payload);
74
  $response = json_decode($this->postTransaction($payload, $headerArray));
80
  ->setParentTransactionId(null)
81
  ->setCcAvsStatus(Mage::helper('payeezy')->getAvsResponse($response->avs))
82
  ->setCcCidStatus(Mage::helper('payeezy')->getCvvResponse($response->cvv2));
83
+ if (isset($post['payment']['save_card'])) {
84
  $this->saveCard($payment, $response->token->token_data->value);
85
  }
86
  return $this;
143
  public function purchase(Varien_Object $payment, $amount)
144
  {
145
  $post = Mage::app()->getRequest()->getPost();
 
146
  $payload = $this->getPayload($payment, $amount, "purchase");
147
  $headerArray = $this->hmacAuthorizationToken($payload);
148
  $response = json_decode($this->postTransaction($payload, $headerArray));
154
  ->setParentTransactionId(null)
155
  ->setCcAvsStatus(Mage::helper('payeezy')->getAvsResponse($response->avs))
156
  ->setCcCidStatus(Mage::helper('payeezy')->getCvvResponse($response->cvv2));
157
+ if (isset($post['payment']['save_card'])) {
158
  $this->saveCard($payment, $response->token->token_data->value);
159
  }
160
  return $this;
324
  public function getPayload(Varien_Object $payment, $amount, $transactionType)
325
  {
326
  $post = Mage::app()->getRequest()->getPost();
327
+ if (isset($post['payment']['token']) && !empty($post['payment']['token'])) {
328
+ $card = $this->getSavedCard($post['payment']['token']);
 
329
  $payment->setCcExpYear($card->getCcExpYear())
330
  ->setCcExpMonth($card->getCcExpMonth())
331
  ->setCcType($card->getCcType())
351
  }
352
 
353
  if ($transactionType == "authorize" || $transactionType == "purchase") {
354
+ if (isset($card)) {
355
  $data = array(
356
  'merchant_ref' => $this->processInput($orderId),
357
  'transaction_type' => $this->processInput($transactionType),
368
  )
369
  ),
370
  'billing_address' => array(
371
+ 'street' => $this->processInput(substr($billing->getStreet(1), 0, 30)),
372
+ 'zip_postal_code' => $this->processInput(substr($billing->getPostcode(), 0, 10))
373
  ),
374
  'level2' => array(
375
+ 'tax1_amount' => number_format($order->getTaxAmount(), '2', '.', ''),
376
  'customer_ref' => $this->processInput($orderId)
377
  )
378
  );
391
  'cvv' => $this->processInput($payment->getCcCid())
392
  ),
393
  'billing_address' => array(
394
+ 'street' => $this->processInput(substr($billing->getStreet(1), 0, 30)),
395
+ 'zip_postal_code' => $this->processInput(substr($billing->getPostcode(), 0, 10))
396
  ),
397
  'level2' => array(
398
+ 'tax1_amount' => number_format($order->getTaxAmount(), '2', '.', ''),
399
  'customer_ref' => $this->processInput($orderId)
400
  )
401
  );
425
  public function getTokenPayload($card)
426
  {
427
  $yr = substr($card->getCcExpYear(), -2);
428
+ $expDate = sprintf('%02d%02d', $card->getCcExpMonth(), $yr);
429
  $testMode = $this->getConfigData('test_mode');
430
  $data = '';
431
 
app/code/community/Cardpay/Payeezy/etc/config.xml CHANGED
@@ -20,7 +20,7 @@
20
  <congig>
21
  <modules>
22
  <Cardpay_Payeezy>
23
- <version>1.0.1</version>
24
  </Cardpay_Payeezy>
25
  </modules>
26
  <global>
20
  <congig>
21
  <modules>
22
  <Cardpay_Payeezy>
23
+ <version>1.0.2</version>
24
  </Cardpay_Payeezy>
25
  </modules>
26
  <global>
app/code/community/Cardpay/Payeezy/sql/payeezy_setup/{install-0.1.0.php → install-1.0.2.php} RENAMED
File without changes
app/design/frontend/base/default/template/payeezy/creditcard/edit.phtml CHANGED
@@ -27,12 +27,12 @@ if ($this->isEditMode()) {
27
  $currentCcExpMonth = $creditCard->getCcExpMonth();
28
  $currentCcExpYear = $creditCard->getCcExpYear();
29
  $isCcDefault = $creditCard->getIsDefault();
 
 
 
 
30
  }
31
  ?>
32
- <div class="tool-tip" id="payment-tool-tip" style="display:none;">
33
- <div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
34
- <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
35
- </div>
36
  <form action='<?php echo $this->getFormAction() ?>' method="post" id="cc-form-validate">
37
  <div class="fieldset">
38
  <?php echo $this->getBlockHtml('formkey')?>
@@ -81,7 +81,7 @@ if ($this->isEditMode()) {
81
  <label for="payeezy_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
82
  <div class="input-box">
83
  <div class="v-fix">
84
- <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" name="payment[cc_cid]" value="" />
85
  </div>
86
  <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
87
  </div>
@@ -104,9 +104,31 @@ if ($this->isEditMode()) {
104
  <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
105
  </div>
106
  </form>
107
-
 
 
 
108
  <script type="text/javascript">
109
  //< ![CDATA[
110
  var dataForm = new VarienForm('cc-form-validate', true);
111
  //]]>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  </script>
27
  $currentCcExpMonth = $creditCard->getCcExpMonth();
28
  $currentCcExpYear = $creditCard->getCcExpYear();
29
  $isCcDefault = $creditCard->getIsDefault();
30
+ } else {
31
+ $currentCcType = '';
32
+ $currentCcExpMonth = '';
33
+ $currentCcExpYear = '';
34
  }
35
  ?>
 
 
 
 
36
  <form action='<?php echo $this->getFormAction() ?>' method="post" id="cc-form-validate">
37
  <div class="fieldset">
38
  <?php echo $this->getBlockHtml('formkey')?>
81
  <label for="payeezy_cc_cid" class="required"><em>*</em><?php echo $this->__('Card Verification Number') ?></label>
82
  <div class="input-box">
83
  <div class="v-fix">
84
+ <input type="text" title="<?php echo $this->__('Card Verification Number') ?>" class="input-text cvv required-entry validate-cc-cvn" id="payeezy_cc_cid" name="payment[cc_cid]" value="" />
85
  </div>
86
  <a href="#" class="cvv-what-is-this"><?php echo $this->__('What is this?') ?></a>
87
  </div>
104
  <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
105
  </div>
106
  </form>
107
+ <div class="tool-tip" id="payment-tool-tip" style="display:none;">
108
+ <div class="btn-close"><a href="#" id="payment-tool-tip-close" title="<?php echo $this->__('Close') ?>"><?php echo $this->__('Close') ?></a></div>
109
+ <div class="tool-tip-content"><img src="<?php echo $this->getSkinUrl('images/cvv.gif') ?>" alt="<?php echo $this->__('Card Verification Number Visual Reference') ?>" title="<?php echo $this->__('Card Verification Number Visual Reference') ?>" /></div>
110
+ </div>
111
  <script type="text/javascript">
112
  //< ![CDATA[
113
  var dataForm = new VarienForm('cc-form-validate', true);
114
  //]]>
115
+ </script>
116
+ <script type="text/javascript">
117
+ function toggleToolTip(event){
118
+ if($('payment-tool-tip')){
119
+ $('payment-tool-tip').setStyle({
120
+ left: (Event.pointerX(event)-100)+'px',
121
+ top: (Event.pointerY(event)-200)+'px'
122
+ });
123
+ $('payment-tool-tip').toggle();
124
+ }
125
+ Event.stop(event);
126
+ }
127
+
128
+ $$('.cvv-what-is-this').each(function(element){
129
+ Event.observe(element, 'click', toggleToolTip);
130
+ });
131
+ if($('payment-tool-tip-close')){
132
+ Event.observe($('payment-tool-tip-close'), 'click', toggleToolTip);
133
+ }
134
  </script>
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardpay_Payeezy</name>
4
- <version>1.0.1</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>
8
  <extends/>
9
  <summary>First Data Payeezy payment extension with TransArmor.</summary>
10
  <description>The First Data Payeezy payment extension allows you to securely accept credit cards through your Magento store. In addition to processing one-time transactions, the extension also utilizes First Data TransArmor Tokenization to allow customers to securely store and manage credit card profiles for future use.</description>
11
- <notes>Initial stable release</notes>
12
  <authors><author><name>Brian McGowan</name><user>bmcgowan</user><email>bmcgowan@cardpaysolutions.com</email></author></authors>
13
- <date>2015-09-02</date>
14
- <time>22:43:26</time>
15
- <contents><target name="magecommunity"><dir name="Cardpay"><dir name="Payeezy"><dir name="Block"><file name="Creditcard.php" hash="a0d44b2d6901f147e7ba8ac1522a1f61"/><file name="Form.php" hash="35ecc9030ab25cdd83e8fb8662e1c4f1"/><file name="Info.php" hash="8c120874f2dcbea00ce1f3e11620c4e3"/></dir><dir name="Helper"><file name="Data.php" hash="b244a2c1646ae47d1ceced0473c8c144"/></dir><dir name="Model"><file name="Creditcard.php" hash="97ec6c6e017bb9895dd487aed85367a1"/><file name="PaymentMethod.php" hash="1889e699f7817d19925da482d65dea02"/><dir name="Resource"><dir name="Creditcard"><file name="Collection.php" hash="6003a43e766277d0ee7e788815473783"/></dir><file name="Creditcard.php" hash="13ed47dda59c30d23382eb4af76c2293"/></dir><dir name="Source"><file name="Cctype.php" hash="9c3e10285ec4d78d17e19e49d803518b"/><file name="PaymentAction.php" hash="1ddd3037b306f1ab9cffe8f93f0cb8e3"/></dir></dir><dir name="controllers"><file name="CreditcardController.php" hash="29b0520b713ecab57c3ad619e0ff6275"/></dir><dir name="etc"><file name="config.xml" hash="3d0694407525c0608afdf5cf59d53045"/><file name="system.xml" hash="cda46ee2b6f67d30683cf3b1a0a1b287"/></dir><dir name="sql"><dir name="payeezy_setup"><file name="install-0.1.0.php" hash="99c1f9408ce25663c185719b446b2adb"/></dir></dir></dir><file name=".DS_Store" hash="a5c46fc114cefdd5054ea2085bc3a3bd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payeezy"><file name="form.phtml" hash="ea092ad5359031ec57e3dfc22b007cda"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payeezy.xml" hash="2bea5df11e86b9c8c589d1e572eea4f0"/></dir><dir name="template"><dir name="payeezy"><dir name="creditcard"><file name="delete.phtml" hash="7f52b91b36608bcaff0422490363c7fd"/><file name="edit.phtml" hash="f8135f96f390a5f41e4ca1545a710010"/><file name="index.phtml" hash="27b13b140de5e8797ee955b1aeb670d6"/></dir><file name="form.phtml" hash="ec1b6c13c4e8752cabeb0ac784886da0"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardpay_Payeezy.xml" hash="7805ddefa49d4a140fc03668cde2c3c2"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Cardpay_Payeezy.csv" hash="1dad15e42befedbf24800f845bebb60c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.29</min><max>5.6.10</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardpay_Payeezy</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>
8
  <extends/>
9
  <summary>First Data Payeezy payment extension with TransArmor.</summary>
10
  <description>The First Data Payeezy payment extension allows you to securely accept credit cards through your Magento store. In addition to processing one-time transactions, the extension also utilizes First Data TransArmor Tokenization to allow customers to securely store and manage credit card profiles for future use.</description>
11
+ <notes>Minor bug fixes</notes>
12
  <authors><author><name>Brian McGowan</name><user>bmcgowan</user><email>bmcgowan@cardpaysolutions.com</email></author></authors>
13
+ <date>2015-09-22</date>
14
+ <time>18:32:45</time>
15
+ <contents><target name="magecommunity"><dir name="Cardpay"><dir name="Payeezy"><dir name="Block"><file name="Creditcard.php" hash="a0d44b2d6901f147e7ba8ac1522a1f61"/><file name="Form.php" hash="35ecc9030ab25cdd83e8fb8662e1c4f1"/><file name="Info.php" hash="8c120874f2dcbea00ce1f3e11620c4e3"/></dir><dir name="Helper"><file name="Data.php" hash="7082ca56f1a091e3c76852040e88a79a"/></dir><dir name="Model"><file name="Creditcard.php" hash="97ec6c6e017bb9895dd487aed85367a1"/><file name="PaymentMethod.php" hash="6cfdf1e1a84d540f0f496568361881f1"/><dir name="Resource"><dir name="Creditcard"><file name="Collection.php" hash="6003a43e766277d0ee7e788815473783"/></dir><file name="Creditcard.php" hash="13ed47dda59c30d23382eb4af76c2293"/></dir><dir name="Source"><file name="Cctype.php" hash="9c3e10285ec4d78d17e19e49d803518b"/><file name="PaymentAction.php" hash="1ddd3037b306f1ab9cffe8f93f0cb8e3"/></dir></dir><dir name="controllers"><file name="CreditcardController.php" hash="29b0520b713ecab57c3ad619e0ff6275"/></dir><dir name="etc"><file name="config.xml" hash="2b8aed749ce56125518cc1bb6bcca586"/><file name="system.xml" hash="cda46ee2b6f67d30683cf3b1a0a1b287"/></dir><dir name="sql"><dir name="payeezy_setup"><file name="install-1.0.2.php" hash="99c1f9408ce25663c185719b446b2adb"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="payeezy"><file name="form.phtml" hash="ea092ad5359031ec57e3dfc22b007cda"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="payeezy.xml" hash="2bea5df11e86b9c8c589d1e572eea4f0"/></dir><dir name="template"><dir name="payeezy"><dir name="creditcard"><file name="delete.phtml" hash="7f52b91b36608bcaff0422490363c7fd"/><file name="edit.phtml" hash="d17445164936a0635f16e4ef79b40cff"/><file name="index.phtml" hash="27b13b140de5e8797ee955b1aeb670d6"/></dir><file name="form.phtml" hash="ec1b6c13c4e8752cabeb0ac784886da0"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Cardpay_Payeezy.xml" hash="7805ddefa49d4a140fc03668cde2c3c2"/></dir></target><target name="magelocale"><dir name="en_US"><file name="Cardpay_Payeezy.csv" hash="1dad15e42befedbf24800f845bebb60c"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.3.29</min><max>5.6.10</max></php></required></dependencies>
18
  </package>