Sha256: 11988f85d30ecdc551d05862394163016a35fd7d9f2047384f598f133455e444

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

module Stripe
  class Order < APIResource
    extend Stripe::APIOperations::Create
    extend Stripe::APIOperations::List
    include Stripe::APIOperations::Save

    OBJECT_NAME = "order".freeze

    custom_method :pay, http_verb: :post
    custom_method :return_order, http_verb: :post, http_path: "returns"

    def pay(params, opts = {})
      resp, opts = request(:post, pay_url, params, opts)
      initialize_from(resp.data, opts)
    end

    def return_order(params, opts = {})
      resp, opts = request(:post, returns_url, params, opts)
      Util.convert_to_stripe_object(resp.data, opts)
    end

    private

    def pay_url
      resource_url + "/pay"
    end

    def returns_url
      resource_url + "/returns"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stripe-4.18.0 lib/stripe/order.rb
stripe-4.17.0 lib/stripe/order.rb