Skip to content

Commit 6353aa0

Browse files
committed
AC-1229:: Unit Test added for venmo and paylater
1 parent 76a95e7 commit 6353aa0

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

app/code/Magento/Paypal/Test/Unit/Model/SdkUrlTest.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Magento\Framework\Locale\ResolverInterface;
1212
use Magento\Paypal\Model\Config;
1313
use Magento\Paypal\Model\ConfigFactory;
14-
use Magento\Paypal\Model\SmartButtonConfig;
1514
use Magento\Store\Model\Store;
1615
use Magento\Store\Model\StoreManagerInterface;
1716
use PHPUnit\Framework\MockObject\MockObject;
@@ -75,7 +74,8 @@ protected function setUp(): void
7574
$scopeConfigMock,
7675
$storeManagerMock,
7776
$this->getDisallowedFundingMap(),
78-
$this->getUnsupportedPaymentMethods()
77+
$this->getUnsupportedPaymentMethods(),
78+
$this->getSupportedPaymentMethods()
7979
);
8080
}
8181

@@ -113,6 +113,10 @@ public function testGetConfig(
113113
]
114114
);
115115

116+
$this->configMock->method('getPayLaterConfigValue')
117+
->with('experience_active')
118+
->willReturn(true);
119+
116120
self::assertEquals($expected['sdkUrl'], $this->model->getUrl());
117121
}
118122

@@ -150,14 +154,27 @@ private function getDisallowedFundingMap()
150154
private function getUnsupportedPaymentMethods()
151155
{
152156
return [
153-
'venmo'=> 'venmo',
154157
'bancontact' => 'bancontact',
155158
'eps' => 'eps',
156159
'giropay' => 'giropay',
157160
'ideal' => 'ideal',
158161
'mybank' => 'mybank',
159162
'p24' => 'p24',
160-
'sofort' => 'sofort'
163+
'sofort' => 'sofort',
164+
];
165+
}
166+
167+
/**
168+
* Get supported payment methods
169+
* See app/code/Magento/Paypal/etc/frontend/di.xml
170+
*
171+
* @return string[]
172+
*/
173+
private function getSupportedPaymentMethods()
174+
{
175+
return [
176+
'venmo'=> 'venmo',
177+
'paylater'=> 'paylater',
161178
];
162179
}
163180
}

app/code/Magento/Paypal/Test/Unit/Model/_files/expected_url_config.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
2727
'client-id' => 'sb',
2828
'locale' => 'es_MX',
2929
'currency' => 'USD',
30+
'enable-funding' => implode(',', ['venmo', 'paylater']),
3031
'commit' => 'false',
3132
'intent' => 'authorize',
3233
'merchant-id' => 'merchant',
@@ -36,7 +37,6 @@ function generateExpectedPaypalSdkUrl(array $params) : String
3637
'credit',
3738
'sepa',
3839
'card',
39-
'venmo',
4040
'bancontact',
4141
'eps',
4242
'giropay',
@@ -62,12 +62,13 @@ function generateExpectedPaypalSdkUrl(array $params) : String
6262
'client-id' => 'sb',
6363
'locale' => 'en_BR',
6464
'currency' => 'USD',
65+
'enable-funding' => implode(',', ['venmo', 'paylater']),
6566
'commit' => 'false',
6667
'intent' => 'capture',
6768
'merchant-id' => 'merchant',
6869
'disable-funding' => implode(
6970
',',
70-
['venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
71+
['bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
7172
),
7273
'components' => implode(',', ['messages', 'buttons'])
7374
]
@@ -85,12 +86,13 @@ function generateExpectedPaypalSdkUrl(array $params) : String
8586
'client-id' => 'sb',
8687
'locale' => 'en_US',
8788
'currency' => 'USD',
89+
'enable-funding' => implode(',', ['venmo', 'paylater']),
8890
'commit' => 'false',
8991
'intent' => 'order',
9092
'merchant-id' => 'merchant',
9193
'disable-funding' => implode(
9294
',',
93-
['venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
95+
['bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
9496
),
9597
'components' => implode(',', ['messages', 'buttons'])
9698
]
@@ -108,6 +110,7 @@ function generateExpectedPaypalSdkUrl(array $params) : String
108110
'client-id' => 'sb',
109111
'locale' => 'en_BR',
110112
'currency' => 'USD',
113+
'enable-funding' => implode(',', ['venmo', 'paylater']),
111114
'commit' => 'false',
112115
'intent' => 'authorize',
113116
'merchant-id' => 'merchant',
@@ -117,7 +120,6 @@ function generateExpectedPaypalSdkUrl(array $params) : String
117120
'credit',
118121
'sepa',
119122
'card',
120-
'venmo',
121123
'bancontact',
122124
'eps',
123125
'giropay',
@@ -143,12 +145,13 @@ function generateExpectedPaypalSdkUrl(array $params) : String
143145
'client-id' => 'sb',
144146
'locale' => 'en_BR',
145147
'currency' => 'USD',
148+
'enable-funding' => implode(',', ['venmo', 'paylater']),
146149
'commit' => 'false',
147150
'intent' => 'authorize',
148151
'merchant-id' => 'merchant',
149152
'disable-funding' => implode(
150153
',',
151-
['credit', 'sepa', 'venmo', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
154+
['credit', 'sepa', 'bancontact', 'eps', 'giropay', 'ideal', 'mybank', 'p24', 'sofort']
152155
),
153156
'components' => implode(',', ['messages', 'buttons'])
154157
]

0 commit comments

Comments
 (0)