Sha256: 3da410286531df33e195072e1c93bee0c38b38c3470efd3e20050836beb68e72

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

module Moip2
  class PaymentApi
    attr_reader :client

    def initialize(client)
      @client = client
    end

    def create(order_id, payment)
      Resource::Payment.new client.post("/v2/orders/#{order_id}/payments", payment)
    end

    def show(payment_id)
      Resource::Payment.new client.get("/v2/payments/#{payment_id}")
    end

    def capture(payment_id)
      Resource::Payment.new client.post("/v2/payments/#{payment_id}/capture", nil)
    end

    def void(payment_id)
      Resource::Payment.new client.post("/v2/payments/#{payment_id}/void", nil)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moip2-1.2.1 lib/moip2/payment_api.rb
moip2-1.2.0 lib/moip2/payment_api.rb
moip2-1.1.0 lib/moip2/payment_api.rb
moip2-1.0.0 lib/moip2/payment_api.rb