Class: CyberSourceMergedSpec::VoidController
- Inherits:
-
BaseController
- Object
- BaseController
- CyberSourceMergedSpec::VoidController
- Defined in:
- lib/cyber_source_merged_spec/controllers/void_controller.rb
Overview
VoidController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#mit_void(mit_void_request) ⇒ ApiResponse
This is to void a previous payment, capture, refund, or credit that merchant does not receive a reply(Mostly due to timeout).
-
#void_capture(void_capture_request, id) ⇒ ApiResponse
Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/id/captures](https://developer.cybersource.com/api-ref erence-assets/index.html#payments_capture) API call.
-
#void_credit(void_credit_request, id) ⇒ ApiResponse
Include the credit ID in the POST request to cancel the credit.
-
#void_payment(void_payment_request, id) ⇒ ApiResponse
Void a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/ index.html#payments_payments) API call.
-
#void_refund(void_refund_request, id) ⇒ ApiResponse
Include the refund ID in the POST request to cancel the refund.
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
#mit_void(mit_void_request) ⇒ ApiResponse
This is to void a previous payment, capture, refund, or credit that merchant does not receive a reply(Mostly due to timeout). To use this feature/API, make sure to pass unique value to field - clientReferenceInformation -> transactionId in your payment, capture, refund, or credit API call and use same transactionId in this API request payload to reverse the payment. description here
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/cyber_source_merged_spec/controllers/void_controller.rb', line 158 def mit_void(mit_void_request) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/pts/v2/voids', Server::DEFAULT) .body_param(new_parameter(mit_void_request) .is_required(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(PtsV2VoidsPost200Response.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid request.', PtsV2VoidsPost400ResponseException) .local_error('502', 'Unexpected system error or system timeout.', PtsV2VoidsPost502ResponseException)) .execute end |
#void_capture(void_capture_request, id) ⇒ ApiResponse
Refund a capture API is only used, if you have requested Capture independenlty using [/pts/v2/payments/id/captures](https://developer.cybersource.com/api-ref erence-assets/index.html#payments_capture) API call. Include the capture ID in the POST request to cancel the capture. type description here previous capture request.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/cyber_source_merged_spec/controllers/void_controller.rb', line 56 def void_capture(void_capture_request, id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/pts/v2/captures/{id}/voids', Server::DEFAULT) .body_param(new_parameter(void_capture_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(PtsV2CapturesVoidsPost201Response.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid request.', PtsV2CapturesVoidsPost400ResponseException) .local_error('502', 'Unexpected system error or system timeout.', PtsV2CapturesVoidsPost502ResponseException)) .execute end |
#void_credit(void_credit_request, id) ⇒ ApiResponse
Include the credit ID in the POST request to cancel the credit. type description here previous credit request.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/cyber_source_merged_spec/controllers/void_controller.rb', line 122 def void_credit(void_credit_request, id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/pts/v2/credits/{id}/voids', Server::DEFAULT) .body_param(new_parameter(void_credit_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(PtsV2CreditsVoidsPost201Response.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid request.', PtsV2CreditsVoidsPost400ResponseException) .local_error('502', 'Unexpected system error or system timeout.', PtsV2CreditsVoidsPost502ResponseException)) .execute end |
#void_payment(void_payment_request, id) ⇒ ApiResponse
Void a Payment API is only used, if you have requested Authorization and Capture together in [/pts/v2/payments](https://developer.cybersource.com/api-reference-assets/ index.html#payments_payments) API call. Include the payment ID in the POST request to cancel the payment. type description here previous payment request.
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 |
# File 'lib/cyber_source_merged_spec/controllers/void_controller.rb', line 19 def void_payment(void_payment_request, id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/pts/v2/payments/{id}/voids', Server::DEFAULT) .body_param(new_parameter(void_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(PtsV2PaymentsVoidsPost201Response.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid request.', PtsV2PaymentsVoidsPost400ResponseException) .local_error('502', 'Unexpected system error or system timeout.', PtsV2PaymentsVoidsPost502ResponseException)) .execute end |
#void_refund(void_refund_request, id) ⇒ ApiResponse
Include the refund ID in the POST request to cancel the refund. type description here previous refund request.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/cyber_source_merged_spec/controllers/void_controller.rb', line 89 def void_refund(void_refund_request, id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/pts/v2/refunds/{id}/voids', Server::DEFAULT) .body_param(new_parameter(void_refund_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(PtsV2RefundsVoidsPost201Response.method(:from_hash)) .is_api_response(true) .local_error('400', 'Invalid request.', PtsV2RefundsVoidsPost400ResponseException) .local_error('502', 'Unexpected system error or system timeout.', PtsV2RefundsVoidsPost502ResponseException)) .execute end |