|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Stripe; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class CreditNote |
|
7
|
|
|
* |
|
8
|
|
|
* @property string $id |
|
9
|
|
|
* @property string $object |
|
10
|
|
|
* @property int $amount |
|
11
|
|
|
* @property string $customer_balance_transaction |
|
12
|
|
|
* @property int $created |
|
13
|
|
|
* @property string $currency |
|
14
|
|
|
* @property string $customer |
|
15
|
|
|
* @property string $invoice |
|
16
|
|
|
* @property bool $livemode |
|
17
|
|
|
* @property string $memo |
|
18
|
|
|
* @property StripeObject $metadata |
|
19
|
|
|
* @property string $number |
|
20
|
|
|
* @property string $pdf |
|
21
|
|
|
* @property string $reason |
|
22
|
|
|
* @property string $refund |
|
23
|
|
|
* @property string $status |
|
24
|
|
|
* @property string $type |
|
25
|
|
|
* |
|
26
|
|
|
* @package Stripe |
|
27
|
|
|
*/ |
|
28
|
|
|
class CreditNote extends ApiResource |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
const OBJECT_NAME = "credit_note"; |
|
32
|
|
|
|
|
33
|
|
|
use ApiOperations\All; |
|
34
|
|
|
use ApiOperations\Create; |
|
35
|
|
|
use ApiOperations\Retrieve; |
|
36
|
|
|
use ApiOperations\Update; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Possible string representations of the credit note reason. |
|
40
|
|
|
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-reason |
|
41
|
|
|
*/ |
|
42
|
|
|
const REASON_DUPLICATE = 'duplicate'; |
|
43
|
|
|
const REASON_FRAUDULENT = 'fraudulent'; |
|
44
|
|
|
const REASON_ORDER_CHANGE = 'order_change'; |
|
45
|
|
|
const REASON_PRODUCT_UNSATISFACTORY = 'product_unsatisfactory'; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Possible string representations of the credit note status. |
|
49
|
|
|
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status |
|
50
|
|
|
*/ |
|
51
|
|
|
const STATUS_ISSUED = 'issued'; |
|
52
|
|
|
const STATUS_VOID = 'void'; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Possible string representations of the credit note type. |
|
56
|
|
|
* @link https://stripe.com/docs/api/credit_notes/object#credit_note_object-status |
|
57
|
|
|
*/ |
|
58
|
|
|
const TYPE_POST_PAYMENT = 'post_payment'; |
|
59
|
|
|
const TYPE_PRE_PAYMENT = 'pre_payment'; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param array|null $params |
|
63
|
|
|
* @param array|string|null $opts |
|
64
|
|
|
* |
|
65
|
|
|
* @return CreditNote The voided credit note. |
|
66
|
|
|
*/ |
|
67
|
|
|
public function voidCreditNote($params = null, $opts = null) |
|
68
|
|
|
{ |
|
69
|
|
|
$url = $this->instanceUrl() . '/void'; |
|
70
|
|
|
list($response, $opts) = $this->_request('post', $url, $params, $opts); |
|
|
|
|
|
|
71
|
|
|
$this->refreshFrom($response, $opts); |
|
72
|
|
|
return $this; |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.