Class: Batches::CloseABatchApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/batches/apis/close_a_batch_api.rb

Overview

CloseABatchApi

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 Batches::BaseApi

Instance Method Details

#close_single_batch(id, authorization, x_gp_version, accept: 'application/json') ⇒ ApiResponse

Closing a batch results in commencement of funding to the merchant all the transactions in that batch. Availability of this feature in production depends on your allowed live configuration. Please contact Global Payments before coding this feature to confirm it will be available to you when you go live. value used to authorize and access the API. Must always begin with the string "Bearer". execute the request. of the message response.

Parameters:

  • id (String)

    Required parameter: TODO: type description here

  • authorization (String)

    Required parameter: Bearer access token

  • x_gp_version (String)

    Required parameter: The version of the API to

  • accept (String) (defaults to: 'application/json')

    Optional parameter: Indicates the expected format

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/batches/apis/close_a_batch_api.rb', line 24

def close_single_batch(id,
                       authorization,
                       x_gp_version,
                       accept: 'application/json')
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/batches/{id}',
                                 Server::DEFAULT)
               .template_param(new_parameter(id, key: 'id')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter(authorization, key: 'Authorization')
                              .is_required(true))
               .header_param(new_parameter(x_gp_version, key: 'X-GP-Version')
                              .is_required(true))
               .header_param(new_parameter(accept, key: 'Accept')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CloseResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request',
                             Batches400ErrorException)
                .local_error('401',
                             'Not Authenticated',
                             Batches401ErrorException)
                .local_error('403',
                             'Forbidden',
                             Batches403ErrorException)
                .local_error('404',
                             'Resource Not Found',
                             APIException)
                .local_error('500',
                             'Internal Server Error',
                             Batches500ErrorException)
                .local_error('501',
                             'Not implemented',
                             Batches501ErrorException)
                .local_error('502',
                             'Bad Gateway',
                             Batches502ErrorException)
                .local_error('504',
                             'Timeout',
                             Batches504ErrorException))
    .execute
end

#post_batches(authorization, x_gp_version, accept: 'application/json', body: nil) ⇒ ApiResponse

Closing a batch results in commencement of funding to the merchant all the transactions in that batch. Here you can close the current open batch without the unique batch id. Availability of this feature in production depends on your allowed live configuration. Please contact Global Payments before coding this feature to confirm it will be available to you when you go live. value used to authorize and access the API. Must always begin with the string "Bearer". execute the request. of the message response. here

Parameters:

  • authorization (String)

    Required parameter: Bearer access token

  • x_gp_version (String)

    Required parameter: The version of the API to

  • accept (String) (defaults to: 'application/json')

    Optional parameter: Indicates the expected format

  • body (BatchesRequest) (defaults to: nil)

    Optional parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/batches/apis/close_a_batch_api.rb', line 88

def post_batches(authorization,
                 x_gp_version,
                 accept: 'application/json',
                 body: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/batches',
                                 Server::DEFAULT)
               .header_param(new_parameter(authorization, key: 'Authorization')
                              .is_required(true))
               .header_param(new_parameter('application/json', key: 'Content-type'))
               .header_param(new_parameter(x_gp_version, key: 'X-GP-Version')
                              .is_required(true))
               .header_param(new_parameter(accept, key: 'Accept'))
               .body_param(new_parameter(body))
               .body_serializer(proc do |param| param.to_json unless param.nil? end))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(CloseResponse.method(:from_hash))
                .is_api_response(true))
    .execute
end