/** * @param StripeException $e * @return CardDeclinedException|IncorrectNumberException|InvalidCvcException|InvalidExpiryMonthException|InvalidExpiryYearException|StripeException */ protected function handleError(StripeException $e) { if ($e->getType() == "card_error") { switch ($e->getCardErrorCode()) { case "incorrect_number": return new IncorrectNumberException($e); case "card_declined": return new CardDeclinedException($e); case "invalid_expiry_month": return new InvalidExpiryMonthException($e); case "invalid_expiry_year": return new InvalidExpiryYearException($e); case "invalid_cvc": return new InvalidCvcException($e); default: return $e; } } return $e; }
public function __construct(StripeException $e) { parent::__construct($e->getMessage(), $e->getStatus(), $e->getCardErrorCode(), $e->getParam(), $e); }