/**
  * @param array $billingData
  * @param array $expectedResult
  *
  * @dataProvider dataProviderBuild
  */
 public function testBuild($billingData, $expectedResult)
 {
     $billingMock = $this->getBillingMock($billingData);
     $this->paymentDOMock->expects(static::once())->method('getOrder')->willReturn($this->orderMock);
     $this->orderMock->expects(static::once())->method('getBillingAddress')->willReturn($billingMock);
     $buildSubject = ['payment' => $this->paymentDOMock];
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDOMock);
     self::assertEquals($expectedResult, $this->builder->build($buildSubject));
 }
 /**
  * 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;
 }
 public function testBuild()
 {
     $additionalData = [[DataAssignObserver::PAYMENT_METHOD_NONCE, self::PAYMENT_METHOD_NONCE]];
     $expectedResult = [PaymentDataBuilder::AMOUNT => 10.0, PaymentDataBuilder::PAYMENT_METHOD_NONCE => self::PAYMENT_METHOD_NONCE, PaymentDataBuilder::ORDER_ID => '000000101', PaymentDataBuilder::MERCHANT_ACCOUNT_ID => self::MERCHANT_ACCOUNT_ID];
     $buildSubject = ['payment' => $this->paymentDO, 'amount' => 10.0];
     $this->paymentMock->expects(static::exactly(count($additionalData)))->method('getAdditionalInformation')->willReturnMap($additionalData);
     $this->configMock->expects(static::once())->method('getValue')->with(Config::KEY_MERCHANT_ACCOUNT_ID)->willReturn(self::MERCHANT_ACCOUNT_ID);
     $this->paymentDO->expects(static::once())->method('getPayment')->willReturn($this->paymentMock);
     $this->paymentDO->expects(static::once())->method('getOrder')->willReturn($this->orderMock);
     $this->subjectReaderMock->expects(self::once())->method('readPayment')->with($buildSubject)->willReturn($this->paymentDO);
     $this->subjectReaderMock->expects(self::once())->method('readAmount')->with($buildSubject)->willReturn(10.0);
     $this->orderMock->expects(static::once())->method('getOrderIncrementId')->willReturn('000000101');
     static::assertEquals($expectedResult, $this->builder->build($buildSubject));
 }