Sha256: e89ad2817a2ccaafc1230c127cdd53993f5d359679f9873655dcf7909ae17c20
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
module SpreeAvataxOfficial module Transactions class PartialRefundService < SpreeAvataxOfficial::Base 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 private def send_request(order, transaction_code, refund_items) refund_transaction_model = SpreeAvataxOfficial::Transactions::PartialRefundPresenter.new( order: order, refund_items: refund_items, transaction_code: transaction_code ).to_json logger.info(refund_transaction_model) client.create_transaction(refund_transaction_model) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems