public function pre_confirmation_check() { if ($this->_isBankAccountNeeded()) { $accountOwner = trim(Globals::getPostEntry('ratepay_lastschrift_bankaccountowner')); $accountNumber = strtoupper(trim(Globals::getPostEntry('ratepay_lastschrift_bankaccountnumber'))); $bankCode = strtoupper(trim(Globals::getPostEntry('ratepay_lastschrift_bankcode'))); $bankName = trim(Globals::getPostEntry('ratepay_lastschrift_bankname')); $conditions = Globals::getPostEntry('ratepay_lastschrift_conditions'); if ($this->_checkBankAccountOwner($accountOwner)) { $bankAccount['owner'] = $accountOwner; } else { $this->error['ACCOUNTOWNER'] = 'MISSING'; } switch ($this->_checkBankAccountNumber($accountNumber)) { case 'IBAN': $bankAccount['iban'] = $accountNumber; break; case 'ACCNR': $bankAccount['bank-account-number'] = $accountNumber; break; case 'MISSING': $this->error['ACCOUNTNUMBER'] = 'MISSING'; break; case 'WRONG_COUNTRY': $this->error['ACCOUNTNUMBER'] = 'WRONG_COUNTRY'; break; case 'INVALID': $this->error['ACCOUNTNUMBER'] = 'INVALID'; break; } switch ($this->_checkBankCode($bankCode)) { case 'BIC': $bankAccount['bic-swift'] = $bankCode; break; case 'BLZ': $bankAccount['bank-code'] = $bankCode; break; case 'MISSING': if (!$bankAccount['iban'] || $this->country != 'DE') { $this->error['BANKCODE'] = 'MISSING'; } break; case 'INVALID': $this->error['BANKCODE'] = 'INVALID'; break; } if ($this->_checkBankName($bankName)) { $bankAccount['bank-name'] = $bankName; } else { $this->error['BANKNAME'] = 'MISSING'; } if ($bankAccount['bank-account-number'] && $bankAccount['bic-swift'] || $bankAccount['iban'] && $bankAccount['bank-code']) { $this->error['BANKACCOUNTS'] = 'INVALID'; } if ($bankAccount) { $this->setBankData($bankAccount); } if (!$this->_checkBankConditions($conditions)) { $this->error['CONDITIONS'] = 'MISSING'; } } parent::pre_confirmation_check(); }
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(); }