Version Notes
This extension has been in production for nine months with many websites. Many cross-platform (Windows vs. Linux) bugs were fixed during this process and the module has proved stable.
Download this release
Release Info
| Developer | Heartland Payment Systems |
| Extension | Hps_Securesubmit |
| Version | 1.0.1 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.0 to 1.0.1
- app/code/community/Hps/.DS_Store +0 -0
- app/code/community/Hps/Securesubmit/.DS_Store +0 -0
- app/code/community/Hps/Securesubmit/Block/Form.php +1 -1
- app/code/community/Hps/Securesubmit/Block/Info.php +1 -1
- app/code/community/Hps/Securesubmit/Model/Payment.php +3 -3
- app/code/community/Hps/Securesubmit/etc/config.xml +21 -0
- app/code/community/Hps/Securesubmit/etc/system.xml +8 -9
- app/design/adminhtml/default/default/template/securesubmit/form.phtml +30 -50
- app/design/frontend/base/default/layout/securesubmit.xml +5 -0
- app/design/frontend/base/default/template/securesubmit/form.phtml +135 -78
- package.xml +7 -7
app/code/community/Hps/.DS_Store
ADDED
|
Binary file
|
app/code/community/Hps/Securesubmit/.DS_Store
ADDED
|
Binary file
|
app/code/community/Hps/Securesubmit/Block/Form.php
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
{
|
| 4 |
protected function _construct()
|
| 5 |
{
|
| 1 |
<?php
|
| 2 |
+
class Hps_SecureSubmit_Block_Form extends Mage_Payment_Block_Form_Ccsave
|
| 3 |
{
|
| 4 |
protected function _construct()
|
| 5 |
{
|
app/code/community/Hps/Securesubmit/Block/Info.php
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
<?php
|
| 2 |
-
class
|
| 3 |
{
|
| 4 |
protected function _prepareSpecificInformation($transport = null)
|
| 5 |
{
|
| 1 |
<?php
|
| 2 |
+
class Hps_SecureSubmit_Block_Info extends Mage_Payment_Block_Info
|
| 3 |
{
|
| 4 |
protected function _prepareSpecificInformation($transport = null)
|
| 5 |
{
|
app/code/community/Hps/Securesubmit/Model/Payment.php
CHANGED
|
@@ -224,9 +224,9 @@ class Hps_Securesubmit_Model_Payment extends Mage_Payment_Model_Method_Cc
|
|
| 224 |
{
|
| 225 |
$transactionId = $payment->getCcTransId();
|
| 226 |
|
| 227 |
-
$config = new
|
| 228 |
-
$config->
|
| 229 |
-
$config->
|
| 230 |
$config->developerId = '002914';
|
| 231 |
|
| 232 |
$chargeService = new HpsChargeService($config);
|
| 224 |
{
|
| 225 |
$transactionId = $payment->getCcTransId();
|
| 226 |
|
| 227 |
+
$config = new HpsConfiguration();
|
| 228 |
+
$config->secretApiKey = $this->getConfigData('secretapikey');
|
| 229 |
+
$config->versionNumber = '1509';
|
| 230 |
$config->developerId = '002914';
|
| 231 |
|
| 232 |
$chargeService = new HpsChargeService($config);
|
app/code/community/Hps/Securesubmit/etc/config.xml
CHANGED
|
@@ -76,4 +76,25 @@
|
|
| 76 |
</hps_securesubmit>
|
| 77 |
</routers>
|
| 78 |
</frontend>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
</config>
|
| 76 |
</hps_securesubmit>
|
| 77 |
</routers>
|
| 78 |
</frontend>
|
| 79 |
+
<adminhtml>
|
| 80 |
+
<secure_url>
|
| 81 |
+
<securesubmit>/securesubmit/</securesubmit>
|
| 82 |
+
</secure_url>
|
| 83 |
+
<layout>
|
| 84 |
+
<updates>
|
| 85 |
+
<hps_securesubmit module="Hps_Securesubmit">
|
| 86 |
+
<file>securesubmit.xml</file>
|
| 87 |
+
</hps_securesubmit>
|
| 88 |
+
</updates>
|
| 89 |
+
</layout>
|
| 90 |
+
<routers>
|
| 91 |
+
<hps_securesubmit>
|
| 92 |
+
<use>standard</use>
|
| 93 |
+
<args>
|
| 94 |
+
<module>Hps_Securesubmit</module>
|
| 95 |
+
<frontName>securesubmit</frontName>
|
| 96 |
+
</args>
|
| 97 |
+
</hps_securesubmit>
|
| 98 |
+
</routers>
|
| 99 |
+
</adminhtml>
|
| 100 |
</config>
|
app/code/community/Hps/Securesubmit/etc/system.xml
CHANGED
|
@@ -38,24 +38,23 @@
|
|
| 38 |
<show_in_website>1</show_in_website>
|
| 39 |
<show_in_store>1</show_in_store>
|
| 40 |
</title>
|
| 41 |
-
<
|
| 42 |
-
<label>
|
| 43 |
-
<frontend_type>obscure</frontend_type>
|
| 44 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 45 |
-
<sort_order>
|
| 46 |
<show_in_default>1</show_in_default>
|
| 47 |
<show_in_website>1</show_in_website>
|
| 48 |
<show_in_store>1</show_in_store>
|
| 49 |
-
</
|
| 50 |
-
<
|
| 51 |
-
<label>
|
| 52 |
<frontend_type>obscure</frontend_type>
|
| 53 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 54 |
-
<sort_order>
|
| 55 |
<show_in_default>1</show_in_default>
|
| 56 |
<show_in_website>1</show_in_website>
|
| 57 |
<show_in_store>1</show_in_store>
|
| 58 |
-
</
|
| 59 |
<cctypes translate="label">
|
| 60 |
<label>Credit Card Types</label>
|
| 61 |
<frontend_type>multiselect</frontend_type>
|
| 38 |
<show_in_website>1</show_in_website>
|
| 39 |
<show_in_store>1</show_in_store>
|
| 40 |
</title>
|
| 41 |
+
<publicapikey translate="label">
|
| 42 |
+
<label>Public Api Key</label>
|
|
|
|
| 43 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 44 |
+
<sort_order>40</sort_order>
|
| 45 |
<show_in_default>1</show_in_default>
|
| 46 |
<show_in_website>1</show_in_website>
|
| 47 |
<show_in_store>1</show_in_store>
|
| 48 |
+
</publicapikey>
|
| 49 |
+
<secretapikey translate="label">
|
| 50 |
+
<label>Secret Api Key</label>
|
| 51 |
<frontend_type>obscure</frontend_type>
|
| 52 |
<backend_model>adminhtml/system_config_backend_encrypted</backend_model>
|
| 53 |
+
<sort_order>30</sort_order>
|
| 54 |
<show_in_default>1</show_in_default>
|
| 55 |
<show_in_website>1</show_in_website>
|
| 56 |
<show_in_store>1</show_in_store>
|
| 57 |
+
</secretapikey>
|
| 58 |
<cctypes translate="label">
|
| 59 |
<label>Credit Card Types</label>
|
| 60 |
<frontend_type>multiselect</frontend_type>
|
app/design/adminhtml/default/default/template/securesubmit/form.phtml
CHANGED
|
@@ -1,10 +1,27 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
| 4 |
<li>
|
|
|
|
| 5 |
<div class="input-box">
|
| 6 |
-
<
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
</div>
|
| 9 |
</li>
|
| 10 |
<li>
|
|
@@ -28,52 +45,15 @@
|
|
| 28 |
<li>
|
| 29 |
<div class="input-box">
|
| 30 |
<label for="<?php echo $_code ?>_cc_cid"><?php echo Mage::helper('payment')->__('Card Verification Number') ?> <span class="required">*</span></label><br/>
|
| 31 |
-
<input type="text" title="<?php echo Mage::helper('payment')->__('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid"
|
| 32 |
</div>
|
| 33 |
</li>
|
| 34 |
<?php endif; ?>
|
| 35 |
-
<?php if ($this->hasSsCardType()): ?>
|
| 36 |
-
<li id="<?php echo $_code ?>_cc_type_ss_div">
|
| 37 |
-
<ul class="inner-form">
|
| 38 |
-
<li class="form-alt"><label for="<?php echo $_code ?>_cc_issue" class="required"><em>*</em><?php echo $this->__('Switch/Solo/Maestro Only') ?></label></li>
|
| 39 |
-
<li>
|
| 40 |
-
<label for="<?php echo $_code ?>_cc_issue"><?php echo $this->__('Issue Number') ?>:</label>
|
| 41 |
-
<span class="input-box">
|
| 42 |
-
<input type="text" title="<?php echo $this->__('Issue Number') ?>" class="input-text validate-cc-ukss cvv" id="<?php echo $_code ?>_cc_issue" name="payment[cc_ss_issue]" value="" />
|
| 43 |
-
</span>
|
| 44 |
-
</li>
|
| 45 |
-
|
| 46 |
-
<li>
|
| 47 |
-
<label for="<?php echo $_code ?>_start_month"><?php echo $this->__('Start Date') ?>:</label>
|
| 48 |
-
<div class="input-box">
|
| 49 |
-
<select id="<?php echo $_code ?>_start_month" name="payment[cc_ss_start_month]" class="validate-cc-ukss month">
|
| 50 |
-
<?php foreach ($this->getCcMonths() as $k=>$v): ?>
|
| 51 |
-
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_month')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
| 52 |
-
<?php endforeach ?>
|
| 53 |
-
</select>
|
| 54 |
-
<select id="<?php echo $_code ?>_start_year" name="payment[cc_ss_start_year]" class="validate-cc-ukss year">
|
| 55 |
-
<?php foreach ($this->getSsStartYears() as $k=>$v): ?>
|
| 56 |
-
<option value="<?php echo $k?$k:'' ?>"<?php if($k==$this->getInfoData('cc_ss_start_year')): ?> selected="selected"<?php endif ?>><?php echo $v ?></option>
|
| 57 |
-
<?php endforeach ?>
|
| 58 |
-
</select>
|
| 59 |
-
</div>
|
| 60 |
-
</li>
|
| 61 |
-
<li class="adv-container"> </li>
|
| 62 |
-
</ul>
|
| 63 |
-
<script type="text/javascript">
|
| 64 |
-
//<![CDATA[
|
| 65 |
-
var SSChecked<?php echo $_code ?> = function() {
|
| 66 |
-
var elm = $('<?php echo $_code ?>_cc_type');
|
| 67 |
-
if (['SS','SM','SO'].indexOf(elm.value) != -1) {
|
| 68 |
-
$('<?php echo $_code ?>_cc_type_ss_div').show();
|
| 69 |
-
} else {
|
| 70 |
-
$('<?php echo $_code ?>_cc_type_ss_div').hide();
|
| 71 |
-
}
|
| 72 |
-
};
|
| 73 |
-
Event.observe($('<?php echo $_code ?>_cc_type'), 'change', SSChecked<?php echo $_code ?>);
|
| 74 |
-
SSChecked<?php echo $_code ?>();
|
| 75 |
-
//]]>
|
| 76 |
-
</script>
|
| 77 |
-
</li>
|
| 78 |
-
<?php endif; ?>
|
| 79 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$_code=$this->getMethodCode();
|
| 3 |
+
$public_key = Mage::getModel('hps_securesubmit/payment')->getConfigData('publicapikey');
|
| 4 |
+
?>
|
| 5 |
+
<input id="<?php echo $_code ?>_payment_method" type="hidden" name="payment[method]" value="<?php echo $_code ?>" />
|
| 6 |
+
<ul id="payment_form_<?php echo $_code ?>" class="form-list" style="display:none;">
|
| 7 |
<li>
|
| 8 |
+
<label for="<?php echo $_code ?>_cc_type" ><?php echo Mage::helper('payment')->__('Credit Card Type') ?><span class="required">*</span></label>
|
| 9 |
<div class="input-box">
|
| 10 |
+
<select id="<?php echo $_code ?>_cc_type" name="payment[cc_type]" class="required-entry validate-cc-type-select">
|
| 11 |
+
<option value=""><?php echo Mage::helper('payment')->__('--Please Select--')?></option>
|
| 12 |
+
<?php $_ccType = $this->getInfoData('cc_type') ?>
|
| 13 |
+
<?php foreach ($this->getCcAvailableTypes() as $_typeCode => $_typeName): ?>
|
| 14 |
+
<option value="<?php echo $_typeCode ?>"<?php if($_typeCode==$_ccType): ?> selected="selected"<?php endif ?>><?php echo $_typeName ?></option>
|
| 15 |
+
<?php endforeach ?>
|
| 16 |
+
</select>
|
| 17 |
+
</div>
|
| 18 |
+
</li>
|
| 19 |
+
<li>
|
| 20 |
+
<label for="<?php echo $_code ?>_cc_number"><?php echo Mage::helper('payment')->__('Credit Card Number') ?><span class="required">*</span></label>
|
| 21 |
+
<div class="input-box">
|
| 22 |
+
<input type="text" id="<?php echo $_code ?>_cc_number" data-encrypted-name="payment[cc_number]" title="<?php echo Mage::helper('payment')->__('Credit Card Number') ?>" class="input-text validate-cc-number validate-cc-type" value=""/>
|
| 23 |
+
<input type="hidden" id="<?php echo $_code ?>_token" name="payment[securesubmit_token]" value="">
|
| 24 |
+
<input type="hidden" id="<?php echo $_code ?>_cc_last_four" name="payment[cc_last_four]" value="">
|
| 25 |
</div>
|
| 26 |
</li>
|
| 27 |
<li>
|
| 45 |
<li>
|
| 46 |
<div class="input-box">
|
| 47 |
<label for="<?php echo $_code ?>_cc_cid"><?php echo Mage::helper('payment')->__('Card Verification Number') ?> <span class="required">*</span></label><br/>
|
| 48 |
+
<input type="text" title="<?php echo Mage::helper('payment')->__('Card Verification Number') ?>" class="required-entry input-text validate-cc-cvn" id="<?php echo $_code ?>_cc_cid" style="width:3em;" value=""/>
|
| 49 |
</div>
|
| 50 |
</li>
|
| 51 |
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
</ul>
|
| 53 |
+
|
| 54 |
+
<script type="text/javascript">
|
| 55 |
+
//<![CDATA[
|
| 56 |
+
order.secureSubmitPublicKey = '<?php echo $public_key ?>';
|
| 57 |
+
order.secureSubmitGetTokenDataUrl = '<?php echo Mage::getUrl('securesubmit/storedcard/getTokenData', array('_secure' => TRUE)) ?>';
|
| 58 |
+
//]]>
|
| 59 |
+
</script>
|
app/design/frontend/base/default/layout/securesubmit.xml
CHANGED
|
@@ -11,6 +11,11 @@
|
|
| 11 |
<action method="addJs"><file>securesubmit/secure.submit-1.0.1.js</file></action>
|
| 12 |
</reference>
|
| 13 |
</checkout_onepage_index>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
<customer_account>
|
| 15 |
<reference name="customer_account_navigation">
|
| 16 |
<action method="addLink" >
|
| 11 |
<action method="addJs"><file>securesubmit/secure.submit-1.0.1.js</file></action>
|
| 12 |
</reference>
|
| 13 |
</checkout_onepage_index>
|
| 14 |
+
<onepagecheckout_index_index>
|
| 15 |
+
<reference name="head">
|
| 16 |
+
<action method="addJs"><file>securesubmit/secure.submit-1.0.1.js</file></action>
|
| 17 |
+
</reference>
|
| 18 |
+
</onepagecheckout_index_index>
|
| 19 |
<customer_account>
|
| 20 |
<reference name="customer_account_navigation">
|
| 21 |
<action method="addLink" >
|
app/design/frontend/base/default/template/securesubmit/form.phtml
CHANGED
|
@@ -82,97 +82,154 @@ if ($_loggedIn && $allow_card_saving) {
|
|
| 82 |
});
|
| 83 |
<?php endif ?>
|
| 84 |
|
| 85 |
-
Payment.prototype._secureSubmitOldSave = Payment.prototype.save;
|
| 86 |
-
Object.extend(Payment.prototype, {
|
| 87 |
-
save: function() {
|
| 88 |
-
if (this.currentMethod != 'hps_securesubmit') {
|
| 89 |
-
this._secureSubmitOldSave();
|
| 90 |
-
return;
|
| 91 |
-
}
|
| 92 |
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
}
|
| 108 |
-
this.secureSubmitResponseHandler({
|
| 109 |
-
token_value: data.token.token_value,
|
| 110 |
-
token_type: null, // 'supt'?
|
| 111 |
-
token_expire: new Date().toISOString(),
|
| 112 |
-
card: {
|
| 113 |
-
number: data.token.cc_last4
|
| 114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
});
|
| 116 |
-
}.bind(this),
|
| 117 |
-
onFailure: function() {
|
| 118 |
-
alert('Unknown error. Please try again.');
|
| 119 |
-
checkout.setLoadWaiting(false);
|
| 120 |
}
|
| 121 |
-
}
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
});
|
|
|
|
|
|
|
| 140 |
}
|
| 141 |
}
|
| 142 |
-
}
|
| 143 |
-
secureSubmitUseStoredCard: function () {
|
| 144 |
-
var storedCheckbox = $('hps_securesubmit_stored_card_checkbox');
|
| 145 |
-
return storedCheckbox && storedCheckbox.checked;
|
| 146 |
-
},
|
| 147 |
-
secureSubmitResponseHandler: function (response) {
|
| 148 |
-
var tokenField = $('hps_securesubmit_token'),
|
| 149 |
-
lastFourField = $('hps_securesubmit_cc_last_four');
|
| 150 |
-
tokenField.value = lastFourField.value = null;
|
| 151 |
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
}
|
| 156 |
-
checkout.setLoadWaiting(false);
|
| 157 |
-
} else if (response && response.token_value) {
|
| 158 |
-
tokenField.value = response.token_value;
|
| 159 |
-
lastFourField.value = response.card.number.substr(-4);
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
});
|
| 169 |
-
}
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
}
|
| 172 |
-
}
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
-
payment.secureSubmitPublicKey = '<?php echo $public_key ?>';
|
| 176 |
-
payment.secureSubmitGetTokenDataUrl = '<?php echo Mage::getUrl('securesubmit/storedcard/getTokenData', array('_secure' => TRUE)) ?>';
|
| 177 |
//]]>
|
| 178 |
</script>
|
| 82 |
});
|
| 83 |
<?php endif ?>
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
if (typeof Payment != "undefined") {
|
| 87 |
+
Payment.prototype._secureSubmitOldSave = Payment.prototype.save;
|
| 88 |
+
Object.extend(Payment.prototype, {
|
| 89 |
+
save: function() {
|
| 90 |
+
if (this.currentMethod != 'hps_securesubmit') {
|
| 91 |
+
this._secureSubmitOldSave();
|
| 92 |
+
return;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
if (checkout.loadWaiting != false) return;
|
| 96 |
|
| 97 |
+
// Use stored card checked, get existing token data
|
| 98 |
+
if (this.secureSubmitUseStoredCard()) {
|
| 99 |
+
var storedcardId = $('hps_securesubmit_stored_card_select').value;
|
| 100 |
+
checkout.setLoadWaiting('payment');
|
| 101 |
+
new Ajax.Request(this.secureSubmitGetTokenDataUrl, {
|
| 102 |
+
method: 'post',
|
| 103 |
+
parameters: {storedcard_id: storedcardId},
|
| 104 |
+
onSuccess: function(response) {
|
| 105 |
+
var data = response.responseJSON;
|
| 106 |
+
if (data && data.token) {
|
| 107 |
+
$('hps_securesubmit_expiration').value = parseInt(data.token.cc_exp_month);
|
| 108 |
+
$('hps_securesubmit_expiration_yr').value = data.token.cc_exp_year;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
}
|
| 110 |
+
this.secureSubmitResponseHandler({
|
| 111 |
+
token_value: data.token.token_value,
|
| 112 |
+
token_type: null, // 'supt'?
|
| 113 |
+
token_expire: new Date().toISOString(),
|
| 114 |
+
card: {
|
| 115 |
+
number: data.token.cc_last4
|
| 116 |
+
}
|
| 117 |
+
});
|
| 118 |
+
}.bind(this),
|
| 119 |
+
onFailure: function() {
|
| 120 |
+
alert('Unknown error. Please try again.');
|
| 121 |
+
checkout.setLoadWaiting(false);
|
| 122 |
+
}
|
| 123 |
+
});
|
| 124 |
+
}
|
| 125 |
+
// Use stored card not checked, get new token
|
| 126 |
+
else {
|
| 127 |
+
var validator = new Validation(this.form);
|
| 128 |
+
if (this.validate() && validator.validate()) {
|
| 129 |
+
checkout.setLoadWaiting('payment');
|
| 130 |
+
|
| 131 |
+
hps.tokenize({
|
| 132 |
+
data: {
|
| 133 |
+
public_key: this.secureSubmitPublicKey,
|
| 134 |
+
number: $('hps_securesubmit_cc_number').value,
|
| 135 |
+
cvc: $('hps_securesubmit_cc_cid').value,
|
| 136 |
+
exp_month: $('hps_securesubmit_expiration').value,
|
| 137 |
+
exp_year: $('hps_securesubmit_expiration_yr').value
|
| 138 |
+
},
|
| 139 |
+
success: this.secureSubmitResponseHandler.bind(this),
|
| 140 |
+
error: this.secureSubmitResponseHandler.bind(this)
|
| 141 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
+
}
|
| 144 |
+
},
|
| 145 |
+
secureSubmitUseStoredCard: function () {
|
| 146 |
+
var storedCheckbox = $('hps_securesubmit_stored_card_checkbox');
|
| 147 |
+
return storedCheckbox && storedCheckbox.checked;
|
| 148 |
+
},
|
| 149 |
+
secureSubmitResponseHandler: function (response) {
|
| 150 |
+
var tokenField = $('hps_securesubmit_token'),
|
| 151 |
+
lastFourField = $('hps_securesubmit_cc_last_four');
|
| 152 |
+
tokenField.value = lastFourField.value = null;
|
| 153 |
|
| 154 |
+
if (response && response.error) {
|
| 155 |
+
if (response.message) {
|
| 156 |
+
alert(response.message);
|
| 157 |
+
}
|
| 158 |
+
checkout.setLoadWaiting(false);
|
| 159 |
+
} else if (response && response.token_value) {
|
| 160 |
+
tokenField.value = response.token_value;
|
| 161 |
+
lastFourField.value = response.card.number.substr(-4);
|
| 162 |
+
|
| 163 |
+
// Continue Magento checkout steps
|
| 164 |
+
new Ajax.Request(this.saveUrl, {
|
| 165 |
+
method:'post',
|
| 166 |
+
onComplete: this.onComplete,
|
| 167 |
+
onSuccess: this.onSave,
|
| 168 |
+
onFailure: checkout.ajaxFailure.bind(checkout),
|
| 169 |
+
parameters: Form.serialize(this.form)
|
| 170 |
});
|
| 171 |
+
} else {
|
| 172 |
+
alert('Unexpected error.')
|
| 173 |
}
|
| 174 |
}
|
| 175 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
+
payment.secureSubmitPublicKey = '<?php echo $public_key ?>';
|
| 178 |
+
payment.secureSubmitGetTokenDataUrl = '<?php echo Mage::getUrl('securesubmit/storedcard/getTokenData', array('_secure' => TRUE)) ?>';
|
| 179 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
+
if (typeof OPC != "undefined") {
|
| 182 |
+
OPC.prototype.__secureSubmitOldSubmit = OPC.prototype.submit;
|
| 183 |
+
Object.extend(OPC.prototype, {
|
| 184 |
+
save: function() {
|
| 185 |
+
if (this.sectionsToValidate[0].currentMethod != 'hps_securesubmit') {
|
| 186 |
+
this._secureSubmitOldSubmit();
|
| 187 |
+
return;
|
| 188 |
+
}
|
| 189 |
+
hps.tokenize({
|
| 190 |
+
data: {
|
| 191 |
+
public_key: this.secureSubmitPublicKey,
|
| 192 |
+
number: $('hps_securesubmit_cc_number').value,
|
| 193 |
+
cvc: $('hps_securesubmit_cc_cid').value,
|
| 194 |
+
exp_month: $('hps_securesubmit_expiration').value,
|
| 195 |
+
exp_year: $('hps_securesubmit_expiration_yr').value
|
| 196 |
+
},
|
| 197 |
+
success: this.secureSubmitResponseHandler.bind(this),
|
| 198 |
+
error: this.secureSubmitResponseHandler.bind(this)
|
| 199 |
});
|
| 200 |
+
},
|
| 201 |
+
secureSubmitResponseHandler: function (response) {
|
| 202 |
+
var tokenField = $('hps_securesubmit_token'),
|
| 203 |
+
lastFourField = $('hps_securesubmit_cc_last_four');
|
| 204 |
+
tokenField.value = lastFourField.value = null;
|
| 205 |
+
|
| 206 |
+
if (response && response.error) {
|
| 207 |
+
if (response.message) {
|
| 208 |
+
alert(response.message);
|
| 209 |
+
}
|
| 210 |
+
checkout.setLoadWaiting(false);
|
| 211 |
+
} else if (response && response.token_value) {
|
| 212 |
+
tokenField.value = response.token_value;
|
| 213 |
+
lastFourField.value = response.card.number.substr(-4);
|
| 214 |
+
|
| 215 |
+
this.setLoadWaiting(true);
|
| 216 |
+
var params = Form.serialize(this.form);
|
| 217 |
+
var request = new Ajax.Request(this.saveUrl, {
|
| 218 |
+
method: 'post',
|
| 219 |
+
parameters: params,
|
| 220 |
+
onSuccess: this.setResponse.bind(this),
|
| 221 |
+
onFailure: this.ajaxFailure.bind(this)
|
| 222 |
+
});;
|
| 223 |
+
} else {
|
| 224 |
+
alert('Unexpected error.')
|
| 225 |
+
}
|
| 226 |
}
|
| 227 |
+
});
|
| 228 |
+
|
| 229 |
+
OPC.prototype.secureSubmitPublicKey = '<?php echo $public_key ?>';
|
| 230 |
+
OPC.prototype.secureSubmitGetTokenDataUrl = '<?php echo Mage::getUrl('securesubmit/storedcard/getTokenData', array('_secure' => TRUE)) ?>';
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
|
|
|
|
|
|
|
| 234 |
//]]>
|
| 235 |
</script>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Hps_Securesubmit</name>
|
| 4 |
-
<version>1.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="https://github.com/SecureSubmit/magento-extension/blob/master/LICENSE">Custom</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -10,11 +10,11 @@
|
|
| 10 |
<description>Use Heartland Payment Systems SecureSubmit platform to charge, authorize, void, refund and partial refund credit cards.
|
| 11 |

|
| 12 |
Allow customers to store their cards for reduced friction at next checkout using our multi-use card tokenization process which helps reduce PCI scope.</description>
|
| 13 |
-
<notes>This extension has been in production for
|
| 14 |
-
<authors><author><name>Heartland Payment Systems</name><user>markhagan</user><email>
|
| 15 |
-
<date>2014-
|
| 16 |
-
<time>
|
| 17 |
-
<contents><target name="magecommunity"><dir name="Hps"><dir name="Securesubmit"><dir name="Block"><file name="Form.php" hash="
|
| 18 |
<compatible/>
|
| 19 |
-
<dependencies><required><php><min>5.2.0</min><max>5.5.
|
| 20 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Hps_Securesubmit</name>
|
| 4 |
+
<version>1.0.1</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="https://github.com/SecureSubmit/magento-extension/blob/master/LICENSE">Custom</license>
|
| 7 |
<channel>community</channel>
|
| 10 |
<description>Use Heartland Payment Systems SecureSubmit platform to charge, authorize, void, refund and partial refund credit cards.
|
| 11 |

|
| 12 |
Allow customers to store their cards for reduced friction at next checkout using our multi-use card tokenization process which helps reduce PCI scope.</description>
|
| 13 |
+
<notes>This extension has been in production for nine months with many websites. Many cross-platform (Windows vs. Linux) bugs were fixed during this process and the module has proved stable.</notes>
|
| 14 |
+
<authors><author><name>Heartland Payment Systems</name><user>markhagan</user><email>EntApp_DevPortal@e-hps.com</email></author></authors>
|
| 15 |
+
<date>2014-08-18</date>
|
| 16 |
+
<time>20:44:24</time>
|
| 17 |
+
<contents><target name="magecommunity"><dir name="Hps"><dir name="Securesubmit"><dir name="Block"><file name="Form.php" hash="a2e7bd1c2457cc7f12cb114b6957fefb"/><file name="Info.php" hash="3fa6b51d26f335e5ca52ee58a4399a3c"/></dir><dir name="Helper"><file name="Data.php" hash="04aeff6f94f56a49cf7527518c6212a1"/></dir><dir name="Model"><file name="Payment.php" hash="52fcb8cc048a1f5e0cc0b13597856a8d"/><dir name="Resource"><file name="Setup.php" hash="f568cb09a6a06fc3d52f145684997416"/><dir name="Storedcard"><file name="Collection.php" hash="021134d46837197e800f54a4b90b0048"/></dir><file name="Storedcard.php" hash="f2a993c8e4236bc03b1273a33a03b5d0"/></dir><dir name="Source"><file name="Cctype.php" hash="b5f75e4a3284f79b2cfab926b193c98b"/><file name="PaymentAction.php" hash="9fc55ebaaeaccba6c40597d25a1cf9d3"/></dir><file name="Storedcard.php" hash="82c7228d2182a0cba979dc4c66a2321c"/><dir name="System"><dir name="Config"><dir name="Backend"><file name="Proxy.php" hash="97028069630bddf2b94cb1b5b0886076"/></dir></dir></dir></dir><dir name="controllers"><file name="StoredcardController.php" hash="cb9e5f7de4f52fd7a764a87f0f4699a8"/></dir><dir name="etc"><file name="config.xml" hash="b3fde0de1a10e823ce680317738fd802"/><file name="system.xml" hash="605ff47915b4a553ed9a568491f5092c"/></dir><dir name="sql"><dir name="hps_securesubmit_setup"><file name="install-1.0.0.php" hash="57917d8b3b29830eb1a219466df4555b"/></dir></dir><file name=".DS_Store" hash="4a6d92e7f95a9f9208c420e97eb1d4ea"/></dir><file name=".DS_Store" hash="27b61043921b573597966793ca039c14"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="securesubmit"><file name="form.phtml" hash="b6329408b11e9e979494a923e639f6cf"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="securesubmit.xml" hash="8aca5736bbba6ec8341cf9510c0ea5ab"/></dir><dir name="template"><dir name="securesubmit"><file name="form.phtml" hash="8c37b338a61b290fd23e80772bd8bf36"/><file name="storedcards.phtml" hash="3412f0560d4ba696dc9bc3ed996e0577"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Hps_Securesubmit.xml" hash="d5aed3f48a45f8e611b68d1e6f34c959"/></dir></target><target name="mage"><dir name="js"><dir name="securesubmit"><file name="secure.submit-1.0.1.js" hash="a149dc8efcfa3b507d6b2b3c784d9db3"/></dir></dir></target><target name="magelib"><dir name="SecureSubmit"><file name="Hps.php" hash="8855d261c2df0de3fe7ad8e6e59668ad"/><dir name="entities"><file name="HpsAccountVerify.php" hash="a910342548320ba07ebc4c9cda2f7c96"/><file name="HpsAddress.php" hash="2e4554c509e1de8e8cb6b0d1f599d657"/><file name="HpsAuthorization.php" hash="c46f0ad9033d3197e641c1b63bd90c7e"/><file name="HpsBatch.php" hash="46ee0321f3c9f3824fdb930736c8df7e"/><file name="HpsCardHolder.php" hash="f74938b2f53d703c777def01adde5e91"/><file name="HpsCharge.php" hash="5e94b3094db8e4f231a456cedce40985"/><file name="HpsChargeExceptions.php" hash="927b346fdac882cf97fd46b5e740e363"/><file name="HpsCreditCard.php" hash="9394bb9cd123d572d2f3376f3ce52594"/><file name="HpsItemChoiceTypePosResponseVer10Transaction.php" hash="3516bf8acb77af8d4a36d02ed991d09e"/><file name="HpsRefund.php" hash="05a8dae7c7e0faf1e67ae628eca75ea2"/><file name="HpsReportTransactionDetails.php" hash="ad0221581bf4ee24410c1ed4aac4d305"/><file name="HpsReportTransactionSummary.php" hash="1d46cce9a3274f25c092171e034479bc"/><file name="HpsReversal.php" hash="1ffd02ea88816b9a7ef5579d6219d6b8"/><file name="HpsTokenData.php" hash="bfc42e3ed9ff078598d694565d7fd3be"/><file name="HpsTransaction.php" hash="fd2bb80e28f9143bb25a3df1508fb927"/><file name="HpsTransactionDetails.php" hash="ded777de86d2b93882b2779283247b64"/><file name="HpsTransactionHeader.php" hash="114de2d7b3648143d0ef16588dfbc1af"/><file name="HpsTransactionType.php" hash="58a73f5915ff2d3f9d89935232e90796"/><file name="HpsVoid.php" hash="09902616437fd001ec17cde2b6dd9780"/></dir><dir name="infrastructure"><file name="AVSResponseCodeHandler.php" hash="b376458f6bbf14907fd96b6b17566861"/><file name="ApiConnectionException.php" hash="8b6e2d5e4d7e3368adb34e1ab20412b0"/><file name="AuthenticationException.php" hash="4685a4fa0209ed56ef0ee38868f52840"/><file name="CardException.php" hash="09bf8965e0e101dcaf560c0927812306"/><file name="Exceptions.json" hash="8f7cbcb2b18963603ee3a62d6888c36d"/><file name="HpsConfiguration.php" hash="48ed3ba9eed035d5e57d245f5174b5bc"/><file name="HpsException.php" hash="89899dd8d9351d5fd4d198c0560864d4"/><file name="HpsExceptionMapper.php" hash="5f81eacdaea3ccb756a89b04ec4c20d6"/><file name="HpsSdkCodes.php" hash="b827c7268a5743a5fd45e992eeab2450"/><file name="InvalidRequestException.php" hash="a01ca17d036ce2e6410647aa1bd25491"/></dir><dir name="services"><file name="HpsBatchService.php" hash="8e46d58de558258c8af585c0a646b9ea"/><file name="HpsChargeService.php" hash="e1474cade11a45ccf450e182094e0e35"/><file name="HpsService.php" hash="52aefe6d72b1e4118fdd8ec04b75e28c"/><file name="HpsTokenService.php" hash="bfdee5e18ebdc2133f3512040e0da766"/></dir></dir></target></contents>
|
| 18 |
<compatible/>
|
| 19 |
+
<dependencies><required><php><min>5.2.0</min><max>5.5.15</max></php></required></dependencies>
|
| 20 |
</package>
|
