dna-apimatic-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +172 -0
- data/bin/console +15 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/api_helper.rb +10 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/authentication_api.rb +53 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/base_api.rb +67 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/ecommerce_transactions_api.rb +113 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/merchants_api.rb +79 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/oauth_authorization_api.rb +44 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/pos_transactions_api.rb +128 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/settlements_api.rb +82 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/client.rb +110 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/configuration.rb +177 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/api_exception.rb +21 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/error_exception.rb +51 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/api_response.rb +19 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/auth/oauth_2.rb +156 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_call_back.rb +10 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_method_enum.rb +10 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_request.rb +10 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_response.rb +10 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/http/proxy_settings.rb +22 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/logging/sdk_logger.rb +17 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb +97 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_response.rb +115 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/base_model.rb +110 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/capture_method.rb +72 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/card_type.rb +36 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/ecommerce_transaction.rb +528 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/ecommerce_transactions_response.rb +94 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/grant_type.rb +26 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v1.rb +85 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb +138 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchants_v2_response.rb +94 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_provider_error.rb +62 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_scope.rb +26 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_token.rb +96 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/operation.rb +48 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb +298 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transactions_response.rb +105 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/processor.rb +36 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/scope.rb +26 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/search_by.rb +36 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb +314 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/settlements_response.rb +94 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status.rb +46 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status1.rb +36 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status2.rb +36 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb +141 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/token_type.rb +26 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/transaction_type.rb +201 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/models/type.rb +36 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/utilities/date_time_helper.rb +11 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is/utilities/file_wrapper.rb +28 -0
- data/lib/dna_payments_partner_reporting_settlement_ap_is.rb +125 -0
- metadata +142 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# PosTransactionsApi
|
|
8
|
+
class PosTransactionsApi < BaseApi
|
|
9
|
+
# Query all POS transactions processed by your merchants. Transactions are
|
|
10
|
+
# available for 365 days; a maximum span of 30 days can be specified per
|
|
11
|
+
# request via `from`/`to`.
|
|
12
|
+
# @param [DateTime] from Required parameter: Start date/time for
|
|
13
|
+
# transactions. Transactions are available for 365 days and a maximum of 30
|
|
14
|
+
# days can be specified per request. ISO 8601 format.
|
|
15
|
+
# @param [DateTime] to Required parameter: End date/time for transactions.
|
|
16
|
+
# Transactions are available for 365 days and a maximum of 30 days can be
|
|
17
|
+
# specified per request. ISO 8601 format.
|
|
18
|
+
# @param [Integer] page Optional parameter: Page number required.
|
|
19
|
+
# @param [Integer] size Optional parameter: Number of records to return.
|
|
20
|
+
# @param [String] merchant_id Optional parameter: Unique id(s) for the
|
|
21
|
+
# merchant, allocated by DNA Payments and returned in GET Merchants. Up to
|
|
22
|
+
# 10 IDs may be submitted, comma separated. Specifying an id will only
|
|
23
|
+
# return results for that merchant.
|
|
24
|
+
# @param [Status2] status Optional parameter: Filter POS results by
|
|
25
|
+
# transaction status.
|
|
26
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
27
|
+
def get_pos_transactions(from,
|
|
28
|
+
to,
|
|
29
|
+
page: 1,
|
|
30
|
+
size: 50,
|
|
31
|
+
merchant_id: nil,
|
|
32
|
+
status: nil)
|
|
33
|
+
@api_call
|
|
34
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
35
|
+
'/v1/partners/pos/transactions',
|
|
36
|
+
Server::DEFAULT)
|
|
37
|
+
.query_param(new_parameter(from, key: 'from')
|
|
38
|
+
.is_required(true))
|
|
39
|
+
.query_param(new_parameter(to, key: 'to')
|
|
40
|
+
.is_required(true))
|
|
41
|
+
.query_param(new_parameter(page, key: 'page'))
|
|
42
|
+
.query_param(new_parameter(size, key: 'size'))
|
|
43
|
+
.query_param(new_parameter(merchant_id, key: 'merchantId'))
|
|
44
|
+
.query_param(new_parameter(status, key: 'status'))
|
|
45
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
46
|
+
.auth(Single.new('BearerAuth')))
|
|
47
|
+
.response(new_response_handler
|
|
48
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
49
|
+
.deserialize_into(PosTransactionsResponse.method(:from_hash))
|
|
50
|
+
.is_api_response(true)
|
|
51
|
+
.local_error('400',
|
|
52
|
+
'Bad Request — request format is invalid.',
|
|
53
|
+
ErrorException)
|
|
54
|
+
.local_error('401',
|
|
55
|
+
'Unauthorized — invalid authentication credentials have been'\
|
|
56
|
+
' supplied.',
|
|
57
|
+
ErrorException)
|
|
58
|
+
.local_error('403',
|
|
59
|
+
'Forbidden — authorisation has failed due to insufficient'\
|
|
60
|
+
' permissions.',
|
|
61
|
+
ErrorException)
|
|
62
|
+
.local_error('404',
|
|
63
|
+
'Not Found — the requested resource does not exist.',
|
|
64
|
+
ErrorException)
|
|
65
|
+
.local_error('422',
|
|
66
|
+
'Unprocessable Entity — the API cannot complete the requested'\
|
|
67
|
+
' action.',
|
|
68
|
+
ErrorException)
|
|
69
|
+
.local_error('500',
|
|
70
|
+
'Internal Server Error — an internal error has occurred, please'\
|
|
71
|
+
' try again later.',
|
|
72
|
+
ErrorException)
|
|
73
|
+
.local_error('503',
|
|
74
|
+
'Service Unavailable — API is temporarily offline for'\
|
|
75
|
+
' maintenance, please try again later.',
|
|
76
|
+
ErrorException))
|
|
77
|
+
.execute
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Query a single POS transaction processed by any of your merchants, using
|
|
81
|
+
# the transaction ID returned from a previous list query.
|
|
82
|
+
# @param [String] transaction_id Required parameter: Unique transaction ID,
|
|
83
|
+
# as returned by GET POS Transactions.
|
|
84
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
85
|
+
def get_pos_transaction_by_id(transaction_id)
|
|
86
|
+
@api_call
|
|
87
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
88
|
+
'/v1/partners/pos/transactions/{transactionId}',
|
|
89
|
+
Server::DEFAULT)
|
|
90
|
+
.template_param(new_parameter(transaction_id, key: 'transactionId')
|
|
91
|
+
.is_required(true)
|
|
92
|
+
.should_encode(true))
|
|
93
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
94
|
+
.auth(Single.new('BearerAuth')))
|
|
95
|
+
.response(new_response_handler
|
|
96
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
97
|
+
.deserialize_into(PosTransaction.method(:from_hash))
|
|
98
|
+
.is_api_response(true)
|
|
99
|
+
.local_error('400',
|
|
100
|
+
'Bad Request — request format is invalid.',
|
|
101
|
+
ErrorException)
|
|
102
|
+
.local_error('401',
|
|
103
|
+
'Unauthorized — invalid authentication credentials have been'\
|
|
104
|
+
' supplied.',
|
|
105
|
+
ErrorException)
|
|
106
|
+
.local_error('403',
|
|
107
|
+
'Forbidden — authorisation has failed due to insufficient'\
|
|
108
|
+
' permissions.',
|
|
109
|
+
ErrorException)
|
|
110
|
+
.local_error('404',
|
|
111
|
+
'Not Found — the requested resource does not exist.',
|
|
112
|
+
ErrorException)
|
|
113
|
+
.local_error('422',
|
|
114
|
+
'Unprocessable Entity — the API cannot complete the requested'\
|
|
115
|
+
' action.',
|
|
116
|
+
ErrorException)
|
|
117
|
+
.local_error('500',
|
|
118
|
+
'Internal Server Error — an internal error has occurred, please'\
|
|
119
|
+
' try again later.',
|
|
120
|
+
ErrorException)
|
|
121
|
+
.local_error('503',
|
|
122
|
+
'Service Unavailable — API is temporarily offline for'\
|
|
123
|
+
' maintenance, please try again later.',
|
|
124
|
+
ErrorException))
|
|
125
|
+
.execute
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# SettlementsApi
|
|
8
|
+
class SettlementsApi < BaseApi
|
|
9
|
+
# Query settlements for your merchants. Settlement records are available for
|
|
10
|
+
# 365 days; a maximum span of 30 days can be specified per request via
|
|
11
|
+
# `from`/`to`.
|
|
12
|
+
# @param [Date] from Required parameter: Start date for settlements.
|
|
13
|
+
# Available for 365 days; a maximum of 30 days can be specified.
|
|
14
|
+
# @param [Date] to Required parameter: End date for settlements. Available
|
|
15
|
+
# for 365 days; a maximum of 30 days can be specified.
|
|
16
|
+
# @param [Integer] page Optional parameter: Page number required.
|
|
17
|
+
# @param [Integer] size Optional parameter: Number of records to return.
|
|
18
|
+
# @param [SearchBy] search_by Optional parameter: Confirms which date is
|
|
19
|
+
# being used in the query. If not supplied, `processed-date` is used.
|
|
20
|
+
# @param [String] merchant_id Optional parameter: Unique id(s) for the
|
|
21
|
+
# merchant, allocated by DNA Payments and returned in GET Merchants. Up to
|
|
22
|
+
# 10 IDs may be submitted, comma separated. Specifying an id will only
|
|
23
|
+
# return results for that merchant.
|
|
24
|
+
# @param [String] transaction_id Optional parameter: Filter settlements by a
|
|
25
|
+
# specific transaction ID.
|
|
26
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
27
|
+
def get_settlements(from,
|
|
28
|
+
to,
|
|
29
|
+
page: 1,
|
|
30
|
+
size: 50,
|
|
31
|
+
search_by: nil,
|
|
32
|
+
merchant_id: nil,
|
|
33
|
+
transaction_id: nil)
|
|
34
|
+
@api_call
|
|
35
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
36
|
+
'/v3/partners/settlements',
|
|
37
|
+
Server::DEFAULT)
|
|
38
|
+
.query_param(new_parameter(from, key: 'from')
|
|
39
|
+
.is_required(true))
|
|
40
|
+
.query_param(new_parameter(to, key: 'to')
|
|
41
|
+
.is_required(true))
|
|
42
|
+
.query_param(new_parameter(page, key: 'page'))
|
|
43
|
+
.query_param(new_parameter(size, key: 'size'))
|
|
44
|
+
.query_param(new_parameter(search_by, key: 'searchBy'))
|
|
45
|
+
.query_param(new_parameter(merchant_id, key: 'merchantId'))
|
|
46
|
+
.query_param(new_parameter(transaction_id, key: 'transactionId'))
|
|
47
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
48
|
+
.auth(Single.new('BearerAuth')))
|
|
49
|
+
.response(new_response_handler
|
|
50
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
51
|
+
.deserialize_into(SettlementsResponse.method(:from_hash))
|
|
52
|
+
.is_api_response(true)
|
|
53
|
+
.local_error('400',
|
|
54
|
+
'Bad Request — request format is invalid.',
|
|
55
|
+
ErrorException)
|
|
56
|
+
.local_error('401',
|
|
57
|
+
'Unauthorized — invalid authentication credentials have been'\
|
|
58
|
+
' supplied.',
|
|
59
|
+
ErrorException)
|
|
60
|
+
.local_error('403',
|
|
61
|
+
'Forbidden — authorisation has failed due to insufficient'\
|
|
62
|
+
' permissions.',
|
|
63
|
+
ErrorException)
|
|
64
|
+
.local_error('404',
|
|
65
|
+
'Not Found — the requested resource does not exist.',
|
|
66
|
+
ErrorException)
|
|
67
|
+
.local_error('422',
|
|
68
|
+
'Unprocessable Entity — the API cannot complete the requested'\
|
|
69
|
+
' action.',
|
|
70
|
+
ErrorException)
|
|
71
|
+
.local_error('500',
|
|
72
|
+
'Internal Server Error — an internal error has occurred, please'\
|
|
73
|
+
' try again later.',
|
|
74
|
+
ErrorException)
|
|
75
|
+
.local_error('503',
|
|
76
|
+
'Service Unavailable — API is temporarily offline for'\
|
|
77
|
+
' maintenance, please try again later.',
|
|
78
|
+
ErrorException))
|
|
79
|
+
.execute
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# dna_payments_partner_reporting_settlement_ap_is client class.
|
|
8
|
+
class Client
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_reader :config, :auth_managers
|
|
11
|
+
|
|
12
|
+
def user_agent_detail
|
|
13
|
+
config.user_agent_detail
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Returns the configured authentication BearerAuth instance.
|
|
17
|
+
def bearer_auth
|
|
18
|
+
@auth_managers['BearerAuth']
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Access to authentication controller.
|
|
22
|
+
# @return [AuthenticationApi] Returns the controller instance.
|
|
23
|
+
def authentication
|
|
24
|
+
@authentication ||= AuthenticationApi.new @global_configuration
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Access to merchants controller.
|
|
28
|
+
# @return [MerchantsApi] Returns the controller instance.
|
|
29
|
+
def merchants
|
|
30
|
+
@merchants ||= MerchantsApi.new @global_configuration
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Access to ecommerce_transactions controller.
|
|
34
|
+
# @return [EcommerceTransactionsApi] Returns the controller instance.
|
|
35
|
+
def ecommerce_transactions
|
|
36
|
+
@ecommerce_transactions ||= EcommerceTransactionsApi.new @global_configuration
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Access to pos_transactions controller.
|
|
40
|
+
# @return [PosTransactionsApi] Returns the controller instance.
|
|
41
|
+
def pos_transactions
|
|
42
|
+
@pos_transactions ||= PosTransactionsApi.new @global_configuration
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Access to settlements controller.
|
|
46
|
+
# @return [SettlementsApi] Returns the controller instance.
|
|
47
|
+
def settlements
|
|
48
|
+
@settlements ||= SettlementsApi.new @global_configuration
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Access to oauth_authorization controller.
|
|
52
|
+
# @return [OauthAuthorizationApi] Returns the controller instance.
|
|
53
|
+
def oauth_authorization
|
|
54
|
+
@oauth_authorization ||= OauthAuthorizationApi.new @global_configuration
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def initialize(
|
|
58
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
|
59
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
60
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
61
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
62
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
|
63
|
+
client_credentials_auth_credentials: nil, config: nil
|
|
64
|
+
)
|
|
65
|
+
@config = if config.nil?
|
|
66
|
+
Configuration.new(
|
|
67
|
+
connection: connection, adapter: adapter, timeout: timeout,
|
|
68
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
69
|
+
backoff_factor: backoff_factor,
|
|
70
|
+
retry_statuses: retry_statuses,
|
|
71
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
72
|
+
proxy_settings: proxy_settings,
|
|
73
|
+
logging_configuration: logging_configuration,
|
|
74
|
+
environment: environment,
|
|
75
|
+
client_credentials_auth_credentials: client_credentials_auth_credentials
|
|
76
|
+
)
|
|
77
|
+
else
|
|
78
|
+
config
|
|
79
|
+
end
|
|
80
|
+
user_agent_params = BaseApi.user_agent_parameters
|
|
81
|
+
|
|
82
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
|
83
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
|
84
|
+
.global_errors(BaseApi::GLOBAL_ERRORS)
|
|
85
|
+
.user_agent(BaseApi.user_agent,
|
|
86
|
+
agent_parameters: user_agent_params)
|
|
87
|
+
|
|
88
|
+
initialize_auth_managers(@global_configuration)
|
|
89
|
+
@global_configuration = @global_configuration.auth_managers(@auth_managers)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Initializes the auth managers hash used for authenticating API calls.
|
|
93
|
+
# @param [GlobalConfiguration] global_config The global configuration of the SDK)
|
|
94
|
+
def initialize_auth_managers(global_config)
|
|
95
|
+
@auth_managers = {}
|
|
96
|
+
http_client_config = global_config.client_configuration
|
|
97
|
+
%w[BearerAuth].each { |auth| @auth_managers[auth] = nil }
|
|
98
|
+
@auth_managers['BearerAuth'] = Oauth2.new(
|
|
99
|
+
http_client_config.client_credentials_auth_credentials, global_config
|
|
100
|
+
)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# Creates a client directly from environment variables.
|
|
104
|
+
def self.from_env(**overrides)
|
|
105
|
+
default_config = Configuration.build_default_config_from_env
|
|
106
|
+
new_config = default_config.clone_with(**overrides)
|
|
107
|
+
new(config: new_config)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# An enum for SDK environments.
|
|
8
|
+
class Environment
|
|
9
|
+
# PRODUCTION: Test/Sandbox API server (Reporting & Settlement APIs)
|
|
10
|
+
# ENVIRONMENT2: Test/Sandbox OAuth2 authorization server
|
|
11
|
+
ENVIRONMENT = [
|
|
12
|
+
PRODUCTION = 'production'.freeze,
|
|
13
|
+
ENVIRONMENT2 = 'environment2'.freeze
|
|
14
|
+
].freeze
|
|
15
|
+
|
|
16
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
17
|
+
def self.from_value(value, default_value = PRODUCTION)
|
|
18
|
+
return default_value if value.nil?
|
|
19
|
+
|
|
20
|
+
str = value.to_s.strip.downcase
|
|
21
|
+
case str
|
|
22
|
+
when 'production' then PRODUCTION
|
|
23
|
+
when 'environment2' then ENVIRONMENT2
|
|
24
|
+
|
|
25
|
+
else
|
|
26
|
+
warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
|
|
27
|
+
default_value
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# An enum for API servers.
|
|
33
|
+
class Server
|
|
34
|
+
SERVER = [
|
|
35
|
+
DEFAULT = 'default'.freeze
|
|
36
|
+
].freeze
|
|
37
|
+
|
|
38
|
+
# Converts a string or symbol into a valid Server constant.
|
|
39
|
+
def self.from_value(value, default_value = DEFAULT)
|
|
40
|
+
return default_value if value.nil?
|
|
41
|
+
|
|
42
|
+
default_value
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# All configuration including auth info and base URI for the API access
|
|
47
|
+
# are configured in this class.
|
|
48
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
49
|
+
# The attribute readers for properties.
|
|
50
|
+
attr_reader :environment, :client_credentials_auth_credentials
|
|
51
|
+
|
|
52
|
+
class << self
|
|
53
|
+
attr_reader :environments
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(
|
|
57
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
|
58
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
59
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
60
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
61
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
|
62
|
+
client_credentials_auth_credentials: nil
|
|
63
|
+
)
|
|
64
|
+
super connection: connection, adapter: adapter, timeout: timeout,
|
|
65
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
66
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
67
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
68
|
+
proxy_settings: proxy_settings,
|
|
69
|
+
logging_configuration: logging_configuration
|
|
70
|
+
|
|
71
|
+
# Current API environment
|
|
72
|
+
@environment = String(environment)
|
|
73
|
+
|
|
74
|
+
# The object holding OAuth 2 Client Credentials Grant credentials
|
|
75
|
+
@client_credentials_auth_credentials = client_credentials_auth_credentials
|
|
76
|
+
|
|
77
|
+
# Initializing OAuth 2 Client Credentials Grant credentials with the provided auth parameters
|
|
78
|
+
@client_credentials_auth_credentials = client_credentials_auth_credentials
|
|
79
|
+
|
|
80
|
+
# The Http Client to use for making requests.
|
|
81
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
85
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
86
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
87
|
+
proxy_settings: nil, logging_configuration: nil,
|
|
88
|
+
environment: nil, client_credentials_auth_credentials: nil)
|
|
89
|
+
connection ||= self.connection
|
|
90
|
+
adapter ||= self.adapter
|
|
91
|
+
timeout ||= self.timeout
|
|
92
|
+
max_retries ||= self.max_retries
|
|
93
|
+
retry_interval ||= self.retry_interval
|
|
94
|
+
backoff_factor ||= self.backoff_factor
|
|
95
|
+
retry_statuses ||= self.retry_statuses
|
|
96
|
+
retry_methods ||= self.retry_methods
|
|
97
|
+
http_callback ||= self.http_callback
|
|
98
|
+
proxy_settings ||= self.proxy_settings
|
|
99
|
+
logging_configuration ||= self.logging_configuration
|
|
100
|
+
environment ||= self.environment
|
|
101
|
+
client_credentials_auth_credentials ||= self.client_credentials_auth_credentials
|
|
102
|
+
|
|
103
|
+
Configuration.new(
|
|
104
|
+
connection: connection, adapter: adapter, timeout: timeout,
|
|
105
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
106
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
107
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
108
|
+
proxy_settings: proxy_settings,
|
|
109
|
+
logging_configuration: logging_configuration, environment: environment,
|
|
110
|
+
client_credentials_auth_credentials: client_credentials_auth_credentials
|
|
111
|
+
)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# All the environments the SDK can run in.
|
|
116
|
+
ENVIRONMENTS = {
|
|
117
|
+
Environment::PRODUCTION => {
|
|
118
|
+
Server::DEFAULT => 'https://test-api.dnapayments.com'
|
|
119
|
+
},
|
|
120
|
+
Environment::ENVIRONMENT2 => {
|
|
121
|
+
Server::DEFAULT => 'https://test-oauth.dnapayments.com'
|
|
122
|
+
}
|
|
123
|
+
}.freeze
|
|
124
|
+
|
|
125
|
+
# Generates the appropriate base URI for the environment and the server.
|
|
126
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
127
|
+
# required.
|
|
128
|
+
# @return [String] The base URI.
|
|
129
|
+
def get_base_uri(server = Server::DEFAULT)
|
|
130
|
+
ENVIRONMENTS[environment][server].clone
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Builds a Configuration instance using environment variables.
|
|
134
|
+
def self.build_default_config_from_env
|
|
135
|
+
# === Core environment ===
|
|
136
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
|
|
137
|
+
timeout = (ENV['TIMEOUT'] || 30).to_f
|
|
138
|
+
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
139
|
+
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
140
|
+
backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
|
|
141
|
+
retry_statuses = ENV.fetch('RETRY_STATUSES',
|
|
142
|
+
'[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
|
|
143
|
+
.split(',')
|
|
144
|
+
.map(&:strip)
|
|
145
|
+
.map do |item|
|
|
146
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
147
|
+
end
|
|
148
|
+
retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
|
|
149
|
+
.split(',')
|
|
150
|
+
.map(&:strip)
|
|
151
|
+
.map do |item|
|
|
152
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# === Authentication credentials ===
|
|
156
|
+
client_credentials_auth_credentials = ClientCredentialsAuthCredentials.from_env
|
|
157
|
+
|
|
158
|
+
# === Proxy settings ===
|
|
159
|
+
proxy_settings = ProxySettings.from_env
|
|
160
|
+
# === Logging Configuration ===
|
|
161
|
+
logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
|
|
162
|
+
|
|
163
|
+
Configuration.new(
|
|
164
|
+
environment: environment,
|
|
165
|
+
timeout: timeout,
|
|
166
|
+
max_retries: max_retries,
|
|
167
|
+
retry_interval: retry_interval,
|
|
168
|
+
backoff_factor: backoff_factor,
|
|
169
|
+
retry_statuses: retry_statuses,
|
|
170
|
+
retry_methods: retry_methods,
|
|
171
|
+
client_credentials_auth_credentials: client_credentials_auth_credentials,
|
|
172
|
+
proxy_settings: proxy_settings,
|
|
173
|
+
logging_configuration: logging_configuration
|
|
174
|
+
)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
|
8
|
+
class APIException < CoreLibrary::ApiException
|
|
9
|
+
# Provides a human-readable string representation of the object.
|
|
10
|
+
def to_s
|
|
11
|
+
class_name = self.class.name.split('::').last
|
|
12
|
+
"<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
16
|
+
def inspect
|
|
17
|
+
class_name = self.class.name.split('::').last
|
|
18
|
+
"<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# Generic error body returned for some failed requests.
|
|
8
|
+
class ErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# TODO: Write general description for this method
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :code
|
|
15
|
+
|
|
16
|
+
# TODO: Write general description for this method
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :message
|
|
19
|
+
|
|
20
|
+
# The constructor.
|
|
21
|
+
# @param [String] reason The reason for raising an exception.
|
|
22
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
23
|
+
def initialize(reason, response)
|
|
24
|
+
super(reason, response)
|
|
25
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
26
|
+
unbox(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Populates this object by extracting properties from a hash.
|
|
30
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
31
|
+
# response body.
|
|
32
|
+
def unbox(hash)
|
|
33
|
+
return nil unless hash
|
|
34
|
+
|
|
35
|
+
@code = hash.key?('code') ? hash['code'] : SKIP
|
|
36
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Provides a human-readable string representation of the object.
|
|
40
|
+
def to_s
|
|
41
|
+
class_name = self.class.name.split('::').last
|
|
42
|
+
"<#{class_name} code: #{@code}, message: #{@message}>"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
46
|
+
def inspect
|
|
47
|
+
class_name = self.class.name.split('::').last
|
|
48
|
+
"<#{class_name} code: #{@code.inspect}, message: #{@message.inspect}>"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/oauth_provider_exception.rb
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# OAuth 2 Authorization endpoint exception.
|
|
8
|
+
class OauthProviderException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Gets or sets error code.
|
|
13
|
+
# @return [OauthProviderError]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# Gets or sets human-readable text providing additional information on
|
|
17
|
+
# error.
|
|
18
|
+
# Used to assist the client developer in understanding the error that
|
|
19
|
+
# occurred.
|
|
20
|
+
# @return [String]
|
|
21
|
+
attr_accessor :error_description
|
|
22
|
+
|
|
23
|
+
# Gets or sets a URI identifying a human-readable web page with information
|
|
24
|
+
# about the error, used to provide the client developer with additional
|
|
25
|
+
# information about the error.
|
|
26
|
+
# @return [String]
|
|
27
|
+
attr_accessor :error_uri
|
|
28
|
+
|
|
29
|
+
# The constructor.
|
|
30
|
+
# @param [String] reason The reason for raising an exception.
|
|
31
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
32
|
+
def initialize(reason, response)
|
|
33
|
+
super(reason, response)
|
|
34
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
35
|
+
unbox(hash)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Populates this object by extracting properties from a hash.
|
|
39
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
40
|
+
# response body.
|
|
41
|
+
def unbox(hash)
|
|
42
|
+
return nil unless hash
|
|
43
|
+
|
|
44
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
45
|
+
@error_description =
|
|
46
|
+
hash.key?('error_description') ? hash['error_description'] : SKIP
|
|
47
|
+
@error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Provides a human-readable string representation of the object.
|
|
51
|
+
def to_s
|
|
52
|
+
class_name = self.class.name.split('::').last
|
|
53
|
+
"<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\
|
|
54
|
+
" #{@error_uri}>"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
58
|
+
def inspect
|
|
59
|
+
class_name = self.class.name.split('::').last
|
|
60
|
+
"<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\
|
|
61
|
+
" error_uri: #{@error_uri.inspect}>"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# dna_payments_partner_reporting_settlement_ap_is
|
|
2
|
+
#
|
|
3
|
+
# This file was
|
|
4
|
+
# automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module DnaPaymentsPartnerReportingSettlementApIs
|
|
7
|
+
# Http response received.
|
|
8
|
+
class ApiResponse < CoreLibrary::ApiResponse
|
|
9
|
+
# The constructor
|
|
10
|
+
# @param [HttpResponse] http_response The original, raw response from the api.
|
|
11
|
+
# @param [Object] data The data field specified for the response.
|
|
12
|
+
# @param [Array<String>] errors Any errors returned by the server.
|
|
13
|
+
def initialize(http_response,
|
|
14
|
+
data: nil,
|
|
15
|
+
errors: nil)
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|