Class: ShellSmartPayApi::DigitalPaymentEnablementController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/shell_smart_pay_api/controllers/digital_payment_enablement_controller.rb

Overview

DigitalPaymentEnablementController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent

Constructor Details

This class inherits a constructor from ShellSmartPayApi::BaseController

Instance Method Details

#mpay_v1_tokens_ref_put(body) ⇒ PaymentEnablementResponse

Generates a DPAN and stores the relationship between the Reference ID, DPAN and the real PAN. This method is called during the customer registration process, ahead of any payment. The Reference ID is an identifier chosen by the client system for mobile payment registration. It must be unique in context of the client system, and is the key to obtaining and managing the payment details later. Example:

Parameters:

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/shell_smart_pay_api/controllers/digital_payment_enablement_controller.rb', line 18

def mpay_v1_tokens_ref_put(body)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/PaymentEnablement/v1/ref',
                                 Server::SHELL)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oAuthTokenPost')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PaymentEnablementResponse.method(:from_hash))
                .local_error('400',
                             'Error Occurred. The server cannot or will not process the'\
                              ' request due to an apparent client error (e.g., malformed'\
                              ' request syntax, invalid request message).',
                             PaymentEnablementErrorResponseException)
                .local_error('401',
                             'Unauthorized. The request has not been applied because it'\
                              ' lacks valid authentication credentials for the target resource'\
                              '.',
                             APIException)
                .local_error('403',
                             'Forbidden. The server understood the request but refuses to'\
                              ' authorize it.',
                             APIException)
                .local_error('404',
                             'Not Found. The origin server did not find a current'\
                              ' representation for the target resource or is not willing to'\
                              ' disclose that one exists.',
                             APIException)
                .local_error('500',
                             'Internal Server Error. The server encountered an unexpected'\
                              ' condition that prevented it from fulfilling the request.',
                             APIException))
    .execute
end