Class: EwayRapid::Message::Convert::Response::DirectRefundToRefundResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/message/convert/response/direct_refund_to_refund_response.rb

Instance Method Summary collapse

Instance Method Details

#do_convert(response) ⇒ RefundResponse

Parameters:

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/eway_rapid/message/convert/response/direct_refund_to_refund_response.rb', line 9

def do_convert(response)
  refund = Models::Refund.new
  refund.refund_details = response.refund

  cust_convert = InternalCustomerToCustomer.new
  refund.customer = cust_convert.do_convert(response.customer)

  refund_response = RefundResponse.new
  refund_response.errors = response.errors.split(/\s*,\s*/) if response.errors
  refund_response.refund = refund

  trans_status_convert = DirectRefundToTransStatus.new
  refund_response.transaction_status = trans_status_convert.do_convert(response)
  refund_response
end