$error = true; $entry_email_address_exists = true; } else { $entry_email_address_exists = false; } if ($error == false) { $sql_data_array = array('customers_firstname' => $customers_firstname, 'customers_cid' => $customers_cid, 'customers_vat_id' => $customers_vat_id, 'customers_vat_id_status' => $customers_vat_id_status, 'customers_lastname' => $customers_lastname, 'customers_email_address' => $customers_email_address, 'customers_telephone' => $customers_telephone, 'customers_fax' => $customers_fax, 'customers_symbol' => $customers_symbol, 'payment_unallowed' => $payment_unallowed, 'shipping_unallowed' => $shipping_unallowed, 'customers_newsletter' => $customers_newsletter, 'customers_last_modified' => 'now()'); // if new password is set if ($password != "") { $sql_data_array['customers_password'] = xtc_encrypt_password($password); } if (ACCOUNT_GENDER == 'true') { $sql_data_array['customers_gender'] = $customers_gender; } if (ACCOUNT_DOB == 'true') { $sql_data_array['customers_dob'] = xtc_date_raw($customers_dob); } //xtc_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '".xtc_db_input($customers_id)."'"); xtc_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . xtc_db_input($customers_id) . "' AND customers_default_address_id = '" . $address_book_id . "'"); xtc_db_query("UPDATE " . TABLE_CUSTOMERS_INFO . "\n SET customers_info_date_account_last_modified = now()\n WHERE customers_info_id = '" . xtc_db_input($customers_id) . "'"); if ($entry_zone_id > 0) { $entry_state = ''; } $sql_data_array = array('entry_firstname' => $customers_firstname, 'entry_lastname' => $customers_lastname, 'entry_street_address' => $entry_street_address, 'entry_postcode' => $entry_postcode, 'entry_city' => $entry_city, 'entry_country_id' => $entry_country_id, 'address_last_modified' => 'now()'); if (ACCOUNT_GENDER == 'true') { $sql_data_array['entry_gender'] = $customers_gender; } if (ACCOUNT_COMPANY == 'true') { $sql_data_array['entry_company'] = $entry_company; } if (ACCOUNT_SUBURB == 'true') {
/** * Checks if all needed Data is set and initializes RatePAY Payment * * @return boolean */ function pre_confirmation_check() { global $order; if (isset($_SESSION['pi_ratepay_rate_conditions']) && $_SESSION['pi_ratepay_rate_conditions'] == true) { unset($_SESSION['pi_ratepay_rate_conditions']); $response = $this->paymentInit($order); if ($response) { if ((string) $response->head->processing->status->attributes()->code == "OK" && (string) $response->head->processing->result->attributes()->code == "350") { return false; } else { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_GATEWAY; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } else { $_SESSION['disable'] = true; $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } else { $successFon = false; $successDate = false; $inputNeededFon = false; $inputNeededBirthdate = false; if (isset($_POST['pi_phone_rate']) && isset($_POST['pi_birthdate_rate'])) { $inputNeededFon = true; $inputNeededBirthdate = true; if ($_POST['pi_phone_rate'] != '') { $successFon = true; $customerId = $_SESSION['customer_id']; xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_telephone = '" . xtc_db_prepare_input($_POST['pi_phone_rate']) . "' WHERE customers_id ='" . xtc_db_input($customerId) . "' "); } $dob = xtc_db_prepare_input($_POST['pi_birthdate_rate']); if (is_numeric(substr(xtc_date_raw($dob), 4, 2)) && is_numeric(substr(xtc_date_raw($dob), 6, 2)) && is_numeric(substr(xtc_date_raw($dob), 0, 4))) { if (checkdate(substr(xtc_date_raw($dob), 4, 2), substr(xtc_date_raw($dob), 6, 2), substr(xtc_date_raw($dob), 0, 4))) { $successDate = true; $customerId = $_SESSION['customer_id']; $dateStr = substr(xtc_date_raw($dob), 6, 2) . "." . substr(xtc_date_raw($dob), 4, 2) . "." . substr(xtc_date_raw($dob), 0, 4) . " 00:00:00"; xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_dob = '" . xtc_date_raw($dateStr) . "' WHERE customers_id ='" . xtc_db_input($customerId) . "' "); $this->verifyAge($dateStr); } } } else { if (isset($_POST['pi_phone_rate'])) { $inputNeededFon = true; if ($_POST['pi_phone_rate'] != '') { $successFon = true; $customerId = $_SESSION['customer_id']; xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_telephone = '" . xtc_db_prepare_input($_POST['pi_phone_rate']) . "' WHERE customers_id ='" . xtc_db_input($customerId) . "' "); } } else { if (isset($_POST['pi_birthdate_rate'])) { $inputNeededBirthdate = true; $dob = xtc_db_prepare_input($_POST['pi_birthdate_rate']); if (is_numeric(substr(xtc_date_raw($dob), 4, 2)) && is_numeric(substr(xtc_date_raw($dob), 6, 2)) && is_numeric(substr(xtc_date_raw($dob), 0, 4))) { if (checkdate(substr(xtc_date_raw($dob), 4, 2), substr(xtc_date_raw($dob), 6, 2), substr(xtc_date_raw($dob), 0, 4))) { $successDate = true; $customerId = $_SESSION['customer_id']; $dateStr = substr(xtc_date_raw($dob), 6, 2) . "." . substr(xtc_date_raw($dob), 4, 2) . "." . substr(xtc_date_raw($dob), 0, 4) . " 00:00:00"; xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_dob = '" . xtc_date_raw($dateStr) . "' WHERE customers_id ='" . xtc_db_input($customerId) . "' "); $this->verifyAge($dateStr); } } } } } $customerId = $_SESSION['customer_id']; $query = xtc_db_query("SELECT customers_gender, customers_dob, customers_email_address, customers_telephone, customers_fax, customers_vat_id, customers_default_address_id from " . TABLE_CUSTOMERS . " WHERE customers_id ='" . xtc_db_input($customerId) . "' "); $customerXTC = xtc_db_fetch_array($query); if ($customerXTC['customers_vat_id'] == '' && ($order->customer['company'] != '' || $order->billing['company'] != '') || $customerXTC['customers_vat_id'] != '' && ($order->customer['company'] == '' || $order->billing['company'] == '')) { $_SESSION['pi']['vatid'] = $customerXTC['customers_vat_id']; if ($customerXTC['customers_vat_id'] == '') { if ($_POST['pi_vatid_rate'] != '') { $_SESSION['pi']['vatid'] = $_POST['pi_vatid_rate']; xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_vat_id = '" . xtc_db_prepare_input($_SESSION['pi']['vatid']) . "' WHERE customers_id ='" . xtc_db_input($customerId) . "' "); } else { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_VATID_ERROR; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } if ($order->customer['company'] == '') { if ($_POST['pi_company_rate'] != '') { $_SESSION['pi']['company'] = $_POST['pi_company_rate']; $order->customer['company'] = $_POST['pi_company_rate']; xtc_db_query("update " . TABLE_ADDRESS_BOOK . " set entry_company = '" . xtc_db_prepare_input($_SESSION['pi']['company']) . "' WHERE address_book_id ='" . xtc_db_input($customerXTC['customers_default_address_id']) . "' "); } else { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_COMPANY_ERROR; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } } if ($inputNeededFon == true && $inputNeededBirthdate == true) { if ($successDate) { $this->verifyAge($dateStr); } if ($successFon == true && $successDate == true) { xtc_redirect(xtc_href_link("pi_ratepay_rate_checkout_terms.php", '', 'SSL')); } else { if ($successFon == false && $successDate == false) { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_PHONE_AND_BIRTH; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } else { if ($successDate == false) { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_BIRTH; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } else { if ($successFon == false) { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_PHONE; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } } } } else { if ($inputNeededFon) { if ($successFon) { xtc_redirect(xtc_href_link("pi_ratepay_rate_checkout_terms.php", '', 'SSL')); } else { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_PHONE; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } else { if ($inputNeededBirthdate) { if ($successDate) { xtc_redirect(xtc_href_link("pi_ratepay_rate_checkout_terms.php", '', 'SSL')); } else { $_SESSION['pi']['error'] = PI_RATEPAY_RATE_ERROR_BIRTH; xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL')); } } else { xtc_redirect(xtc_href_link("pi_ratepay_rate_checkout_terms.php", '', 'SSL')); } } } } return false; }
/** * Is called after checkout_payment.php is confirmed, * checks if all needed customer data available or * redirect the customer to the checkout_payment.php * with a error message otherwise the user get to the * ratepay terms page * * @global order $order */ public function pre_confirmation_check() { global $order; if (strtoupper($this->code) == 'RATEPAY_SEPA' && !rpGlobals::hasPostEntry($this->code . '_conditions')) { $this->error['CONDITIONS'] = 'MISSING'; } if ($this->_isPhoneNeeded()) { if (rpGlobals::hasPostEntry($this->code . '_phone') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_phone'))) { rpDb::setXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_telephone', rpGlobals::getPostEntry($this->code . '_phone')); $order->customer['telephone'] = rpGlobals::getPostEntry($this->code . '_phone'); } else { $this->error['PHONE'] = 'MISSING'; } } if ($this->_isDobNeeded()) { if (rpGlobals::hasPostEntry($this->code . '_birthdate') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_birthdate'))) { if (!$this->_isDobValid(rpGlobals::getPostEntry($this->code . '_birthdate'))) { $this->error['DOB'] = 'INVALID'; } else { $dob = rpGlobals::getPostEntry($this->code . '_birthdate'); $dateStr = substr(xtc_date_raw($dob), 6, 2) . "." . substr(xtc_date_raw($dob), 4, 2) . "." . substr(xtc_date_raw($dob), 0, 4) . " 00:00:00"; $dateStr = substr(xtc_date_raw($dob), 0, 4) . '-' . substr(xtc_date_raw($dob), 4, 2) . '-' . substr(xtc_date_raw($dob), 6, 2) . ' 00:00:00'; rpDb::setXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_dob', $dateStr); } } else { $this->error['DOB'] = 'MISSING'; } } if ($this->_isCompanyNeeded()) { if (rpGlobals::hasPostEntry($this->code . '_company') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_company'))) { $company = rpGlobals::getPostEntry($this->code . '_company'); $order->customer['company'] = $company; $order->billing['company'] = $company; $dbInput = xtc_db_input(rpDb::getXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_default_address_id')); xtc_db_query("UPDATE " . TABLE_ADDRESS_BOOK . " " . "SET entry_company = '" . xtc_db_prepare_input($company) . "' " . "WHERE address_book_id = '" . $dbInput . "'"); } else { $this->error['VATID'] = 'MISSING'; } } if ($this->_isVatIdNeeded()) { if (rpGlobals::hasPostEntry($this->code . '_vatid') && !rpData::betterEmpty(rpGlobals::getPostEntry($this->code . '_vatid'))) { rpDb::setXtCustomerEntry(rpSession::getSessionEntry('customer_id'), 'customers_vat_id', rpGlobals::getPostEntry($this->code . '_vatid')); } else { $this->error['VATID'] = 'MISSING'; } } if (!$this->_isAdult(rpDb::getCustomersDob(null, rpSession::getSessionEntry('customer_id')))) { $this->error['DOB'] = 'YOUNGER'; } if (!empty($this->error)) { $error = urlencode($this->_getErrorString($this->error)); $url = xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . $error, 'SSL'); xtc_redirect($url); } }
function payment_action() { global $order, $insert_id; if (!isset($insert_id) || $insert_id == '') { $insert_id = $_SESSION['tmp_oID']; } $this->payone->log("(pre-)authorizing {$this->code} payment"); $standard_parameters = parent::_standard_parameters('preauthorization'); $this->personal_data = new Payone_Api_Request_Parameter_Authorization_PersonalData(); parent::_set_customers_standard_params(); // set manually for klarna if ($_SESSION[$this->code]['installment_type'] == 'klarna') { $this->personal_data->setBirthday(xtc_date_raw($_SESSION[$this->code]['installment_customers_dob'])); $this->personal_data->setTelephonenumber($_SESSION[$this->code]['installment_customers_telephone']); } $this->delivery_data = new Payone_Api_Request_Parameter_Authorization_DeliveryData(); parent::_set_customers_shipping_params(); $this->payment_method = new Payone_Api_Request_Parameter_Authorization_PaymentMethod_Financing(); $this->payment_method->setSuccessurl((ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . FILENAME_CHECKOUT_PROCESS . '?' . xtc_session_name() . '=' . xtc_session_id()); $this->payment_method->setBackurl((ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . FILENAME_CHECKOUT_PAYMENT . '?' . xtc_session_name() . '=' . xtc_session_id()); $this->payment_method->setErrorurl((ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . FILENAME_CHECKOUT_PAYMENT . '?' . xtc_session_name() . '=' . xtc_session_id() . '&payment_error=' . $this->code); // set order_id for deleting canceld order $_SESSION['tmp_payone_oID'] = $_SESSION['tmp_oID']; $financingtype = $this->installmenttypes[$_SESSION[$this->code]['installment_type']]; $this->payment_method->setFinancingtype($financingtype); $request_parameters = parent::_request_parameters('fnc'); if (!isset($request_parameters['invoicing'])) { $request_parameters['invoicing'] = $this->_getInvoicingTransaction($insert_id); } $this->params = array_merge($standard_parameters, $request_parameters); $this->builder = new Payone_Builder($this->payone->getPayoneConfig()); parent::_build_service_authentification('fnc'); parent::_parse_response_payone_api(); xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')); }
$entry_company_taxid_error = false; // Check Payment $entry_payment_check_error = false; $entry_payment_paypal_error = false; $entry_payment_bank_name_error = false; $entry_payment_bank_branch_number_error = false; $entry_payment_bank_swift_code_error = false; $entry_payment_bank_account_name_error = false; $entry_payment_bank_account_number_error = false; if (!$error) { $sql_data_array = array('affiliate_firstname' => $a_firstname, 'affiliate_lastname' => $a_lastname, 'affiliate_email_address' => $a_email_address, 'affiliate_payment_check' => $a_payment_check, 'affiliate_payment_paypal' => $a_payment_paypal, 'affiliate_payment_bank_name' => $a_payment_bank_name, 'affiliate_payment_bank_branch_number' => $a_payment_bank_branch_number, 'affiliate_payment_bank_swift_code' => $a_payment_bank_swift_code, 'affiliate_payment_bank_account_name' => $a_payment_bank_account_name, 'affiliate_payment_bank_account_number' => $a_payment_bank_account_number, 'affiliate_street_address' => $a_street_address, 'affiliate_postcode' => $a_postcode, 'affiliate_city' => $a_city, 'affiliate_country_id' => $a_country, 'affiliate_telephone' => $a_telephone, 'affiliate_fax' => $a_fax, 'affiliate_homepage' => $a_homepage, 'affiliate_password' => xtc_encrypt_password($a_password), 'affiliate_agb' => $a_agb); if (ACCOUNT_GENDER == 'true') { $sql_data_array['affiliate_gender'] = $a_gender; } if (ACCOUNT_DOB == 'true') { $sql_data_array['affiliate_dob'] = xtc_date_raw($a_dob); } if (ACCOUNT_COMPANY == 'true') { $sql_data_array['affiliate_company'] = $a_company; $sql_data_array['affiliate_company_taxid'] = $a_company_taxid; } if (ACCOUNT_SUBURB == 'true') { $sql_data_array['affiliate_suburb'] = $a_suburb; } if (ACCOUNT_STATE == 'true') { if ($a_zone_id > 0) { $sql_data_array['affiliate_zone_id'] = $a_zone_id; $sql_data_array['affiliate_state'] = ''; } else { $sql_data_array['affiliate_zone_id'] = '0'; $sql_data_array['affiliate_state'] = $a_state;