Sha256: 9e88550176890717f4504ae4f6d60491543344be6dc39cf75dad039117bbc583

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

require_relative 'account'
require_relative 'currency'
require_relative 'department'
require_relative 'vendor'
require_relative 'bill_payment_line_item'

module LedgerSync
  module Ledgers
    module QuickBooksOnline
      class BillPayment < QuickBooksOnline::Resource
        PAYMENT_TYPES = {
          'cash' => 'Cash',
          'check' => 'Check',
          'credit_card' => 'CreditCard'
        }.freeze

        attribute :amount, type: Type::Integer
        attribute :memo, type: Type::String
        attribute :transaction_date, type: Type::Date
        attribute :exchange_rate, type: Type::Float
        attribute :reference_number, type: Type::String
        attribute :payment_type, type: Type::StringFromSet.new(values: PAYMENT_TYPES.keys)

        references_one :account, to: Account
        references_one :currency, to: Currency
        references_one :department, to: Department
        references_one :vendor, to: Vendor

        references_one :bank_account, to: Account
        references_one :credit_card_account, to: Account

        references_many :line_items, to: BillPaymentLineItem

        def name
          "Bill Payment: #{reference_number}"
        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/resources/bill_payment.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/quickbooks_online/resources/bill_payment.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/quickbooks_online/resources/bill_payment.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/quickbooks_online/resources/bill_payment.rb