|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stripe; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class TaxId |
|
7
|
|
|
* |
|
8
|
|
|
* @package Stripe |
|
9
|
|
|
* |
|
10
|
|
|
* @property string $id |
|
11
|
|
|
* @property string $object |
|
12
|
|
|
* @property string $country |
|
13
|
|
|
* @property int $created |
|
14
|
|
|
* @property string $customer |
|
15
|
|
|
* @property bool $livemode |
|
16
|
|
|
* @property string $type |
|
17
|
|
|
* @property string $value |
|
18
|
|
|
* @property mixed $verification |
|
19
|
|
|
*/ |
|
20
|
|
|
class TaxId extends ApiResource |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
const OBJECT_NAME = "tax_id"; |
|
24
|
|
|
|
|
25
|
|
|
use ApiOperations\Delete; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Possible string representations of a tax id's type. |
|
29
|
|
|
* @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-type |
|
30
|
|
|
*/ |
|
31
|
|
|
const TYPE_AU_ABN = 'au_abn'; |
|
32
|
|
|
const TYPE_EU_VAT = 'eu_vat'; |
|
33
|
|
|
const TYPE_IN_GST = 'in_gst'; |
|
34
|
|
|
const TYPE_NO_VAT = 'no_vat'; |
|
35
|
|
|
const TYPE_NZ_GST = 'nz_gst'; |
|
36
|
|
|
const TYPE_UNKNOWN = 'unknown'; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Possible string representations of the verification status. |
|
40
|
|
|
* @link https://stripe.com/docs/api/customer_tax_ids/object#tax_id_object-verification |
|
41
|
|
|
*/ |
|
42
|
|
|
const VERIFICATION_STATUS_PENDING = 'pending'; |
|
43
|
|
|
const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable'; |
|
44
|
|
|
const VERIFICATION_STATUS_UNVERIFIED = 'unverified'; |
|
45
|
|
|
const VERIFICATION_STATUS_VERIFIED = 'verified'; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return string The API URL for this tax id. |
|
49
|
|
|
*/ |
|
50
|
|
|
public function instanceUrl() |
|
51
|
|
|
{ |
|
52
|
|
|
$id = $this['id']; |
|
53
|
|
|
$customer = $this['customer']; |
|
54
|
|
|
if (!$id) { |
|
55
|
|
|
throw new Error\InvalidRequest( |
|
56
|
|
|
"Could not determine which URL to request: class instance has invalid ID: $id", |
|
57
|
|
|
null |
|
58
|
|
|
); |
|
59
|
|
|
} |
|
60
|
|
|
$id = Util\Util::utf8($id); |
|
61
|
|
|
$customer = Util\Util::utf8($customer); |
|
62
|
|
|
|
|
63
|
|
|
$base = Customer::classUrl(); |
|
64
|
|
|
$customerExtn = urlencode($customer); |
|
65
|
|
|
$extn = urlencode($id); |
|
66
|
|
|
return "$base/$customerExtn/tax_ids/$extn"; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @param array|string $_id |
|
71
|
|
|
* @param array|string|null $_opts |
|
72
|
|
|
* |
|
73
|
|
|
* @throws \Stripe\Error\InvalidRequest |
|
74
|
|
|
*/ |
|
75
|
|
|
public static function retrieve($_id, $_opts = null) |
|
|
|
|
|
|
76
|
|
|
{ |
|
77
|
|
|
$msg = "Tax Ids cannot be accessed without a customer ID. " . |
|
78
|
|
|
"Retrieve a Tax Id using Customer::retrieveTaxId('tax_id') instead."; |
|
79
|
|
|
throw new Error\InvalidRequest($msg, null); |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.