Sha256: 480cd74d6eda82e3ba17b60cf5d9461c60c7d2d09b5ca54b16e7e1680d1927af

Contents?: true

Size: 944 Bytes

Versions: 3

Compression:

Stored size: 944 Bytes

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 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
      def calculate_installments(params)
        PagarMe::Request.get(url('calculate_installments_amount'), query: params).run
      end

      alias :charge :create
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pagarme-2.1.2 lib/pagarme/resources/transaction.rb
pagarme-2.1.1 lib/pagarme/resources/transaction.rb
pagarme-2.1.0 lib/pagarme/resources/transaction.rb