public function pre_confirmation_check() { if (!rpGlobals::hasPostEntry('rp-account-number') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-account-number'))) { $this->error['ACCOUNT_NUMBER'] = 'MISSING'; } if (strtoupper(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2)) !== 'DE') { if (!rpGlobals::hasPostEntry('rp-sort-code') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-sort-code'))) { $this->error['SORT_CODE'] = 'MISSING'; } } if (strtoupper(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2)) === 'DE') { if (strlen(rpGlobals::getPostEntry('rp-account-number')) !== 22) { $this->error['ACCOUNT_NUMBER'] = 'DE_WRONG_LENGTH'; } if (!is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 2))) { $this->error['ACCOUNT_NUMBER'] = 'IBAN_INVALID'; } } if (strtoupper(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2)) === 'AT') { if (strlen(rpGlobals::getPostEntry('rp-account-number')) !== 20) { $this->error['ACCOUNT_NUMBER'] = 'AT_WRONG_LENGTH'; } if (!is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 2))) { $this->error['ACCOUNT_NUMBER'] = 'IBAN_INVALID'; } } if (is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2))) { if (!is_numeric(rpGlobals::getPostEntry('rp-sort-code'))) { $this->error['SORT_CODE'] = 'NOT_NUMERIC'; } if (strlen(rpGlobals::getPostEntry('rp-sort-code')) !== 8) { $this->error['SORT_CODE'] = 'WRONG_LENGTH'; } if (!is_numeric(rpGlobals::getPostEntry('rp-account-number'))) { $this->error['ACCOUNT_NUMBER'] = 'KONTO_NR_NOT_NUMERIC'; } } if (!is_numeric(substr(rpGlobals::getPostEntry('rp-account-number'), 0, 2))) { if (is_numeric(rpGlobals::getPostEntry('rp-sort-code')) && !rpData::betterEmpty(rpGlobals::getPostEntry('rp-sort-code'))) { $this->error['SORT_CODE'] = 'IBAN_AND_BLZ_PROVIDED'; } } if (!rpGlobals::hasPostEntry('rp-account-holder') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-account-holder'))) { $this->error['ACCOUNT_HOLDER'] = 'MISSING'; } if (!rpGlobals::hasPostEntry('rp-bank-name') || rpData::betterEmpty(rpGlobals::getPostEntry('rp-bank-name'))) { $this->error['BANK_NAME'] = 'MISSING'; } if (empty($this->error)) { $this->setBankData($_POST); } parent::pre_confirmation_check(); }
/** * Is called when the checkout_confirmation.php page is called */ public function confirmation() { $checking = true; if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_total_amount'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_amount'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_interest_amount'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_service_charge'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_annual_percentage_rate'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_monthly_debit_interest'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_number_of_rates'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_rate'))) { $checking = false; } else { if (rpData::betterEmpty(rpSession::getRpSessionEntry('ratepay_rate_last_rate'))) { $checking = false; } } } } } } } } } if (!$checking) { xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=calculation_error', 'SSL')); } }
/** * 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); } }