OAuth
4 years ago
ApiConnectionException.php
4 years ago
ApiErrorException.php
4 years ago
AuthenticationException.php
4 years ago
BadMethodCallException.php
4 years ago
CardException.php
4 years ago
ExceptionInterface.php
4 years ago
IdempotencyException.php
4 years ago
InvalidArgumentException.php
4 years ago
InvalidRequestException.php
4 years ago
PermissionException.php
4 years ago
RateLimitException.php
4 years ago
SignatureVerificationException.php
4 years ago
UnexpectedValueException.php
4 years ago
UnknownApiErrorException.php
4 years ago
CardException.php
85 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Stripe\Exception; |
| 4 | |
| 5 | /** |
| 6 | * CardException is thrown when a user enters a card that can't be charged for |
| 7 | * some reason. |
| 8 | */ |
| 9 | class CardException extends ApiErrorException |
| 10 | { |
| 11 | protected $declineCode; |
| 12 | protected $stripeParam; |
| 13 | |
| 14 | /** |
| 15 | * Creates a new CardException exception. |
| 16 | * |
| 17 | * @param string $message the exception message |
| 18 | * @param null|int $httpStatus the HTTP status code |
| 19 | * @param null|string $httpBody the HTTP body as a string |
| 20 | * @param null|array $jsonBody the JSON deserialized body |
| 21 | * @param null|array|\Stripe\Util\CaseInsensitiveArray $httpHeaders the HTTP headers array |
| 22 | * @param null|string $stripeCode the Stripe error code |
| 23 | * @param null|string $declineCode the decline code |
| 24 | * @param null|string $stripeParam the parameter related to the error |
| 25 | * |
| 26 | * @return CardException |
| 27 | */ |
| 28 | public static function factory( |
| 29 | $message, |
| 30 | $httpStatus = null, |
| 31 | $httpBody = null, |
| 32 | $jsonBody = null, |
| 33 | $httpHeaders = null, |
| 34 | $stripeCode = null, |
| 35 | $declineCode = null, |
| 36 | $stripeParam = null |
| 37 | ) { |
| 38 | $instance = parent::factory($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders, $stripeCode); |
| 39 | $instance->setDeclineCode($declineCode); |
| 40 | $instance->setStripeParam($stripeParam); |
| 41 | |
| 42 | return $instance; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Gets the decline code. |
| 47 | * |
| 48 | * @return null|string |
| 49 | */ |
| 50 | public function getDeclineCode() |
| 51 | { |
| 52 | return $this->declineCode; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Sets the decline code. |
| 57 | * |
| 58 | * @param null|string $declineCode |
| 59 | */ |
| 60 | public function setDeclineCode($declineCode) |
| 61 | { |
| 62 | $this->declineCode = $declineCode; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Gets the parameter related to the error. |
| 67 | * |
| 68 | * @return null|string |
| 69 | */ |
| 70 | public function getStripeParam() |
| 71 | { |
| 72 | return $this->stripeParam; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Sets the parameter related to the error. |
| 77 | * |
| 78 | * @param null|string $stripeParam |
| 79 | */ |
| 80 | public function setStripeParam($stripeParam) |
| 81 | { |
| 82 | $this->stripeParam = $stripeParam; |
| 83 | } |
| 84 | } |
| 85 |