lib/ledger_sync/adaptors/test/expense/operations/update.rb in ledger_sync-1.1.1 vs lib/ledger_sync/adaptors/test/expense/operations/update.rb in ledger_sync-1.1.2

- old
+ new

@@ -4,51 +4,21 @@ module Expense module Operations class Update < Operation::Update class Contract < LedgerSync::Adaptors::Contract params do + required(:external_id).maybe(:string) required(:ledger_id).filled(:string) required(:account).hash(Types::Reference) required(:vendor).hash(Types::Reference) - required(:amount).filled(:integer) required(:currency).filled(:string) required(:memo).filled(:string) required(:payment_type).filled(:string) required(:transaction_date).filled(:date?) required(:exchange_rate).maybe(:float) required(:line_items).array(Types::Reference) + required(:reference_number).filled(:string) end - end - - private - - def operate - ledger_resource_data = adaptor.find( - resource: 'purchase', - id: resource.ledger_id - ) - response = adaptor.post( - resource: 'purchase', - payload: merge_into(from: local_resource_data, to: ledger_resource_data) - ) - - success(response: response) - end - - def local_resource_data - { - 'amount' => resource.amount, - 'currency' => resource.currency, - 'account_id' => resource.account.ledger_id, - 'vendor_id' => resource.vendor.ledger_id, - 'line_items' => resource.line_items.map do |line_item| - { - 'account_id' => line_item.account&.ledger_id, - 'Amount' => line_item.amount / 100.0, - 'description' => line_item.description - } - end - } end end end end end