26 private $directoryHelper;
31 private $storeManager;
36 private $ccTypeFactory;
45 $this->scopeConfig = $this->createMock(\
Magento\Framework\
App\
Config\ScopeConfigInterface::class);
47 $this->directoryHelper = $this->getMockBuilder(\
Magento\Directory\Helper\Data::class)
48 ->disableOriginalConstructor()
51 $this->storeManager = $this->createMock(\
Magento\
Store\Model\StoreManagerInterface::class);
53 $this->ccTypeFactory = $this->getMockBuilder(\
Magento\
Payment\Model\Source\CctypeFactory::class)
54 ->disableOriginalConstructor()
57 $this->certFactory = $this->getMockBuilder(\
Magento\Paypal\Model\CertFactory::class)
58 ->disableOriginalConstructor()
63 $this->directoryHelper,
72 $this->assertNotContains(
'payflow_direct', $this->model->getCountryMethods(
'GB'));
104 $this->assertFalse($this->model->isMethodActive(
'payflow_direct'));
112 $this->assertFalse($this->model->isMethodAvailable(
'payflow_direct'));
120 $this->scopeConfig->expects($this->any())
122 ->with(
'paypal/general/merchant_country')
123 ->will($this->returnValue(
'US'));
124 $this->scopeConfig->expects($this->exactly(2))
125 ->method(
'isSetFlag')
126 ->withAnyParameters()
127 ->will($this->returnValue(
true));
129 $this->model->setMethod($methodName);
130 $this->assertEquals($expected, $this->model->isMethodAvailable($methodName));
135 $this->scopeConfig->expects(static::once())
138 'paypal/general/merchant_country',
143 $this->directoryHelper->expects(static::never())
144 ->method(
'getDefaultCountry');
146 static::assertEquals(
'US', $this->model->getMerchantCountry());
151 $this->scopeConfig->expects(static::once())
154 'paypal/general/merchant_country',
159 $this->directoryHelper->expects(static::once())
160 ->method(
'getDefaultCountry')
164 static::assertEquals(
'US', $this->model->getMerchantCountry());
182 $this->assertFalse($this->model->getIsCreditCardMethod(
'payflow_direct'));
187 $this->model->setMethod(
'payflow_direct');
188 $this->assertNull($this->model->getValue(
'useccv'));
189 $this->assertNull($this->model->getValue(
'vendor'));
193 $this->scopeConfig->expects($this->once())
196 ->will($this->returnValue(1));
197 $this->assertEquals(1, $this->model->getValue(
'allow_ba_signup'));
204 $this->scopeConfig->expects($this->once())
207 ->will($this->returnValue(1));
208 $this->assertEquals(1, $this->model->getValue(
'allow_ba_signup'));
215 $this->scopeConfig->expects($this->once())
218 ->willReturn(
'Authorization');
219 $this->assertEquals(
'Authorization', $this->model->getValue(
'payment_action'));
227 $this->scopeConfig->expects($this->once())
229 ->with(
'payment/paypal_express/skip_order_review_step')
230 ->will($this->returnValue(
$value));
231 $this->assertEquals(
$url, $this->model->getPayPalBasicStartUrl(
'token'));
240 [
true,
'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=token&useraction=commit'],
241 [
false,
'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=token']
247 $url =
'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&order_id=orderId';
248 $this->assertEquals(
$url, $this->model->getExpressCheckoutOrderUrl(
'orderId'));
253 $this->scopeConfig->expects($this->once())
256 ->will($this->returnValue(
'12345'));
257 $this->assertEquals(
'12345', $this->model->getBmlPublisherId());
265 $this->scopeConfig->expects($this->once())
268 ->will($this->returnValue($expected));
269 $this->assertEquals($expected, $this->model->getBmlPosition($section));
288 $this->scopeConfig->expects($this->once())
291 ->will($this->returnValue($expected));
292 $this->assertEquals($expected, $this->model->getBmlSize($section));
302 [
'checkout', [
'50x50']]
311 $this->model->setStoreId(1);
312 $this->directoryHelper->expects($this->any())
313 ->method(
'getDefaultCountry')
315 ->will($this->returnValue(
'US'));
316 $this->scopeConfig->expects($this->any())
317 ->method(
'isSetFlag')
318 ->will($this->returnValue($expectedFlag));
319 $this->scopeConfig->expects($this->any())
321 ->will($this->returnValueMap([
326 $this->assertEquals($expected, $this->model->getBmlDisplay($section));
335 [
'head',
true,
true,
true],
336 [
'head',
true,
false,
false],
337 [
'head',
false,
true,
false],
338 [
'head',
false,
false,
false],
362 $this->model->setStoreId(123);
364 $this->scopeConfig->expects($this->any())
374 $this->model->getExpressCheckoutShortcutImageUrl($localeCode, $orderTotal, $pal)
386 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-medium.png' 390 'https://fpdbs.sandbox.paypal.com/dynamicimageweb?cmd=_dynamic-image&buttontype=ecshortcut&locale=en_GB' 394 'https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-image&buttontype=ecshortcut&locale=en_GB' 398 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' 402 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-medium.png'],
405 'https://www.paypal.com/en_GB/i/btn/btn_xpressCheckout.gif' 430 $this->model->setStoreId(123);
432 $this->scopeConfig->expects($this->any())
441 $this->model->getPaymentMarkImageUrl($localeCode, $orderTotal, $pal, $staticSize)
453 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/ppcredit-logo-medium.png' 457 'https://fpdbs.sandbox.paypal.com/dynamicimageweb?cmd=_dynamic-image&buttontype=ecmark&locale=en_GB' 461 'https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-image&buttontype=ecmark&locale=en_GB' 465 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' 469 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' 473 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-large.png' 477 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png' testGetBmlSize($section, $expected)
testGetMerchantCountryGeneral()
testGetBmlPosition($section, $expected)
const METHOD_PAYFLOWADVANCED
const EC_BUTTON_TYPE_SHORTCUT
dataProviderGetExpressCheckoutShortcutImageUrl()
testGetBmlDisplay($section, $expectedValue, $expectedFlag, $expected)
testGetPaymentMarkImageUrl( $localeCode, $orderTotal, $pal, $staticSize, $areButtonDynamic, $sandboxFlag, $result)
skipOrderReviewStepDataProvider()
dataProviderGetPaymentMarkImageUrl()
testIsMethodAvailableWPPPE()
testGetMerchantCountryPaypal()
testGetSpecificConfigPath()
dataProviderGetBmlDisplay()
const EC_BUTTON_TYPE_MARK
testGetSpecificConfigPathPayflowAdvancedLink()
getBmlPositionDataProvider()
testGetSpecificConfigPathPayflow()
testGetPayPalBasicStartUrl($value, $url)
const METHOD_WPP_PE_EXPRESS
testIsMethodAvailableForIsMethodActive($methodName, $expected)
isMethodAvailableDataProvider()
testGetExpressCheckoutOrderUrl()
testGetExpressCheckoutShortcutImageUrl( $localeCode, $orderTotal, $pal, $areButtonDynamic, $sandboxFlag, $buttonType, $result)
const METHOD_BILLING_AGREEMENT