Sha256: e739535a7ac435066cf79e79ab89af0f07360d35aca65a40be589ad725e88e55

Contents?: true

Size: 937 Bytes

Versions: 13

Compression:

Stored size: 937 Bytes

Contents

require_relative '../resource'

module Tickethub
  class Supplier::Payment < Resource
    path '/supplier/payments'

    require_relative 'payment/card'
    require_relative 'payment/cash'
    require_relative 'payment/credit'
    require_relative 'payment/direct'
    require_relative 'payment/gratuity'

    require_relative 'order'
    require_relative 'user'

    association :order, Supplier::Order
    association :user, Supplier::User

    attribute :amount, type: :money
    attribute :refunded, type: :money
    attribute :currency, type: :currency
    attribute :refunded_at, type: :datetime
    attribute :created_at, type: :datetime
    attribute :updated_at, type: :datetime

    def refund(attributes)
      self.load @endpoint[:refund].post(attributes).decoded
      return true
    rescue Tickethub::ResourceInvalid => err
      self.load Tickethub::Response.new(err.response).decoded
      return false
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tickethub-0.0.14 lib/tickethub/supplier/payment.rb
tickethub-0.0.12 lib/tickethub/supplier/payment.rb
tickethub-0.0.11 lib/tickethub/supplier/payment.rb
tickethub-0.0.10 lib/tickethub/supplier/payment.rb
tickethub-0.0.9 lib/tickethub/supplier/payment.rb
tickethub-0.0.8 lib/tickethub/supplier/payment.rb
tickethub-0.0.7 lib/tickethub/supplier/payment.rb
tickethub-0.0.6 lib/tickethub/supplier/payment.rb
tickethub-0.0.5 lib/tickethub/supplier/payment.rb
tickethub-0.0.4 lib/tickethub/supplier/payment.rb
tickethub-0.0.3 lib/tickethub/supplier/payment.rb
tickethub-0.0.2 lib/tickethub/supplier/payment.rb
tickethub-0.0.1 lib/tickethub/supplier/payment.rb