Class: CyberSourceMergedSpec::CaptureController
- Inherits:
-
BaseController
- Object
- BaseController
- CyberSourceMergedSpec::CaptureController
- Defined in:
- lib/cyber_source_merged_spec/controllers/capture_controller.rb
Overview
CaptureController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#capture_payment(capture_payment_request, id) ⇒ ApiResponse
Include the payment ID in the POST request to capture the payment amount.
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
#capture_payment(capture_payment_request, id) ⇒ ApiResponse
Include the payment ID in the POST request to capture the payment amount. TODO: type description here previous payment request. This ID links the capture to the payment.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cyber_source_merged_spec/controllers/capture_controller.rb', line 15 def capture_payment(capture_payment_request, id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/pts/v2/payments/{id}/captures', Server::DEFAULT) .body_param(new_parameter(capture_payment_request) .is_required(true)) .template_param(new_parameter(id, key: 'id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(PtsV2PaymentsCapturesPost201Response.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid request.', PtsV2PaymentsCapturesPost400ResponseException) .local_error('502', 'Unexpected system error or system timeout.', PtsV2PaymentsCapturesPost502ResponseException)) .execute end |