Exemple #1
0
 public function prepareAuthRequestData()
 {
     $requestData = array(Fields::A01Y_ACTION_ID => '701', Fields::A01Y_VERS => '0002', Fields::A01Y_RCVID => $this->sellerId, Fields::A01Y_LANGCODE => 'ET', Fields::A01Y_STAMP => date('YmdHis', time()) . substr($this->sellerId, 0, 6), Fields::A01Y_IDTYPE => '02', Fields::A01Y_RETLINK => $this->endpointUrl, Fields::A01Y_CANLINK => \URL::to('user'), Fields::A01Y_REJLINK => \URL::to('user'), Fields::A01Y_KEYVERS => $this->keyVersion, Fields::A01Y_ALG => '01');
     $requestData = ProtocolUtils::convertValues($requestData, 'UTF-8', 'ISO-8859-1');
     $requestData[Fields::A01Y_MAC] = $this->getAuthRequestSignature($requestData);
     return $requestData;
 }
Exemple #2
0
 /**
  * Determine which response exactly by service id, if it's supported then call related internal method
  *
  * @param array  $responseData
  * @param string $inputEncoding
  *
  * @return \Banklink\Response\Response
  *
  * @throws \InvalidArgumentException
  */
 public function handleResponse(array $responseData, $inputEncoding)
 {
     $verificationSuccess = $this->verifyResponseSignature($responseData, $inputEncoding);
     $responseData = ProtocolUtils::convertValues($responseData, $inputEncoding, 'UTF-8');
     $service = $responseData[Fields::SERVICE_ID];
     if (in_array($service, Services::getPaymentServices())) {
         return $this->handlePaymentResponse($responseData, $verificationSuccess);
     }
     throw new \InvalidArgumentException('Unsupported service with id: ' . $service);
 }
Exemple #3
0
 /**
  * @param integer  $orderId
  * @param float    $sum
  * @param string   $message
  * @param string   $outputEncoding Will most likely always be ISO-8859-1
  * @param string   $language
  * @param string   $currency
  *
  * @return array
  */
 public function preparePaymentRequestData($orderId, $sum, $message, $outputEncoding, $language = 'EST', $currency = 'EUR')
 {
     $requestData = array(Fields::PROTOCOL_VERSION => $this->protocolVersion, Fields::MAC_KEY_VERSION => $this->keyVersion, Fields::SELLER_ID => $this->sellerId, Fields::ORDER_ID => $orderId, Fields::SUM => $sum, Fields::CURRENCY => $currency, Fields::ORDER_REFERENCE => ProtocolUtils::generateOrderReference($orderId), Fields::DESCRIPTION => $message, Fields::SUCCESS_URL => $this->endpointUrl, Fields::CANCEL_URL => $this->endpointUrl, Fields::REJECT_URL => $this->endpointUrl, Fields::USER_LANG => $this->getLanguageCodeForString($language), Fields::TRANSACTION_DATE => 'EXPRESS', Fields::TRANSACTION_CONFIRM => 'YES');
     // Solo protocol doesn't require seller name/account, unless it's different than default one specified
     if ($this->sellerName && $this->sellerAccountNumber) {
         $requestData[Fields::SELLER_NAME] = $this->sellerName;
         $requestData[Fields::SELLER_BANK_ACC] = $this->sellerAccountNumber;
     }
     $requestData = ProtocolUtils::convertValues($requestData, 'UTF-8', $outputEncoding);
     $requestData[Fields::SIGNATURE] = $this->getRequestSignature($requestData);
     return $requestData;
 }
 /**
  * Test for too long/too short id
  *
  * @expectedException InvalidArgumentException
  */
 public function testGenerateOrderReferenceValidation()
 {
     ProtocolUtils::generateOrderReference('');
     ProtocolUtils::generateOrderReference(1.2345678901234567E+19);
 }