/**
  * Check if 3d secure is enabled
  * @param OrderAdapterInterface $order
  * @param float $amount
  * @return bool
  */
 private function is3DSecureEnabled(OrderAdapterInterface $order, $amount)
 {
     if (!$this->config->isVerify3DSecure() || $amount < $this->config->getThresholdAmount()) {
         return false;
     }
     $billingAddress = $order->getBillingAddress();
     $specificCounties = $this->config->get3DSecureSpecificCountries();
     if (!empty($specificCounties) && !in_array($billingAddress->getCountryId(), $specificCounties)) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @param int $value
  * @param array $expected
  * @covers \Magento\BraintreeTwo\Gateway\Config\Config::get3DSecureSpecificCountries
  * @dataProvider threeDSecureSpecificCountriesDataProvider
  */
 public function testGet3DSecureSpecificCountries($value, array $expected)
 {
     $this->scopeConfigMock->expects(static::at(0))->method('getValue')->with($this->getPath(Config::KEY_VERIFY_ALLOW_SPECIFIC), ScopeInterface::SCOPE_STORE, null)->willReturn($value);
     if ($value !== Config::VALUE_3DSECURE_ALL) {
         $this->scopeConfigMock->expects(static::at(1))->method('getValue')->with($this->getPath(Config::KEY_VERIFY_SPECIFIC), ScopeInterface::SCOPE_STORE, null)->willReturn('GB,US');
     }
     static::assertEquals($expected, $this->model->get3DSecureSpecificCountries());
 }
 /**
  * Retrieve assoc array of checkout configuration
  *
  * @return array
  */
 public function getConfig()
 {
     return ['payment' => [self::CODE => ['clientToken' => $this->getClientToken(), 'ccTypesMapper' => $this->config->getCctypesMapper(), 'sdkUrl' => $this->config->getSdkUrl(), 'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig(), 'availableCardTypes' => $this->config->getAvailableCardTypes(), 'useCvv' => $this->config->isCvvEnabled(), 'environment' => $this->config->getEnvironment(), 'kountMerchantId' => $this->config->getKountMerchantId(), 'hasFraudProtection' => $this->config->hasFraudProtection(), 'merchantId' => $this->config->getMerchantId()], Config::CODE_3DSECURE => ['enabled' => $this->config->isVerify3DSecure(), 'thresholdAmount' => $this->config->getThresholdAmount(), 'specificCountries' => $this->config->get3DSecureSpecificCountries()]]];
 }
 /**
  * Retrieve assoc array of checkout configuration
  *
  * @return array
  */
 public function getConfig()
 {
     $isPayPalActive = $this->payPalConfig->isActive();
     return ['payment' => [self::CODE => ['isActive' => $this->config->isActive(), 'isSingleUse' => !$isPayPalActive, 'clientToken' => $this->getClientToken(), 'ccTypesMapper' => $this->config->getCctypesMapper(), 'sdkUrl' => $this->config->getSdkUrl(), 'countrySpecificCardTypes' => $this->config->getCountrySpecificCardTypeConfig(), 'availableCardTypes' => $this->config->getAvailableCardTypes(), 'useCvv' => $this->config->isCvvEnabled(), 'environment' => $this->config->getEnvironment(), 'kountMerchantId' => $this->config->getKountMerchantId(), 'hasFraudProtection' => $this->config->hasFraudProtection(), 'merchantId' => $this->config->getMerchantId()], Config::CODE_3DSECURE => ['enabled' => $this->config->isVerify3DSecure(), 'thresholdAmount' => $this->config->getThresholdAmount(), 'specificCountries' => $this->config->get3DSecureSpecificCountries()], self::PAYPAL_CODE => ['isActive' => $isPayPalActive, 'title' => $this->payPalConfig->getTitle(), 'isAllowShippingAddressOverride' => $this->payPalConfig->isAllowToEditShippingAddress(), 'merchantName' => $this->payPalConfig->getMerchantName(), 'locale' => strtolower($this->localeResolver->getLocale()), 'paymentAcceptanceMarkSrc' => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png']]];
 }