Class: PaysecureApiDocumentationLive::RefundApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/paysecure_api_documentation_live/apis/refund_api.rb

Overview

RefundApi

Constant Summary

Constants inherited from BaseApi

BaseApi::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from PaysecureApiDocumentationLive::BaseApi

Instance Method Details

#refundApiResponse

This API is used to initate refund of the purchases that have status as PAID Once the refund has been initiated, the status of the purchase would become REFUND_IN_PROCESS and once the refund has been approved by the bank, the status woud become REFUNDED Purchase ID is mandatory for this API. If due to some reason, the refund has failed, the status would again become PAID

Response Examples

In the response examples you can see instances of both successful and unsuccessful in refund of purchases.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/paysecure_api_documentation_live/apis/refund_api.rb', line 21

def refund
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/api/v1/purchases/657af976c3fceb7beb30eeb4/refund',
                                 Server::SERVER_3)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(RefundPending1.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             RefundErrorException))
    .execute
end