Sha256: 7a3e550def340b943832ab678dfcc939b35a492ab1e6e41c6811e4e154aa4ccc
Contents?: true
Size: 795 Bytes
Versions: 1
Compression:
Stored size: 795 Bytes
Contents
# encoding: utf-8 require 'openssl' require 'base64' require File.join(File.dirname(__FILE__), '..', 'pagarme') module PagarMe class Transaction < TransactionCommon # server requests methods def to_hash { :amount => self.amount, :payment_method => self.payment_method, :installments => self.installments, :card_hash => (self.payment_method == 'credit_card' ? self.card_hash : nil), :postback_url => self[:postback_url], :customer => (self.customer) ? self.customer.to_hash : nil } end def charge validation_error = self[:card_hash] ? nil : validate self.card_hash = generate_card_hash unless self[:card_hash] create end def refund request = PagarMe::Request.new(self.url + '/refund', 'POST') response = request.run update(response) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pagarme-1.0 | lib/pagarme/transaction.rb |