Sha256: 3eb9c3ee527fd553def0b4280787791a643c22dfd0a5b0d33e2e9542578e3645

Contents?: true

Size: 904 Bytes

Versions: 7

Compression:

Stored size: 904 Bytes

Contents

module Conekta
  class Charge < Resource
    include Conekta::Operations::Find
    include Conekta::Operations::Where
    include Conekta::Operations::Create
    include Conekta::Operations::CustomAction

    attr_accessor :livemode, :amount, :created_at, :currency, :description,
                  :reference_id, :failure_code, :failure_message, :fee,
                  :monthly_installments, :device_fingerprint, :status,
                  :exchange_rate, :foreign_currency, :amount_in_foreign_currency,
                  :checkout_id, :checkout_order_count

    # Usage: charge_reference.capture(2000)
    def capture(capture_amount=nil)
      params = { 'amount' => (capture_amount || self.amount) }
      custom_action(:post, 'capture', params)
    end

    def refund(params=nil)
      params = { 'amount' => (params || self.amount) }
      custom_action(:post, 'refund', params)
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
conekta-2.6.0 lib/conekta/charge.rb
conekta-tiempometa-2.4.2 lib/conekta/charge.rb
conekta-2.5.0 lib/conekta/charge.rb
conekta-2.4.2 lib/conekta/charge.rb
conekta-2.4.1 lib/conekta/charge.rb
conekta-2.4.0 lib/conekta/charge.rb
conekta-2.3.0 lib/conekta/charge.rb