Class: EwayRapid::Message::CustomerProcess::CustDirectUpdateMsgProcess

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

Overview

Create customer with direct payment method message process

Class Method Summary collapse

Methods included from RestProcess

#do_get, #do_post

Class Method Details

.create_request(input) ⇒ DirectPaymentRequest

Parameters:

Returns:



152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/eway_rapid/message/process/customer_process.rb', line 152

def self.create_request(input)
  request = DirectPaymentRequest.new
  converter = Convert::CustomerToInternalCustomer.new
  payment = InternalModels::Payment.new
  payment.total_amount = 0
  request.payment = payment
  request.customer = converter.do_convert(input)
  request.customer_ip = input.customer_device_ip
  request.method = Constants::UPDATE_TOKEN_CUSTOMER_METHOD
  request.transaction_type = Enums::TransactionType::MOTO
  request
end

.make_result(response) ⇒ CreateCustomerResponse

Parameters:

  • response (String)

Returns:



175
176
177
178
179
# File 'lib/eway_rapid/message/process/customer_process.rb', line 175

def self.make_result(response)
  direct_response = DirectPaymentResponse.from_json(response)
  converter = Convert::Response::DirectPaymentToCreateCust.new
  converter.do_convert(direct_response)
end

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

Parameters:



169
170
171
# File 'lib/eway_rapid/message/process/customer_process.rb', line 169

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