/** * Extracts the BC from an IBAN * * @param IBAN $iban * * @throws \InvalidArgumentException When the supplied IBAN is not from Switzerland */ public static function fromIBAN(IBAN $iban) { if ($iban->getCountry() !== 'CH') { throw new \InvalidArgumentException('BC can only be extracted from Swiss IBANs.'); } return new self(substr($iban->normalize(), 4, 5)); }
function calc($land, $kontonummer, $bankleitzahl, $ibanField, $bicField) { if ($kontonummer == "" or $bankleitzahl == "") { Red::alertD("Bitte tragen Sie Bankleitzahl und Kontonummer ein"); } $url = "http://www.iban.de/iban-berechnen.html"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0', 'Referer: http://www.iban.de/iban-berechnen.html', 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8', 'X-Requested-With: XMLHttpRequest')); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "ibanrechnerCountry={$land}&ibanrechnerBlz={$bankleitzahl}&ibanrechnerKonto={$kontonummer}&ibanToolkit=ibanrechner"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); $I = new IBAN(trim(str_replace("Die IBAN lautet: ", "", strip_tags($result)))); $iban = $I->MachineFormat(); $url = "https://www.s-bausparkasse.at/portal/if_ajax.asp"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "mode=calc.ibanbic.listofbic&cuid=&alt_iban=&iban={$iban}&rechnername=IBAN%2FBIC-Rechner¤tpageid=87&berechnungsdaten=&autocalc=&getresult=&country={$land}&bank={$bankleitzahl}&account=" . str_pad($kontonummer, 10, "0", STR_PAD_LEFT)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); curl_close($ch); $ex = explode("&&&", $result); $ex[0] = str_replace("listofbic==", "", strip_tags(trim($ex[0]))); $ex[1] = str_replace("iban==", "", trim($ex[1])); $T = new HTMLTable(3, "Gefundene Ergebnisse"); $T->weight("light"); $T->maxHeight(400); $T->useForSelection(false); $T->setColWidth(1, 20); $T->addHeaderRow(array("", "BIC", "IBAN")); foreach (explode("\n", $ex[0]) as $bic) { $B = new Button("Diese Kombination verwenden", "arrow_right", "iconic"); $T->addRow(array($B, trim($bic), $ex[1])); $T->addRowEvent("click", "\$j('[name={$ibanField}]').val('{$ex['1']}'); \$j('[name={$bicField}]').val('" . trim($bic) . "'); " . OnEvent::closePopup("IBANCalc")); } echo $T; #echo "<pre>"; #echo htmlentities(print_r($ex, true)); #echo($result); #echo "</pre>"; }
# Loop through the registry's examples, validating foreach ($countries as $countrycode) { # instantiate $myCountry = new IBANCountry($countrycode); # start section print "[{$countrycode}: " . $myCountry->Name() . "]\n"; # output remaining country properties print "Is a SEPA member? "; if ($myCountry->IsSEPA()) { print "Yes"; } else { print "No"; } print ".\n"; # get example iban $myIban = new IBAN($myCountry->IBANExample()); # output example iban properties one by one print "Example IBAN: " . $myIban->HumanFormat() . "\n"; print " - country " . $myIban->Country() . "\n"; print " - checksum " . $myIban->Checksum() . "\n"; print " - bban " . $myIban->BBAN() . "\n"; print " - bank " . $myIban->Bank() . "\n"; print " - branch " . $myIban->Branch() . "\n"; print " - account " . $myIban->Account() . "\n"; # output all properties #$parts = $myIban->Parts(); #print_r($parts); # verify print "\nChecking validity... "; if ($myIban->Verify()) { print "IBAN {$myIban->iban} is valid.\n";
/** * Check IBAN number informations for a bank account. * * @param Account $account A bank account * @return boolean True if informations are valid, false otherwise */ function checkIbanForAccount($account) { require_once DOL_DOCUMENT_ROOT . '/includes/php-iban/oophp-iban.php'; $iban = new IBAN($account->iban); $check = $iban->Verify(); if ($check) { return true; } else { return false; } }
public function validate_fields() { if (!$this->is_available() || !isset($_POST['payment_method']) || $_POST['payment_method'] != $this->id) { return; } $iban = isset($_POST['direct_debit_account_iban']) ? wc_clean($_POST['direct_debit_account_iban']) : ''; $holder = isset($_POST['direct_debit_account_holder']) ? wc_clean($_POST['direct_debit_account_holder']) : ''; $bic = isset($_POST['direct_debit_account_bic']) ? wc_clean($_POST['direct_debit_account_bic']) : ''; $country = isset($_POST['billing_country']) ? wc_clean($_POST['billing_country']) : WC()->countries->get_base_country(); if (empty($iban) || empty($holder) || empty($bic)) { wc_add_notice(__('Please insert your SEPA account data.', 'woocommerce-germanized'), 'error'); return false; } // Validate IBAN include_once WC_germanized()->plugin_path() . '/includes/libraries/iban/oophp-iban.php'; $iban_validator = new IBAN($iban); if (!$iban_validator->Verify()) { wc_add_notice(__('Your IBAN seems to be invalid.', 'woocommerce-germanized'), 'error'); } else { if ($iban_validator->Country() != $country) { wc_add_notice(__('Your IBAN\'s country code doesn’t match with your billing country.', 'woocommerce-germanized'), 'error'); } } // Validate BIC if (!preg_match('/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/', $bic)) { wc_add_notice(__('Your BIC seems to be invalid.', 'woocommerce-germanized'), 'error'); } }
// faccio i controlli sul codice postale $rs_pc=gaz_dbi_get_row($gTables['country'],'iso',$form["country"]); $cap= new postal_code; if ($cap->check_postal_code($form["capspe"],$form["country"],$rs_pc['postal_code_length'])) { $msg.='2+'; } if (empty($form["citspe"])) { $msg.='3+'; } if (empty($form["prospe"])) { $msg.='4+'; } if (empty($form["sexper"])) { $msg.='5+'; } $iban= new IBAN; if (!empty($form['iban']) && !$iban->checkIBAN($form['iban'])) { $msg.='6+'; } if (!empty($form['iban']) && (substr($form['iban'],0,2) <> $form['country'])) { $msg.='7+'; } $cf_pi = new check_VATno_TAXcode(); $r_pi = $cf_pi->check_VAT_reg_no($form['pariva'],$form['country']); if(strlen(trim($form['codfis'])) == 11) { $r_cf = $cf_pi->check_VAT_reg_no($form['codfis'],$form['country']); if ($form['sexper'] != 'G') { $r_cf = 'Codice fiscale sbagliato per una persona fisica'; $msg .= '8+'; } } else {
public function Verify($iban = '') { $_iban = str_replace(' ', '', $iban); _iban_load_registry(); return parent::Verify($_iban); }
if (!isset($_POST['ritorno'])) { $_POST['ritorno'] = $_SERVER['HTTP_REFERER']; } if ((isset($_GET['Update']) and !isset($_GET['codice'])) or isset($_POST['Return'])) { header("Location: ".$_POST['ritorno']); exit; } if ((isset($_POST['Insert'])) or (isset($_POST['Update']))) { //se non e' il primo accesso $parse_clfoco=gaz_dbi_parse_post('clfoco'); $form = $parse_clfoco+gaz_dbi_parse_post('anagra'); // Se viene inviata la richiesta di conferma totale ... if (isset($_POST['ins'])) { //validazione IBAN $iban= new IBAN; $msg .= ((empty($form['iban']) || !$iban->checkIBAN($form['iban'])) ? "16+" : '' ); $msg .= ((substr($form['iban'],0,2) != $form['country']) ? "20+" : '' ); //fine validazione IBAN if ($toDo == 'insert') { // e' un inserimento, controllo se il codice esiste $rs_ctrl = $anagrafica->getPartner($admin_aziend['masban']*1000000+$form['codice']); if ($rs_ctrl){ $msg .= "17+"; } } if ($form['codice'] <= 0){ //codice sbagliato <1 $msg .= "18+"; } if (empty($form['ragso1']) && $form['banapp'] <= 0){ //descrizione vuota e senza banca appoggio $msg .= "19+"; }
if ($parent_registrar != '') { print "No (outsources to the wise experts of '" . $parent_registrar . "')\n"; } else { print "Yes.\n"; } # official currency print "Official currency: "; $official_currency = $myCountry->CurrencyISO4217(); if ($official_currency == '') { print "None."; } else { print $official_currency; } print "\n"; # get example iban $myIban = new IBAN($myCountry->IBANExample()); # output example iban properties one by one print "Example IBAN: " . $myIban->HumanFormat() . "\n"; print " - country " . $myIban->Country() . "\n"; print " - checksum " . $myIban->Checksum() . "\n"; print " - bban " . $myIban->BBAN() . "\n"; print " - bank " . $myIban->Bank() . "\n"; print " - branch " . $myIban->Branch() . "\n"; print " - account " . $myIban->Account() . "\n"; $nationalchecksum = $myIban->NationalChecksum(); print " - natcksum " . $nationalchecksum . "\n"; # if a national checksum was present, validate it $supposed_checksum = $myIban->FindNationalChecksum(); if ($supposed_checksum != '') { if ($supposed_checksum != $nationalchecksum) { print " (INVALID! Should be '" . $supposed_checksum . "'!)\n";