Sha256: 6a932bba3bd7b4079fc876665bf2606bbd6f83d330077cc219739e498a60d4c1

Contents?: true

Size: 1.74 KB

Versions: 4

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

require_relative '../currency/deserializer'
require_relative '../department/deserializer'
require_relative '../bill_payment_line_item/deserializer'

module LedgerSync
  module Ledgers
    module QuickBooksOnline
      class BillPayment
        class Deserializer < QuickBooksOnline::Deserializer
          id

          amount :amount,
                 hash_attribute: 'TotalAmt'

          references_one :currency,
                         hash_attribute: :CurrencyRef,
                         deserializer: Currency::Deserializer

          attribute 'vendor.ledger_id',
                    hash_attribute: 'VendorRef.value'

          attribute 'department.ledger_id',
                    hash_attribute: 'DepartmentRef.value'

          attribute 'account.ledger_id',
                    hash_attribute: 'APAccountRef.value'

          attribute :reference_number,
                    hash_attribute: 'DocNumber'

          attribute :memo,
                    hash_attribute: 'PrivateNote'

          attribute :exchange_rate,
                    hash_attribute: 'ExchangeRate'

          date :transaction_date,
               hash_attribute: 'TxnDate'

          mapping :payment_type,
                  hash_attribute: 'PayType',
                  hash: BillPayment::PAYMENT_TYPES.invert

          attribute 'credit_card_account.ledger_id',
                    hash_attribute: 'CreditCardPayment.CCAccountRef.value'

          attribute 'bank_account.ledger_id',
                    hash_attribute: 'CheckPayment.BankAccountRef.value'

          references_many :line_items,
                          hash_attribute: 'Line',
                          deserializer: BillPaymentLineItem::Deserializer
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.4.4 lib/ledger_sync/ledgers/quickbooks_online/bill_payment/deserializer.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/quickbooks_online/bill_payment/deserializer.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/quickbooks_online/bill_payment/deserializer.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/quickbooks_online/bill_payment/deserializer.rb