Class: ForestAdminDatasourceMambuPayments::Collections::Transaction

Inherits:
BaseCollection
  • Object
show all
Defined in:
lib/forest_admin_datasource_mambu_payments/collections/transaction.rb

Constant Summary collapse

ManyToOneSchema =
ForestAdminDatasourceToolkit::Schema::Relations::ManyToOneSchema
ENUM_DIRECTION =
%w[debit credit].freeze

Constants inherited from BaseCollection

BaseCollection::BOOL_OPS, BaseCollection::ColumnSchema, BaseCollection::DATE_OPS, BaseCollection::ForestException, BaseCollection::ID_OPS, BaseCollection::Leaf, BaseCollection::NUMBER_OPS, BaseCollection::Operators, BaseCollection::STRING_OPS

Instance Method Summary collapse

Methods inherited from BaseCollection

#aggregate, client_resource, #fetch_by_ids, #list

Constructor Details

#initialize(datasource) ⇒ Transaction

Returns a new instance of Transaction.



10
11
12
13
14
15
# File 'lib/forest_admin_datasource_mambu_payments/collections/transaction.rb', line 10

def initialize(datasource)
  super(datasource, 'MambuTransaction')
  define_schema
  define_relations
  reconcile_filter_operators!
end

Instance Method Details

#serialize(record) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/forest_admin_datasource_mambu_payments/collections/transaction.rb', line 17

def serialize(record)
  a = attrs_of(record)
  {
    'id' => a['id'],
    'object' => a['object'],
    'connected_account_id' => a['connected_account_id'],
    'category' => a['category'],
    'direction' => a['direction'],
    'amount' => a['amount'],
    'currency' => a['currency'],
    'description' => a['description'],
    'structured_reference' => a['structured_reference'],
    'value_date' => a['value_date'],
    'booking_date' => a['booking_date'],
    'internal_account_id' => a['internal_account_id'],
    'external_account_id' => a['external_account_id'],
    'uetr' => a['uetr'],
    'bank_data' => a['bank_data'],
    'reconciliation_status' => a['reconciliation_status'],
    'reconciled_amount' => a['reconciled_amount'],
    'custom_fields' => a['custom_fields'],
    'created_at' => a['created_at']
  }
end