Sha256: 5752287fa4d7cac6425b4b4b514a9aae6ceab015699016c116b898ca13c854b0

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

module PagarMe
  class Transaction < TransactionCommon
    alias :charge :create

    def split_rules
      PagarMe::Request.get( url 'split_rules' ).call
    end

    def antifraud_analyses
      PagarMe::Request.get( url 'antifraud_analyses' ).call
    end

    def payables
      PagarMe::Request.get( url 'payables' ).call
    end

    def postbacks
      PagarMe::Request.get( url 'postbacks' ).call
    end

    def operations
      PagarMe::Request.get( url 'operations' ).call
    end

    def events
      PagarMe::Request.get( url 'events' ).call
    end

    def collect_payment(params={})
      PagarMe::Request.post(url('collect_payment'), params: params).run
    end

    def capture(params={})
      update PagarMe::Request.post(url('capture'), params: params).run
    end

    def refund(params={})
      update PagarMe::Request.post(url('refund'), params: params).run
    end

    class << self
      alias :charge :create

      def calculate_installments(params)
        PagarMe::Request.get(url('calculate_installments_amount'), query: params).run
      end

      def generate_card_hash
        raise RequestError.new('Invalid Encryption Key') if PagarMe.encryption_key.blank?
        PagarMe::Request.get(url('card_hash_key'), params: { encryption_key: PagarMe.encryption_key }).call
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pagarme-2.4.0 lib/pagarme/resources/transaction.rb
pagarme-2.3.0 lib/pagarme/resources/transaction.rb
pagarme-2.2.3 lib/pagarme/resources/transaction.rb
pagarme-2.2.2 lib/pagarme/resources/transaction.rb
pagarme-2.2.1 lib/pagarme/resources/transaction.rb
pagarme-2.2.0 lib/pagarme/resources/transaction.rb
pagarme-2.1.4 lib/pagarme/resources/transaction.rb