Skip to content

Commit 2cf5d4a

Browse files
author
Ievgen Sentiabov
committed
MAGETWO-45180: [Refactoring] Accept Credit Card Payments using Braintree for StoreFront and Backend
- Updated card type validation for Braintree - Updated tips for config section
1 parent cbe9b55 commit 2cf5d4a

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

app/code/Magento/BraintreeTwo/Model/Adminhtml/Source/CcType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CcType extends \Magento\Payment\Model\Source\Cctype
2626
*/
2727
public function getAllowedTypes()
2828
{
29-
return ['VI', 'MC', 'AE', 'DI', 'JCB', 'MI', 'DN', 'CUP', 'OT'];
29+
return ['VI', 'MC', 'AE', 'DI', 'JCB', 'MI', 'DN', 'CUP'];
3030
}
3131

3232
/**

app/code/Magento/BraintreeTwo/Test/Unit/Block/FormTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class FormTest extends \PHPUnit_Framework_TestCase
2626
'JBC' => 'JBC',
2727
'CUP' => 'China Union Pay',
2828
'MI' => 'Maestro',
29-
'OT' => 'Other'
3029
];
3130

3231
public static $configCardTypes = [

app/code/Magento/BraintreeTwo/etc/adminhtml/system.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
6666
<field id="merchant_account_id" translate="label" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
6767
<label>Merchant Account ID</label>
68-
<comment>If you don't specify the merchant account to use to process a transaction, Braintree will process it using your default merchant account</comment>
68+
<comment>If you don't specify the merchant account to use to process a transaction, Braintree will process it using your default merchant account.</comment>
6969
<config_path>payment/braintreetwo/merchant_account_id</config_path>
7070
</field>
7171
<field id="debug" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="0">
@@ -76,7 +76,7 @@
7676
<field id="useccv" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0">
7777
<label>CVV Verification</label>
7878
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
79-
<comment>Be sure to Enable AVS and/or CVV in Your Braintree Account in Settings/Processing Section</comment>
79+
<comment>Be sure to Enable AVS and/or CVV in Your Braintree Account in Settings/Processing Section.</comment>
8080
<config_path>payment/braintreetwo/useccv</config_path>
8181
</field>
8282
<field id="cctypes" translate="label" type="multiselect" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="0">
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"cc_type","Credit Card Type"
22
"cc_number","Credit Card Number"
33
"avsPostalCodeResponseCode","AVS Postal Code Response Code"
4-
"avsStreetAddressResponseCode","Avs Street Address Response Code"
5-
"cvvResponseCode","Cvv Response Code"
4+
"avsStreetAddressResponseCode","AVS Street Address Response Code"
5+
"cvvResponseCode","CVV Response Code"
66
"processorAuthorizationCode","Processor Authorization Code"
77
"processorResponseCode","Processor Response Code"
88
"processorResponseText","Processor Response Text"

app/code/Magento/BraintreeTwo/view/frontend/web/js/view/payment/method-renderer/braintree.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ define(
129129
},
130130
expirationYear: {
131131
selector: self.getSelector('expirationYear'),
132-
placeholder: $t('YYYY')
132+
placeholder: $t('YY')
133133
},
134134

135135
/**
@@ -195,8 +195,13 @@ define(
195195
* @returns {Boolean}
196196
*/
197197
validateCardType: function () {
198+
var $selector = $(this.getSelector('cc_number')),
199+
invalidClass = 'braintree-hosted-fields-invalid';
200+
201+
$selector.removeClass(invalidClass);
202+
198203
if (this.selectedCardType() === null) {
199-
$(this.getSelector('cc_number')).attr('class', 'braintree-hosted-fields-invalid');
204+
$(this.getSelector('cc_number')).addClass('class', invalidClass);
200205

201206
return false;
202207
}

0 commit comments

Comments
 (0)