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' require_relative 'charge/service' association :service_charge, Supplier::Charge::Service 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