protected function getReactionUrlParameters() { $notificationUrl = $this->container->getBean('Customweb_Payment_Endpoint_IAdapter')->getUrl("process", "index", array('cw_transaction_id' => $this->getTransaction()->getExternalTransactionId())); $cancelUrl = $this->container->getBean('Customweb_Payment_Endpoint_IAdapter')->getUrl("process", "cancel", array('cw_transaction_id' => $this->getTransaction()->getExternalTransactionId())); $failUrl = $this->container->getBean('Customweb_Payment_Endpoint_IAdapter')->getUrl("process", "fail", array('cw_transaction_id' => $this->getTransaction()->getExternalTransactionId())); $parameters = array(); $parameters['SUCCESSLINK'] = Customweb_Util_Url::appendParameters($this->getSuccessUrl(), $this->getTransactionContext()->getCustomParameters()); $parameters['NOTIFYURL'] = $notificationUrl; $parameters['FAILLINK'] = $failUrl; $parameters['BACKLINK'] = $cancelUrl; return $parameters; }
public function getFailUrl($transaction) { $frontentId = 'checkout/onepage/'; // If the onestep checkout module is enabled redirect there if ((Mage::helper('core')->isModuleEnabled('Idev_OneStepCheckout') || Mage::helper('core')->isModuleEnabled('Iksanika_OneStepCheckout')) && Mage::getStoreConfig('onestepcheckout/general/rewrite_checkout_links')) { $frontentId = 'onestepcheckout'; } // If the firecheckout module is enabled redirect there if (Mage::helper('core')->isModuleEnabled('TM_FireCheckout') && Mage::getStoreConfig('firecheckout/general/enabled')) { $frontentId = 'firecheckout'; } $redirectionUrl = Customweb_Util_Url::appendParameters(Mage::getUrl($frontentId, array('_secure' => true)), array('loadFailed' => 'true')); $result = new StdClass(); $result->url = $redirectionUrl; Mage::dispatchEvent('customweb_failure_redirection', array('result' => $result, 'transaction' => $transaction)); return $result->url; }
public function breakoutAction() { $transaction = $this->getTransaction(); $redirectionUrl = ''; if ($transaction->getTransactionObject()->isAuthorizationFailed()) { $redirectionUrl = Customweb_Util_Url::appendParameters($transaction->getTransactionObject()->getTransactionContext()->getFailedUrl(), $transaction->getTransactionObject()->getTransactionContext()->getCustomParameters()); } else { $redirectionUrl = Mage::getUrl('SaferpayCw/process/success', array('transaction_id' => $transaction->getTransactionId(), '_secure' => true)); } $html = '<html> <body> <script type="text/javascript"> top.location.href = "' . $redirectionUrl . '"; </script> ' . Mage::helper('SaferpayCw')->__("You will be redirect to the order confirmation page.") . ' </body> <html>'; echo $html; die; }
/** * This method checks the enrollment of the credit card in the 3D secure program. * If the card is enrolled the user is redirected to the 3D secure verification page * otherwise the transaction is authorized without 3D secure. * * @param Customweb_Saferpay_Authorization_Transaction $transaction */ protected function request3DSecure(Customweb_Saferpay_Authorization_Transaction $transaction, $parameters) { $builder = new Customweb_Saferpay_Authorization_Hidden_ParameterBuilder($transaction, $this->getConfiguration(), $this->container); $sendParameters = $builder->buildVerifyEnrollmentParameters(); $additionalParameters = array(); if (isset($parameters['sfpCardCvc']) && !empty($parameters['sfpCardCvc'])) { $sendParameters['MPI_PA_BACKLINK'] = Customweb_Util_Url::appendParameters($sendParameters['MPI_PA_BACKLINK'], array('sfCecD' => $transaction->encrypt($parameters['sfpCardCvc']))); $additionalParameters['CVC'] = $parameters['sfpCardCvc']; } $requestUrl = Customweb_Saferpay_Util::addParametersToUrl($this->getVerifyEnrollmentUrl(), $sendParameters); $response = Customweb_Saferpay_Util::sendRequest($requestUrl); $parameters = $this->getXmlParameters($response); if ($this->is3DSecurePossible($transaction, $parameters)) { return $this->redirect(Customweb_Saferpay_Authorization_Transaction::STATE_3D_SECURE, $transaction, $parameters['MPI_PA_LINK']); } else { if (isset($parameters['MPI_SESSIONID'])) { $transaction->setMpiSessionId($parameters['MPI_SESSIONID']); } return $this->requestAuthorization($transaction, $additionalParameters); } }
public function getFailedUrl($transaction) { return Customweb_Util_Url::appendParameters($transaction->getTransactionContext()->getIframeBreakOutUrl(), $transaction->getTransactionContext()->getCustomParameters()); }
/** * Simply appends the parameters in the array as get parameters to the url * @param string $url An arbitrary url * @param array $parameters The array contains the parameters to append * @deprecated use instead Customweb_Util_Url::appendParameters * */ public static function addParametersToUrl($url, array $parameters) { return Customweb_Util_Url::appendParameters($url, $parameters); }
public function getFailedUrlWithCustomParameters() { $baseUrl = ""; if ($this->isMoto()) { $baseUrl = $this->getTransactionContext()->getBackendFailedUrl(); } else { $baseUrl = $this->getTransactionContext()->getFailedUrl(); } return Customweb_Util_Url::appendParameters($baseUrl, $this->getTransactionContext()->getCustomParameters()); }
private function appendNonTrackingParameter($url) { return Customweb_Util_Url::appendParameters($url, array('utm_nooverride' => '1')); }
public function getNotificationUrl() { return Customweb_Util_Url::appendParameters($this->getTransactionContext()->getNotificationUrl(), $this->getTransactionContext()->getCustomParameters()); }
public function processAuthorization(Customweb_Payment_Authorization_ITransaction $transaction, array $parameters) { if (!$transaction instanceof Customweb_Saferpay_Authorization_Transaction) { throw new Customweb_Core_Exception_CastException('Customweb_Saferpay_Authorization_Transaction'); } if ($transaction->isUseExistingAlias()) { $hiddenAdapter = new Customweb_Saferpay_Authorization_Hidden_Adapter($this->getConfiguration()->getConfigurationAdapter(), $this->getContainer()); $result = $hiddenAdapter->processAuthorization($transaction, $parameters); if ($transaction->getAuthorizationMethod() == Customweb_Payment_Authorization_Iframe_IAdapter::AUTHORIZATION_METHOD_NAME) { if ($result == 'redirect:' . $transaction->getSuccessUrl() || $result == 'redirect:' . $transaction->getFailedUrl()) { return 'redirect:' . Customweb_Util_Url::appendParameters($transaction->getTransactionContext()->getIframeBreakOutUrl(), $transaction->getTransactionContext()->getCustomParameters()); } } return $result; } if (!isset($parameters['DATA']) || empty($parameters['DATA'])) { return Customweb_Core_Http_Response::_("NO DATA parameter provided.")->setStatusCode(500); } if (!$this->validateCustomParameters($transaction, $parameters)) { $reason = Customweb_I18n_Translation::__("Custom parameters have been altered. Fraud possible, aborting."); $transaction->setAuthorizationFailed($reason); return 'redirect:' . $this->getFailedUrl($transaction); } try { $parameters = $this->parseRequestParameters($parameters); } catch (Exception $e) { $transaction->setAuthorizationParameters($parameters); $transaction->setAuthorizationFailed($e->getMessage()); return 'redirect:' . $this->getFailedUrl($transaction); } $transaction->setPaymentInformation($this->getPaymentMethodWrapper($transaction->getTransactionContext()->getOrderContext())->extractPaymentInformation($parameters)); if ($this->validateParameters($transaction, $parameters)) { // Check transaction state $transaction->authorizeDry(); if (isset($parameters['PAYMENTMETHOD']) && !empty($parameters['PAYMENTMETHOD'])) { $paymentMachineName = Customweb_Saferpay_Method_PaymentMethodWrapper::getPaymentMethodMachineNameByPaymentMethodId($parameters['PAYMENTMETHOD']); $transaction->setEffectivePaymentMethodMachineName($paymentMachineName); } $transaction->setPaymentId($parameters['ID']); if (isset($parameters['ECI']) && $parameters['ECI'] != 0) { $transaction->setState3DSecure(Customweb_Payment_Authorization_DefaultTransaction::STATE_3D_SECURE_SUCCESS); } if ($this->getConfiguration()->isMarkLiabilityShiftTransactions()) { if ((!isset($parameters['ECI']) || $parameters['ECI'] == 0) && !$this->getPaymentMethodWrapper($transaction->getTransactionContext()->getOrderContext())->isEciMeaningless()) { $transaction->setAuthorizationUncertain(); } } if (isset($parameters['CARDREFID'])) { $transaction->setCardRefId($parameters['CARDREFID']); } if (isset($parameters['CARDMASK'])) { $transaction->setTruncatedPAN($parameters['CARDMASK']); $transaction->setAliasForDisplay($parameters['CARDMASK']); $this->setAliasAddress($transaction); $parameters['PAN'] = $parameters['CARDMASK']; } if (isset($parameters[Customweb_Saferpay_Method_PaymentMethodWrapper::FORM_KEY_OWNER_NAME])) { $transaction->setOwnerName($parameters[Customweb_Saferpay_Method_PaymentMethodWrapper::FORM_KEY_OWNER_NAME]); } // $transaction->setOwnerName($parameters[Customweb_Saferpay_Method_PaymentMethodWrapper::FORM_KEY_OWNER_NAME]); if (isset($parameters['EXPIRYMONTH']) && isset($parameters['EXPIRYYEAR'])) { $transaction->setCardExpiryDate($parameters['EXPIRYMONTH'], $parameters['EXPIRYYEAR']); } $transaction->authorize(Customweb_I18n_Translation::__('Customer sucessfully returned from the Saferpay payment page.')); if ($transaction->getTransactionContext()->getCapturingMode() == null) { $capturingMode = $this->getPaymentMethodWrapper($transaction->getTransactionContext()->getOrderContext())->getPaymentMethodConfigurationValue('capturing'); } else { $capturingMode = $transaction->getTransactionContext()->getCapturingMode(); } $transaction->setAuthorizationParameters($parameters); if (!$transaction->isAuthorizationUncertain() && $capturingMode == Customweb_Payment_Authorization_ITransactionContext::CAPTURING_MODE_DIRECT) { $this->captureTransaction($transaction); } } else { $transaction->setAuthorizationParameters($parameters); $transaction->setAuthorizationFailed(Customweb_I18n_Translation::__('Possible fraud detected. Parameters send from Saferpay were not correct.')); } return $this->finalizeAuthorizationRequest($transaction); }
public function getSuccessUrl($transaction) { $url = ""; if ($transaction->isMoto()) { $url = $transaction->getTransactionContext()->getBackendSuccessUrl(); } else { $url = $transaction->getTransactionContext()->getSuccessUrl(); } return Customweb_Util_Url::appendParameters($url, $transaction->getTransactionContext()->getCustomParameters()); }