Sha256: 81beb90a57e4b9b24cd3aa18bb413c753fa759854576ca3b65bc433921a39f55

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

module Moip2
  class MultiPaymentApi
    attr_reader :client

    def initialize(client)
      @client = client
    end

    def base_path(multi_order_id)
      "/v2/multiorders/#{multi_order_id}/multipayments"
    end

    def create(multi_order_id, payment)
      Resource::Payment.new client.post(base_path(multi_order_id), payment)
    end

    def show(multi_payment_id)
      Resource::MultiPayment.new client.get("/v2/multipayments/#{multi_payment_id}")
    end

    def capture(multi_payment_id)
      Resource::MultiPayment.new client.post("/v2/multipayments/#{multi_payment_id}/capture", {})
    end

    def void(multi_payment_id)
      Resource::MultiPayment.new client.post("/v2/multipayments/#{multi_payment_id}/void", {})
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moip2-1.3.1 lib/moip2/multi_payment_api.rb
moip2-1.2.1 lib/moip2/multi_payment_api.rb
moip2-1.2.0 lib/moip2/multi_payment_api.rb
moip2-1.1.0 lib/moip2/multi_payment_api.rb