1
0
mirror of https://github.com/fzaninotto/Faker.git synced 2025-03-19 06:49:50 +01:00

moved bank account numbers from Company to Payment provider

This commit is contained in:
John Was 2013-09-29 13:18:00 +02:00
parent 931f1779de
commit 27d02663e5
38 changed files with 506 additions and 406 deletions

View File

@ -97,6 +97,14 @@ Each of the generator properties (like `name`, `address`, and `lorem`) are calle
company // 'Bogan-Treutel'
companySuffix // 'and Sons'
### `Faker\Provider\Payment`
creditCardType // 'MasterCard'
creditCardNumber // '4485480221084675'
creditCardExpirationDate // 04/13
creditCardExpirationDateString // '04/13'
creditCardDetails // array('MasterCard', '4485480221084675', 'Aleksander Nowak', '04/13')
### `Faker\Provider\Lorem`
word // 'aut'
@ -713,6 +721,18 @@ echo $faker->regonLocal; // "15346111382836"
```
### `Faker\Provider\pl_PL\Payment`
```php
<?php
// Generates a random bank name
echo $faker->bank; // "Narodowy Bank Polski"
// Generates a random bank account number
echo $faker->bankAccountNumber; // "PL14968907563953822118075816"
```
## License
Faker is released under the MIT Licence. See the bundled LICENSE file for details.

View File

@ -32,6 +32,13 @@ namespace Faker;
* @property string company
* @property string companySuffix
*
* @property string creditCardType
* @property string creditCardNumber
* @property string creditCardExpirationDate
* @property string creditCardExpirationDateString
* @property string creditCardDetails
* @property string bankAccountNumber
*
* @property string word
* @method string words
* @method string sentence

View File

@ -10,73 +10,6 @@ class Company extends \Faker\Provider\Base
protected static $companySuffix = array('Ltd');
/**
* @var array list of IBAN formats, source: @link http://www.swift.com/dsp/resources/documents/IBAN_Registry.txt
*/
protected static $ibanFormats = array(
'AD' => array(array('n', 4), array('n', 4), array('c', 12)),
'AE' => array(array('n', 3), array('n', 16)),
'AL' => array(array('n', 8), array('c', 16)),
'AT' => array(array('n', 5), array('n', 11)),
'AZ' => array(array('a', 4), array('c', 20)),
'BA' => array(array('n', 3), array('n', 3), array('n', 8), array('n', 2)),
'BE' => array(array('n', 3), array('n', 7), array('n', 2)),
'BG' => array(array('a', 4), array('n', 4), array('n', 2), array('c', 8)),
'BH' => array(array('a', 4), array('c', 14)),
'BR' => array(array('n', 8), array('n', 5), array('n', 10), array('a', 1), array('c', 1)),
'CH' => array(array('n', 5), array('c', 12)),
'CR' => array(array('n', 3), array('n', 14)),
'CY' => array(array('n', 3), array('n', 5), array('c', 16)),
'CZ' => array(array('n', 4), array('n', 6), array('n', 10)),
'DE' => array(array('n', 8), array('n', 10)),
'DK' => array(array('n', 4), array('n', 9), array('n', 1)),
'DO' => array(array('c', 4), array('n', 20)),
'EE' => array(array('n', 2), array('n', 2), array('n', 11), array('n', 1)),
'ES' => array(array('n', 4), array('n', 4), array('n', 1), array('n', 1), array('n', 10)),
'FR' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)),
'GB' => array(array('a', 4), array('n', 6), array('n', 8)),
'GE' => array(array('a', 2), array('n', 16)),
'GI' => array(array('a', 4), array('c', 15)),
'GR' => array(array('n', 3), array('n', 4), array('c', 16)),
'GT' => array(array('c', 4), array('c', 20)),
'HR' => array(array('n', 7), array('n', 10)),
'HU' => array(array('n', 3), array('n', 4), array('n', 1), array('n', 15), array('n', 1)),
'IE' => array(array('a', 4), array('n', 6), array('n', 8)),
'IL' => array(array('n', 3), array('n', 3), array('n', 13)),
'IS' => array(array('n', 4), array('n', 2), array('n', 6), array('n', 10)),
'IT' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)),
'KW' => array(array('a', 4), array('c', 22)),
'KZ' => array(array('n', 3), array('c', 13)),
'LB' => array(array('n', 4), array('c', 20)),
'LI' => array(array('n', 5), array('c', 12)),
'LT' => array(array('n', 5), array('n', 11)),
'LU' => array(array('n', 3), array('c', 13)),
'LV' => array(array('a', 4), array('c', 13)),
'MC' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)),
'MD' => array(array('c', 2), array('c', 18)),
'ME' => array(array('n', 3), array('n', 13), array('n', 2)),
'MK' => array(array('n', 3), array('c', 10), array('n', 2)),
'MR' => array(array('n', 5), array('n', 5), array('n', 11), array('n', 2)),
'MT' => array(array('a', 4), array('n', 5), array('c', 18)),
'MU' => array(array('a', 4), array('n', 2), array('n', 2), array('n', 12), array('n', 3), array('a', 3)),
'NL' => array(array('a', 4), array('n', 10)),
'NO' => array(array('n', 4), array('n', 6), array('n', 1)),
'PK' => array(array('a', 4), array('c', 16)),
'PL' => array(array('n', 8), array('n', 16)),
'PS' => array(array('a', 4), array('c', 21)),
'PT' => array(array('n', 4), array('n', 4), array('n', 11), array('n', 2)),
'RO' => array(array('a', 4), array('c', 16)),
'RS' => array(array('n', 3), array('n', 13), array('n', 2)),
'SA' => array(array('n', 2), array('c', 18)),
'SE' => array(array('n', 3), array('n', 16), array('n', 1)),
'SI' => array(array('n', 5), array('n', 8), array('n', 2)),
'SK' => array(array('n', 4), array('n', 6), array('n', 10)),
'SM' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)),
'TN' => array(array('n', 2), array('n', 3), array('n', 13), array('n', 2)),
'TR' => array(array('n', 5), array('c', 1), array('c', 16)),
'VG' => array(array('a', 4), array('n', 16)),
);
/**
* @example 'Acme Ltd'
*/
@ -94,77 +27,4 @@ class Company extends \Faker\Provider\Base
{
return static::randomElement(static::$companySuffix);
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param string $prefix for generating bank account number of a specific bank
* @param integer $length total length without country code and 2 check digits
* @return string
*/
protected static function iban($countryCode, $prefix = '', $length = null)
{
$countryCode = strtoupper($countryCode);
$format = !isset(static::$ibanFormats[$countryCode]) ? array() : static::$ibanFormats[$countryCode];
if ($length === null) {
if ($format === null) {
$length = 24;
} else {
$length = 0;
foreach($format as $part) {
list($class, $groupCount) = $part;
$length += $groupCount;
}
}
}
$result = $prefix;
$length -= strlen($prefix);
$nextPart = array_shift($format);
if ($nextPart !== false) {
list($class, $groupCount) = $nextPart;
} else {
$class = 'n';
$groupCount = 0;
}
$groupCount = $nextPart === false ? 0 : $nextPart[1];
for ($i = 0; $i < $length; $i++) {
if ($nextPart !== false && $groupCount-- < 1) {
$nextPart = array_shift($format);
list($class, $groupCount) = $nextPart;
}
switch($class) {
default:
case 'c': $result .= mt_rand(0, 100) <= 50 ? static::randomDigit() : strtoupper(static::randomLetter()); break;
case 'a': $result .= strtoupper(static::randomLetter()); break;
case 'n': $result .= static::randomDigit(); break;
}
}
$result = static::addBankCodeChecksum($result, $countryCode);
$countryNumber = 100 * (ord($countryCode[0])-55) + (ord($countryCode[1])-55);
$tempResult = $result . $countryNumber . '00';
// perform MOD97-10 checksum calculation
$checksum = (int)$tempResult[0];
for ($i = 1; $i < strlen($tempResult); $i++) {
$checksum = (10 * $checksum + (int)$tempResult[$i]) % 97;
}
$checksum = 98 - $checksum;
if ($checksum < 10)
$checksum = '0'.$checksum;
return $countryCode . $checksum . $result;
}
/**
* Calculates a checksum for the national bank and branch code part in the IBAN.
* @param string $iban randomly generated $iban
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @return string IBAN with one character altered to a proper checksum
*/
protected static function addBankCodeChecksum($iban, $countryCode = '')
{
return $iban;
}
}

View File

@ -50,6 +50,73 @@ class Payment extends Base
),
);
/**
* @var array list of IBAN formats, source: @link http://www.swift.com/dsp/resources/documents/IBAN_Registry.txt
*/
protected static $ibanFormats = array(
'AD' => array(array('n', 4), array('n', 4), array('c', 12)),
'AE' => array(array('n', 3), array('n', 16)),
'AL' => array(array('n', 8), array('c', 16)),
'AT' => array(array('n', 5), array('n', 11)),
'AZ' => array(array('a', 4), array('c', 20)),
'BA' => array(array('n', 3), array('n', 3), array('n', 8), array('n', 2)),
'BE' => array(array('n', 3), array('n', 7), array('n', 2)),
'BG' => array(array('a', 4), array('n', 4), array('n', 2), array('c', 8)),
'BH' => array(array('a', 4), array('c', 14)),
'BR' => array(array('n', 8), array('n', 5), array('n', 10), array('a', 1), array('c', 1)),
'CH' => array(array('n', 5), array('c', 12)),
'CR' => array(array('n', 3), array('n', 14)),
'CY' => array(array('n', 3), array('n', 5), array('c', 16)),
'CZ' => array(array('n', 4), array('n', 6), array('n', 10)),
'DE' => array(array('n', 8), array('n', 10)),
'DK' => array(array('n', 4), array('n', 9), array('n', 1)),
'DO' => array(array('c', 4), array('n', 20)),
'EE' => array(array('n', 2), array('n', 2), array('n', 11), array('n', 1)),
'ES' => array(array('n', 4), array('n', 4), array('n', 1), array('n', 1), array('n', 10)),
'FR' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)),
'GB' => array(array('a', 4), array('n', 6), array('n', 8)),
'GE' => array(array('a', 2), array('n', 16)),
'GI' => array(array('a', 4), array('c', 15)),
'GR' => array(array('n', 3), array('n', 4), array('c', 16)),
'GT' => array(array('c', 4), array('c', 20)),
'HR' => array(array('n', 7), array('n', 10)),
'HU' => array(array('n', 3), array('n', 4), array('n', 1), array('n', 15), array('n', 1)),
'IE' => array(array('a', 4), array('n', 6), array('n', 8)),
'IL' => array(array('n', 3), array('n', 3), array('n', 13)),
'IS' => array(array('n', 4), array('n', 2), array('n', 6), array('n', 10)),
'IT' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)),
'KW' => array(array('a', 4), array('c', 22)),
'KZ' => array(array('n', 3), array('c', 13)),
'LB' => array(array('n', 4), array('c', 20)),
'LI' => array(array('n', 5), array('c', 12)),
'LT' => array(array('n', 5), array('n', 11)),
'LU' => array(array('n', 3), array('c', 13)),
'LV' => array(array('a', 4), array('c', 13)),
'MC' => array(array('n', 5), array('n', 5), array('c', 11), array('n', 2)),
'MD' => array(array('c', 2), array('c', 18)),
'ME' => array(array('n', 3), array('n', 13), array('n', 2)),
'MK' => array(array('n', 3), array('c', 10), array('n', 2)),
'MR' => array(array('n', 5), array('n', 5), array('n', 11), array('n', 2)),
'MT' => array(array('a', 4), array('n', 5), array('c', 18)),
'MU' => array(array('a', 4), array('n', 2), array('n', 2), array('n', 12), array('n', 3), array('a', 3)),
'NL' => array(array('a', 4), array('n', 10)),
'NO' => array(array('n', 4), array('n', 6), array('n', 1)),
'PK' => array(array('a', 4), array('c', 16)),
'PL' => array(array('n', 8), array('n', 16)),
'PS' => array(array('a', 4), array('c', 21)),
'PT' => array(array('n', 4), array('n', 4), array('n', 11), array('n', 2)),
'RO' => array(array('a', 4), array('c', 16)),
'RS' => array(array('n', 3), array('n', 13), array('n', 2)),
'SA' => array(array('n', 2), array('c', 18)),
'SE' => array(array('n', 3), array('n', 16), array('n', 1)),
'SI' => array(array('n', 5), array('n', 8), array('n', 2)),
'SK' => array(array('n', 4), array('n', 6), array('n', 10)),
'SM' => array(array('a', 1), array('n', 5), array('n', 5), array('c', 12)),
'TN' => array(array('n', 2), array('n', 3), array('n', 13), array('n', 2)),
'TR' => array(array('n', 5), array('c', 1), array('c', 16)),
'VG' => array(array('a', 4), array('n', 16)),
);
/**
* @return string Returns a credit card vendor name
*
@ -127,4 +194,77 @@ class Payment extends Base
'expirationDate' => $this->creditCardExpirationDateString($valid)
);
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param string $prefix for generating bank account number of a specific bank
* @param integer $length total length without country code and 2 check digits
* @return string
*/
protected static function iban($countryCode, $prefix = '', $length = null)
{
$countryCode = strtoupper($countryCode);
$format = !isset(static::$ibanFormats[$countryCode]) ? array() : static::$ibanFormats[$countryCode];
if ($length === null) {
if ($format === null) {
$length = 24;
} else {
$length = 0;
foreach($format as $part) {
list($class, $groupCount) = $part;
$length += $groupCount;
}
}
}
$result = $prefix;
$length -= strlen($prefix);
$nextPart = array_shift($format);
if ($nextPart !== false) {
list($class, $groupCount) = $nextPart;
} else {
$class = 'n';
$groupCount = 0;
}
$groupCount = $nextPart === false ? 0 : $nextPart[1];
for ($i = 0; $i < $length; $i++) {
if ($nextPart !== false && $groupCount-- < 1) {
$nextPart = array_shift($format);
list($class, $groupCount) = $nextPart;
}
switch($class) {
default:
case 'c': $result .= mt_rand(0, 100) <= 50 ? static::randomDigit() : strtoupper(static::randomLetter()); break;
case 'a': $result .= strtoupper(static::randomLetter()); break;
case 'n': $result .= static::randomDigit(); break;
}
}
$result = static::addBankCodeChecksum($result, $countryCode);
$countryNumber = 100 * (ord($countryCode[0])-55) + (ord($countryCode[1])-55);
$tempResult = $result . $countryNumber . '00';
// perform MOD97-10 checksum calculation
$checksum = (int)$tempResult[0];
for ($i = 1; $i < strlen($tempResult); $i++) {
$checksum = (10 * $checksum + (int)$tempResult[$i]) % 97;
}
$checksum = 98 - $checksum;
if ($checksum < 10)
$checksum = '0'.$checksum;
return $countryCode . $checksum . $result;
}
/**
* Calculates a checksum for the national bank and branch code part in the IBAN.
* @param string $iban randomly generated $iban
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @return string IBAN with one character altered to a proper checksum
*/
protected static function addBankCodeChecksum($iban, $countryCode = '')
{
return $iban;
}
}

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\bg_BG;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\cs_CZ;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -67,17 +67,4 @@ class Company extends \Faker\Provider\Company
{
return static::numerify(static::$pFormat);
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'DK', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Faker\Provider\da_DK;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'DK', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\de_AT;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -12,17 +12,4 @@ class Company extends \Faker\Provider\Company
);
protected static $companySuffix = array('e.G.', 'e.V.', 'GbR', 'GbR', 'OHG mbH', 'GmbH & Co. OHG', 'AG & Co. OHG', 'GmbH', 'GmbH', 'GmbH', 'GmbH', 'AG', 'AG', 'AG', 'AG', 'KG', 'KG', 'KG', 'GmbH & Co. KG', 'GmbH & Co. KG', 'AG & Co. KG', 'Stiftung & Co. KG', 'KGaA', 'GmbH & Co. KGaA', 'AG & Co. KGaA', 'Stiftung & Co. KGaA');
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'DE', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\de_DE;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'DE', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\el_GR;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\en_GB;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -77,17 +77,4 @@ class Company extends \Faker\Provider\Company
return join($result, ' ');
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'ES', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\es_ES;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'ES', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -10,17 +10,4 @@ class Company extends \Faker\Provider\Company
);
protected static $companySuffix = array('ASBL', 'SCS', 'SNC', 'SPRL', 'Associations', 'Entreprise individuelle', 'GEIE', 'GIE', 'SA', 'SCA', 'SCRI', 'SCRL');
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'BE', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\fr_BE;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'BE', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -220,17 +220,4 @@ class Company extends \Faker\Provider\Company
return true;
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'FR', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\fr_FR;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'FR', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -50,17 +50,4 @@ class Company extends \Faker\Provider\Company
{
return static::numerify(static::$vskFormat);
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'IS', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\is_IS;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'IS', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -61,17 +61,4 @@ class Company extends \Faker\Provider\Company
return join($result, ' ');
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'IT', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\it_IT;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'IT', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\lv_LV;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -10,17 +10,4 @@ class Company extends \Faker\Provider\Company
);
protected static $companySuffix = array('VZW', 'Comm.V', 'VOF', 'BVBA', 'EBVBA', 'ESV', 'NV', 'Comm.VA', 'CVOA', 'CVBA', '& Zonen', '& Zn');
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'BE', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\nl_BE;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'BE', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -12,17 +12,4 @@ class Company extends \Faker\Provider\Company
);
protected static $companySuffix = array('VOF', 'CV', 'LLP', 'BV', 'NV', 'IBC', 'CSL', 'EESV', 'SE', 'CV', 'Stichting', '& Zonen', '& Zn');
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'NL', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\nl_NL;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'NL', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -4,84 +4,6 @@ namespace Faker\Provider\pl_PL;
class Company extends \Faker\Provider\Company
{
/**
* @var array list of Polish banks, source: http://www.nbp.pl/banki_w_polsce/ewidencja/ewidencja.html
*/
protected static $banks = array(
'251' => 'Aareal Bank Aktiengesellschaft (Spółka Akcyjna) - Oddział w Polsce',
'249' => 'Alior Bank SA',
'247' => 'Banco Espirito Santo de Investimento, S.A. Spółka Akcyjna Oddział w Polsce',
'238' => 'Banco Mais S.A. (SA) Oddział w Polsce',
'106' => 'Bank BPH SA',
'219' => 'Bank DnB NORD Polska SA',
'203' => 'Bank Gospodarki Żywnościowej SA',
'113' => 'Bank Gospodarstwa Krajowego',
'122' => 'Bank Handlowo - Kredytowy SA (w likwidacji 31.03.92)',
'103' => 'Bank Handlowy w Warszawie SA',
'116' => 'Bank Millennium SA',
'154' => 'Bank Ochrony Środowiska SA',
'260' => 'Bank of China (Luxembourg)S.A. Spółka Akcyjna Oddział w Polsce',
'221' => 'Bank of Tokyo-Mitsubishi UFJ (Polska) SA',
'132' => 'Bank Pocztowy SA',
'124' => 'Bank Polska Kasa Opieki SA',
'193' => 'BANK POLSKIEJ SPÓŁDZIELCZOŚCI SA',
'109' => 'Bank Zachodni WBK SA',
'224' => 'Banque PSA Finance SA Oddział w Polsce',
'160' => 'BNP PARIBAS BANK POLSKA SA',
'235' => 'BNP PARIBAS SA Oddział w Polsce',
'243' => 'BNP Paribas Securities Services SKAOddział w Polsce',
'229' => 'BPI Bank Polskich Inwestycji SA',
'215' => 'BRE Bank Hipoteczny SA',
'114' => 'BRE Bank SA',
'239' => 'CAIXABANK, S.A. (SPÓŁKA AKCYJNA)ODDZIAŁ W POLSCE',
'254' => 'Citibank Europe plc (Publiczna Spółka Akcyjna) Oddział w Polsce',
'194' => 'Credit Agricole Bank Polska SA',
'252' => 'CREDIT SUISSE (LUXEMBOURG) S.A. Spółka Akcyjna, Oddział w Polsce',
'236' => 'Danske Bank A/S SA Oddział w Polsce',
'191' => 'Deutsche Bank PBC SA',
'188' => 'Deutsche Bank Polska SA',
'174' => 'DZ BANK Polska SA',
'241' => 'Elavon Financial Services Limited (Spółka z ograniczoną odpowiedzialnością) Oddział w Polsce',
'147' => 'Euro Bank SA',
'265' => 'EUROCLEAR Bank SA/NV (Spółka Akcyjna) - Oddział w Polsce',
'207' => 'FCE Bank Polska SA',
'214' => 'Fiat Bank Polska SA',
'253' => 'FM Bank SA',
'248' => 'Getin Noble Bank SA',
'128' => 'HSBC Bank Polska SA',
'195' => 'Idea Bank SA',
'255' => 'Ikano Bank GmbH (Sp. z o.o.) Oddział w Polsce',
'262' => 'Industrial and Commercial Bank of China (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce',
'105' => 'ING Bank Śląski SA',
'266' => 'Intesa Sanpaolo S.p.A. Spółka Akcyjna Oddział w Polsce',
'168' => 'INVEST - BANK SA',
'258' => 'J.P. Morgan Europe Limited Sp. z o.o. Oddział w Polsce',
'158' => 'Mercedes-Benz Bank Polska SA',
'130' => 'Meritum Bank ICB SA',
'101' => 'Narodowy Bank Polski',
'256' => 'Nordea Bank AB SA Oddział w Polsce',
'144' => 'NORDEA BANK POLSKA SA',
'232' => 'Nykredit Realkredit A/S SA - Oddział w Polsce',
'189' => 'Pekao Bank Hipoteczny SA',
'187' => 'Polski Bank Przedsiębiorczości SA',
'102' => 'Powszechna Kasa Oszczędności Bank Polski SA',
'200' => 'Rabobank Polska SA',
'175' => 'Raiffeisen Bank Polska SA',
'167' => 'RBS Bank (Polska) SA',
'264' => 'RCI Banque Spółka Akcyjna Oddział w Polsce',
'212' => 'Santander Consumer Bank SA',
'263' => 'Saxo Bank A/S Spółka Akcyjna Oddział w Polsce',
'161' => 'SGB-Bank SA',
'237' => 'Skandinaviska Enskilda Banken AB (SA) - Oddział w Polsce',
'184' => 'Societe Generale SA Oddział w Polsce',
'225' => 'Svenska Handelsbanken AB SA Oddział w Polsce',
'227' => 'Sygma Banque Societe Anonyme (SA) Oddział w Polsce',
'216' => 'Toyota Bank Polska SA',
'257' => 'UBS Limited (spółka z ograniczoną odpowiedzialnością) Oddział w Polsce',
'261' => 'Vanquis Bank Limited (spółka z ograniczoną odpowiedzialnością) Oddział w Polsce',
'213' => 'VOLKSWAGEN BANK POLSKA SA',
);
/*
* Register of the National Economy
* @link http://pl.wikipedia.org/wiki/REGON
@ -132,39 +54,4 @@ class Company extends \Faker\Provider\Company
return implode('', $result);
}
/**
* @example 'Euro Bank SA'
*/
public static function bank()
{
return static::randomElement(static::$banks);
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'PL', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
protected static function addBankCodeChecksum($iban, $countryCode = 'PL')
{
if ($countryCode != "PL" || strlen($iban) <= 8) {
return $iban;
}
$checksum = 0;
$weights = array(7, 1, 3, 9, 7, 1, 3);
for ($i = 0; $i < 7; $i++) {
$checksum += $weights[$i] * (int)$iban[$i];
}
$checksum = $checksum % 10;
return substr($iban, 0, 7) . $checksum . substr($iban, 8);
}
}

View File

@ -0,0 +1,119 @@
<?php
namespace Faker\Provider\pl_PL;
class Payment extends \Faker\Provider\Payment
{
/**
* @var array list of Polish banks, source: http://www.nbp.pl/banki_w_polsce/ewidencja/ewidencja.html
*/
protected static $banks = array(
'251' => 'Aareal Bank Aktiengesellschaft (Spółka Akcyjna) - Oddział w Polsce',
'249' => 'Alior Bank SA',
'247' => 'Banco Espirito Santo de Investimento, S.A. Spółka Akcyjna Oddział w Polsce',
'238' => 'Banco Mais S.A. (SA) Oddział w Polsce',
'106' => 'Bank BPH SA',
'219' => 'Bank DnB NORD Polska SA',
'203' => 'Bank Gospodarki Żywnościowej SA',
'113' => 'Bank Gospodarstwa Krajowego',
'122' => 'Bank Handlowo - Kredytowy SA (w likwidacji 31.03.92)',
'103' => 'Bank Handlowy w Warszawie SA',
'116' => 'Bank Millennium SA',
'154' => 'Bank Ochrony Środowiska SA',
'260' => 'Bank of China (Luxembourg)S.A. Spółka Akcyjna Oddział w Polsce',
'221' => 'Bank of Tokyo-Mitsubishi UFJ (Polska) SA',
'132' => 'Bank Pocztowy SA',
'124' => 'Bank Polska Kasa Opieki SA',
'193' => 'BANK POLSKIEJ SPÓŁDZIELCZOŚCI SA',
'109' => 'Bank Zachodni WBK SA',
'224' => 'Banque PSA Finance SA Oddział w Polsce',
'160' => 'BNP PARIBAS BANK POLSKA SA',
'235' => 'BNP PARIBAS SA Oddział w Polsce',
'243' => 'BNP Paribas Securities Services SKAOddział w Polsce',
'229' => 'BPI Bank Polskich Inwestycji SA',
'215' => 'BRE Bank Hipoteczny SA',
'114' => 'BRE Bank SA',
'239' => 'CAIXABANK, S.A. (SPÓŁKA AKCYJNA)ODDZIAŁ W POLSCE',
'254' => 'Citibank Europe plc (Publiczna Spółka Akcyjna) Oddział w Polsce',
'194' => 'Credit Agricole Bank Polska SA',
'252' => 'CREDIT SUISSE (LUXEMBOURG) S.A. Spółka Akcyjna, Oddział w Polsce',
'236' => 'Danske Bank A/S SA Oddział w Polsce',
'191' => 'Deutsche Bank PBC SA',
'188' => 'Deutsche Bank Polska SA',
'174' => 'DZ BANK Polska SA',
'241' => 'Elavon Financial Services Limited (Spółka z ograniczoną odpowiedzialnością) Oddział w Polsce',
'147' => 'Euro Bank SA',
'265' => 'EUROCLEAR Bank SA/NV (Spółka Akcyjna) - Oddział w Polsce',
'207' => 'FCE Bank Polska SA',
'214' => 'Fiat Bank Polska SA',
'253' => 'FM Bank SA',
'248' => 'Getin Noble Bank SA',
'128' => 'HSBC Bank Polska SA',
'195' => 'Idea Bank SA',
'255' => 'Ikano Bank GmbH (Sp. z o.o.) Oddział w Polsce',
'262' => 'Industrial and Commercial Bank of China (Europe) S.A. (Spółka Akcyjna) Oddział w Polsce',
'105' => 'ING Bank Śląski SA',
'266' => 'Intesa Sanpaolo S.p.A. Spółka Akcyjna Oddział w Polsce',
'168' => 'INVEST - BANK SA',
'258' => 'J.P. Morgan Europe Limited Sp. z o.o. Oddział w Polsce',
'158' => 'Mercedes-Benz Bank Polska SA',
'130' => 'Meritum Bank ICB SA',
'101' => 'Narodowy Bank Polski',
'256' => 'Nordea Bank AB SA Oddział w Polsce',
'144' => 'NORDEA BANK POLSKA SA',
'232' => 'Nykredit Realkredit A/S SA - Oddział w Polsce',
'189' => 'Pekao Bank Hipoteczny SA',
'187' => 'Polski Bank Przedsiębiorczości SA',
'102' => 'Powszechna Kasa Oszczędności Bank Polski SA',
'200' => 'Rabobank Polska SA',
'175' => 'Raiffeisen Bank Polska SA',
'167' => 'RBS Bank (Polska) SA',
'264' => 'RCI Banque Spółka Akcyjna Oddział w Polsce',
'212' => 'Santander Consumer Bank SA',
'263' => 'Saxo Bank A/S Spółka Akcyjna Oddział w Polsce',
'161' => 'SGB-Bank SA',
'237' => 'Skandinaviska Enskilda Banken AB (SA) - Oddział w Polsce',
'184' => 'Societe Generale SA Oddział w Polsce',
'225' => 'Svenska Handelsbanken AB SA Oddział w Polsce',
'227' => 'Sygma Banque Societe Anonyme (SA) Oddział w Polsce',
'216' => 'Toyota Bank Polska SA',
'257' => 'UBS Limited (spółka z ograniczoną odpowiedzialnością) Oddział w Polsce',
'261' => 'Vanquis Bank Limited (spółka z ograniczoną odpowiedzialnością) Oddział w Polsce',
'213' => 'VOLKSWAGEN BANK POLSKA SA',
);
/**
* @example 'Euro Bank SA'
*/
public static function bank()
{
return static::randomElement(static::$banks);
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'PL', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
protected static function addBankCodeChecksum($iban, $countryCode = 'PL')
{
if ($countryCode != "PL" || strlen($iban) <= 8) {
return $iban;
}
$checksum = 0;
$weights = array(7, 1, 3, 9, 7, 1, 3);
for ($i = 0; $i < 7; $i++) {
$checksum += $weights[$i] * (int)$iban[$i];
}
$checksum = $checksum % 10;
return substr($iban, 0, 7) . $checksum . substr($iban, 8);
}
}

View File

@ -63,17 +63,4 @@ class Company extends \Faker\Provider\Company
return join($result, ' ');
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'BR', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\pt_BR;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'BR', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -61,17 +61,4 @@ class Company extends \Faker\Provider\Company
return join($result, ' ');
}
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'SK', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Faker\Provider\sk_SK;
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
* @param string $prefix for generating bank account number of a specific bank
* @param string $countryCode ISO 3166-1 alpha-2 country code
* @param integer $length total length without country code and 2 check digits
* @return string
*/
public static function bankAccountNumber($prefix = '', $countryCode = 'SK', $length = null)
{
return static::iban($countryCode, $prefix, $length);
}
}

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\sr_Cyrl_RS;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\sr_Latn_RS;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\sr_RS;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)

View File

@ -2,7 +2,7 @@
namespace Faker\Provider\tr_TR;
class Company extends \Faker\Provider\Company
class Payment extends \Faker\Provider\Payment
{
/**
* International Bank Account Number (IBAN)