Class: CyberSourceMergedSpec::MicroformIntegrationController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/controllers/microform_integration_controller.rb

Overview

MicroformIntegrationController

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_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from CyberSourceMergedSpec::BaseController

Instance Method Details

#generate_capture_context(generate_capture_context_request) ⇒ ApiResponse

This API is used to generate the Capture Context data structure for the Microform Integration. Microform is a browser-based acceptance solution that allows a seller to capture payment information is a secure manner from their website. For more information about Flex Microform transactions, see the [Flex Developer Guides Page](https://developer.cybersource.com/api/developer-guides/dita-flex/SAF lexibleToken.html). For examples on how to integrate Flex Microform within your webpage please see our GitHub Flex Samples This API is a server-to-server API to generate the capture context that can be used to initiate instance of microform on a acceptance page. The capture context is a digitally signed JWT that provides authentication, one-time keys, and the target origin to the Microform Integration application. The availability of API features for a merchant may depend on the portfolio configuration and may need to be enabled at the portfolio level before they can be added to merchant accounts. Required parameter: TODO: type description here

Parameters:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cyber_source_merged_spec/controllers/microform_integration_controller.rb', line 28

def generate_capture_context(generate_capture_context_request)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/microform/v2/sessions',
                                 Server::DEFAULT)
               .body_param(new_parameter(generate_capture_context_request)
                            .is_required(true))
               .header_param(new_parameter('application/json; charset=utf-8', key: 'content-type'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:deserialize_primitive_types))
                .deserialize_into(proc do |response| response&.to_s end)
                .is_api_response(true)
                .is_primitive_response(true)
                .local_error('default',
                             'Error retrieving key.',
                             GenerateCaptureContextException))
    .execute
end