Class: LockstepSdk::TransactionModel

Inherits:
Object
  • Object
show all
Defined in:
lib/lockstep_sdk/models/transaction_model.rb

Overview

Represents detailed transaction information which represents either Invoices, Credit Memos or Payments within the group account.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ TransactionModel

Initialize the TransactionModel using the provided prototype



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 26

def initialize(params = {})
    @group_key = params.dig(:group_key)
    @base_currency_code = params.dig(:base_currency_code)
    @reference_number = params.dig(:reference_number)
    @transaction_id = params.dig(:transaction_id)
    @transaction_status = params.dig(:transaction_status)
    @transaction_type = params.dig(:transaction_type)
    @transaction_sub_type = params.dig(:transaction_sub_type)
    @transaction_date = params.dig(:transaction_date)
    @due_date = params.dig(:due_date)
    @days_past_due = params.dig(:days_past_due)
    @currency_code = params.dig(:currency_code)
    @transaction_amount = params.dig(:transaction_amount)
    @outstanding_amount = params.dig(:outstanding_amount)
    @base_currency_transaction_amount = params.dig(:base_currency_transaction_amount)
    @base_currency_outstanding_amount = params.dig(:base_currency_outstanding_amount)
    @transaction_detail_count = params.dig(:transaction_detail_count)
    @supports_erp_pdf_retrieval = params.dig(:supports_erp_pdf_retrieval)
end

Instance Attribute Details

#base_currency_codeString

Returns The base currency code of the group.

Returns:

  • (String)

    The base currency code of the group.



52
53
54
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 52

def base_currency_code
  @base_currency_code
end

#base_currency_outstanding_amountDouble

Returns The remaining balance of this transaction in the group’s base currency.

Returns:

  • (Double)

    The remaining balance of this transaction in the group’s base currency.



104
105
106
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 104

def base_currency_outstanding_amount
  @base_currency_outstanding_amount
end

#base_currency_transaction_amountDouble

Returns The total value of this transaction, inclusive or all taxes and line items in the group’s base currency.

Returns:

  • (Double)

    The total value of this transaction, inclusive or all taxes and line items in the group’s base currency.



100
101
102
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 100

def base_currency_transaction_amount
  @base_currency_transaction_amount
end

#currency_codeString

Returns The currency code of the transaction.

Returns:

  • (String)

    The currency code of the transaction.



88
89
90
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 88

def currency_code
  @currency_code
end

#days_past_dueInt32

Returns The amount of days past the due date the transaction is left un-closed.

Returns:

  • (Int32)

    The amount of days past the due date the transaction is left un-closed.



84
85
86
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 84

def days_past_due
  @days_past_due
end

#due_dateDate-time

Returns The date when a transaction record is due for payment or completion.

Returns:

  • (Date-time)

    The date when a transaction record is due for payment or completion.



80
81
82
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 80

def due_date
  @due_date
end

#group_keyUuid

Returns Group account transaction is associated with.

Returns:

  • (Uuid)

    Group account transaction is associated with.



48
49
50
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 48

def group_key
  @group_key
end

#outstanding_amountDouble

Returns The remaining balance of this transaction.

Returns:

  • (Double)

    The remaining balance of this transaction.



96
97
98
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 96

def outstanding_amount
  @outstanding_amount
end

#reference_numberString

Returns An additional reference number that is sometimes used to identify a transaction. The meaning of this field is specific to the ERP or accounting system used by the user.

Returns:

  • (String)

    An additional reference number that is sometimes used to identify a transaction. The meaning of this field is specific to the ERP or accounting system used by the user.



56
57
58
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 56

def reference_number
  @reference_number
end

#supports_erp_pdf_retrievalBoolean

Returns Specific transactions have support for pdf retrieval from their respective erp. When this flag is true, an additional call to Invoices/id/pdf or Payments/id/pdf can be made to retrieve a pdf directly from the erp.

Returns:

  • (Boolean)

    Specific transactions have support for pdf retrieval from their respective erp. When this flag is true, an additional call to Invoices/id/pdf or Payments/id/pdf can be made to retrieve a pdf directly from the erp.



112
113
114
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 112

def supports_erp_pdf_retrieval
  @supports_erp_pdf_retrieval
end

#transaction_amountDouble

Returns The total value of this transaction, inclusive or all taxes and line items.

Returns:

  • (Double)

    The total value of this transaction, inclusive or all taxes and line items.



92
93
94
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 92

def transaction_amount
  @transaction_amount
