apimatic-polpay-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 (43) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +173 -0
  4. data/bin/console +15 -0
  5. data/lib/poli_ap_is/api_helper.rb +10 -0
  6. data/lib/poli_ap_is/apis/base_api.rb +67 -0
  7. data/lib/poli_ap_is/apis/payments_api.rb +155 -0
  8. data/lib/poli_ap_is/apis/poli_links_api.rb +135 -0
  9. data/lib/poli_ap_is/client.rb +79 -0
  10. data/lib/poli_ap_is/configuration.rb +179 -0
  11. data/lib/poli_ap_is/exceptions/api_exception.rb +21 -0
  12. data/lib/poli_ap_is/http/api_response.rb +19 -0
  13. data/lib/poli_ap_is/http/auth/basic_auth.rb +62 -0
  14. data/lib/poli_ap_is/http/http_call_back.rb +10 -0
  15. data/lib/poli_ap_is/http/http_method_enum.rb +10 -0
  16. data/lib/poli_ap_is/http/http_request.rb +10 -0
  17. data/lib/poli_ap_is/http/http_response.rb +10 -0
  18. data/lib/poli_ap_is/http/proxy_settings.rb +22 -0
  19. data/lib/poli_ap_is/logging/configuration/api_logging_configuration.rb +186 -0
  20. data/lib/poli_ap_is/logging/sdk_logger.rb +17 -0
  21. data/lib/poli_ap_is/models/bank_details.rb +126 -0
  22. data/lib/poli_ap_is/models/base_model.rb +110 -0
  23. data/lib/poli_ap_is/models/create_poli_link_request.rb +170 -0
  24. data/lib/poli_ap_is/models/create_poli_link_request_body_json.rb +170 -0
  25. data/lib/poli_ap_is/models/daily_transaction.rb +245 -0
  26. data/lib/poli_ap_is/models/fetch_statusof_poli_link_response200_text.rb +48 -0
  27. data/lib/poli_ap_is/models/financial_institution.rb +95 -0
  28. data/lib/poli_ap_is/models/get_transaction_response.rb +109 -0
  29. data/lib/poli_ap_is/models/initiate_transaction_request.rb +201 -0
  30. data/lib/poli_ap_is/models/initiate_transaction_response.rb +118 -0
  31. data/lib/poli_ap_is/models/link_payment.rb +137 -0
  32. data/lib/poli_ap_is/models/merchant_details.rb +100 -0
  33. data/lib/poli_ap_is/models/payer_details.rb +100 -0
  34. data/lib/poli_ap_is/models/poli_link_basic_info.rb +116 -0
  35. data/lib/poli_ap_is/models/poli_link_basic_info_status.rb +48 -0
  36. data/lib/poli_ap_is/models/poli_link_payments_response.rb +116 -0
  37. data/lib/poli_ap_is/models/poli_link_payments_response_status.rb +48 -0
  38. data/lib/poli_ap_is/models/poli_link_payments_response_transactions_items.rb +159 -0
  39. data/lib/poli_ap_is/models/transaction_details.rb +148 -0
  40. data/lib/poli_ap_is/utilities/date_time_helper.rb +11 -0
  41. data/lib/poli_ap_is/utilities/file_wrapper.rb +28 -0
  42. data/lib/poli_ap_is.rb +64 -0
  43. metadata +126 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bc2895305008009161967784dd23fec2b1715e2b535ead18b4eb92c2b1bfe845
