/**
  * @param FinancialTransactionInterface $transaction
  *
  * @return ActionRequiredException
  */
 public function createDotpayRedirectActionException(FinancialTransactionInterface $transaction)
 {
     $actionRequest = new ActionRequiredException('Redirecting to DotPay.');
     $actionRequest->setFinancialTransaction($transaction);
     $instruction = $transaction->getPayment()->getPaymentInstruction();
     $extendedData = $transaction->getExtendedData();
     $urlc = $this->router->generate('ets_payment_dotpay_callback_urlc', array('id' => $instruction->getId()), true);
     $datas = array('id' => $this->token->getId(), 'url' => $this->getReturnUrl($extendedData), 'URLC' => $urlc, 'type' => $this->type, 'amount' => $transaction->getRequestedAmount(), 'currency' => $instruction->getCurrency(), 'description' => sprintf('Payment Instruction #%d', $instruction->getId()));
     $additionalDatas = array('street', 'phone', 'postcode', 'lastname', 'firstname', 'email', 'country', 'city', 'grupykanalow');
     foreach ($additionalDatas as $value) {
         if ($extendedData->has($value)) {
             $datas[$value] = $this->stringTools->normalize($extendedData->get($value));
         }
     }
     if ($extendedData->has('lang')) {
         $datas['lang'] = substr($extendedData->get('lang'), 0, 2);
     }
     $actionRequest->setAction(new VisitUrl($this->url . '?' . http_build_query($datas)));
     return $actionRequest;
 }
 /**
  * @param string $input    Input string
  * @param string $expected Expected output string
  *
  * @dataProvider normalizeProvider
  */
 public function testNormaize($input, $expected)
 {
     $tool = new String();
     $this->assertEquals($expected, $tool->normalize($input));
 }