end

#transaction_dateDate-time

Returns The date when a transaction record was reported.

Returns:

  • (Date-time)

    The date when a transaction record was reported.



76
77
78
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 76

def transaction_date
  @transaction_date
end

#transaction_detail_countInt32

Returns The count of items associated to the transaction. Examples: * Number of payments for an invoice. * Number of invoices a payment or credit memo is applied to.

Returns:

  • (Int32)

    The count of items associated to the transaction. Examples: * Number of payments for an invoice. * Number of invoices a payment or credit memo is applied to.



108
109
110
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 108

def transaction_detail_count
  @transaction_detail_count
end

#transaction_idUuid

Returns The unique ID of the transaction record.

Returns:

  • (Uuid)

    The unique ID of the transaction record.



60
61
62
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 60

def transaction_id
  @transaction_id
end

#transaction_statusString

Returns The status of the transaction record. Recognized Invoice status codes are: * ‘Open` - Represents an invoice that is considered open and needs more work to complete * `Closed` - Represents an invoice that is considered closed and resolved Recognized Payment status codes are: * `Open` - Represents an payment that includes some unassigned amount that has not yet been applied to an invoice * `Closed` - Represents an payment where `UnappliedAmount` will be zero.

Returns:

  • (String)

    The status of the transaction record. Recognized Invoice status codes are: * ‘Open` - Represents an invoice that is considered open and needs more work to complete * `Closed` - Represents an invoice that is considered closed and resolved Recognized Payment status codes are: * `Open` - Represents an payment that includes some unassigned amount that has not yet been applied to an invoice * `Closed` - Represents an payment where `UnappliedAmount` will be zero



64
65
66
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 64

def transaction_status
  @transaction_status
end

#transaction_sub_typeString

Returns Additional type categorization of the transaction.

Returns:

  • (String)

    Additional type categorization of the transaction.



72
73
74
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 72

def transaction_sub_type
  @transaction_sub_type
end

#transaction_typeString

Returns The type of the transaction record. Recognized Invoice types are: * ‘AR Invoice` - Represents an invoice sent by Company to the Customer * `AP Invoice` - Represents an invoice sent by Vendor to the Company * `AR Credit Memo` - Represents a credit memo generated by Company given to Customer * `AP Credit Memo` - Represents a credit memo generated by Vendor given to Company Recognized PaymentType values are: * `AR Payment` - A payment made by a Customer to the Company * `AP Payment` - A payment made by the Company to a Vendor.

Returns:

  • (String)

    The type of the transaction record. Recognized Invoice types are: * ‘AR Invoice` - Represents an invoice sent by Company to the Customer * `AP Invoice` - Represents an invoice sent by Vendor to the Company * `AR Credit Memo` - Represents a credit memo generated by Company given to Customer * `AP Credit Memo` - Represents a credit memo generated by Vendor given to Company Recognized PaymentType values are: * `AR Payment` - A payment made by a Customer to the Company * `AP Payment` - A payment made by the Company to a Vendor



68
69
70
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 68

def transaction_type
  @transaction_type
end

Instance Method Details

#as_json(options = {}) ⇒ object

Returns This object as a JSON key-value structure.

Returns:

  • (object)

    This object as a JSON key-value structure



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 116

def as_json(options={})
    {
        'groupKey' => @group_key,
        'baseCurrencyCode' => @base_currency_code,
        'referenceNumber' => @reference_number,
        'transactionId' => @transaction_id,
        'transactionStatus' => @transaction_status,
        'transactionType' => @transaction_type,
        'transactionSubType' => @transaction_sub_type,
        'transactionDate' => @transaction_date,
        'dueDate' => @due_date,
        'daysPastDue' => @days_past_due,
        'currencyCode' => @currency_code,
        'transactionAmount' => @transaction_amount,
        'outstandingAmount' => @outstanding_amount,
        'baseCurrencyTransactionAmount' => @base_currency_transaction_amount,
        'baseCurrencyOutstandingAmount' => @base_currency_outstanding_amount,
        'transactionDetailCount' => @transaction_detail_count,
        'supportsErpPdfRetrieval' => @supports_erp_pdf_retrieval,
    }
end

#to_json(*options) ⇒ String

Returns This object converted to a JSON string.

Returns:

  • (String)

    This object converted to a JSON string



140
141
142
# File 'lib/lockstep_sdk/models/transaction_model.rb', line 140

def to_json(*options)
    "[#{as_json(*options).to_json(*options)}]"
end