Пример #1
0
 /**
  * @param OrderInterface         $order
  * @param ConfigurationInterface $configuration
  *
  * @return string
  * @throws OrderAutocompleteException
  */
 private function getSignature(OrderInterface $order, ConfigurationInterface $configuration)
 {
     try {
         $signature = $this->signatureCalculator->calculate($order, $configuration->getCredentials(), $configuration->getCredentials()->getSignatureAlgorithm());
     } catch (SignatureCalculatorException $exception) {
         throw new OrderAutocompleteException($exception->getMessage(), $exception->getCode(), $exception);
     }
     return $signature;
 }
Пример #2
0
 /**
  * @param Request                $curlRequest
  * @param ConfigurationInterface $configuration
  */
 private function addHeaders(Request $curlRequest, ConfigurationInterface $configuration)
 {
     $authorization = sprintf('Basic %s', base64_encode(sprintf('%s:%s', $configuration->getCredentials()->getMerchantPosId(), $configuration->getCredentials()->getPrivateKey())));
     $curlRequest->addHeaders(['Authorization' => $authorization, 'Content-Type' => self::CONTENT_TYPE, 'Accept' => self::CONTENT_TYPE]);
 }
 public function testAutocomplete()
 {
     $merchant = new MerchantPosIdStrategy();
     $merchant->autocomplete($order = new Order(), $this->configuration);
     $this->assertEquals($order->getMerchantPosId(), $this->configuration->getCredentials()->getMerchantPosId());
 }
 /**
  * @param OrderInterface         $order
  * @param ConfigurationInterface $configuration
  */
 public function autocomplete(OrderInterface $order, ConfigurationInterface $configuration)
 {
     $order->setMerchantPosId($configuration->getCredentials()->getMerchantPosId());
 }