Sha256: 4048c3e2e9e2f220905f19527a8e05200708fbd124ad39ecc70f014801313673
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
module LedgerSync module Adaptors module Test module Payment module Operations class Create < Operation::Create class Contract < LedgerSync::Adaptors::Contract schema do required(:external_id).maybe(:string) required(:ledger_id).value(:nil) required(:amount).filled(:integer) required(:currency).filled(:string) required(:customer).hash(Types::Reference) end end private def operate response = adaptor.post( resource: 'payment', payload: local_resource_data ) resource.ledger_id = response.dig('id') success( resource: Test::LedgerSerializer.new(resource: resource).deserialize(hash: response), response: response ) end def local_resource_data { 'amount' => resource.amount, 'currency' => resource.currency, 'customer_id' => resource.customer.ledger_id } end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-1.1.3 | lib/ledger_sync/adaptors/test/payment/operations/create.rb |
ledger_sync-1.1.2 | lib/ledger_sync/adaptors/test/payment/operations/create.rb |