Class: SpreeAvataxOfficial::Transactions::PartialRefundService

Inherits:
Base
  • Object
show all
Defined in:
app/services/spree_avatax_official/transactions/partial_refund_service.rb

Constant Summary

Constants inherited from Base

Base::APP_NAME, Base::APP_VERSION, Base::CONNECTION_OPTIONS, Base::SUCCESS_STATUSES

Instance Method Summary collapse

Instance Method Details

#call(order:, transaction_code:, refund_items:) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/services/spree_avatax_official/transactions/partial_refund_service.rb', line 4

def call(order:, transaction_code:, refund_items:)
  response = send_request(order, transaction_code, refund_items)

  request_result(response, order) do
    unless response.body['id'].to_i.zero?
      create_transaction!(
        code:             response.body['code'],
        order:            order,
        transaction_type: SpreeAvataxOfficial::Transaction::RETURN_INVOICE
      )
    end
  end
end