Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Faker\Provider\fr_FR;
4
 
5
class Payment extends \Faker\Provider\Payment
6
{
7
    /**
8
     * Value Added Tax (VAT)
9
     *
10
     * @example 'FR12123456789', ('spaced') 'FR 12 123 456 789'
11
     *
12
     * @see http://ec.europa.eu/taxation_customs/vies/faq.html?locale=en#item_11
13
     * @see http://www.iecomputersystems.com/ordering/eu_vat_numbers.htm
14
     * @see http://en.wikipedia.org/wiki/VAT_identification_number
15
     *
16
     * @param bool $spacedNationalPrefix
17
     *
18
     * @return string VAT Number
19
     */
20
    public function vat($spacedNationalPrefix = true)
21
    {
22
        $siren = Company::siren(false);
23
        $key = (12 + 3 * ($siren % 97)) % 97;
24
        $pattern = "%s%'.02d%s";
25
 
26
        if ($spacedNationalPrefix) {
27
            $siren = trim(chunk_split($siren, 3, ' '));
28
            $pattern = "%s %'.02d %s";
29
        }
30
 
31
        return sprintf($pattern, 'FR', $key, $siren);
32
    }
33
 
34
    /**
35
     * International Bank Account Number (IBAN)
36
     *
37
     * @see http://en.wikipedia.org/wiki/International_Bank_Account_Number
38
     *
39
     * @param string $prefix      for generating bank account number of a specific bank
40
     * @param string $countryCode ISO 3166-1 alpha-2 country code
41
     * @param int    $length      total length without country code and 2 check digits
42
     *
43
     * @return string
44
     */
45
    public static function bankAccountNumber($prefix = '', $countryCode = 'FR', $length = null)
46
    {
47
        return static::iban($countryCode, $prefix, $length);
48
    }
49
}