function process_button()
 {
     global $order;
     if ($this->pg_config['genre_specific']['sepa_use_managemandate'] == 'true') {
         $this->payone->log("managemandate {$this->code} payment");
         $standard_parameters = parent::_standard_parameters();
         unset($standard_parameters['request']);
         $this->personal_data = new Payone_Api_Request_Parameter_ManageMandate_PersonalData();
         parent::_set_customers_standard_params();
         $this->payment_method = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_DebitPayment();
         if (isset($_SESSION[$this->code]['iban']) && $_SESSION[$this->code]['iban'] != '' && isset($_SESSION[$this->code]['bic']) && $_SESSION[$this->code]['bic'] != '') {
             $this->payment_method->setIban($_SESSION[$this->code]['iban']);
             $this->payment_method->setBic($_SESSION[$this->code]['bic']);
         } else {
             $this->payment_method->setBankaccount($_SESSION[$this->code]['bankaccount']);
             $this->payment_method->setBankcode($_SESSION[$this->code]['bankcode']);
         }
         $this->payment_method->setBankcountry($_SESSION[$this->code]['bankcountry']);
         $request_parameters = array('aid' => $this->global_config['subaccount_id'], 'key' => $this->global_config['key'], 'currency' => $order->info['currency']);
         $params = array_merge($standard_parameters, $request_parameters);
         $builder = new Payone_Builder($this->payone->getPayoneConfig());
         $mandate_service = $builder->buildServiceManagementManageMandate();
         $manage_mandate_request = new Payone_Api_Request_ManageMandate($params);
         $manage_mandate_request->setAid($this->global_config['subaccount_id']);
         $manage_mandate_request->setClearingType('elv');
         $manage_mandate_request->setPersonalData($this->personal_data);
         $manage_mandate_request->setPayment($this->payment_method);
         $this->payone->log("elv managemandate request:\n" . print_r($manage_mandate_request, true));
         $manage_mandate_result = $mandate_service->managemandate($manage_mandate_request);
         $this->payone->log("managemandate result:\n" . print_r($manage_mandate_result, true));
         $error = false;
         if ($manage_mandate_result instanceof Payone_Api_Response_Error) {
             $this->payone->log("ERROR retrieving SEPA mandate: " . $manage_mandate_result->getErrorcode() . ' - ' . $manage_mandate_result->getErrormessage());
             $_SESSION['payone_error'] = $manage_mandate_result->getCustomermessage();
             if ($_SESSION['payone_error'] == '') {
                 $_SESSION['payone_error'] = PAYMENT_ERROR;
             }
             xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL'));
         } else {
             if ($manage_mandate_result instanceof Payone_Api_Response_Management_ManageMandate_Approved) {
                 if ($manage_mandate_result->isApproved()) {
                     $mandate_status = $manage_mandate_result->getMandateStatus();
                     if ($mandate_status == 'pending' || $mandate_status == 'active') {
                         $mandate_id = $manage_mandate_result->getMandateIdentification();
                     }
                     if ($mandate_status == 'pending') {
                         $mandate_text = urldecode($manage_mandate_result->getMandateText());
                     }
                 } else {
                     $this->payone->log('ERROR: SEPA mandate not approved');
                     $error = true;
                 }
             } else {
                 $this->payone->log('ERROR retrieving SEPA mandate: unhandled response type');
                 $error = true;
             }
         }
         if ($error === true) {
             $_SESSION['payone_error'] = PAYMENT_ERROR;
             xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL'));
         }
         if (isset($mandate_id)) {
             $_SESSION[$this->code]['sepa_mandate_id'] = $mandate_id;
             $_SESSION[$this->code]['sepa_download_pdf'] = $this->pg_config['genre_specific']['sepa_download_pdf'];
         }
         if (isset($mandate_text) == true) {
             $_SESSION['payone_elv_sepa_mandate_mustconfirm'] = true;
             $payment_smarty = new Smarty();
             $payment_smarty->template_dir = DIR_FS_EXTERNAL . 'payone/templates/';
             $payment_smarty->assign('mandate_text', $mandate_text);
             $payment_smarty->assign('payonecss', DIR_WS_EXTERNAL . 'payone/css/payone.css');
             $payment_smarty->caching = 0;
             $module_form = $payment_smarty->fetch('checkout_payone_elv_mandate.html');
             return $module_form;
         }
     }
 }
 public function scoreCustomer($ab_id)
 {
     $global_config = $this->getConfig('global');
     $config = $this->getConfig('credit_risk');
     $cdata = $this->_getAddressBookEntry($ab_id);
     if ($cdata === false) {
         throw new Exception('invalid address book entry');
     }
     switch ($config['typeofcheck']) {
         case 'iscorehard':
             $scoretype = 'IH';
             break;
         case 'iscoreall':
             $scoretype = 'IA';
             break;
         case 'iscorebscore':
             $scoretype = 'IB';
             break;
         default:
             $scoretype = 'IH';
     }
     $standard_parameters = $this->getStandardParameters();
     $builder = new Payone_Builder($this->getPayoneConfig());
     $service = $builder->buildServiceVerificationConsumerscore();
     $requestData = array('key' => $global_config['key'], 'addresschecktype' => 'NO', 'consumerscoretype' => $scoretype);
     $addressData = array('firstname' => $cdata['entry_firstname'], 'lastname' => $cdata['entry_lastname'], 'company' => $cdata['entry_company'], 'street' => $cdata['entry_street_address'], 'zip' => $cdata['entry_postcode'], 'city' => $cdata['entry_city'], 'country' => $cdata['countries_iso_code_2'], 'birthday' => date('Ymd', strtotime($cdate['dob_date'])), 'telephonenumber' => $cdata['customers_telephone']);
     $address_hash = md5(implode('', $addressData));
     $response = $this->_retrieveCachedCreditRiskResponse($address_hash, $scoretype);
     if ($response == false) {
         $this->log("creditRisk cache miss");
         $requestData = array_merge($standard_parameters, $requestData, $addressData);
         $request = new Payone_Api_Request_Consumerscore($requestData);
         $this->log("scoreCustomer request:\n" . print_r($request, true));
         $response = $service->score($request);
         $this->log("scoreCustomer response:\n" . print_r($response, true));
     } else {
         $this->log("creditRisk cache hit");
     }
     if ($response instanceof Payone_Api_Response_Consumerscore_Valid || $response instanceof Payone_Api_Response_Consumerscore_Invalid) {
         $this->_storeCreditRiskResponse($response, $ab_id, $address_hash, $scoretype);
         return $response;
     } else {
         return false;
     }
 }