Sha256: 93be109fe8507581096a8231b3f0f27aed2ac8e6da2dfe774802c3caf355e442

Contents?: true

Size: 770 Bytes

Versions: 3

Compression:

Stored size: 770 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.query.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

3 entries across 3 versions & 1 rubygems

Version Path
pagarme-2.0.2 lib/pagarme/transaction.rb
pagarme-2.0.1 lib/pagarme/transaction.rb
pagarme-2.0.0 lib/pagarme/transaction.rb