Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1241 from baptistedonaux/add-vat-french-format
Browse files Browse the repository at this point in the history
Add VAT french format
  • Loading branch information
fzaninotto authored Aug 7, 2017
2 parents cb3bcad + 904d977 commit a0f4fa0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,15 @@ echo $faker->siren; // 082 250 104
echo $faker->siret; // 347 355 708 00224
```

### `Faker\Provider\fr_FR\Payment`

```php
<?php

// Generates a random VAT
echo $faker->vat; // FR 12 123 456 789
```

### `Faker\Provider\fr_FR\Person`

```php
Expand Down
20 changes: 20 additions & 0 deletions src/Faker/Provider/fr_FR/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@

class Payment extends \Faker\Provider\Payment
{
/**
* Value Added Tax (VAT)
*
* @example 'FR12123456789', ('spaced') 'FR 12 123 456 789'
*
* @see http://ec.europa.eu/taxation_customs/vies/faq.html?locale=en#item_11
* @see http://www.iecomputersystems.com/ordering/eu_vat_numbers.htm
* @see http://en.wikipedia.org/wiki/VAT_identification_number
*
* @param bool $spacedNationalPrefix
*
* @return string VAT Number
*/
public function vat($spacedNationalPrefix = true)
{
$prefix = ($spacedNationalPrefix) ? "FR " : "FR";

return sprintf("%s%s%s%s", $prefix, self::randomNumber(2, true), $this->siren($spacedNationalPrefix));
}

/**
* International Bank Account Number (IBAN)
* @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
Expand Down

0 comments on commit a0f4fa0

Please sign in to comment.