Class: Brightpearl::CustomerPayment

Inherits:
Resource
  • Object
show all
Extended by:
APIOperations::Delete, APIOperations::Post
Defined in:
lib/brightpearl/resources/customer_payment.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Post

post

Methods included from APIOperations::Delete

delete

Methods inherited from Resource

send_request, to_query

Constructor Details

#initialize(ara) ⇒ CustomerPayment

ARA => API Record Array



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/brightpearl/resources/customer_payment.rb', line 30

def initialize(ara)
  @payment_id = ara[0]
  @transaction_ref = ara[1]
  @transaction_code = ara[2]
  @payment_method_code = ara[3]
  @payment_type = ara[4]
  @order_id = ara[5]
  @currency_id = ara[6]
  @currency_code = ara[7]
  @amount_authorized = ara[8]
  @amount_paid = ara[9]
  @expires = ara[10]
  @payment_date = ara[11]
  @created_on = ara[12]
  @journal_id = ara[13]
end

Instance Attribute Details

#amount_authorizedObject

Returns the value of attribute amount_authorized.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def amount_authorized
  @amount_authorized
end

#amount_paidObject

Returns the value of attribute amount_paid.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def amount_paid
  @amount_paid
end

#created_onObject

Returns the value of attribute created_on.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def created_on
  @created_on
end

#currency_codeObject

Returns the value of attribute currency_code.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def currency_code
  @currency_code
end

#currency_idObject

Returns the value of attribute currency_id.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def currency_id
  @currency_id
end

#expiresObject

Returns the value of attribute expires.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def expires
  @expires
end

#journal_idObject

Returns the value of attribute journal_id.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def journal_id
  @journal_id
end

#order_idObject

Returns the value of attribute order_id.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def order_id
  @order_id
end

#payment_dateObject

Returns the value of attribute payment_date.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def payment_date
  @payment_date
end

#payment_idObject

Returns the value of attribute payment_id.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def payment_id
  @payment_id
end

#payment_method_codeObject

Returns the value of attribute payment_method_code.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def payment_method_code
  @payment_method_code
end

#payment_typeObject

Returns the value of attribute payment_type.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def payment_type
  @payment_type
end

#transaction_codeObject

Returns the value of attribute transaction_code.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def transaction_code
  @transaction_code
end

#transaction_refObject

Returns the value of attribute transaction_ref.



7
8
9
# File 'lib/brightpearl/resources/customer_payment.rb', line 7

def transaction_ref
  @transaction_ref
end

Class Method Details

.resource_pathObject



13
14
15
# File 'lib/brightpearl/resources/customer_payment.rb', line 13

def resource_path
  "accounting-service/customer-payment"
end

.search(query_params = {}) ⇒ Object



21
22
23
24
25
26
# File 'lib/brightpearl/resources/customer_payment.rb', line 21

def search(query_params = {})
  response = send_request(path: "accounting-service/customer-payment-search?#{to_query(query_params)}", method: :get)
  return response.merge({
    records: response[:payload]["response"]["results"].map { |item| CustomerPayment.new(item) },
  })
end