4
+ data.tar.gz: 3542fdee49aa612e140574f56716caee71cdf5838ae835fa63befe317f6ce73e
5
+ SHA512:
6
+ metadata.gz: 7ecdbe60b1a6bdf2de930b1175d0f698a04fd7827194318fdebdfb3f0d8bb36cd84872a9fcd9a487ac42644f048130e48ada36d1e8b8ff7b493d9689b9556835
7
+ data.tar.gz: 214c5ac8d7c137d87795e2a235ad6234bd042dd1aac91d412f55a00a005cc109a18f71540cd7261f8db05fe770eb6c57260bfdd6bffd54d9c257b15d593e142b
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,173 @@
1
+
2
+ # Getting Started with POLi APIs
3
+
4
+ ## Introduction
5
+
6
+ POLi provides the POLi API consisting of the following web services:
7
+ Initiate Transaction -used to initiate a POLi transaction.
8
+
9
+ GETTransaction - used to acquire the status and details of a POLi transaction
10
+
11
+ GETDailyTransactions - used to acquire a list of transactions for a specified date
12
+
13
+ GETDailyTransactionsCSV - used to acquire a list of transactions for a specified date in csv format
14
+
15
+ GETFinancialInstitutions - used to acquire a list of Financial Institutions for a specified merchant
16
+
17
+ NOTE: The Notification URL field in your initiate transaction request must be provided. The POLi system will POST a 'NUDGE' to the specified notification URL and this will prompt your servers to make the GETTransaction API call.
18
+
19
+ ## Install the Package
20
+
21
+ Install the gem from the command line:
22
+
23
+ ```bash
24
+ gem install apimatic-polpay-sdk -v 0.0.1
25
+ ```
26
+
27
+ Or add the gem to your Gemfile and run `bundle`:
28
+
29
+ ```ruby
30
+ gem 'apimatic-polpay-sdk', '0.0.1'
31
+ ```
32
+
33
+ For additional gem details, see the [RubyGems page for the apimatic-polpay-sdk gem](https://rubygems.org/gems/apimatic-polpay-sdk/versions/0.0.1).
34
+
35
+ ## IRB Console Usage
36
+
37
+ You can explore the SDK interactively using IRB in two ways
38
+
39
+ ### 1. Use IRB with Installed Gem
40
+
41
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console.
42
+
43
+ ```bash
44
+ irb
45
+ ```
46
+
47
+ Now you can load the SDK in the IRB
48
+
49
+ ```ruby
50
+ require 'poli_ap_is'
51
+ include PoliApIs
52
+ ```
53
+
54
+ ### 2. Use IRB within SDK
55
+
56
+ Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK.
57
+
58
+ ```
59
+ cd path/to/poli_ap_is
60
+ ```
61
+
62
+ Now you can start the preconfigured irb console by running the following command
63
+
64
+ ```bash
65
+ ruby bin/console
66
+ ```
67
+
68
+ **_Note:_** This automatically loads the SDK from lib/
69
+
70
+ ## Initialize the API Client
71
+
72
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/client.md)
73
+
74
+ The following parameters are configurable for the API Client:
75
+
76
+ | Parameter | Type | Description |
77
+ | --- | --- | --- |
78
+ | environment | [`Environment`](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/README.md#environments) | The API environment. <br> **Default: `Environment.PRODUCTION`** |
79
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
80
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
81
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
82
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
83
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
84
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
85
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
86
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
87
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
88
+ | proxy_settings | [`ProxySettings`](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
89
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
90
+ | basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/auth/basic-authentication.md) | The credential object for Basic Authentication |
91
+
92
+ The API client can be initialized as follows:
93
+
94
+ ### Code-Based Client Initialization
95
+
96
+ ```ruby
97
+ require 'poli_ap_is'
98
+ include PoliApIs
99
+
100
+ client = Client.new(
101
+ basic_auth_credentials: BasicAuthCredentials.new(
102
+ username: 'BasicAuthUserName',
103
+ password: 'BasicAuthPassword'
104
+ ),
105
+ environment: Environment::PRODUCTION,
106
+ logging_configuration: LoggingConfiguration.new(
107
+ log_level: Logger::INFO,
108
+ request_logging_config: RequestLoggingConfiguration.new(
109
+ log_body: true
110
+ ),
111
+ response_logging_config: ResponseLoggingConfiguration.new(
112
+ log_headers: true
113
+ )
114
+ )
115
+ )
116
+ ```
117
+
118
+ ### Environment-Based Client Initialization
119
+
120
+ ```ruby
121
+ require 'poli_ap_is'
122
+ include PoliApIs
123
+
124
+ # Create client from environment
125
+ client = Client.from_env
126
+ ```
127
+
128
+ See the [`Environment-Based Client Initialization`](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md) section for details.
129
+
130
+ ## Environments
131
+
132
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
133
+
134
+ ### Fields
135
+
136
+ | Name | Description |
137
+ | --- | --- |
138
+ | PRODUCTION | **Default** Production environment |
139
+ | ENVIRONMENT2 | UAT environment |
140
+
141
+ ## Authorization
142
+
143
+ This API uses the following authentication schemes.
144
+
145
+ * [`Basic (Basic Authentication)`](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/auth/basic-authentication.md)
146
+
147
+ ## List of APIs
148
+
149
+ * [Payments API](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/controllers/payments-api.md)
150
+ * [PoLi Links API](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/controllers/poli-links-api.md)
151
+
152
+ ## SDK Infrastructure
153
+
154
+ ### Configuration
155
+
156
+ * [ProxySettings](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/proxy-settings.md)
157
+ * [Environment-Based Client Initialization](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/environment-based-client-initialization.md)
158
+ * [AbstractLogger](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/abstract-logger.md)
159
+ * [LoggingConfiguration](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/logging-configuration.md)
160
+ * [RequestLoggingConfiguration](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/request-logging-configuration.md)
161
+ * [ResponseLoggingConfiguration](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/response-logging-configuration.md)
162
+
163
+ ### HTTP
164
+
165
+ * [HttpResponse](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/http-response.md)
166
+ * [HttpRequest](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/http-request.md)
167
+
168
+ ### Utilities
169
+
170
+ * [ApiResponse](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/api-response.md)
171
+ * [ApiHelper](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/api-helper.md)
172
+ * [DateTimeHelper](https://www.github.com/sdks-io/apimatic-polpay-ruby-sdk/tree/0.0.1/doc/date-time-helper.md)
173
+
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 'poli_ap_is'
8
+
9
+ puts 'PoliApIs SDK loaded!'
10
+ puts 'You can now create a client with: client = PoliApIs::Client.new'
11
+ puts 'Or use from_env: client = PoliApIs::Client.from_env'
12
+
13
+ # Start an interactive IRB session
14
+ require 'irb'
15
+ IRB.start
@@ -0,0 +1,10 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,67 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
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,155 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # PaymentsApi
8
+ class PaymentsApi < BaseApi
9
+ # Initiates a transaction in the POLi payment system.
10
+ # @param [InitiateTransactionRequest] body Required parameter: TODO: type
11
+ # description here
12
+ # @return [ApiResponse] Complete http response with raw body and status code.
13
+ def initiate_a_new_transaction(body)
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::POST,
16
+ '/v2/Transaction/Initiate',
17
+ Server::DEFAULT)
18
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
19
+ .body_param(new_parameter(body)
20
+ .is_required(true))
21
+ .header_param(new_parameter('application/json', key: 'accept'))
22
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
23
+ .auth(Single.new('Basic')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(InitiateTransactionResponse.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('400',
29
+ 'Bad request. Missing or invalid parameters.',
30
+ APIException)
31
+ .local_error('500',
32
+ 'Internal server error.',
33
+ APIException))
34
+ .execute
35
+ end
36
+
37
+ # TODO: type endpoint description here
38
+ # @param [String] token Required parameter: The transaction token to
39
+ # identify the transaction
40
+ # @return [ApiResponse] Complete http response with raw body and status code.
41
+ def retrieve_transaction_details(token)
42
+ @api_call
43
+ .request(new_request_builder(HttpMethodEnum::GET,
44
+ '/v2/Transaction/GetTransaction',
45
+ Server::DEFAULT)
46
+ .query_param(new_parameter(token, key: 'token')
47
+ .is_required(true))
48
+ .header_param(new_parameter('application/json', key: 'accept'))
49
+ .auth(Single.new('Basic')))
50
+ .response(new_response_handler
51
+ .deserializer(APIHelper.method(:custom_type_deserializer))
52
+ .deserialize_into(GetTransactionResponse.method(:from_hash))
53
+ .is_api_response(true)
54
+ .local_error('400',
55
+ 'Invalid request',
56
+ APIException)
57
+ .local_error('404',
58
+ 'Transaction not found',
59
+ APIException)
60
+ .local_error('500',
61
+ 'Internal server error',
62
+ APIException))
63
+ .execute
64
+ end
65
+
66
+ # Obtain a list of all transactions for a merchant on a particular date in
67
+ # JSON format.
68
+ # @param [DateTime] date Required parameter: The date for which transactions
69
+ # should be retrieved, in ISO 8601 format (YYYY-MM-DDTHH:mm:SS+HH).
70
+ # @param [String] statuscodes Optional parameter: Comma-separated list of
71
+ # status codes to filter transactions. Leave blank to retrieve all
72
+ # transactions.
73
+ # @param [DateTime] end_date Optional parameter: The end date for the
74
+ # transactions range, in ISO 8601 format (only for JSON responses).
75
+ # @return [ApiResponse] Complete http response with raw body and status code.
76
+ def retrieve_daily_transactions(date,
77
+ statuscodes: nil,
78
+ end_date: nil)
79
+ @api_call
80
+ .request(new_request_builder(HttpMethodEnum::GET,
81
+ '/v2/Transaction/GetDailyTransactions',
82
+ Server::DEFAULT)
83
+ .query_param(new_parameter(date, key: 'date')
84
+ .is_required(true))
85
+ .query_param(new_parameter(statuscodes, key: 'statuscodes'))
86
+ .query_param(new_parameter(end_date, key: 'endDate'))
87
+ .header_param(new_parameter('application/json', key: 'accept'))
88
+ .auth(Single.new('Basic')))
89
+ .response(new_response_handler
90
+ .deserializer(APIHelper.method(:custom_type_deserializer))
91
+ .deserialize_into(DailyTransaction.method(:from_hash))
92
+ .is_api_response(true)
93
+ .is_response_array(true)
94
+ .local_error('400',
95
+ 'Invalid request',
96
+ APIException)
97
+ .local_error('500',
98
+ 'Internal server error',
99
+ APIException))
100
+ .execute
101
+ end
102
+
103
+ # Obtain a list of all transactions for a merchant on a particular date in
104
+ # CSV format.
105
+ # @param [DateTime] date Required parameter: The date for which transactions
106
+ # should be retrieved, in ISO 8601 format (YYYY-MM-DDTHH:mm:SS+HH).
107
+ # @param [String] statuscodes Optional parameter: Comma-separated list of
108
+ # status codes to filter transactions. Leave blank to retrieve all
109
+ # transactions.
110
+ # @return [ApiResponse] Complete http response with raw body and status code.
111
+ def retrieve_daily_transactions_in_csv_format(date,
112
+ statuscodes: nil)
113
+ @api_call
114
+ .request(new_request_builder(HttpMethodEnum::GET,
115
+ '/v2/Transaction/GetDailyTransactionsCSV',
116
+ Server::DEFAULT)
117
+ .query_param(new_parameter(date, key: 'date')
118
+ .is_required(true))
119
+ .query_param(new_parameter(statuscodes, key: 'statuscodes'))
120
+ .auth(Single.new('Basic')))
121
+ .response(new_response_handler
122
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
123
+ .deserialize_into(proc do |response| response&.to_s end)
124
+ .is_api_response(true)
125
+ .is_primitive_response(true)
126
+ .local_error('400',
127
+ 'Invalid request',
128
+ APIException)
129
+ .local_error('500',
130
+ 'Internal server error',
131
+ APIException))
132
+ .execute
133
+ end
134
+
135
+ # TODO: type endpoint description here
136
+ # @return [ApiResponse] Complete http response with raw body and status code.
137
+ def retrieve_financial_institutions
138
+ @api_call
139
+ .request(new_request_builder(HttpMethodEnum::GET,
140
+ '/Entity/GetFinancialInstitutions',
141
+ Server::DEFAULT)
142
+ .header_param(new_parameter('application/json', key: 'accept'))
143
+ .auth(Single.new('Basic')))
144
+ .response(new_response_handler
145
+ .deserializer(APIHelper.method(:custom_type_deserializer))
146
+ .deserialize_into(FinancialInstitution.method(:from_hash))
147
+ .is_api_response(true)
148
+ .is_response_array(true)
149
+ .local_error('500',
150
+ 'Internal server error',
151
+ APIException))
152
+ .execute
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,135 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # PoliLinksApi
8
+ class PoliLinksApi < BaseApi
9
+ # Creates a POLi Link payment with the specified payment details which can
10
+ # be used by a customer to initiate a transaction
11
+ # @param [CreatePoliLinkRequestBodyJson] body Required parameter: TODO: type
12
+ # description here
13
+ # @return [ApiResponse] Complete http response with raw body and status code.
14
+ def create_poli_link(body)
15
+ @api_call
16
+ .request(new_request_builder(HttpMethodEnum::POST,
17
+ '/Create',
18
+ Server::DEFAULT)
19
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
20
+ .body_param(new_parameter(body)
21
+ .is_required(true))
22
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
23
+ .auth(Single.new('Basic')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
26
+ .deserialize_into(proc do |response| response&.to_s end)
27
+ .is_api_response(true)
28
+ .is_primitive_response(true))
29
+ .execute
30
+ end
31
+
32
+ # It fetches the overall transaction status of the specified POLi Link
33
+ # @param [String] poli_link Required parameter: TODO: type description
34
+ # here
35
+ # @return [ApiResponse] Complete http response with raw body and status code.
36
+ def fetch_status_of_poli_link(poli_link)
37
+ @api_call
38
+ .request(new_request_builder(HttpMethodEnum::GET,
39
+ '/Status/{POLiLink}',
40
+ Server::DEFAULT)
41
+ .template_param(new_parameter(poli_link, key: 'POLiLink')
42
+ .is_required(true)
43
+ .should_encode(true))
44
+ .auth(Single.new('Basic')))
45
+ .response(new_response_handler
46
+ .deserializer(APIHelper.method(:json_deserialize))
47
+ .deserialize_into(proc do |response| response&.to_s end)
48
+ .is_api_response(true))
49
+ .execute
50
+ end
51
+
52
+ # It fetches full list of POLi Links with basic information
53
+ # @return [ApiResponse] Complete http response with raw body and status code.
54
+ def lists_all_poli_links
55
+ @api_call
56
+ .request(new_request_builder(HttpMethodEnum::GET,
57
+ '/List',
58
+ Server::DEFAULT)
59
+ .header_param(new_parameter('application/json', key: 'accept'))
60
+ .auth(Single.new('Basic')))
61
+ .response(new_response_handler
62
+ .deserializer(APIHelper.method(:custom_type_deserializer))
63
+ .deserialize_into(PoliLinkBasicInfo.method(:from_hash))
64
+ .is_api_response(true)
65
+ .is_response_array(true))
66
+ .execute
67
+ end
68
+
69
+ # It fetches a collection of transactions initiated by this specified POLi
70
+ # Link.
71
+ # @param [String] poli_link Required parameter: TODO: type description
72
+ # here
73
+ # @return [ApiResponse] Complete http response with raw body and status code.
74
+ def poli_link_payments(poli_link)
75
+ @api_call
76
+ .request(new_request_builder(HttpMethodEnum::GET,
77
+ '/Payments/{POLiLink}',
78
+ Server::DEFAULT)
79
+ .template_param(new_parameter(poli_link, key: 'POLiLink')
80
+ .is_required(true)
81
+ .should_encode(true))
82
+ .header_param(new_parameter('application/json', key: 'accept'))
83
+ .auth(Single.new('Basic')))
84
+ .response(new_response_handler
85
+ .deserializer(APIHelper.method(:custom_type_deserializer))
86
+ .deserialize_into(PoliLinkPaymentsResponse.method(:from_hash))
87
+ .is_api_response(true))
88
+ .execute
89
+ end
90
+
91
+ # Find POLiLink for a Transaction Reference
92
+ # @param [String] token Required parameter: TODO: type description here
93
+ # @return [ApiResponse] Complete http response with raw body and status code.
94
+ def from_token(token)
95
+ @api_call
96
+ .request(new_request_builder(HttpMethodEnum::GET,
97
+ '/FromToken',
98
+ Server::DEFAULT)
99
+ .query_param(new_parameter(token, key: 'token')
100
+ .is_required(true))
101
+ .auth(Single.new('Basic')))
102
+ .response(new_response_handler
103
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
104
+ .deserialize_into(proc do |response| response&.to_s end)
105
+ .is_api_response(true)
106
+ .is_primitive_response(true))
107
+ .execute
108
+ end
109
+
110
+ # Mark a POLi Link as expired and stop future transactions initiated against
111
+ # it.
112
+ # @param [String] url_token Required parameter: TODO: type description
113
+ # here
114
+ # @return [ApiResponse] Complete http response with raw body and status code.
115
+ def expire_a_poli_link(url_token)
116
+ @api_call
117
+ .request(new_request_builder(HttpMethodEnum::GET,
118
+ '/Expire',
119
+ Server::DEFAULT)
120
+ .query_param(new_parameter(url_token, key: 'urlToken')
121
+ .is_required(true))
122
+ .auth(Single.new('Basic')))
123
+ .response(new_response_handler
124
+ .deserializer(APIHelper.method(:deserialize_primitive_types))
125
+ .deserialize_into(proc do |response| response&.to_s end)
126
+ .is_api_response(true)
127
+ .is_primitive_response(true)
128
+ .local_error('400',
129
+ 'Failed to expire POLi Link due to invalid request or'\
130
+ ' parameters.',
131
+ APIException))
132
+ .execute
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,79 @@
1
+ # poli_ap_is
2
+ #
3
+ # This file was automatically generated by APIMATIC v3.0 (
4
+ # https://www.apimatic.io ).
5
+
6
+ module PoliApIs
7
+ # poli_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
+ # Access to poli_links_api controller.
17
+ # @return [PoliLinksApi] Returns the controller instance.
18
+ def poli_links_api
19
+ @poli_links_api ||= PoliLinksApi.new @global_configuration
20
+ end
21
+
22
+ # Access to payments_api controller.
23
+ # @return [PaymentsApi] Returns the controller instance.
24
+ def payments_api
25
+ @payments_api ||= PaymentsApi.new @global_configuration
26
+ end
27
+
28
+ def initialize(
29
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
30
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
31
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
32
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
33
+ logging_configuration: nil, environment: Environment::PRODUCTION,
34
+ basic_auth_credentials: nil, config: nil
35
+ )
36
+ @config = if config.nil?
37
+ Configuration.new(
38
+ connection: connection, adapter: adapter, timeout: timeout,
39
+ max_retries: max_retries, retry_interval: retry_interval,
40
+ backoff_factor: backoff_factor,
41
+ retry_statuses: retry_statuses,
42
+ retry_methods: retry_methods, http_callback: http_callback,
43
+ proxy_settings: proxy_settings,
44
+ logging_configuration: logging_configuration,
45
+ environment: environment,
46
+ basic_auth_credentials: basic_auth_credentials
47
+ )
48
+ else
49
+ config
50
+ end
51
+ user_agent_params = BaseApi.user_agent_parameters
52
+
53
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
54
+ .base_uri_executor(@config.method(:get_base_uri))
55
+ .global_errors(BaseApi::GLOBAL_ERRORS)
56
+ .user_agent(BaseApi.user_agent,
57
+ agent_parameters: user_agent_params)
58
+
59
+ initialize_auth_managers(@global_configuration)
60
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
61
+ end
62
+
63
+ # Initializes the auth managers hash used for authenticating API calls.
64
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
65
+ def initialize_auth_managers(global_config)
66
+ @auth_managers = {}
67
+ http_client_config = global_config.client_configuration
68
+ %w[Basic].each { |auth| @auth_managers[auth] = nil }
69
+ @auth_managers['Basic'] = BasicAuth.new(http_client_config.basic_auth_credentials)
70
+ end
71
+
72
+ # Creates a client directly from environment variables.
73
+ def self.from_env(**overrides)
74
+ default_config = Configuration.build_default_config_from_env
75
+ new_config = default_config.clone_with(**overrides)
76
+ new(config: new_config)
77
+ end
78
+ end
79
+ end