Class: DnaPaymentsPartnerReportingSettlementApIs::SettlementsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/dna_payments_partner_reporting_settlement_ap_is/apis/settlements_api.rb

Overview

SettlementsApi

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

Instance Method Details

#get_settlements(from, to, page: 1, size: 50, search_by: nil, merchant_id: nil, transaction_id: nil) ⇒ ApiResponse

Query settlements for your merchants. Settlement records are available for 365 days; a maximum span of 30 days can be specified per request via from/to. Available for 365 days; a maximum of 30 days can be specified. for 365 days; a maximum of 30 days can be specified. being used in the query. If not supplied, processed-date is used. merchant, allocated by DNA Payments and returned in GET Merchants. Up to 10 IDs may be submitted, comma separated. Specifying an id will only return results for that merchant. specific transaction ID.

Parameters:

  • from (Date)

    Required parameter: Start date for settlements.

  • to (Date)

    Required parameter: End date for settlements. Available

  • page (Integer) (defaults to: 1)

    Optional parameter: Page number required.

  • size (Integer) (defaults to: 50)

    Optional parameter: Number of records to return.

  • search_by (SearchBy) (defaults to: nil)

    Optional parameter: Confirms which date is

  • merchant_id (String) (defaults to: nil)

    Optional parameter: Unique id(s) for the

  • transaction_id (String) (defaults to: nil)

    Optional parameter: Filter settlements by a

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/apis/settlements_api.rb', line 27

def get_settlements(from,
                    to,
                    page: 1,
                    size: 50,
                    search_by: nil,
                    merchant_id: nil,
                    transaction_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v3/partners/settlements',
                                 Server::DEFAULT)
               .query_param(new_parameter(from, key: 'from')
                             .is_required(true))
               .query_param(new_parameter(to, key: 'to')
                             .is_required(true))
               .query_param(new_parameter(page, key: 'page'))
               .query_param(new_parameter(size, key: 'size'))
               .query_param(new_parameter(search_by, key: 'searchBy'))
               .query_param(new_parameter(merchant_id, key: 'merchantId'))
               .query_param(new_parameter(transaction_id, key: 'transactionId'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SettlementsResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'Bad Request — request format is invalid.',
                             ErrorException)
                .local_error('401',
                             'Unauthorized — invalid authentication credentials have been'\
                              ' supplied.',
                             ErrorException)
                .local_error('403',
                             'Forbidden — authorisation has failed due to insufficient'\
                              ' permissions.',
                             ErrorException)
                .local_error('404',
                             'Not Found — the requested resource does not exist.',
                             ErrorException)
                .local_error('422',
                             'Unprocessable Entity — the API cannot complete the requested'\
                              ' action.',
                             ErrorException)
                .local_error('500',
                             'Internal Server Error — an internal error has occurred, please'\
                              ' try again later.',
                             ErrorException)
                .local_error('503',
                             'Service Unavailable — API is temporarily offline for'\
                              ' maintenance, please try again later.',
                             ErrorException))
    .execute
end