Suppose there are multiple returns (therefore multiple return_authorizations) on same order.
When i th RMA is received/processed, we are sending every single order.return_authorizations to Avalara (1st, 2nd... i th RMAs).
Expected behavior:
When i th RMA is received, i-1, i-2 th, ... RMA should not be considered since they are already committed to Avalara previously
Relevant code in avalara_transaction.rb
order_details.return_authorizations.each do |return_auth|
line = Hash.new
i += 1
line[:LineNo] = "#{i}-RA"
line[:ItemCode] = "Return Authorization"
line[:Qty] = 1
if invoice_detail == "ReturnInvoice" || invoice_detail == "ReturnOrder"
line[:Amount] = -return_auth.amount.to_f
else
line[:Amount] = return_auth.amount.to_f
end
line[:OriginCode] = "Orig"
line[:DestinationCode] = "Dest"
if myusecode
line[:CustomerUsageType] = myusecode.try(:use_code)
end
line[:Description] = return_auth.reason
line[:TaxCode] = ""
AVALARA_TRANSACTION_LOGGER.debug line.to_xml
tax_line_items<<line
end
Suppose there are multiple returns (therefore multiple return_authorizations) on same order. When i th RMA is received/processed, we are sending every single order.return_authorizations to Avalara (1st, 2nd... i th RMAs).
Expected behavior: When i th RMA is received, i-1, i-2 th, ... RMA should not be considered since they are already committed to Avalara previously
Relevant code in avalara_transaction.rb