Sha256: 0fc6ed80d4bacc9bd5c6cb22a1cbb7671492e022475238b687922be50629f8b5
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
# frozen_string_literal: true module LedgerSync module Adaptors module QuickBooksOnline module Payment module Operations class Create < Operation::Create class Contract < LedgerSync::Adaptors::Contract params do required(:ledger_id).value(:nil) required(:ledger_id).maybe(:string) required(:amount).filled(:integer) required(:currency).filled(:string) required(:customer).hash do required(:object).filled(:symbol) required(:id).filled(:string) end end end private def operate response = adaptor.post( resource: 'payment', payload: local_resource_data ) resource.ledger_id = response.dig('Id') success(response: response) end def local_resource_data { 'TotalAmt' => resource.amount / 100.0, 'CurrencyRef' => { 'value' => resource.currency }, 'CustomerRef' => { 'value' => resource.customer.ledger_id } } end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.1.1 | lib/ledger_sync/adaptors/quickbooks_online/payment/operations/create.rb |