Sha256: 5ad537a16c77f79cf14cee337831c888e2cdc176e46359ade2cb68fb7844cf62

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require_relative 'account'
require_relative 'currency'
require_relative 'department'
require_relative 'vendor'
require_relative 'bill_payment_line'
require_relative 'check_payment'
require_relative 'credit_card_payment'

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

      attribute :TotalAmt, type: Type::Integer
      attribute :PrivateNote, type: Type::String
      attribute :TxnDate, type: Type::Date
      attribute :ExchangeRate, type: Type::Float
      attribute :DocNumber, type: Type::String
      attribute :PayType, type: Type::StringFromSet.new(values: PAYMENT_TYPES.keys)

      references_one :APAccount, to: Account
      references_one :Currency, to: Currency
      references_one :Department, to: Department
      references_one :Vendor, to: Vendor

      references_one :CheckPayment, to: CheckPayment
      references_one :CreditCardPayment, to: CreditCardPayment

      references_many :Line, to: BillPaymentLine

      def name
        "Bill Payment: #{self.DocNumber}"
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ledger_sync-quickbooks_online-2.0.0 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-1.0.1 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-1.0.0 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.4.0 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.3.1 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.3.0 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.2.6 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.2.5 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.2.4 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.2.2 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.2.1 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.2.0 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb
ledger_sync-quickbooks_online-0.1.1 lib/ledger_sync/quickbooks_online/resources/bill_payment.rb