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

Add VAT french format #1241

Merged
merged 3 commits into from
Aug 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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