Exemplo n.º 1
0
 protected function _initRequestParams($isOrderPlaced = true)
 {
     $languages = array('SE' => 'SV', 'DK' => 'DA', 'ES' => 'ES', 'FR' => 'FR', 'IT' => 'IT', 'PL' => 'PL', 'GR' => 'GR', 'RO' => 'RO', 'RU' => 'RU', 'TR' => 'TR', 'CN' => 'CN', 'CZ' => 'CZ', 'NL' => 'NL', 'DE' => 'DE', 'FI' => 'FI', 'BG' => 'BG');
     $params = parent::_initRequestParams($isOrderPlaced);
     $params['FRONTEND.ENABLED'] = 'true';
     $params['FRONTEND.COLLECT_DATA'] = 'false';
     $params['ACCOUNT.BRAND'] = 'MONEYBOOKERS';
     if (!$isOrderPlaced) {
         if (!($dataObject = Mage::registry('current_quote'))) {
             $dataObject = Mage::getSingleton('checkout/session')->getQuote();
         }
         $info = $dataObject->getPayment();
     } else {
         $info = $this->getInfoInstance();
         $dataObject = $info->getOrder();
     }
     $billingAddress = $dataObject->getBillingAddress();
     $billingAddress = $dataObject->getBillingAddress();
     $country = $billingAddress->getCountry();
     try {
         $iso3_country = Mage::getModel('directory/country')->loadByCode($country)->getIso3Code();
         $params['CRITERION.MONEYBOOKERS_country'] = $iso3_country;
         $params['CRITERION.MONEYBOOKERS_language'] = array_key_exists($country, $languages) ? $languages[$country] : 'EN';
     } catch (Mage_Core_Exception $e) {
         // Used for requests that do not include customer data, initial payment options display/listing
     }
     return $params;
 }
Exemplo n.º 2
0
 protected function _beforeProcessResponse($request, $result, Varien_Object $payment)
 {
     try {
         $action = explode('.', $request['PAYMENT.CODE']);
         if (!isset($action[1])) {
             Mage::throwException(Mage::helper('moneybookerspsp')->__('MoneybookersPSP: Wrong response data, method is missing'));
         }
         $method = strtoupper($action[0]);
         $action = strtoupper($action[1]);
         if ((string) $result->Transaction->attributes()->{'response'} == 'ASYNC' && (string) $result->Transaction->Processing->Result == self::PROCESSING_RESULT_OK && (string) $result->Transaction->Processing->Status->attributes()->{'code'} == self::PROCESSING_STATUS_CODE_WAITING && !empty($result->Transaction->Processing->Redirect)) {
             $this->setOrderPlaceRedirectUrl(Mage::getUrl('moneybookerspsp/processing/threeds'));
             $params = array();
             foreach ($result->Transaction->Processing->Redirect->Parameter as $parameter) {
                 $params[(string) $parameter->attributes()->{'name'}] = (string) $parameter;
             }
             $params['redirect_url'] = (string) $result->Transaction->Processing->Redirect->attributes()->{'url'};
             $payment->setAdditionalInformation($params);
         } else {
             return parent::_beforeProcessResponse($request, $result, $payment);
         }
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }