apimatic-ci-cd-test 1.0.0
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 +1168 -0
- data/lib/payments_api.rb +49 -0
- data/lib/payments_api/api_helper.rb +277 -0
- data/lib/payments_api/client.rb +42 -0
- data/lib/payments_api/configuration.rb +116 -0
- data/lib/payments_api/controllers/base_controller.rb +49 -0
- data/lib/payments_api/controllers/payments_controller.rb +272 -0
- data/lib/payments_api/controllers/quotes_controller.rb +213 -0
- data/lib/payments_api/exceptions/api_exception.rb +20 -0
- data/lib/payments_api/exceptions/request_error_exception.rb +29 -0
- data/lib/payments_api/http/auth/custom_header_auth.rb +16 -0
- data/lib/payments_api/http/faraday_client.rb +70 -0
- data/lib/payments_api/http/http_call_back.rb +24 -0
- data/lib/payments_api/http/http_client.rb +104 -0
- data/lib/payments_api/http/http_method_enum.rb +13 -0
- data/lib/payments_api/http/http_request.rb +50 -0
- data/lib/payments_api/http/http_response.rb +29 -0
- data/lib/payments_api/models/address.rb +80 -0
- data/lib/payments_api/models/bank.rb +63 -0
- data/lib/payments_api/models/bank_account.rb +48 -0
- data/lib/payments_api/models/base_model.rb +47 -0
- data/lib/payments_api/models/beneficiary.rb +62 -0
- data/lib/payments_api/models/originator.rb +44 -0
- data/lib/payments_api/models/payment.rb +127 -0
- data/lib/payments_api/models/payment_details.rb +53 -0
- data/lib/payments_api/models/payment_status.rb +44 -0
- data/lib/payments_api/models/quote.rb +104 -0
- data/lib/payments_api/utilities/date_time_helper.rb +156 -0
- data/lib/payments_api/utilities/file_wrapper.rb +17 -0
- metadata +155 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
8
|
+
class APIException < StandardError
|
9
|
+
attr_reader :response, :response_code
|
10
|
+
|
11
|
+
# The constructor.
|
12
|
+
# @param [String] The reason for raising an exception.
|
13
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
14
|
+
def initialize(reason, response)
|
15
|
+
super(reason)
|
16
|
+
@response = response
|
17
|
+
@response_code = response.status_code
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# Format for 400 Errors
|
8
|
+
class RequestErrorException < APIException
|
9
|
+
# Message indicating the source of the error in the request
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :message
|
12
|
+
|
13
|
+
# The constructor.
|
14
|
+
# @param [String] The reason for raising an exception.
|
15
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
16
|
+
def initialize(reason, response)
|
17
|
+
super(reason, response)
|
18
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
19
|
+
unbox(hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Populates this object by extracting properties from a hash.
|
23
|
+
# @param [Hash] The deserialized response sent by the server in the
|
24
|
+
# response body.
|
25
|
+
def unbox(hash)
|
26
|
+
@message = hash['message']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# Utility class for custom header authorization.
|
8
|
+
class CustomHeaderAuth
|
9
|
+
# Add custom authentication to the request.
|
10
|
+
# @param [HttpRequest] The HttpRequest object to which authentication will
|
11
|
+
# be added.
|
12
|
+
def self.apply(config, http_request)
|
13
|
+
http_request.add_header('x-api-key', config.x_api_key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
require 'faraday/http_cache'
|
7
|
+
require 'faraday_middleware'
|
8
|
+
|
9
|
+
module PaymentsApi
|
10
|
+
# An implementation of HttpClient.
|
11
|
+
class FaradayClient < HttpClient
|
12
|
+
# The constructor.
|
13
|
+
def initialize(timeout:, max_retries:, retry_interval:,
|
14
|
+
backoff_factor:, retry_statuses:, retry_methods:,
|
15
|
+
cache: false, verify: true)
|
16
|
+
@connection = Faraday.new do |faraday|
|
17
|
+
faraday.use Faraday::HttpCache, serializer: Marshal if cache
|
18
|
+
faraday.use FaradayMiddleware::FollowRedirects
|
19
|
+
faraday.use :gzip
|
20
|
+
faraday.request :multipart
|
21
|
+
faraday.request :url_encoded
|
22
|
+
faraday.ssl[:ca_file] = Certifi.where
|
23
|
+
faraday.ssl[:verify] = verify
|
24
|
+
faraday.request :retry, max: max_retries, interval: retry_interval,
|
25
|
+
backoff_factor: backoff_factor,
|
26
|
+
retry_statuses: retry_statuses,
|
27
|
+
methods: retry_methods
|
28
|
+
faraday.adapter Faraday.default_adapter
|
29
|
+
faraday.options[:params_encoder] = Faraday::FlatParamsEncoder
|
30
|
+
faraday.options[:timeout] = timeout if timeout > 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# Method overridden from HttpClient.
|
35
|
+
def execute_as_string(http_request)
|
36
|
+
response = @connection.send(
|
37
|
+
http_request.http_method.downcase,
|
38
|
+
http_request.query_url
|
39
|
+
) do |request|
|
40
|
+
request.headers = http_request.headers
|
41
|
+
unless http_request.http_method == HttpMethodEnum::GET &&
|
42
|
+
http_request.parameters.empty?
|
43
|
+
request.body = http_request.parameters
|
44
|
+
end
|
45
|
+
end
|
46
|
+
convert_response(response, http_request)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Method overridden from HttpClient.
|
50
|
+
def execute_as_binary(http_request)
|
51
|
+
response = @connection.send(
|
52
|
+
http_request.http_method.downcase,
|
53
|
+
http_request.query_url
|
54
|
+
) do |request|
|
55
|
+
request.headers = http_request.headers
|
56
|
+
unless http_request.http_method == HttpMethodEnum::GET &&
|
57
|
+
http_request.parameters.empty?
|
58
|
+
request.body = http_request.parameters
|
59
|
+
end
|
60
|
+
end
|
61
|
+
convert_response(response, http_request)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Method overridden from HttpClient.
|
65
|
+
def convert_response(response, http_request)
|
66
|
+
HttpResponse.new(response.status, response.reason_phrase,
|
67
|
+
response.headers, response.body, http_request)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack
|
9
|
+
# A controller will call this method before making an HTTP Request.
|
10
|
+
# @param [HttpRequest] The HttpRequest object which the HttpClient
|
11
|
+
# will execute.
|
12
|
+
def on_before_request(_http_request)
|
13
|
+
raise NotImplementedError, 'This method needs
|
14
|
+
to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
|
17
|
+
# A controller will call this method after making an HTTP Request.
|
18
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
19
|
+
def on_after_response(_http_response)
|
20
|
+
raise NotImplementedError, 'This method needs
|
21
|
+
to be implemented in a child class.'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# An interface for the methods that an HTTP Client must implement.
|
8
|
+
#
|
9
|
+
# This class should not be instantiated but should be used as a base class
|
10
|
+
# for HTTP Client classes.
|
11
|
+
class HttpClient
|
12
|
+
# Execute an HttpRequest when the response is expected to be a string.
|
13
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
14
|
+
def execute_as_string(_http_request)
|
15
|
+
raise NotImplementedError, 'This method needs
|
16
|
+
to be implemented in a child class.'
|
17
|
+
end
|
18
|
+
|
19
|
+
# Execute an HttpRequest when the response is expected to be binary.
|
20
|
+
# @param [HttpRequest] The HttpRequest to be executed.
|
21
|
+
def execute_as_binary(_http_request)
|
22
|
+
raise NotImplementedError, 'This method needs
|
23
|
+
to be implemented in a child class.'
|
24
|
+
end
|
25
|
+
|
26
|
+
# Converts the HTTP Response from the client to an HttpResponse object.
|
27
|
+
# @param [Dynamic] The response object received from the client.
|
28
|
+
def convert_response(_response)
|
29
|
+
raise NotImplementedError, 'This method needs
|
30
|
+
to be implemented in a child class.'
|
31
|
+
end
|
32
|
+
|
33
|
+
# Get a GET HttpRequest object.
|
34
|
+
# @param [String] The URL to send the request to.
|
35
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
36
|
+
def get(query_url,
|
37
|
+
headers: {})
|
38
|
+
HttpRequest.new(HttpMethodEnum::GET,
|
39
|
+
query_url,
|
40
|
+
headers: headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get a HEAD HttpRequest object.
|
44
|
+
# @param [String] The URL to send the request to.
|
45
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
46
|
+
def head(query_url,
|
47
|
+
headers: {})
|
48
|
+
HttpRequest.new(HttpMethodEnum::HEAD,
|
49
|
+
query_url,
|
50
|
+
headers: headers)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Get a POST HttpRequest object.
|
54
|
+
# @param [String] The URL to send the request to.
|
55
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
56
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
57
|
+
def post(query_url,
|
58
|
+
headers: {},
|
59
|
+
parameters: {})
|
60
|
+
HttpRequest.new(HttpMethodEnum::POST,
|
61
|
+
query_url,
|
62
|
+
headers: headers,
|
63
|
+
parameters: parameters)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Get a PUT HttpRequest object.
|
67
|
+
# @param [String] The URL to send the request to.
|
68
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
69
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
70
|
+
def put(query_url,
|
71
|
+
headers: {},
|
72
|
+
parameters: {})
|
73
|
+
HttpRequest.new(HttpMethodEnum::PUT,
|
74
|
+
query_url,
|
75
|
+
headers: headers,
|
76
|
+
parameters: parameters)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Get a PATCH HttpRequest object.
|
80
|
+
# @param [String] The URL to send the request to.
|
81
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
82
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
83
|
+
def patch(query_url,
|
84
|
+
headers: {},
|
85
|
+
parameters: {})
|
86
|
+
HttpRequest.new(HttpMethodEnum::PATCH,
|
87
|
+
query_url,
|
88
|
+
headers: headers,
|
89
|
+
parameters: parameters)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Get a DELETE HttpRequest object.
|
93
|
+
# @param [String] The URL to send the request to.
|
94
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
95
|
+
def delete(query_url,
|
96
|
+
headers: {},
|
97
|
+
parameters: {})
|
98
|
+
HttpRequest.new(HttpMethodEnum::DELETE,
|
99
|
+
query_url,
|
100
|
+
headers: headers,
|
101
|
+
parameters: parameters)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# HTTP Methods Enumeration.
|
8
|
+
class HttpMethodEnum
|
9
|
+
HTTPMETHODENUM = [GET = 'GET'.freeze, POST = 'POST'.freeze,
|
10
|
+
PUT = 'PUT'.freeze, PATCH = 'PATCH'.freeze,
|
11
|
+
DELETE = 'DELETE'.freeze, HEAD = 'HEAD'.freeze].freeze
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# Represents a single Http Request.
|
8
|
+
class HttpRequest
|
9
|
+
attr_accessor :http_method, :query_url, :headers,
|
10
|
+
:parameters, :username, :password
|
11
|
+
|
12
|
+
# The constructor.
|
13
|
+
# @param [HttpMethodEnum] The HTTP method.
|
14
|
+
# @param [String] The URL to send the request to.
|
15
|
+
# @param [Hash, Optional] The headers for the HTTP Request.
|
16
|
+
# @param [Hash, Optional] The parameters for the HTTP Request.
|
17
|
+
def initialize(http_method,
|
18
|
+
query_url,
|
19
|
+
headers: {},
|
20
|
+
parameters: {})
|
21
|
+
@http_method = http_method
|
22
|
+
@query_url = query_url
|
23
|
+
@headers = headers
|
24
|
+
@parameters = parameters
|
25
|
+
end
|
26
|
+
|
27
|
+
# Add a header to the HttpRequest.
|
28
|
+
# @param [String] The name of the header.
|
29
|
+
# @param [String] The value of the header.
|
30
|
+
def add_header(name, value)
|
31
|
+
@headers[name] = value
|
32
|
+
end
|
33
|
+
|
34
|
+
# Add a parameter to the HttpRequest.
|
35
|
+
# @param [String] The name of the parameter.
|
36
|
+
# @param [String] The value of the parameter.
|
37
|
+
def add_parameter(name, value)
|
38
|
+
@parameters[name] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Add a query parameter to the HttpRequest.
|
42
|
+
# @param [String] The name of the query parameter.
|
43
|
+
# @param [String] The value of the query parameter.
|
44
|
+
def add_query_parameter(name, value)
|
45
|
+
@query_url = APIHelper.append_url_with_query_parameters(@query_url,
|
46
|
+
name => value)
|
47
|
+
@query_url = APIHelper.clean_url(@query_url)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# Http response received.
|
8
|
+
class HttpResponse
|
9
|
+
attr_reader :status_code, :reason_phrase, :headers, :raw_body, :request
|
10
|
+
|
11
|
+
# The constructor
|
12
|
+
# @param [Integer] The status code returned by the server.
|
13
|
+
# @param [String] The reason phrase returned by the server.
|
14
|
+
# @param [Hash] The headers sent by the server in the response.
|
15
|
+
# @param [String] The raw body of the response.
|
16
|
+
# @param [HttpRequest] The request that resulted in this response.
|
17
|
+
def initialize(status_code,
|
18
|
+
reason_phrase,
|
19
|
+
headers,
|
20
|
+
raw_body,
|
21
|
+
request)
|
22
|
+
@status_code = status_code
|
23
|
+
@reason_phrase = reason_phrase
|
24
|
+
@headers = headers
|
25
|
+
@raw_body = raw_body
|
26
|
+
@request = request
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# payments_api
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module PaymentsApi
|
7
|
+
# Address Information
|
8
|
+
class Address < BaseModel
|
9
|
+
# Address Line 1
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :address1
|
12
|
+
|
13
|
+
# Address Line 2
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :address2
|
16
|
+
|
17
|
+
# City
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :city
|
20
|
+
|
21
|
+
# State / Province
|
22
|
+
# @return [String]
|
23
|
+
attr_accessor :state
|
24
|
+
|
25
|
+
# Postal Code
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :postal_code
|
28
|
+
|
29
|
+
# Country (ISO 3166-1 Alpha-2 Code)
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :country
|
32
|
+
|
33
|
+
# A mapping from model property names to API property names.
|
34
|
+
def self.names
|
35
|
+
@_hash = {} if @_hash.nil?
|
36
|
+
@_hash['address1'] = 'address1'
|
37
|
+
@_hash['address2'] = 'address2'
|
38
|
+
@_hash['city'] = 'city'
|
39
|
+
@_hash['state'] = 'state'
|
40
|
+
@_hash['postal_code'] = 'postalCode'
|
41
|
+
@_hash['country'] = 'country'
|
42
|
+
@_hash
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(address1 = nil,
|
46
|
+
city = nil,
|
47
|
+
postal_code = nil,
|
48
|
+
country = nil,
|
49
|
+
address2 = nil,
|
50
|
+
state = nil)
|
51
|
+
@address1 = address1
|
52
|
+
@address2 = address2
|
53
|
+
@city = city
|
54
|
+
@state = state
|
55
|
+
@postal_code = postal_code
|
56
|
+
@country = country
|
57
|
+
end
|
58
|
+
|
59
|
+
# Creates an instance of the object from a hash.
|
60
|
+
def self.from_hash(hash)
|
61
|
+
return nil unless hash
|
62
|
+
|
63
|
+
# Extract variables from the hash.
|
64
|
+
address1 = hash['address1']
|
65
|
+
city = hash['city']
|
66
|
+
postal_code = hash['postalCode']
|
67
|
+
country = hash['country']
|
68
|
+
address2 = hash['address2']
|
69
|
+
state = hash['state']
|
70
|
+
|
71
|
+
# Create object from extracted values.
|
72
|
+
Address.new(address1,
|
73
|
+
city,
|
74
|
+
postal_code,
|
75
|
+
country,
|
76
|
+
address2,
|
77
|
+
state)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|