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

stripe / stripe-php / 10223419258

02 Aug 2024 11:47PM UTC coverage: 64.761% (-0.09%) from 64.847%
10223419258

Pull #1729

github

web-flow
Merge 9e9c60b3c into d20fbbf25
Pull Request #1729: Update generated code

0 of 7 new or added lines in 2 files covered. (0.0%)

1 existing line in 1 file now uncovered.

3444 of 5318 relevant lines covered (64.76%)

2.27 hits per line

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

0.0
/lib/Tax/Calculation.php
1
<?php
2

3
// File generated from our OpenAPI spec
4

5
namespace Stripe\Tax;
6

7
/**
8
 * A Tax Calculation allows you to calculate the tax to collect from your customer.
9
 *
10
 * Related guide: <a href="https://stripe.com/docs/tax/custom">Calculate tax in your custom payment flow</a>
11
 *
12
 * @property null|string $id Unique identifier for the calculation.
13
 * @property string $object String representing the object's type. Objects of the same type share the same value.
14
 * @property int $amount_total Total amount after taxes in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
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|int $expires_at Timestamp of date at which the tax calculation will expire.
19
 * @property null|\Stripe\Collection<\Stripe\Tax\CalculationLineItem> $line_items The list of items the customer is purchasing.
20
 * @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.
21
 * @property null|\Stripe\StripeObject $ship_from_details The details of the ship from location, such as the address.
22
 * @property null|\Stripe\StripeObject $shipping_cost The shipping cost details for the calculation.
23
 * @property int $tax_amount_exclusive The amount of tax to be collected on top of the line item prices.
24
 * @property int $tax_amount_inclusive The amount of tax already included in the line item prices.
25
 * @property \Stripe\StripeObject[] $tax_breakdown Breakdown of individual tax amounts that add up to the total.
26
 * @property int $tax_date Timestamp of date at which the tax rules and rates in effect applies for the calculation.
27
 */
28
class Calculation extends \Stripe\ApiResource
29
{
30
    const OBJECT_NAME = 'tax.calculation';
31

32
    /**
33
     * Calculates tax based on the input and returns a Tax <code>Calculation</code>
34
     * object.
35
     *
36
     * @param null|array $params
37
     * @param null|array|string $options
38
     *
39
     * @throws \Stripe\Exception\ApiErrorException if the request fails
40
     *
41
     * @return \Stripe\Tax\Calculation the created resource
42
     */
43
    public static function create($params = null, $options = null)
×
44
    {
45
        self::_validateParams($params);
×
46
        $url = static::classUrl();
×
47

48
        list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
×
49
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
50
        $obj->setLastResponse($response);
×
51

52
        return $obj;
×
53
    }
54

55
    /**
56
     * Retrieves a Tax <code>Calculation</code> object, if the calculation hasn’t
57
     * expired.
58
     *
59
     * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
60
     * @param null|array|string $opts
61
     *
62
     * @throws \Stripe\Exception\ApiErrorException if the request fails
63
     *
64
     * @return \Stripe\Tax\Calculation
65
     */
NEW
66
    public static function retrieve($id, $opts = null)
×
67
    {
NEW
68
        $opts = \Stripe\Util\RequestOptions::parse($opts);
×
NEW
69
        $instance = new static($id, $opts);
×
NEW
70
        $instance->refresh();
×
71

NEW
72
        return $instance;
×
73
    }
74

75
    /**
76
     * @param string $id
77
     * @param null|array $params
78
     * @param null|array|string $opts
79
     *
80
     * @throws \Stripe\Exception\ApiErrorException if the request fails
81
     *
82
     * @return \Stripe\Collection<\Stripe\Tax\CalculationLineItem> list of calculation line items
83
     */
84
    public static function allLineItems($id, $params = null, $opts = null)
×
85
    {
86
        $url = static::resourceUrl($id) . '/line_items';
×
87
        list($response, $opts) = static::_staticRequest('get', $url, $params, $opts);
×
88
        $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
×
89
        $obj->setLastResponse($response);
×
90

91
        return $obj;
×
92
    }
93
}
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