• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-php / 6471862601

10 Oct 2023 04:02PM UTC coverage: 69.665% (-0.5%) from 70.141%
6471862601

push

github

web-flow
Merge pull request #1570 from localheinz/feature/coveralls

Enhancement: Use `coverallsapp/github-action` to report code coverage

2393 of 3435 relevant lines covered (69.67%)

3.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/Exception/CardException.php
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
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc