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

stripe / stripe-php / 9308609267

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

push

github

web-flow
Merge pull request #1699 from stripe/latest-codegen-beta

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/Tax/Transaction.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Tax;
6

7
/**
8
 * A Tax Transaction records the tax collected from or refunded to your customer.
9
 *
10
 * Related guide: <a href="https://stripe.com/docs/tax/custom#tax-transaction">Calculate tax in your custom payment flow</a>
11
 *
12
 * @property string $id Unique identifier for the transaction.
13
 * @property string $object String representing the object's type. Objects of the same type share the same value.
14
 * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
15
 * @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>.
16
 * @property null|string $customer The ID of an existing <a href="https://stripe.com/docs/api/customers/object">Customer</a> used for the resource.
17
 * @property \Stripe\StripeObject $customer_details
18
 * @property null|\Stripe\Collection<\Stripe\Tax\TransactionLineItem> $line_items The tax collected or refunded, by line item.
19
 * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
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 string $reference A custom unique identifier, such as 'myOrder_123'.
22
 * @property null|\Stripe\StripeObject $reversal If <code>type=reversal</code>, contains information about what was reversed.
23
 * @property null|\Stripe\StripeObject $ship_from_details The details of the ship from location, such as the address.
24
 * @property null|\Stripe\StripeObject $shipping_cost The shipping cost details for the transaction.
25
 * @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
26
 * @property string $type If <code>reversal</code>, this transaction reverses an earlier transaction.
27
 */
28
class Transaction extends \Stripe\ApiResource
29
{
30
    const OBJECT_NAME = 'tax.transaction';
31

32
    const TYPE_REVERSAL = 'reversal';
33
    const TYPE_TRANSACTION = 'transaction';
34

35
    /**
36
     * Retrieves a Tax <code>Transaction</code> object.
37
     *
38
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
39
     * @param null|array|string $opts
40
     *
41
     * @throws \Stripe\Exception\ApiErrorException if the request fails
42
     *
43
     * @return \Stripe\Tax\Transaction
44
     */
NEW
45
    public static function retrieve($id, $opts = null)
×
46
    {
NEW
47
        $opts = \Stripe\Util\RequestOptions::parse($opts);
×
NEW
48
        $instance = new static($id, $opts);
×
NEW
49
        $instance->refresh();
×
50

NEW
51
        return $instance;
×
52
    }
53

54
    /**
55
     * @param null|array $params
56
     * @param null|array|string $opts
57
     *
58
     * @throws \Stripe\Exception\ApiErrorException if the request fails
59
     *
60
     * @return \Stripe\Tax\Transaction the created transaction
61
     */
62
    public static function createFromCalculation($params = null, $opts = null)
×
63
    {
64
        $url = static::classUrl() . '/create_from_calculation';
×
65
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
66
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
67
        $obj->setLastResponse($response);
×
68

69
        return $obj;
×
70
    }
71

72
    /**
73
     * @param null|array $params
74
     * @param null|array|string $opts
75
     *
76
     * @throws \Stripe\Exception\ApiErrorException if the request fails
77
     *
78
     * @return \Stripe\Tax\Transaction the created transaction
79
     */
80
    public static function createReversal($params = null, $opts = null)
×
81
    {
82
        $url = static::classUrl() . '/create_reversal';
×
83
        list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
×
84
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
85
        $obj->setLastResponse($response);
×
86

87
        return $obj;
×
88
    }
89

90
    /**
91
     * @param string $id
92
     * @param null|array $params
93
     * @param null|array|string $opts
94
     *
95
     * @throws \Stripe\Exception\ApiErrorException if the request fails
96
     *
97
     * @return \Stripe\Collection<\Stripe\Tax\TransactionLineItem> list of transaction line items
98
     */
99
    public static function allLineItems($id, $params = null, $opts = null)
×
100
    {
101
        $url = static::resourceUrl($id) . '/line_items';
×
102
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
103
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
104
        $obj->setLastResponse($response);
×
105

106
        return $obj;
×
107
    }
108
}
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