Class: EwayRapid::Message::CustomerProcess::CustDirectPaymentMsgProcess
- Inherits:
-
Object
- Object
- EwayRapid::Message::CustomerProcess::CustDirectPaymentMsgProcess
- 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
- .create_request(input) ⇒ DirectPaymentRequest
- .make_result(response) ⇒ CreateCustomerResponse
- .send_request(url, api_key, password, request) ⇒ String
Methods included from RestProcess
Class Method Details
.create_request(input) ⇒ DirectPaymentRequest
11 12 13 14 15 16 17 18 19 |
# File 'lib/eway_rapid/message/process/customer_process.rb', line 11 def self.create_request(input) request = DirectPaymentRequest.new convert = Convert::CustomerToInternalCustomer.new(false) request.customer = convert.do_convert(input) request.customer_ip = input.customer_device_ip request.method = Constants::CREATE_TOKEN_CUSTOMER_METHOD request.transaction_type = Enums::TransactionType::MOTO request end |
.make_result(response) ⇒ CreateCustomerResponse
42 43 44 45 46 |
# File 'lib/eway_rapid/message/process/customer_process.rb', line 42 def self.make_result(response) direct_payment_response = DirectPaymentResponse.from_json(response) convert = Convert::Response::DirectPaymentToCreateCust.new convert.do_convert(direct_payment_response) end |
.send_request(url, api_key, password, request) ⇒ String
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/eway_rapid/message/process/customer_process.rb', line 26 def self.send_request(url, api_key, password, request) begin CustDirectPaymentMsgProcess.new.do_post(url, api_key, password, request) rescue SocketError => e raise Exceptions::CommunicationFailureException.new(e.) rescue RestClient::Exception => e if e.http_code == 401 || e.http_code == 403 || e.http_code == 404 raise Exceptions::AuthenticationFailureException.new(e.) else raise Exceptions::SystemErrorException.new(e.) end end end |