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.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +172 -0
  4. data/bin/console +15 -0
  5. data/lib/dna_payments_partner_reporting_settlement_ap_is/api_helper.rb +10 -0
  6. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/authentication_api.rb +53 -0
  7. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/base_api.rb +67 -0
  8. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/ecommerce_transactions_api.rb +113 -0
  9. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/merchants_api.rb +79 -0
  10. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/oauth_authorization_api.rb +44 -0
  11. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/pos_transactions_api.rb +128 -0
  12. data/lib/dna_payments_partner_reporting_settlement_ap_is/apis/settlements_api.rb +82 -0
  13. data/lib/dna_payments_partner_reporting_settlement_ap_is/client.rb +110 -0
  14. data/lib/dna_payments_partner_reporting_settlement_ap_is/configuration.rb +177 -0
  15. data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/api_exception.rb +21 -0
  16. data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/error_exception.rb +51 -0
  17. data/lib/dna_payments_partner_reporting_settlement_ap_is/exceptions/oauth_provider_exception.rb +64 -0
  18. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/api_response.rb +19 -0
  19. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/auth/oauth_2.rb +156 -0
  20. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_call_back.rb +10 -0
  21. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_method_enum.rb +10 -0
  22. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_request.rb +10 -0
  23. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/http_response.rb +10 -0
  24. data/lib/dna_payments_partner_reporting_settlement_ap_is/http/proxy_settings.rb +22 -0
  25. data/lib/dna_payments_partner_reporting_settlement_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  26. data/lib/dna_payments_partner_reporting_settlement_ap_is/logging/sdk_logger.rb +17 -0
  27. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_request.rb +97 -0
  28. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/auth_token_response.rb +115 -0
  29. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/base_model.rb +110 -0
  30. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/capture_method.rb +72 -0
  31. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/card_type.rb +36 -0
  32. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/ecommerce_transaction.rb +528 -0
  33. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/ecommerce_transactions_response.rb +94 -0
  34. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/grant_type.rb +26 -0
  35. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v1.rb +85 -0
  36. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchant_v2.rb +138 -0
  37. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/merchants_v2_response.rb +94 -0
  38. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_provider_error.rb +62 -0
  39. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_scope.rb +26 -0
  40. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/oauth_token.rb +96 -0
  41. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/operation.rb +48 -0
  42. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transaction.rb +298 -0
  43. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/pos_transactions_response.rb +105 -0
  44. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/processor.rb +36 -0
  45. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/scope.rb +26 -0
  46. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/search_by.rb +36 -0
  47. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/settlement.rb +314 -0
  48. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/settlements_response.rb +94 -0
  49. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status.rb +46 -0
  50. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status1.rb +36 -0
  51. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/status2.rb +36 -0
  52. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/terminal.rb +141 -0
  53. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/token_type.rb +26 -0
  54. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/transaction_type.rb +201 -0
  55. data/lib/dna_payments_partner_reporting_settlement_ap_is/models/type.rb +36 -0
  56. data/lib/dna_payments_partner_reporting_settlement_ap_is/utilities/date_time_helper.rb +11 -0
  57. data/lib/dna_payments_partner_reporting_settlement_ap_is/utilities/file_wrapper.rb +28 -0
  58. data/lib/dna_payments_partner_reporting_settlement_ap_is.rb +125 -0
  59. metadata +142 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d11d5009c8ff74b649a0c46999e1bcb77480c1270a99b2c37036701660e9346d
