Sha256: d618008b3b4380a96cb6e75316a1eb83922ea29baeab490cfe8e83850e7f3045

Contents?: true

Size: 811 Bytes

Versions: 5

Compression:

Stored size: 811 Bytes

Contents

# encoding: utf-8
require 'openssl'
require 'base64'
require File.join(File.dirname(__FILE__), '..', 'pagarme')

module PagarMe
  class Transaction < TransactionCommon
    def self.calculate_installments(params)
      request = PagarMe::Request.new('/transactions/calculate_installments_amount', 'GET')
      request.parameters.merge!(params)
      response = request.run
      response
    end

    def charge
      create
    end

	def capture(params={})
	  request = PagarMe::Request.new(self.url + '/capture', 'POST')
	  request.parameters.merge!(params)
	  response = request.run
	  update(response)
	end

    def refund(params={})
      request = PagarMe::Request.new(self.url + '/refund', 'POST')
	  request.parameters.merge!(params)
      response = request.run
      update(response)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pagarme-1.10.0 lib/pagarme/transaction.rb
pagarme-1.9.9 lib/pagarme/transaction.rb
pagarme-1.9.8 lib/pagarme/transaction.rb
pagarme-1.9.7 lib/pagarme/transaction.rb
pagarme-1.9.6 lib/pagarme/transaction.rb