/**
  * This method processes the response from the secure card data service that
  * should get us a card alias to use further on.
  *
  * @param Customweb_Saferpay_Authorization_Transaction $transaction
  * @param array $parameters
  */
 protected function processScdResponse(Customweb_Saferpay_Authorization_Transaction $transaction, $parameters)
 {
     if ($transaction->isUseExistingAlias()) {
         $transaction->setCardRefId($transaction->getTransactionContext()->getAlias()->getCardRefId());
         $transaction->setOwnerName($parameters[Customweb_Saferpay_Method_PaymentMethodWrapper::FORM_KEY_OWNER_NAME]);
         if ($this->getPaymentMethodWrapper($transaction->getTransactionContext()->getOrderContext())->is3DSecureSupported()) {
             $transaction->setCardExpiryDate($parameters['sfpCardExpiryMonth'], $parameters['sfpCardExpiryYear']);
             if (!$this->getConfiguration()->isUseMotoAccountForAlias()) {
                 return $this->request3DSecure($transaction, $parameters);
             }
         }
         return $this->requestAuthorization($transaction);
     } else {
         $parameters = $this->parseRequestParameters($parameters);
         if ($parameters['RESULT'] == 0) {
             $transaction->setCardRefId($parameters['CARDREFID']);
             $transaction->setTruncatedPAN($parameters['CARDMASK']);
             $transaction->setOwnerName($parameters[Customweb_Saferpay_Method_PaymentMethodWrapper::FORM_KEY_OWNER_NAME]);
             if ($this->getPaymentMethodWrapper($transaction->getTransactionContext()->getOrderContext())->is3DSecureSupported()) {
                 $transaction->setCardExpiryDate($parameters['EXPIRYMONTH'], $parameters['EXPIRYYEAR']);
                 return $this->request3DSecure($transaction, $parameters);
             }
             return $this->requestAuthorization($transaction);
         } else {
             $userMessage = Customweb_Saferpay_Util::getUserErrorMessage($parameters['DESCRIPTION']);
             $backendMessage = Customweb_I18n_Translation::__("Server responded '!response'", array('!response' => $parameters['DESCRIPTION']));
             $transaction->setAuthorizationFailed(new Customweb_Payment_Authorization_ErrorMessage($userMessage, $backendMessage));
             $this->redirect(null, $transaction, $this->getFailedUrl($transaction));
         }
     }
 }
Exemplo n.º 2
0
 public function createTransaction(Customweb_Payment_Authorization_Moto_ITransactionContext $transactionContext, $failedTransaction)
 {
     $transaction = new Customweb_Saferpay_Authorization_Transaction($transactionContext);
     $transaction->setAuthorizationMethod(self::AUTHORIZATION_METHOD_NAME);
     $orderContext = $transaction->getTransactionContext()->getOrderContext();
     $adapter = $this->getAdapterInstanceByPaymentMethod($orderContext->getPaymentMethod());
     $transaction->setMotoAuthorizationMethodName($adapter->getAuthorizationMethodName());
     $transaction->setLiveTransaction(!$this->getConfiguration()->isTestMode());
     return $transaction;
 }
Exemplo n.º 3
0
 protected function processFormData(Customweb_Saferpay_Authorization_Transaction $transaction, $parameters)
 {
     if ($transaction->isUseExistingAlias()) {
         $transaction->setTransactionState(Customweb_Saferpay_Authorization_Transaction::STATE_ALIAS_EXISTS);
         $parameters = array_merge($parameters, $transaction->getTransactionContext()->getCustomParameters());
         $this->processAuthorization($transaction, $parameters);
     } else {
         $this->createAlias($transaction, $parameters);
     }
 }
 public function __construct(Customweb_Saferpay_Authorization_Transaction $transaction, Customweb_Saferpay_Configuration $configuration, Customweb_DependencyInjection_IContainer $container)
 {
     parent::__construct($transaction->getTransactionContext(), $configuration, $container);
     $this->transaction = $transaction;
 }
 /**
  * Stores the alias with a hash of the shipping address the alias was created with.
  * This is used for fraud prevention as an alias can only be resused without
  * entering the cvc when the shipping address did not change.
  *
  * @param Customweb_Saferpay_Authorization_Transaction $transaction
  */
 protected function setAliasAddress(Customweb_Saferpay_Authorization_Transaction $transaction)
 {
     $cardrefId = $transaction->getCardRefId();
     $orderContext = $transaction->getTransactionContext()->getOrderContext();
     $aliasContext = array($cardrefId => $this->getShippingAddressHash($orderContext));
     $transaction->getPaymentCustomerContext()->updateMap($aliasContext);
 }