Class: DnaPaymentsPartnerReportingSettlementApIs::MerchantsApi

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

Overview

MerchantsApi

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_merchants_v1ApiResponse

Returns the merchants available to the authenticated partner. Deprecated — use V2 (/v2/partners/merchants) instead.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/apis/merchants_api.rb', line 12

def get_merchants_v1
  warn 'Endpoint get_merchants_v1 in MerchantsApi is deprecated'
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/partners/merchants',
                                 Server::DEFAULT)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(MerchantV1.method(:from_hash))
                .is_api_response(true)
                .is_response_array(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))
    .execute
end

#get_merchants_v2(processor: nil, page: 1, size: 1000) ⇒ ApiResponse

Returns the merchants available to the authenticated partner, including terminal configuration for each merchant. Supports pagination and filtering by processor. processor used for transactions. to retrieve. page will be returned.

Parameters:

  • processor (Processor) (defaults to: nil)

    Optional parameter: Filter merchants by the

  • page (Integer) (defaults to: 1)

    Optional parameter: Specifies which set of records

  • size (Integer) (defaults to: 1000)

    Optional parameter: Specifies how many records per

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/apis/merchants_api.rb', line 49

def get_merchants_v2(processor: nil,
                     page: 1,
                     size: 1000)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v2/partners/merchants',
                                 Server::DEFAULT)
               .query_param(new_parameter(processor, key: 'processor'))
               .query_param(new_parameter(page, key: 'page'))
               .query_param(new_parameter(size, key: 'size'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(MerchantsV2Response.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))
    .execute
end