4
+ data.tar.gz: 97318444e193780588f19b2a3b686c6914e681e4a7ac19a1743a59207419d002
5
+ SHA512:
6
+ metadata.gz: f9cabe0dd0d7ce53a16fff17930f485e0970b69390e3734d725f17d1cffd6674b40f81221ab7c3b8927a360ef1648fd2d8277e6b5ca85fb8f967569366df8a17
7
+ data.tar.gz: 7c924250aba308df43dd7b0e360ecbe3f9842cb9bf587eb1945dcb3dce3e4583003943250949a587d6a4448ac2380fafde03ac89eb458eb383c3aa54f87d344b
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2026 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,172 @@
1
+
2
+ # Getting Started with DNA Payments Partner Reporting & Settlement APIs
3
+
4
+ ## Introduction
5
+
6
+ Combined OpenAPI 3.0 specification for DNA Payments' Partner Tools: the Reporting API (Ecommerce & POS transaction reporting, Merchants) and the Settlement API. Generated from https://developer.dnapayments.com/docs/partner-tools/reporting/ documentation.
7
+
8
+ NOTE: The 'Reference' page (https://developer.dnapayments.com/docs/partner-tools/reporting/reporting-api/ecommerce/reference) which defines the full canonical enumerations of Transaction Statuses, Transaction Types, and Payment Methods for the Ecommerce endpoints could not be retrieved (the page returned a redirect error). Fields that rely on that reference (status, type, paymentMethod, cardType on Ecommerce transactions) are therefore modeled as free-form strings with illustrative examples rather than strict enums. Supply that page's content to tighten these definitions.
9
+
10
+ All URLs shown are the TEST/sandbox environment URLs published in the documentation; no production base URLs were provided in the source documentation.
11
+
12
+ ## Install the Package
13
+
14
+ Install the gem from the command line:
15
+
16
+ ```bash
17
+ gem install dna-apimatic-sdk -v 0.0.1
18
+ ```
19
+
20
+ Or add the gem to your Gemfile and run `bundle`:
21
+
22
+ ```ruby
23
+ gem 'dna-apimatic-sdk', '0.0.1'
24
+ ```
25
+
26
+ For additional gem details, see the [RubyGems page for the dna-apimatic-sdk gem](https://rubygems.org/gems/dna-apimatic-sdk/versions/0.0.1).
27
+
28
+ ## IRB Console Usage
29
+
30
+ You can explore the SDK interactively using IRB in two ways
31
+
32
+ ### 1. Use IRB with Installed Gem
33
+
34
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
35
+
36
+ ```bash
37
+ irb
38
+ ```
39
+
40
+ Now you can load the SDK in the IRB
41
+
42
+ ```ruby
43
+ require 'dna_payments_partner_reporting_settlement_ap_is'
44
+ include DnaPaymentsPartnerReportingSettlementApIs
45
+ ```
46
+
47
+ ### 2. Use IRB within SDK
48
+
49
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
50
+
51
+ ```
52
+ cd path/to/dna_payments_partner_reporting_settlement_ap_is
53
+ ```
54
+
55
+ Now you can start the preconfigured irb console by running the following command
56
+
57
+ ```bash
58
+ ruby bin/console
59
+ ```
60
+
61
+ **_Note:_** This automatically loads the SDK from lib/
62
+
63
+ ## Initialize the API Client
64
+
65
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/client.md)
66
+
67
+ The following parameters are configurable for the API Client:
68
+
69
+ | Parameter | Type | Description |
70
+ | --- | --- | --- |
71
+ | environment | [`Environment`](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
72
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
73
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
74
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
75
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
76
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
77
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
78
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
79
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
80
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
81
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
82
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
83
+ | client_credentials_auth_credentials | [`ClientCredentialsAuthCredentials`](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
84
+
85
+ The API client can be initialized as follows:
86
+
87
+ ### Code-Based Client Initialization
88
+
89
+ ```ruby
90
+ require 'dna_payments_partner_reporting_settlement_ap_is'
91
+ include DnaPaymentsPartnerReportingSettlementApIs
92
+
93
+ client = Client.new(
94
+ client_credentials_auth_credentials: ClientCredentialsAuthCredentials.new(
95
+ oauth_client_id: 'OAuthClientId',
96
+ oauth_client_secret: 'OAuthClientSecret',
97
+ oauth_scopes: [
98
+ OauthScope::PARTNERS_REPORTING
99
+ ]
100
+ ),
101
+ environment: Environment::PRODUCTION,
102
+ logging_configuration: LoggingConfiguration.new(
103
+ log_level: Logger::INFO,
104
+ request_logging_config: RequestLoggingConfiguration.new(
105
+ log_body: true
106
+ ),
107
+ response_logging_config: ResponseLoggingConfiguration.new(
108
+ log_headers: true
109
+ )
110
+ )
111
+ )
112
+ ```
113
+
114
+ ### Environment-Based Client Initialization
115
+
116
+ ```ruby
117
+ require 'dna_payments_partner_reporting_settlement_ap_is'
118
+ include DnaPaymentsPartnerReportingSettlementApIs
119
+
120
+ # Create client from environment
121
+ client = Client.from_env
122
+ ```
123
+
124
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
125
+
126
+ ## Environments
127
+
128
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
129
+
130
+ ### Fields
131
+
132
+ | Name | Description |
133
+ | --- | --- |
134
+ | PRODUCTION | **Default** Test/Sandbox API server (Reporting & Settlement APIs) |
135
+ | ENVIRONMENT2 | Test/Sandbox OAuth2 authorization server |
136
+
137
+ ## Authorization
138
+
139
+ This API uses the following authentication schemes.
140
+
141
+ * [`BearerAuth (OAuth 2 Client Credentials Grant)`](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/auth/oauth-2-client-credentials-grant.md)
142
+
143
+ ## List of APIs
144
+
145
+ * [Ecommerce Transactions](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/ecommerce-transactions.md)
146
+ * [POS Transactions](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/pos-transactions.md)
147
+ * [Authentication](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/authentication.md)
148
+ * [Merchants](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/merchants.md)
149
+ * [Settlements](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/controllers/settlements.md)
150
+
151
+ ## SDK Infrastructure
152
+
153
+ ### Configuration
154
+
155
+ * [ProxySettings](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
156
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
157
+ * [AbstractLogger](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
158
+ * [LoggingConfiguration](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
159
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
160
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
161
+
162
+ ### HTTP
163
+
164
+ * [HttpResponse](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/http-response.md)
165
+ * [HttpRequest](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/http-request.md)
166
+
167
+ ### Utilities
168
+
169
+ * [ApiResponse](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/api-response.md)
170
+ * [ApiHelper](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/api-helper.md)
171
+ * [DateTimeHelper](https://www.github.com/sdks-io/dna-apimatic-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
172
+
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Load the lib folder into Ruby's load path
4
+ $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
5
+
6
+ # Require the gem
7
+ require 'dna_payments_partner_reporting_settlement_ap_is'
8
+
9
+ puts 'DnaPaymentsPartnerReportingSettlementApIs SDK loaded!'
10
+ puts 'You can now create a client with: client = DnaPaymentsPartnerReportingSettlementApIs::Client.new'
11
+ puts 'Or use from_env: client = DnaPaymentsPartnerReportingSettlementApIs::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,53 @@
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
+ # AuthenticationApi
8
+ class AuthenticationApi < BaseApi
9
+ # Prior to querying any Reporting or Settlement API endpoint, an access
10
+ # token must be obtained. This endpoint is shared by both the Reporting API
11
+ # and the Settlement API (both use the `partners_reporting` scope).
12
+ # @param [GrantType] grant_type Required parameter: Authorisation type
13
+ # required to confirm the action required.
14
+ # @param [Scope] scope Required parameter: Scope of the action to be
15
+ # performed with the credentials.
16
+ # @param [String] client_id Required parameter: Provided to the integrator
17
+ # following successful creation of a test account.
18
+ # @param [String] client_secret Required parameter: Provided to the
19
+ # integrator following successful creation of a test account.
20
+ # @return [ApiResponse] Complete http response with raw body and status code.
21
+ def get_access_token(grant_type,
22
+ scope,
23
+ client_id,
24
+ client_secret)
25
+ @api_call
26
+ .request(new_request_builder(HttpMethodEnum::POST,
27
+ '/oauth2/token',
28
+ Server::DEFAULT)
29
+ .form_param(new_parameter(grant_type, key: 'grant_type')
30
+ .is_required(true))
31
+ .form_param(new_parameter(scope, key: 'scope')
32
+ .is_required(true))
33
+ .form_param(new_parameter(client_id, key: 'client_id')
34
+ .is_required(true))
35
+ .form_param(new_parameter(client_secret, key: 'client_secret')
36
+ .is_required(true))
37
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
38
+ .header_param(new_parameter('application/json', key: 'accept')))
39
+ .response(new_response_handler
40
+ .deserializer(APIHelper.method(:custom_type_deserializer))
41
+ .deserialize_into(AuthTokenResponse.method(:from_hash))
42
+ .is_api_response(true)
43
+ .local_error('400',
44
+ 'Bad Request — request format is invalid.',
45
+ ErrorException)
46
+ .local_error('401',
47
+ 'Unauthorized — invalid authentication credentials have been'\
48
+ ' supplied.',
49
+ ErrorException))
50
+ .execute
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,67 @@
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
+ # BaseApi.
8
+ class BaseApi
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'Ruby-SDK/0.0.1 (OS: {os-info}, Engine: {engine}/{engine-version})'
14
+ end
15
+
16
+ def self.user_agent_parameters
17
+ {
18
+ '{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
19
+ '{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
20
+ '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
21
+ }
22
+ end
23
+
24
+ GLOBAL_ERRORS = {
25
+ 'default' => ErrorCase.new
26
+ .error_message('HTTP response not OK.')
27
+ .exception_type(APIException)
28
+ }.freeze
29
+
30
+ # Initialization constructor.
31
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
32
+ def initialize(global_configuration)
33
+ @global_configuration = global_configuration
34
+ @config = @global_configuration.client_configuration
35
+ @http_call_back = @config.http_callback
36
+ @api_call = ApiCall.new(@global_configuration)
37
+ end
38
+
39
+ # Creates a new instance of the request builder.
40
+ # @param [String] http_method The HTTP method to use in the request.
41
+ # @param [String] path The endpoint path to use in the request.
42
+ # @param [String] server The server to extract the base uri for the request.
43
+ # @return [RequestBuilder] The instance of RequestBuilder.
44
+ def new_request_builder(http_method, path, server)
45
+ RequestBuilder.new
46
+ .http_method(http_method)
47
+ .path(path)
48
+ .server(server)
49
+ end
50
+
51
+ # Creates a new instance of the response handler.
52
+ # @return [ResponseHandler] The instance of ResponseHandler.
53
+ def new_response_handler
54
+ ResponseHandler.new
55
+ end
56
+
57
+ # Creates a new instance of the parameter.
58
+ # @param [String|optional] key The key of the parameter.
59
+ # @param [Object] value The value of the parameter.
60
+ # @return [Parameter] The instance of Parameter.
61
+ def new_parameter(value, key: nil)
62
+ Parameter.new
63
+ .key(key)
64
+ .value(value)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,113 @@
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
+ # EcommerceTransactionsApi
8
+ class EcommerceTransactionsApi < BaseApi
9
+ # Query Ecommerce 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 [String] status Optional parameter: Filter by transaction status.
25
+ # Multiple statuses may be supplied, comma separated. See the Ecommerce
26
+ # Reference documentation for the full list of statuses (not available at
27
+ # spec-generation time).
28
+ # @param [Processor] processor Optional parameter: Filter transactions by
29
+ # the platform responsible for processing the transaction.
30
+ # @param [String] search_by Optional parameter: Allows filtering of
31
+ # transactions by the field used to match the from/to date range (as
32
+ # documented, this parameter mirrors the processor filtering behaviour
33
+ # described in the source docs).
34
+ # @return [ApiResponse] Complete http response with raw body and status code.
35
+ def get_ecommerce_transactions(from,
36
+ to,
37
+ page: 1,
38
+ size: 50,
39
+ merchant_id: nil,
40
+ status: nil,
41
+ processor: nil,
42
+ search_by: nil)
43
+ @api_call
44
+ .request(new_request_builder(HttpMethodEnum::GET,
45
+ '/v1/partners/transactions',
46
+ Server::DEFAULT)
47
+ .query_param(new_parameter(from, key: 'from')
48
+ .is_required(true))
49
+ .query_param(new_parameter(to, key: 'to')
50
+ .is_required(true))
51
+ .query_param(new_parameter(page, key: 'page'))
52
+ .query_param(new_parameter(size, key: 'size'))
53
+ .query_param(new_parameter(merchant_id, key: 'merchantId'))
54
+ .query_param(new_parameter(status, key: 'status'))
55
+ .query_param(new_parameter(processor, key: 'processor'))
56
+ .query_param(new_parameter(search_by, key: 'searchBy'))
57
+ .header_param(new_parameter('application/json', key: 'accept'))
58
+ .auth(Single.new('BearerAuth')))
59
+ .response(new_response_handler
60
+ .deserializer(APIHelper.method(:custom_type_deserializer))
61
+ .deserialize_into(EcommerceTransactionsResponse.method(:from_hash))
62
+ .is_api_response(true)
63
+ .local_error('400',
64
+ 'Bad Request — request format is invalid.',
65
+ ErrorException)
66
+ .local_error('401',
67
+ 'Unauthorized — invalid authentication credentials have been'\
68
+ ' supplied.',
69
+ ErrorException)
70
+ .local_error('403',
71
+ 'Forbidden — authorisation has failed due to insufficient'\
72
+ ' permissions.',
73
+ ErrorException))
74
+ .execute
75
+ end
76
+
77
+ # Query a single Ecommerce transaction processed by any of your merchants,
78
+ # using the transaction ID returned from a previous list query.
79
+ # @param [String] transaction_id Required parameter: Unique transaction ID,
80
+ # as returned by GET Transactions.
81
+ # @return [ApiResponse] Complete http response with raw body and status code.
82
+ def get_ecommerce_transaction_by_id(transaction_id)
83
+ @api_call
84
+ .request(new_request_builder(HttpMethodEnum::GET,
85
+ '/v1/partners/transactions/{transactionId}',
86
+ Server::DEFAULT)
87
+ .template_param(new_parameter(transaction_id, key: 'transactionId')
88
+ .is_required(true)
89
+ .should_encode(true))
90
+ .header_param(new_parameter('application/json', key: 'accept'))
91
+ .auth(Single.new('BearerAuth')))
92
+ .response(new_response_handler
93
+ .deserializer(APIHelper.method(:custom_type_deserializer))
94
+ .deserialize_into(EcommerceTransaction.method(:from_hash))
95
+ .is_api_response(true)
96
+ .local_error('400',
97
+ 'Bad Request — request format is invalid.',
98
+ ErrorException)
99
+ .local_error('401',
100
+ 'Unauthorized — invalid authentication credentials have been'\
101
+ ' supplied.',
102
+ ErrorException)
103
+ .local_error('403',
104
+ 'Forbidden — authorisation has failed due to insufficient'\
105
+ ' permissions.',
106
+ ErrorException)
107
+ .local_error('404',
108
+ 'Not Found — the requested resource does not exist.',
109
+ ErrorException))
110
+ .execute
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,79 @@
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
+ # MerchantsApi
8
+ class MerchantsApi < BaseApi
9
+ # Returns the merchants available to the authenticated partner.
10
+ # **Deprecated** — use V2 (`/v2/partners/merchants`) instead.
11
+ # @return [ApiResponse] Complete http response with raw body and status code.
12
+ def get_merchants_v1
13
+ warn 'Endpoint get_merchants_v1 in MerchantsApi is deprecated'
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::GET,
16
+ '/v1/partners/merchants',
17
+ Server::DEFAULT)
18
+ .header_param(new_parameter('application/json', key: 'accept'))
19
+ .auth(Single.new('BearerAuth')))
20
+ .response(new_response_handler
21
+ .deserializer(APIHelper.method(:custom_type_deserializer))
22
+ .deserialize_into(MerchantV1.method(:from_hash))
23
+ .is_api_response(true)
24
+ .is_response_array(true)
25
+ .local_error('400',
26
+ 'Bad Request — request format is invalid.',
27
+ ErrorException)
28
+ .local_error('401',
29
+ 'Unauthorized — invalid authentication credentials have been'\
30
+ ' supplied.',
31
+ ErrorException)
32
+ .local_error('403',
33
+ 'Forbidden — authorisation has failed due to insufficient'\
34
+ ' permissions.',
35
+ ErrorException))
36
+ .execute
37
+ end
38
+
39
+ # Returns the merchants available to the authenticated partner, including
40
+ # terminal configuration for each merchant. Supports pagination and
41
+ # filtering by processor.
42
+ # @param [Processor] processor Optional parameter: Filter merchants by the
43
+ # processor used for transactions.
44
+ # @param [Integer] page Optional parameter: Specifies which set of records
45
+ # to retrieve.
46
+ # @param [Integer] size Optional parameter: Specifies how many records per
47
+ # page will be returned.
48
+ # @return [ApiResponse] Complete http response with raw body and status code.
49
+ def get_merchants_v2(processor: nil,
50
+ page: 1,
51
+ size: 1000)
52
+ @api_call
53
+ .request(new_request_builder(HttpMethodEnum::GET,
54
+ '/v2/partners/merchants',
55
+ Server::DEFAULT)
56
+ .query_param(new_parameter(processor, key: 'processor'))
57
+ .query_param(new_parameter(page, key: 'page'))
58
+ .query_param(new_parameter(size, key: 'size'))
59
+ .header_param(new_parameter('application/json', key: 'accept'))
60
+ .auth(Single.new('BearerAuth')))
61
+ .response(new_response_handler
62
+ .deserializer(APIHelper.method(:custom_type_deserializer))
63
+ .deserialize_into(MerchantsV2Response.method(:from_hash))
64
+ .is_api_response(true)
65
+ .local_error('400',
66
+ 'Bad Request — request format is invalid.',
67
+ ErrorException)
68
+ .local_error('401',
69
+ 'Unauthorized — invalid authentication credentials have been'\
70
+ ' supplied.',
71
+ ErrorException)
72
+ .local_error('403',
73
+ 'Forbidden — authorisation has failed due to insufficient'\
74
+ ' permissions.',
75
+ ErrorException))
76
+ .execute
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,44 @@
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
+ # OauthAuthorizationApi
8
+ class OauthAuthorizationApi < BaseApi
9
+ # Create a new OAuth 2 token.
10
+ # @param [String] authorization Required parameter: Authorization header in
11
+ # Basic auth format
12
+ # @param [String] scope Optional parameter: Requested scopes as a
13
+ # space-delimited list.
14
+ # @param [Hash] _field_parameters Additional optional form parameters are
15
+ # supported by this endpoint.
16
+ # @return [ApiResponse] Complete http response with raw body and status code.
17
+ def request_token(authorization,
18
+ scope: nil,
19
+ _field_parameters: nil)
20
+ @api_call
21
+ .request(new_request_builder(HttpMethodEnum::POST,
22
+ '/oauth2/token',
23
+ Server::DEFAULT)
24
+ .form_param(new_parameter('client_credentials', key: 'grant_type'))
25
+ .header_param(new_parameter(authorization, key: 'Authorization')
26
+ .is_required(true))
27
+ .form_param(new_parameter(scope, key: 'scope'))
28
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
29
+ .header_param(new_parameter('application/json', key: 'accept'))
30
+ .additional_form_params(_field_parameters))
31
+ .response(new_response_handler
32
+ .deserializer(APIHelper.method(:custom_type_deserializer))
33
+ .deserialize_into(OauthToken.method(:from_hash))
34
+ .is_api_response(true)
35
+ .local_error('400',
36
+ 'OAuth 2 provider returned an error.',
37
+ OauthProviderException)
38
+ .local_error('401',
39
+ 'OAuth 2 provider says client authentication failed.',
40
+ OauthProviderException))
41
+ .execute
42
+ end
43
+ end
44
+ end