Skip to content

Commit 77ca314

Browse files
committed
MC-19008: PayPal Credit is not available in Funding Options but visible on frontend
- Removed filter by country from Disable Funding Options list
1 parent 7d5f1b0 commit 77ca314

File tree

2 files changed

+20
-53
lines changed

2 files changed

+20
-53
lines changed

app/code/Magento/Paypal/Block/Adminhtml/System/Config/MultiSelect/DisabledFundingOptions.php

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,6 @@ public function __construct(
3838
parent::__construct($context, $data);
3939
}
4040

41-
/**
42-
* Render country field considering request parameter
43-
*
44-
* @param AbstractElement $element
45-
* @return string
46-
*/
47-
public function render(AbstractElement $element)
48-
{
49-
if (!$this->isSelectedMerchantCountry('US')) {
50-
$fundingOptions = $element->getValues();
51-
$element->setValues($this->filterValuesForPaypalCredit($fundingOptions));
52-
}
53-
return parent::render($element);
54-
}
55-
5641
/**
5742
* Getting the name of a UI attribute
5843
*
@@ -62,30 +47,4 @@ protected function getDataAttributeName(): string
6247
{
6348
return 'disable-funding-options';
6449
}
65-
66-
/**
67-
* Filters array for CREDIT
68-
*
69-
* @param array $options
70-
* @return array
71-
*/
72-
private function filterValuesForPaypalCredit($options): array
73-
{
74-
return array_filter($options, function ($opt) {
75-
return ($opt['value'] !== 'CREDIT');
76-
});
77-
}
78-
79-
/**
80-
* Checks for chosen Merchant country from the config/url
81-
*
82-
* @param string $country
83-
* @return bool
84-
*/
85-
private function isSelectedMerchantCountry(string $country): bool
86-
{
87-
$merchantCountry = $this->getRequest()->getParam(StructurePlugin::REQUEST_PARAM_COUNTRY)
88-
?: $this->config->getMerchantCountry();
89-
return $merchantCountry === $country;
90-
}
9150
}

app/code/Magento/Paypal/Test/Unit/Block/Adminhtml/System/Config/Multiselect/DisabledFundingOptionsTest.php

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,25 @@ public function testIsPaypalCreditAvailable(
8080
) {
8181
$this->request->expects($this->any())
8282
->method('getParam')
83-
->will($this->returnCallback(function ($param) use ($requestCountry) {
84-
if ($param == StructurePlugin::REQUEST_PARAM_COUNTRY) {
85-
return $requestCountry;
86-
}
87-
return $param;
88-
}));
83+
->will(
84+
$this->returnCallback(
85+
function ($param) use ($requestCountry) {
86+
if ($param == StructurePlugin::REQUEST_PARAM_COUNTRY) {
87+
return $requestCountry;
88+
}
89+
return $param;
90+
}
91+
)
92+
);
8993
$this->config->expects($this->any())
9094
->method('getMerchantCountry')
91-
->will($this->returnCallback(function () use ($merchantCountry) {
92-
return $merchantCountry;
93-
}));
95+
->will(
96+
$this->returnCallback(
97+
function () use ($merchantCountry) {
98+
return $merchantCountry;
99+
}
100+
)
101+
);
94102
$this->model->render($this->element);
95103
$payPalCreditOption = [
96104
'value' => 'CREDIT',
@@ -113,9 +121,9 @@ public function isPaypalCreditAvailableDataProvider(): array
113121
[null, 'US', true],
114122
['US', 'US', true],
115123
['US', 'GB', true],
116-
['GB', 'GB', false],
117-
['GB', 'US', false],
118-
['GB', null, false],
124+
['GB', 'GB', true],
125+
['GB', 'US', true],
126+
['GB', null, true],
119127
];
120128
}
121129

0 commit comments

Comments
 (0)