Sha256: 90890026bafa6294f4755846e1008f1e145ff8fae2e48e10e425e14522e11e4e

Contents?: true

Size: 1.61 KB

Versions: 6

Compression:

Stored size: 1.61 KB

Contents

# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
  class MarginService < StripeService
    # Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount. A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.
    def create(params = {}, opts = {})
      request(
        method: :post,
        path: "/v1/billing/margins",
        params: params,
        opts: opts,
        base_address: :api
      )
    end

    # Retrieve a list of your margins.
    def list(params = {}, opts = {})
      request(
        method: :get,
        path: "/v1/billing/margins",
        params: params,
        opts: opts,
        base_address: :api
      )
    end

    # Retrieve a margin object with the given ID.
    def retrieve(margin, params = {}, opts = {})
      request(
        method: :get,
        path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }),
        params: params,
        opts: opts,
        base_address: :api
      )
    end

    # Update the specified margin object. Certain fields of the margin object are not editable.
    def update(margin, params = {}, opts = {})
      request(
        method: :post,
        path: format("/v1/billing/margins/%<margin>s", { margin: CGI.escape(margin) }),
        params: params,
        opts: opts,
        base_address: :api
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stripe-13.3.0.pre.beta.1 lib/stripe/services/margin_service.rb
stripe-13.2.0.pre.beta.3 lib/stripe/services/margin_service.rb
stripe-13.2.0.pre.beta.2 lib/stripe/services/margin_service.rb
stripe-13.2.0.pre.beta.1 lib/stripe/services/margin_service.rb
stripe-13.1.0.pre.beta.3 lib/stripe/services/margin_service.rb
stripe-13.1.0.pre.beta.2 lib/stripe/services/margin_service.rb