Skip to content

Commit

Permalink
Merge pull request #418 from magento-mpi/MPI-PR-bugfixes
Browse files Browse the repository at this point in the history
[MPI] Bugfixes
  • Loading branch information
kandy authored Sep 27, 2016
2 parents 8007ad1 + ca6bdeb commit 0a6c5b2
Show file tree
Hide file tree
Showing 33 changed files with 735 additions and 227 deletions.
15 changes: 7 additions & 8 deletions app/code/Magento/Braintree/Helper/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
namespace Magento\Braintree\Helper;

use Magento\Directory\Model\ResourceModel\Country\CollectionFactory;
use Magento\Braintree\Model\Adminhtml\System\Config\Country as CountryConfig;

/**
* Class Country
*/
class Country
{
/**
* @var \Magento\Directory\Model\ResourceModel\Country\CollectionFactory
* @var CollectionFactory
*/
private $collectionFactory;

/**
* @var \Magento\Braintree\Model\Adminhtml\System\Config\Country
* @var CountryConfig
*/
private $countryConfig;

Expand All @@ -28,13 +29,11 @@ class Country
private $countries;

/**
* @param \Magento\Directory\Model\ResourceModel\Country\CollectionFactory $factory
* @param \Magento\Braintree\Model\Adminhtml\System\Config\Country $countryConfig
* @param CollectionFactory $factory
* @param CountryConfig $countryConfig
*/
public function __construct(
\Magento\Directory\Model\ResourceModel\Country\CollectionFactory $factory,
\Magento\Braintree\Model\Adminhtml\System\Config\Country $countryConfig
) {
public function __construct(CollectionFactory $factory, CountryConfig $countryConfig)
{
$this->collectionFactory = $factory;
$this->countryConfig = $countryConfig;
}
Expand Down
19 changes: 18 additions & 1 deletion app/code/Magento/Braintree/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<argument name="code" xsi:type="const">Magento\Braintree\Model\Ui\PayPal\ConfigProvider::PAYPAL_CODE</argument>
<argument name="infoBlockType" xsi:type="string">BraintreePayPalInfo</argument>
<argument name="valueHandlerPool" xsi:type="object">BraintreePayPalValueHandlerPool</argument>
<argument name="validatorPool" xsi:type="object">BraintreePayPalValidatorPool</argument>
<argument name="commandPool" xsi:type="object">BraintreePayPalCommandPool</argument>
</arguments>
</virtualType>
Expand Down Expand Up @@ -474,7 +475,7 @@
</arguments>
</virtualType>

<!-- Value validators infrastructure -->
<!-- Braintree validators infrastructure -->
<virtualType name="BraintreeCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Magento\Braintree\Gateway\Config\Config</argument>
Expand All @@ -487,6 +488,22 @@
</argument>
</arguments>
</virtualType>
<!-- Braintree validators infrastructure -->

<!-- Braintree PayPal validators -->
<virtualType name="BraintreePayPalCountryValidator" type="Magento\Payment\Gateway\Validator\CountryValidator">
<arguments>
<argument name="config" xsi:type="object">Magento\Braintree\Gateway\Config\PayPal\Config</argument>
</arguments>
</virtualType>
<virtualType name="BraintreePayPalValidatorPool" type="Magento\Payment\Gateway\Validator\ValidatorPool">
<arguments>
<argument name="validators" xsi:type="array">
<item name="country" xsi:type="string">BraintreePayPalCountryValidator</item>
</argument>
</arguments>
</virtualType>
<!-- END Braintree PayPal validators -->

<type name="Magento\Braintree\Block\Info">
<arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@ define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/full-screen-loader',
'Magento_Checkout/js/model/payment/additional-validators',
'Magento_Vault/js/view/payment/vault-enabler'
], function ($, _, Component, Braintree, quote, fullScreenLoader, additionalValidators, VaultEnabler) {
'Magento_Vault/js/view/payment/vault-enabler',
'Magento_Checkout/js/action/create-billing-address'
], function (
$,
_,
Component,
Braintree,
quote,
fullScreenLoader,
additionalValidators,
VaultEnabler,
createBillingAddress
) {
'use strict';

return Component.extend({
Expand Down Expand Up @@ -172,14 +183,16 @@ define([
var billingAddress = {
street: [address.streetAddress],
city: address.locality,
regionCode: address.region,
postcode: address.postalCode,
countryId: address.countryCodeAlpha2,
email: customer.email,
firstname: customer.firstName,
lastname: customer.lastName,
telephone: customer.phone
};

billingAddress['region_code'] = address.region;
billingAddress = createBillingAddress(billingAddress);
quote.billingAddress(billingAddress);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
<input type="checkbox"
name="vault[is_enabled]"
class="checkbox"
data-bind="attr: {'id': getCode() + '_vault_enabler'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
<label class="label" data-bind="attr: {'for': getCode() + '_vault_enabler'}">
data-bind="attr: {'id': getCode() + '_enable_vault'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
<label class="label" data-bind="attr: {'for': getCode() + '_enable_vault'}">
<span><!-- ko i18n: 'Save for later use.'--><!-- /ko --></span>
</label>
<div class="field-tooltip toggle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<input type="checkbox"
name="vault[is_enabled]"
class="checkbox"
data-bind="attr: {'id': getCode() + '_vault_enabler'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
<label class="label" data-bind="attr: {'for': getCode() + '_vault_enabler'}">
data-bind="attr: {'id': getCode() + '_enable_vault'}, checked: vaultEnabler.isActivePaymentTokenEnabler"/>
<label class="label" data-bind="attr: {'for': getCode() + '_enable_vault'}">
<span><!-- ko i18n: 'Save for later use.'--><!-- /ko --></span>
</label>
<div class="field-tooltip toggle">
Expand Down
Loading

0 comments on commit 0a6c5b2

Please sign in to comment.