class Rbvore::Payment

Attributes

amount[RW]
change[RW]
comment[RW]
full_name[RW]
id[RW]
last4[RW]
status[RW]
tip[RW]
type[RW]

Public Class Methods

new(hash) click to toggle source
# File lib/rbvore/payment.rb, line 8
def initialize(hash)
  set_attributes(hash)
end

Public Instance Methods

api() click to toggle source
# File lib/rbvore/payment.rb, line 12
def api
  @api ||= API.new
end
create_3rd_party(location_id:, ticket_id:, auto_close: false, api_key: nil) click to toggle source
# File lib/rbvore/payment.rb, line 16
def create_3rd_party(location_id:, ticket_id:, auto_close: false, api_key: nil)
  response = api.request(
    :post,
    self.class.endpoint(location_id: location_id, ticket_id: ticket_id),
    body: third_party_body(auto_close),
    api_key: api_key,
  )
  raise response.error unless response.success?

  Payment.new(response.json_body)
end
third_party_body(auto_close) click to toggle source
# File lib/rbvore/payment.rb, line 28
def third_party_body(auto_close)
  {
    amount: amount,
    tip: tip,
    tender_type: tender_type,
    auto_close: auto_close,
    comment: comment,
    type: "3rd_party",
  }
end