Skip to content

Commit

Permalink
Merge pull request #85 from magento-mpi/MAGETWO-44603
Browse files Browse the repository at this point in the history
[MPI] Bugfix
  • Loading branch information
dkvashninbay committed Oct 31, 2015
2 parents b2f0ef0 + 4663042 commit f748e57
Show file tree
Hide file tree
Showing 131 changed files with 2,318 additions and 1,201 deletions.
61 changes: 0 additions & 61 deletions app/code/Magento/Braintree/Controller/PayPal/GetButtonData.php

This file was deleted.

6 changes: 3 additions & 3 deletions app/code/Magento/Braintree/Model/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

class ConfigProvider extends CcGenericConfigProvider
{

/**
* @var string[]
*/
Expand Down Expand Up @@ -97,8 +98,7 @@ public function getStoredCards()
*/
protected function getCcAvailableCcTypes()
{
$country = $this->checkoutSession->getQuote()->getBillingAddress()->getCountryId();
return $this->dataHelper->getCcAvailableCardTypes($country);
return $this->dataHelper->getCcAvailableCardTypes();
}

/**
Expand Down Expand Up @@ -185,7 +185,7 @@ public function getConfig()
'isCcDetectionEnabled' => $this->config->isCcDetectionEnabled(),
'availableCardTypes' => $this->getCcAvailableCcTypes(),
'braintreeDataJs'=> $this->config->getBraintreeDataJs(),
'ajaxGenerateNonceUrl' => $this->getAjaxGenerateNonceUrl(),
'ajaxGenerateNonceUrl' => $this->getAjaxGenerateNonceUrl()
],
],
]);
Expand Down
7 changes: 5 additions & 2 deletions app/code/Magento/Braintree/Observer/AddPaypalShortcuts.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ public function __construct(
*/
public function execute(\Magento\Framework\Event\Observer $observer)
{
$isMiniCart = !$observer->getEvent()->getIsCatalogProduct();

//Don't display shortcut on product view page
if (!$this->methodPayPal->isActive() ||
!$this->paypalConfig->isShortcutCheckoutEnabled()) {
!$this->paypalConfig->isShortcutCheckoutEnabled() ||
!$isMiniCart) {
return;
}

Expand All @@ -57,7 +60,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
'',
[
'data' => [
Shortcut::MINI_CART_FLAG_KEY => !$observer->getEvent()->getIsCatalogProduct()
Shortcut::MINI_CART_FLAG_KEY => $isMiniCart
]
]
);
Expand Down

This file was deleted.

19 changes: 5 additions & 14 deletions app/code/Magento/Braintree/Test/Unit/Model/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Magento\Braintree\Test\Unit\Model;

use Magento\Braintree\Model\ConfigProvider;
use Magento\Braintree\Model\PaymentMethod;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;

Expand Down Expand Up @@ -193,16 +194,6 @@ public function testGetConfig(
->method('generatePaymentMethodToken')
->willReturnMap($tokenNonceMap);

$quoteMock = $this->getMockBuilder('\Magento\Quote\Model\Quote')
->disableOriginalConstructor()
->getMock();
$quoteMock->expects($this->once())
->method('getBillingAddress')
->willReturn(new \Magento\Framework\DataObject(['country_id' => 'US']));
$this->checkoutSessionMock->expects($this->once())
->method('getQuote')
->willReturn($quoteMock);

$cardTypeMap = [
['Visa', 'VI'],
['Master Card', 'MA'],
Expand Down Expand Up @@ -272,7 +263,7 @@ public function getConfigDataProvider()
'isCcDetectionEnabled' => true,
'availableCardTypes' => $this->availableCardTypes,
'braintreeDataJs'=> 'https://js.braintreegateway.com/v1/braintree-data.js',
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL,
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL
],
],
]
Expand Down Expand Up @@ -347,7 +338,7 @@ public function getConfigDataProvider()
'isCcDetectionEnabled' => true,
'availableCardTypes' => $this->availableCardTypes,
'braintreeDataJs'=> 'https://js.braintreegateway.com/v1/braintree-data.js',
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL,
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL
],
],
]
Expand Down Expand Up @@ -422,7 +413,7 @@ public function getConfigDataProvider()
'isCcDetectionEnabled' => true,
'availableCardTypes' => $this->availableCardTypes,
'braintreeDataJs'=> 'https://js.braintreegateway.com/v1/braintree-data.js',
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL,
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL
],
],
]
Expand Down Expand Up @@ -466,7 +457,7 @@ public function getConfigDataProvider()
'isCcDetectionEnabled' => true,
'availableCardTypes' => $this->availableCardTypes,
'braintreeDataJs'=> 'https://js.braintreegateway.com/v1/braintree-data.js',
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL,
'ajaxGenerateNonceUrl' => self::PAYMENT_NONCE_GENERATION_URL
],
],
]
Expand Down
Loading

0 comments on commit f748e57

Please sign in to comment.