Class: EwayRapid::Message::RefundProcess::CancelAuthorisationMsgProcess

Inherits:
Object
  • Object
show all
Includes:
EwayRapid::Message::RestProcess
Defined in:
lib/eway_rapid/message/process/refund_process.rb

Overview

cancel authorisation message process

Class Method Summary collapse

Methods included from EwayRapid::Message::RestProcess

#do_get, #do_post

Class Method Details

.create_request(refund) ⇒ CancelAuthorisationRequest

Parameters:

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/eway_rapid/message/process/refund_process.rb', line 39

def self.create_request(refund)
  set_refund(refund)
  request = CancelAuthorisationRequest.new

  # @type [InternalModels::RefundDetails]
  refund_detail = refund.refund_details
  unless refund_detail
    fail 'Refund detail has been null'
  end
  request.transaction_id = refund_detail.original_transaction_id
  request
end

.get_refundModels::Refund

Returns:



70
71
72
# File 'lib/eway_rapid/message/process/refund_process.rb', line 70

def self.get_refund
  @refund
end

.make_result(response) ⇒ RefundResponse

Parameters:

  • response (String)

Returns:



58
59
60
61
62
# File 'lib/eway_rapid/message/process/refund_process.rb', line 58

def self.make_result(response)
  cancel_response = CancelAuthorisationResponse.from_json(response)
  converter = Convert::Response::CancelAuthorisationToRefund.new(get_refund)
  converter.do_convert(cancel_response)
end

.send_request(url, api_key, password, request) ⇒ Object



52
53
54
# File 'lib/eway_rapid/message/process/refund_process.rb', line 52

def self.send_request(url, api_key, password, request)
  CancelAuthorisationMsgProcess.new.do_post(url, api_key, password, request)
end

.set_refund(refund) ⇒ Object

Parameters:



65
66
67
# File 'lib/eway_rapid/message/process/refund_process.rb', line 65

def self.set_refund(refund)
  @refund = refund
end