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

stripe / stripe-php / 9308560111

30 May 2024 08:09PM UTC coverage: 60.343% (-1.0%) from 61.377%
9308560111

Pull #1699

github

web-flow
Merge 73f733810 into 3533dc330
Pull Request #1699: Update generated code for beta

1080 of 1830 new or added lines in 117 files covered. (59.02%)

15 existing lines in 3 files now uncovered.

3486 of 5777 relevant lines covered (60.34%)

2.19 hits per line

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

0.0
/lib/GiftCards/Card.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\GiftCards;
6

7
/**
8
 * A gift card represents a single gift card owned by a customer, including the
9
 * remaining balance, gift card code, and whether or not it is active.
10
 *
11
 * @property string $id Unique identifier for the object.
12
 * @property string $object String representing the object's type. Objects of the same type share the same value.
13
 * @property bool $active Whether this gift card can be used or not.
14
 * @property int $amount_available The amount of funds available for new transactions.
15
 * @property int $amount_held The amount of funds marked as held.
16
 * @property null|string $code Code used to redeem this gift card.
17
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
18
 * @property null|\Stripe\StripeObject $created_by The related Stripe objects that created this gift card.
19
 * @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
20
 * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
21
 * @property null|\Stripe\Collection<\Stripe\GiftCards\Transaction> $transactions Transactions on this gift card.
22
 */
23
class Card extends \Stripe\ApiResource
24
{
25
    const OBJECT_NAME = 'gift_cards.card';
26

27
    use \Stripe\ApiOperations\Update;
28

29
    /**
30
     * Creates a new gift card object.
31
     *
32
     * @param null|array $params
33
     * @param null|array|string $options
34
     *
35
     * @throws \Stripe\Exception\ApiErrorException if the request fails
36
     *
37
     * @return \Stripe\GiftCards\Card the created resource
38
     */
NEW
39
    public static function create($params = null, $options = null)
×
40
    {
NEW
41
        self::_validateParams($params);
×
NEW
42
        $url = static::classUrl();
×
43

NEW
44
        list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
×
NEW
45
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
46
        $obj->setLastResponse($response);
×
47

NEW
48
        return $obj;
×
49
    }
50

51
    /**
52
     * List gift cards for an account.
53
     *
54
     * @param null|array $params
55
     * @param null|array|string $opts
56
     *
57
     * @throws \Stripe\Exception\ApiErrorException if the request fails
58
     *
59
     * @return \Stripe\Collection<\Stripe\GiftCards\Card> of ApiResources
60
     */
NEW
61
    public static function all($params = null, $opts = null)
×
62
    {
NEW
63
        $url = static::classUrl();
×
64

NEW
65
        return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
×
66
    }
67

68
    /**
69
     * Retrieve a gift card by id.
70
     *
71
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
72
     * @param null|array|string $opts
73
     *
74
     * @throws \Stripe\Exception\ApiErrorException if the request fails
75
     *
76
     * @return \Stripe\GiftCards\Card
77
     */
NEW
78
    public static function retrieve($id, $opts = null)
×
79
    {
NEW
80
        $opts = \Stripe\Util\RequestOptions::parse($opts);
×
NEW
81
        $instance = new static($id, $opts);
×
NEW
82
        $instance->refresh();
×
83

NEW
84
        return $instance;
×
85
    }
86

87
    /**
88
     * Update a gift card.
89
     *
90
     * @param string $id the ID of the resource to update
91
     * @param null|array $params
92
     * @param null|array|string $opts
93
     *
94
     * @throws \Stripe\Exception\ApiErrorException if the request fails
95
     *
96
     * @return \Stripe\GiftCards\Card the updated resource
97
     */
NEW
98
    public static function update($id, $params = null, $opts = null)
×
99
    {
NEW
100
        self::_validateParams($params);
×
NEW
101
        $url = static::resourceUrl($id);
×
102

NEW
103
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
NEW
104
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
NEW
105
        $obj->setLastResponse($response);
×
106

NEW
107
        return $obj;
×
108
    }
109

110
    /**
111
     * @param null|array $params
112
     * @param null|array|string $opts
113
     *
114
     * @throws \Stripe\Exception\ApiErrorException if the request fails
115
     *
116
     * @return \Stripe\GiftCards\Card the validated card
117
     */
118
    public static function validate($params = null, $opts = null)
×
119
    {
120
        $url = static::classUrl() . '/validate';
×
121
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
122
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
123
        $obj->setLastResponse($response);
×
124

125
        return $obj;
×
126
    }
127
}
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

© 2024 Coveralls, Inc