1 | <?php namespace Arcanedev\Stripe\Exceptions; |
||
9 | class CardException extends StripeException |
||
10 | { |
||
11 | /* ------------------------------------------------------------------------------------------------ |
||
12 | | Properties |
||
13 | | ------------------------------------------------------------------------------------------------ |
||
14 | */ |
||
15 | protected $declineCode; |
||
16 | |||
17 | /* ------------------------------------------------------------------------------------------------ |
||
18 | | Constructor |
||
19 | | ------------------------------------------------------------------------------------------------ |
||
20 | */ |
||
21 | /** |
||
22 | * CardException constructor. |
||
23 | * |
||
24 | * @param string $message |
||
25 | * @param int $code |
||
26 | * @param string|null $type |
||
27 | * @param string|null $stripeCode |
||
28 | * @param string|null $httpBody |
||
29 | * @param array $jsonBody |
||
30 | * @param array $params |
||
31 | * @param array $headers |
||
32 | */ |
||
33 | 8 | public function __construct( |
|
34 | $message, |
||
35 | $code, |
||
36 | $type, |
||
37 | $stripeCode, |
||
38 | $httpBody, |
||
39 | array $jsonBody, |
||
40 | array $params = [], |
||
41 | array $headers = [] |
||
42 | ) { |
||
43 | 8 | parent::__construct( |
|
44 | 8 | $message, $code, $type, $stripeCode, $httpBody, $jsonBody, $params, $headers |
|
45 | ); |
||
46 | |||
47 | // This one is not like the others because it was added later and we're trying to do our best |
||
48 | // not to change the public interface of this class' constructor. |
||
49 | // We should consider changing its implementation on the next major version bump of this library. |
||
50 | 8 | $this->setDeclineCode( |
|
51 | 8 | isset($jsonBody['error']['decline_code']) ? $jsonBody['error']['decline_code'] : null |
|
52 | ); |
||
53 | 8 | } |
|
54 | |||
55 | /* ------------------------------------------------------------------------------------------------ |
||
56 | | Getters & Setters |
||
57 | | ------------------------------------------------------------------------------------------------ |
||
58 | */ |
||
59 | public function getDeclineCode() |
||
63 | |||
64 | 8 | private function setDeclineCode($declineCode) |
|
70 | } |
||
71 |