Class: DnaPaymentsPartnerReportingSettlementApIs::EcommerceTransactionsApi

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

Overview

EcommerceTransactionsApi

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_ecommerce_transaction_by_id(transaction_id) ⇒ ApiResponse

Query a single Ecommerce transaction processed by any of your merchants, using the transaction ID returned from a previous list query. as returned by GET Transactions.

Parameters:

  • transaction_id (String)

    Required parameter: Unique transaction ID,

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/apis/ecommerce_transactions_api.rb', line 82

def get_ecommerce_transaction_by_id(transaction_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/partners/transactions/{transactionId}',
                                 Server::DEFAULT)
               .template_param(new_parameter(transaction_id, key: 'transactionId')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(EcommerceTransaction.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))
    .execute
end

#get_ecommerce_transactions(from, to, page: 1, size: 50, merchant_id: nil, status: nil, processor: nil, search_by: nil) ⇒ ApiResponse

Query Ecommerce transactions processed by your merchants. Transactions are available for 365 days; a maximum span of 30 days can be specified per request via from/to. transactions. Transactions are available for 365 days and a maximum of 30 days can be specified per request. ISO 8601 format. Transactions are available for 365 days and a maximum of 30 days can be specified per request. ISO 8601 format. 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. Multiple statuses may be supplied, comma separated. See the Ecommerce Reference documentation for the full list of statuses (not available at spec-generation time). the platform responsible for processing the transaction. transactions by the field used to match the from/to date range (as documented, this parameter mirrors the processor filtering behaviour described in the source docs).

Parameters:

  • from (DateTime)

    Required parameter: Start date/time for

  • to (DateTime)

    Required parameter: End date/time for transactions.

  • page (Integer) (defaults to: 1)

    Optional parameter: Page number required.

  • size (Integer) (defaults to: 50)

    Optional parameter: Number of records to return.

  • merchant_id (String) (defaults to: nil)

    Optional parameter: Unique id(s) for the

  • status (String) (defaults to: nil)

    Optional parameter: Filter by transaction status.

  • processor (Processor) (defaults to: nil)

    Optional parameter: Filter transactions by

  • search_by (String) (defaults to: nil)

    Optional parameter: Allows filtering of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def get_ecommerce_transactions(from,
                               to,
                               page: 1,
                               size: 50,
                               merchant_id: nil,
                               status: nil,
                               processor: nil,
                               search_by: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/partners/transactions',
                                 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(merchant_id, key: 'merchantId'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(processor, key: 'processor'))
               .query_param(new_parameter(search_by, key: 'searchBy'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('BearerAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(EcommerceTransactionsResponse.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