Sha256: 1c3fb332655fb091e5d95b4a4683180bd86203f2d52874f36c10d2a27d8ca95c

Contents?: true

Size: 1.5 KB

Versions: 18

Compression:

Stored size: 1.5 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  module Tax
    # A Tax Calculation allows you to calculate the tax to collect from your customer.
    #
    # Related guide: [Calculate tax in your custom payment flow](https://stripe.com/docs/tax/custom)
    class Calculation < APIResource
      extend Stripe::APIOperations::Create

      OBJECT_NAME = "tax.calculation"
      def self.object_name
        "tax.calculation"
      end

      # Calculates tax based on input and returns a Tax Calculation object.
      def self.create(params = {}, opts = {})
        request_stripe_object(
          method: :post,
          path: "/v1/tax/calculations",
          params: params,
          opts: opts
        )
      end

      # Retrieves the line items of a persisted tax calculation as a collection.
      def list_line_items(params = {}, opts = {})
        request_stripe_object(
          method: :get,
          path: format("/v1/tax/calculations/%<calculation>s/line_items", { calculation: CGI.escape(self["id"]) }),
          params: params,
          opts: opts
        )
      end

      # Retrieves the line items of a persisted tax calculation as a collection.
      def self.list_line_items(calculation, params = {}, opts = {})
        request_stripe_object(
          method: :get,
          path: format("/v1/tax/calculations/%<calculation>s/line_items", { calculation: CGI.escape(calculation) }),
          params: params,
          opts: opts
        )
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
stripe-11.7.0 lib/stripe/resources/tax/calculation.rb
stripe-11.7.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-11.6.0 lib/stripe/resources/tax/calculation.rb
stripe-11.4.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-11.3.0 lib/stripe/resources/tax/calculation.rb
stripe-11.3.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-11.2.0 lib/stripe/resources/tax/calculation.rb
stripe-11.1.0 lib/stripe/resources/tax/calculation.rb
stripe-11.1.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-11.0.0 lib/stripe/resources/tax/calculation.rb
stripe-10.15.0 lib/stripe/resources/tax/calculation.rb
stripe-10.15.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-10.14.0 lib/stripe/resources/tax/calculation.rb
stripe-10.14.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-10.13.0 lib/stripe/resources/tax/calculation.rb
stripe-10.13.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb
stripe-10.12.0 lib/stripe/resources/tax/calculation.rb
stripe-10.12.0.pre.beta.1 lib/stripe/resources/tax/calculation.rb