Card.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Stripe\Error;
  3. class Card extends Base
  4. {
  5. public function __construct(
  6. $message,
  7. $stripeParam,
  8. $stripeCode,
  9. $httpStatus,
  10. $httpBody,
  11. $jsonBody,
  12. $httpHeaders = null
  13. ) {
  14. parent::__construct($message, $httpStatus, $httpBody, $jsonBody, $httpHeaders);
  15. $this->stripeParam = $stripeParam;
  16. // TODO: once Error\Base accepts the error code as an argument, pass it
  17. // in the call to parent::__construct() and stop setting it here.
  18. $this->stripeCode = $stripeCode;
  19. // This one is not like the others because it was added later and we're
  20. // trying to do our best not to change the public interface of this class'
  21. // constructor.
  22. // TODO: make this a proper constructor argument in the next major
  23. // release.
  24. $this->declineCode = isset($jsonBody["error"]["decline_code"]) ? $jsonBody["error"]["decline_code"] : null;
  25. }
  26. public function getDeclineCode()
  27. {
  28. return $this->declineCode;
  29. }
  30. public function getStripeParam()
  31. {
  32. return $this->stripeParam;
  33. }
  34. }