Sha256: 623112aefece39a70fcd5cb1c5f2ed42bb13a4d161ca5178cb7f41315bd9a327

Contents?: true

Size: 1020 Bytes

Versions: 15

Compression:

Stored size: 1020 Bytes

Contents

require_relative '../resource'

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

    require_relative 'charge'

    require_relative 'payment/cash'
    require_relative 'payment/credit'
    require_relative 'payment/direct'
    require_relative 'payment/stripe'
    require_relative 'payment/complimentary'

    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 :confirmed_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

15 entries across 15 versions & 1 rubygems

Version Path
tickethub-0.3.20 lib/tickethub/supplier/payment.rb
tickethub-0.3.18 lib/tickethub/supplier/payment.rb
tickethub-0.3.17 lib/tickethub/supplier/payment.rb
tickethub-0.3.16 lib/tickethub/supplier/payment.rb
tickethub-0.3.15 lib/tickethub/supplier/payment.rb
tickethub-0.3.14 lib/tickethub/supplier/payment.rb
tickethub-0.3.13 lib/tickethub/supplier/payment.rb
tickethub-0.3.12 lib/tickethub/supplier/payment.rb
tickethub-0.3.11 lib/tickethub/supplier/payment.rb
tickethub-0.3.9 lib/tickethub/supplier/payment.rb
tickethub-0.3.7 lib/tickethub/supplier/payment.rb
tickethub-0.3.6 lib/tickethub/supplier/payment.rb
tickethub-0.3.4 lib/tickethub/supplier/payment.rb
tickethub-0.3.3 lib/tickethub/supplier/payment.rb
tickethub-0.3.2 lib/tickethub/supplier/payment.rb