pnap_payments_api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +143 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/docs/CardPaymentMethodDetails.md +20 -0
- data/docs/Error.md +20 -0
- data/docs/PaginatedResponse.md +22 -0
- data/docs/PaginatedTransactions.md +24 -0
- data/docs/Transaction.md +32 -0
- data/docs/TransactionMetadata.md +22 -0
- data/docs/TransactionsApi.md +159 -0
- data/lib/pnap_payments_api/api/transactions_api.rb +180 -0
- data/lib/pnap_payments_api/api_client.rb +397 -0
- data/lib/pnap_payments_api/api_error.rb +58 -0
- data/lib/pnap_payments_api/configuration.rb +298 -0
- data/lib/pnap_payments_api/models/card_payment_method_details.rb +261 -0
- data/lib/pnap_payments_api/models/error.rb +234 -0
- data/lib/pnap_payments_api/models/paginated_response.rb +256 -0
- data/lib/pnap_payments_api/models/paginated_transactions.rb +281 -0
- data/lib/pnap_payments_api/models/transaction.rb +333 -0
- data/lib/pnap_payments_api/models/transaction_metadata.rb +250 -0
- data/lib/pnap_payments_api/version.rb +19 -0
- data/lib/pnap_payments_api.rb +46 -0
- data/pnap_payments_api.gemspec +39 -0
- data/spec/api/transactions_api_spec.rb +64 -0
- data/spec/models/card_payment_method_details_spec.rb +42 -0
- data/spec/models/error_spec.rb +42 -0
- data/spec/models/paginated_response_spec.rb +48 -0
- data/spec/models/paginated_transactions_spec.rb +54 -0
- data/spec/models/transaction_metadata_spec.rb +48 -0
- data/spec/models/transaction_spec.rb +78 -0
- data/spec/spec_helper.rb +111 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 489dfe534742ec568a15226ddb5f75a28db4f345a498b62290d64ef7816489be
|
4
|
+
data.tar.gz: eea7739d5aff9c33876c4d90874b558cd64460c5e9f39f9612815fa92006b7d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b2ebe98c8ac6921d13799a2bc4d79f0520e86f55e2e9f427ea113ab61b71a3bc536467de1e68b58d0ca322c7702c178f7107d419fa263282660c0d4343eee51b
|
7
|
+
data.tar.gz: 13ee5b8483b0d2e71d74b5b09c7a8dba8ee87250ec21caf38d12b1397958fef25e5e2d878b459f906146f75e8ddc91351225b550850bcf40d1acd75c9ded0938
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
# pnap_payments_api
|
2
|
+
|
3
|
+
PaymentsApi - the Ruby gem for the Payments API
|
4
|
+
|
5
|
+
Payments API are currently designed to fetch Transactions only.
|
6
|
+
|
7
|
+
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
8
|
+
|
9
|
+
- API version: 0.1
|
10
|
+
For more information, please visit [https://phoenixnap.com/](https://phoenixnap.com/)
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
### Build a gem
|
15
|
+
|
16
|
+
To build the Ruby code into a gem:
|
17
|
+
|
18
|
+
```shell
|
19
|
+
gem build pnap_payments_api.gemspec
|
20
|
+
```
|
21
|
+
|
22
|
+
Then either install the gem locally, replacing `<VERSION>` with the actual version:
|
23
|
+
|
24
|
+
```shell
|
25
|
+
gem install ./pnap_payments_api-<VERSION>.gem
|
26
|
+
```
|
27
|
+
|
28
|
+
(for development, run `gem install --dev ./pnap_payments_api-<VERSION>.gem` to install the development dependencies)
|
29
|
+
|
30
|
+
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
|
+
|
32
|
+
Finally add this to the Gemfile:
|
33
|
+
|
34
|
+
gem 'pnap_payments_api', '~> <VERSION>'
|
35
|
+
|
36
|
+
### Install from Git
|
37
|
+
|
38
|
+
To install this Gem from this repository, you'll need to get Bundler by doing `gem install bundler`. Add the following line in your Gemfile:
|
39
|
+
|
40
|
+
gem 'pnap_payments_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'PaymentsApi/*.gemspec'
|
41
|
+
|
42
|
+
If you'd like the development version:
|
43
|
+
|
44
|
+
gem 'pnap_payments_api', git: 'https://github.com/phoenixnap/ruby-sdk-bmc-poc', glob: 'PaymentsApi/*.gemspec', branch: 'develop'
|
45
|
+
|
46
|
+
Then run `bundle install`.
|
47
|
+
|
48
|
+
### Include the Ruby code directly
|
49
|
+
|
50
|
+
Include the Ruby code directly using `-I` as follows:
|
51
|
+
|
52
|
+
```shell
|
53
|
+
ruby -Ilib script.rb
|
54
|
+
```
|
55
|
+
|
56
|
+
## Getting Started
|
57
|
+
|
58
|
+
Please follow the [installation](#installation) procedure and then run the following code:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
# Load the gem
|
62
|
+
require 'pnap_payments_api'
|
63
|
+
|
64
|
+
# Setup authorization
|
65
|
+
PaymentsApi.configure do |config|
|
66
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
67
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
68
|
+
# Configure a proc to get access tokens in lieu of the static access_token configuration
|
69
|
+
config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' }
|
70
|
+
end
|
71
|
+
|
72
|
+
api_instance = PaymentsApi::TransactionsApi.new
|
73
|
+
transaction_id = '0a1b2c3d4f5g6h7i8j9k' # String | The transaction identifier.
|
74
|
+
|
75
|
+
begin
|
76
|
+
#Get Transaction.
|
77
|
+
result = api_instance.transaction_id_get(transaction_id)
|
78
|
+
p result
|
79
|
+
rescue PaymentsApi::ApiError => e
|
80
|
+
puts "Exception when calling TransactionsApi->transaction_id_get: #{e}"
|
81
|
+
end
|
82
|
+
|
83
|
+
```
|
84
|
+
|
85
|
+
Authorization can also be setup by using the [`oauth`](https://github.com/oauth-xx/oauth2) library:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
# Load the gem
|
89
|
+
require 'pnap_payments_api'
|
90
|
+
require 'oauth2'
|
91
|
+
|
92
|
+
# Setup variables for getting a token.
|
93
|
+
client_id = 'YOUR_CLIENT_ID'
|
94
|
+
client_secret = 'YOUR_CLIENT_SECRET'
|
95
|
+
auth_url = 'https://auth.phoenixnap.com/auth/realms/BMC/protocol/openid-connect/token'
|
96
|
+
|
97
|
+
|
98
|
+
# Setup authorization
|
99
|
+
PaymentsApi.configure do |config|
|
100
|
+
# Retrieve the token using OAuth2.
|
101
|
+
client = OAuth2::Client.new(client_id, client_secret, token_url: auth_url)
|
102
|
+
token = client.client_credentials.get_token
|
103
|
+
|
104
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
105
|
+
config.access_token = token.token
|
106
|
+
end
|
107
|
+
|
108
|
+
```
|
109
|
+
|
110
|
+
## Documentation for API Endpoints
|
111
|
+
|
112
|
+
All URIs are relative to *https://api.phoenixnap.com/payments/v1*
|
113
|
+
|
114
|
+
Class | Method | HTTP request | Description
|
115
|
+
------------ | ------------- | ------------- | -------------
|
116
|
+
*PaymentsApi::TransactionsApi* | [**transaction_id_get**](docs/TransactionsApi.md#transaction_id_get) | **GET** /transactions/{transactionId} | Get Transaction.
|
117
|
+
*PaymentsApi::TransactionsApi* | [**transactions_get**](docs/TransactionsApi.md#transactions_get) | **GET** /transactions | Get Transactions.
|
118
|
+
|
119
|
+
|
120
|
+
## Documentation for Models
|
121
|
+
|
122
|
+
- [PaymentsApi::CardPaymentMethodDetails](docs/CardPaymentMethodDetails.md)
|
123
|
+
- [PaymentsApi::Error](docs/Error.md)
|
124
|
+
- [PaymentsApi::PaginatedResponse](docs/PaginatedResponse.md)
|
125
|
+
- [PaymentsApi::PaginatedTransactions](docs/PaginatedTransactions.md)
|
126
|
+
- [PaymentsApi::Transaction](docs/Transaction.md)
|
127
|
+
- [PaymentsApi::TransactionMetadata](docs/TransactionMetadata.md)
|
128
|
+
|
129
|
+
|
130
|
+
## Documentation for Authorization
|
131
|
+
|
132
|
+
|
133
|
+
Authentication schemes defined for the API:
|
134
|
+
### OAuth2
|
135
|
+
|
136
|
+
|
137
|
+
- **Type**: OAuth
|
138
|
+
- **Flow**: application
|
139
|
+
- **Authorization URL**:
|
140
|
+
- **Scopes**:
|
141
|
+
- transactions: Grants full access to transactions.
|
142
|
+
- transactions.read: Grants read only access to transactions.
|
143
|
+
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# PaymentsApi::CardPaymentMethodDetails
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **card_type** | **String** | The Card Type. Supported Card Types include: VISA, MASTERCARD, DISCOVER, JCB & AMEX. | |
|
8
|
+
| **last_four_digits** | **String** | The last four digits of the card number. | |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'pnap_payments_api'
|
14
|
+
|
15
|
+
instance = PaymentsApi::CardPaymentMethodDetails.new(
|
16
|
+
card_type: VISA,
|
17
|
+
last_four_digits: 5666
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
data/docs/Error.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# PaymentsApi::Error
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **message** | **String** | The description detailing the cause of the error code. | [readonly] |
|
8
|
+
| **validation_errors** | **Array<String>** | Validation errors, if any. | [optional][readonly] |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
require 'pnap_payments_api'
|
14
|
+
|
15
|
+
instance = PaymentsApi::Error.new(
|
16
|
+
message: null,
|
17
|
+
validation_errors: null
|
18
|
+
)
|
19
|
+
```
|
20
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# PaymentsApi::PaginatedResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **limit** | **Integer** | Maximum number of items in the page (actual returned length can be less). | |
|
8
|
+
| **offset** | **Integer** | The number of returned items skipped. | |
|
9
|
+
| **total** | **Integer** | The total number of records available for retrieval. | |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'pnap_payments_api'
|
15
|
+
|
16
|
+
instance = PaymentsApi::PaginatedResponse.new(
|
17
|
+
limit: 5,
|
18
|
+
offset: 25,
|
19
|
+
total: 400
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# PaymentsApi::PaginatedTransactions
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **results** | [**Array<Transaction>**](Transaction.md) | | |
|
8
|
+
| **limit** | **Integer** | Maximum number of items in the page (actual returned length can be less). | |
|
9
|
+
| **offset** | **Integer** | The number of returned items skipped. | |
|
10
|
+
| **total** | **Integer** | The total number of records available for retrieval. | |
|
11
|
+
|
12
|
+
## Example
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
require 'pnap_payments_api'
|
16
|
+
|
17
|
+
instance = PaymentsApi::PaginatedTransactions.new(
|
18
|
+
results: null,
|
19
|
+
limit: 5,
|
20
|
+
offset: 25,
|
21
|
+
total: 400
|
22
|
+
)
|
23
|
+
```
|
24
|
+
|
data/docs/Transaction.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# PaymentsApi::Transaction
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **id** | **String** | The Transaction ID. | |
|
8
|
+
| **status** | **String** | The Transaction status. Status may be: SUCCESS, PROCESSING, FAILED | |
|
9
|
+
| **details** | **String** | Details about the transaction. Contains failure reason in case of failed transactions. | [optional] |
|
10
|
+
| **amount** | **Float** | The transaction amount. | |
|
11
|
+
| **currency** | **String** | The transaction currency. | |
|
12
|
+
| **date** | **Time** | Date and time when transaction was created. | |
|
13
|
+
| **metadata** | [**TransactionMetadata**](TransactionMetadata.md) | | |
|
14
|
+
| **card_payment_method_details** | [**CardPaymentMethodDetails**](CardPaymentMethodDetails.md) | | |
|
15
|
+
|
16
|
+
## Example
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
require 'pnap_payments_api'
|
20
|
+
|
21
|
+
instance = PaymentsApi::Transaction.new(
|
22
|
+
id: 60ffafcdffb8b074c7968faf,
|
23
|
+
status: FAILED,
|
24
|
+
details: Transaction failed due to credit card expiration.,
|
25
|
+
amount: 10.99,
|
26
|
+
currency: USD,
|
27
|
+
date: 2023-04-27T16:24:57.123Z,
|
28
|
+
metadata: null,
|
29
|
+
card_payment_method_details: null
|
30
|
+
)
|
31
|
+
```
|
32
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# PaymentsApi::TransactionMetadata
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
| Name | Type | Description | Notes |
|
6
|
+
| ---- | ---- | ----------- | ----- |
|
7
|
+
| **invoice_id** | **String** | The Invoice ID that this transaction pertains to. | |
|
8
|
+
| **invoice_number** | **String** | A user-friendly reference number assigned to the invoice that this transaction pertains to. | [optional] |
|
9
|
+
| **is_auto_charge** | **Boolean** | Whether this transaction was triggered by an auto charge or not. | |
|
10
|
+
|
11
|
+
## Example
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'pnap_payments_api'
|
15
|
+
|
16
|
+
instance = PaymentsApi::TransactionMetadata.new(
|
17
|
+
invoice_id: 3088561,
|
18
|
+
invoice_number: 1234-4321,
|
19
|
+
is_auto_charge: true
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# PaymentsApi::TransactionsApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.phoenixnap.com/payments/v1*
|
4
|
+
|
5
|
+
| Method | HTTP request | Description |
|
6
|
+
| ------ | ------------ | ----------- |
|
7
|
+
| [**transaction_id_get**](TransactionsApi.md#transaction_id_get) | **GET** /transactions/{transactionId} | Get Transaction. |
|
8
|
+
| [**transactions_get**](TransactionsApi.md#transactions_get) | **GET** /transactions | Get Transactions. |
|
9
|
+
|
10
|
+
|
11
|
+
## transaction_id_get
|
12
|
+
|
13
|
+
> <Transaction> transaction_id_get(transaction_id)
|
14
|
+
|
15
|
+
Get Transaction.
|
16
|
+
|
17
|
+
Get transaction details.
|
18
|
+
|
19
|
+
### Examples
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'time'
|
23
|
+
require 'pnap_payments_api'
|
24
|
+
# setup authorization
|
25
|
+
PaymentsApi.configure do |config|
|
26
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
27
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
28
|
+
end
|
29
|
+
|
30
|
+
api_instance = PaymentsApi::TransactionsApi.new
|
31
|
+
transaction_id = '0a1b2c3d4f5g6h7i8j9k' # String | The transaction identifier.
|
32
|
+
|
33
|
+
begin
|
34
|
+
# Get Transaction.
|
35
|
+
result = api_instance.transaction_id_get(transaction_id)
|
36
|
+
p result
|
37
|
+
rescue PaymentsApi::ApiError => e
|
38
|
+
puts "Error when calling TransactionsApi->transaction_id_get: #{e}"
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
#### Using the transaction_id_get_with_http_info variant
|
43
|
+
|
44
|
+
This returns an Array which contains the response data, status code and headers.
|
45
|
+
|
46
|
+
> <Array(<Transaction>, Integer, Hash)> transaction_id_get_with_http_info(transaction_id)
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
begin
|
50
|
+
# Get Transaction.
|
51
|
+
data, status_code, headers = api_instance.transaction_id_get_with_http_info(transaction_id)
|
52
|
+
p status_code # => 2xx
|
53
|
+
p headers # => { ... }
|
54
|
+
p data # => <Transaction>
|
55
|
+
rescue PaymentsApi::ApiError => e
|
56
|
+
puts "Error when calling TransactionsApi->transaction_id_get_with_http_info: #{e}"
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
### Parameters
|
61
|
+
|
62
|
+
| Name | Type | Description | Notes |
|
63
|
+
| ---- | ---- | ----------- | ----- |
|
64
|
+
| **transaction_id** | **String** | The transaction identifier. | |
|
65
|
+
|
66
|
+
### Return type
|
67
|
+
|
68
|
+
[**Transaction**](Transaction.md)
|
69
|
+
|
70
|
+
### Authorization
|
71
|
+
|
72
|
+
[OAuth2](../README.md#OAuth2)
|
73
|
+
|
74
|
+
### HTTP request headers
|
75
|
+
|
76
|
+
- **Content-Type**: Not defined
|
77
|
+
- **Accept**: application/json
|
78
|
+
|
79
|
+
|
80
|
+
## transactions_get
|
81
|
+
|
82
|
+
> <PaginatedTransactions> transactions_get(opts)
|
83
|
+
|
84
|
+
Get Transactions.
|
85
|
+
|
86
|
+
A paginated list of client's transactions.
|
87
|
+
|
88
|
+
### Examples
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
require 'time'
|
92
|
+
require 'pnap_payments_api'
|
93
|
+
# setup authorization
|
94
|
+
PaymentsApi.configure do |config|
|
95
|
+
# Configure OAuth2 access token for authorization: OAuth2
|
96
|
+
config.access_token = 'YOUR ACCESS TOKEN'
|
97
|
+
end
|
98
|
+
|
99
|
+
api_instance = PaymentsApi::TransactionsApi.new
|
100
|
+
opts = {
|
101
|
+
limit: 25, # Integer | The limit of the number of results returned. The number of records returned may be smaller than the limit.
|
102
|
+
offset: 5, # Integer | The number of items to skip in the results.
|
103
|
+
sort_direction: 'ASC', # String | Sort Given Field depending on the desired direction. Default sorting is descending.
|
104
|
+
sort_field: 'date', # String | If a sortField is requested, pagination will be done after sorting. Default sorting is by date.
|
105
|
+
from: Time.parse('2021-04-27T16:24:57.123Z'), # Time | From the date and time (inclusive) to filter transactions by.
|
106
|
+
to: Time.parse('2021-04-29T16:24:57.123Z') # Time | To the date and time (inclusive) to filter transactions by.
|
107
|
+
}
|
108
|
+
|
109
|
+
begin
|
110
|
+
# Get Transactions.
|
111
|
+
result = api_instance.transactions_get(opts)
|
112
|
+
p result
|
113
|
+
rescue PaymentsApi::ApiError => e
|
114
|
+
puts "Error when calling TransactionsApi->transactions_get: #{e}"
|
115
|
+
end
|
116
|
+
```
|
117
|
+
|
118
|
+
#### Using the transactions_get_with_http_info variant
|
119
|
+
|
120
|
+
This returns an Array which contains the response data, status code and headers.
|
121
|
+
|
122
|
+
> <Array(<PaginatedTransactions>, Integer, Hash)> transactions_get_with_http_info(opts)
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
begin
|
126
|
+
# Get Transactions.
|
127
|
+
data, status_code, headers = api_instance.transactions_get_with_http_info(opts)
|
128
|
+
p status_code # => 2xx
|
129
|
+
p headers # => { ... }
|
130
|
+
p data # => <PaginatedTransactions>
|
131
|
+
rescue PaymentsApi::ApiError => e
|
132
|
+
puts "Error when calling TransactionsApi->transactions_get_with_http_info: #{e}"
|
133
|
+
end
|
134
|
+
```
|
135
|
+
|
136
|
+
### Parameters
|
137
|
+
|
138
|
+
| Name | Type | Description | Notes |
|
139
|
+
| ---- | ---- | ----------- | ----- |
|
140
|
+
| **limit** | **Integer** | The limit of the number of results returned. The number of records returned may be smaller than the limit. | [optional][default to 100] |
|
141
|
+
| **offset** | **Integer** | The number of items to skip in the results. | [optional][default to 0] |
|
142
|
+
| **sort_direction** | **String** | Sort Given Field depending on the desired direction. Default sorting is descending. | [optional][default to 'DESC'] |
|
143
|
+
| **sort_field** | **String** | If a sortField is requested, pagination will be done after sorting. Default sorting is by date. | [optional][default to 'date'] |
|
144
|
+
| **from** | **Time** | From the date and time (inclusive) to filter transactions by. | [optional] |
|
145
|
+
| **to** | **Time** | To the date and time (inclusive) to filter transactions by. | [optional] |
|
146
|
+
|
147
|
+
### Return type
|
148
|
+
|
149
|
+
[**PaginatedTransactions**](PaginatedTransactions.md)
|
150
|
+
|
151
|
+
### Authorization
|
152
|
+
|
153
|
+
[OAuth2](../README.md#OAuth2)
|
154
|
+
|
155
|
+
### HTTP request headers
|
156
|
+
|
157
|
+
- **Content-Type**: Not defined
|
158
|
+
- **Accept**: application/json
|
159
|
+
|
@@ -0,0 +1,180 @@
|
|
1
|
+
=begin
|
2
|
+
#Payments API
|
3
|
+
|
4
|
+
#Payments API are currently designed to fetch Transactions only.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 0.1
|
7
|
+
Contact: support@phoenixnap.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 7.2.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module PaymentsApi
|
16
|
+
class TransactionsApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Get Transaction.
|
23
|
+
# Get transaction details.
|
24
|
+
# @param transaction_id [String] The transaction identifier.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [Transaction]
|
27
|
+
def transaction_id_get(transaction_id, opts = {})
|
28
|
+
data, _status_code, _headers = transaction_id_get_with_http_info(transaction_id, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Get Transaction.
|
33
|
+
# Get transaction details.
|
34
|
+
# @param transaction_id [String] The transaction identifier.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(Transaction, Integer, Hash)>] Transaction data, response status code and response headers
|
37
|
+
def transaction_id_get_with_http_info(transaction_id, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: TransactionsApi.transaction_id_get ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'transaction_id' is set
|
42
|
+
if @api_client.config.client_side_validation && transaction_id.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'transaction_id' when calling TransactionsApi.transaction_id_get"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/transactions/{transactionId}'.sub('{' + 'transactionId' + '}', CGI.escape(transaction_id.to_s))
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
55
|
+
|
56
|
+
# form parameters
|
57
|
+
form_params = opts[:form_params] || {}
|
58
|
+
|
59
|
+
# http body (model)
|
60
|
+
post_body = opts[:debug_body]
|
61
|
+
|
62
|
+
# return_type
|
63
|
+
return_type = opts[:debug_return_type] || 'Transaction'
|
64
|
+
|
65
|
+
# auth_names
|
66
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
67
|
+
|
68
|
+
new_options = opts.merge(
|
69
|
+
:operation => :"TransactionsApi.transaction_id_get",
|
70
|
+
:header_params => header_params,
|
71
|
+
:query_params => query_params,
|
72
|
+
:form_params => form_params,
|
73
|
+
:body => post_body,
|
74
|
+
:auth_names => auth_names,
|
75
|
+
:return_type => return_type
|
76
|
+
)
|
77
|
+
|
78
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
79
|
+
if @api_client.config.debugging
|
80
|
+
@api_client.config.logger.debug "API called: TransactionsApi#transaction_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
81
|
+
end
|
82
|
+
return data, status_code, headers
|
83
|
+
end
|
84
|
+
|
85
|
+
# Get Transactions.
|
86
|
+
# A paginated list of client's transactions.
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @option opts [Integer] :limit The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)
|
89
|
+
# @option opts [Integer] :offset The number of items to skip in the results. (default to 0)
|
90
|
+
# @option opts [String] :sort_direction Sort Given Field depending on the desired direction. Default sorting is descending. (default to 'DESC')
|
91
|
+
# @option opts [String] :sort_field If a sortField is requested, pagination will be done after sorting. Default sorting is by date. (default to 'date')
|
92
|
+
# @option opts [Time] :from From the date and time (inclusive) to filter transactions by.
|
93
|
+
# @option opts [Time] :to To the date and time (inclusive) to filter transactions by.
|
94
|
+
# @return [PaginatedTransactions]
|
95
|
+
def transactions_get(opts = {})
|
96
|
+
data, _status_code, _headers = transactions_get_with_http_info(opts)
|
97
|
+
data
|
98
|
+
end
|
99
|
+
|
100
|
+
# Get Transactions.
|
101
|
+
# A paginated list of client's transactions.
|
102
|
+
# @param [Hash] opts the optional parameters
|
103
|
+
# @option opts [Integer] :limit The limit of the number of results returned. The number of records returned may be smaller than the limit. (default to 100)
|
104
|
+
# @option opts [Integer] :offset The number of items to skip in the results. (default to 0)
|
105
|
+
# @option opts [String] :sort_direction Sort Given Field depending on the desired direction. Default sorting is descending. (default to 'DESC')
|
106
|
+
# @option opts [String] :sort_field If a sortField is requested, pagination will be done after sorting. Default sorting is by date. (default to 'date')
|
107
|
+
# @option opts [Time] :from From the date and time (inclusive) to filter transactions by.
|
108
|
+
# @option opts [Time] :to To the date and time (inclusive) to filter transactions by.
|
109
|
+
# @return [Array<(PaginatedTransactions, Integer, Hash)>] PaginatedTransactions data, response status code and response headers
|
110
|
+
def transactions_get_with_http_info(opts = {})
|
111
|
+
if @api_client.config.debugging
|
112
|
+
@api_client.config.logger.debug 'Calling API: TransactionsApi.transactions_get ...'
|
113
|
+
end
|
114
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 1000
|
115
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionsApi.transactions_get, must be smaller than or equal to 1000.'
|
116
|
+
end
|
117
|
+
|
118
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
119
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TransactionsApi.transactions_get, must be greater than or equal to 1.'
|
120
|
+
end
|
121
|
+
|
122
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
123
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling TransactionsApi.transactions_get, must be greater than or equal to 0.'
|
124
|
+
end
|
125
|
+
|
126
|
+
allowable_values = ["ASC", "DESC"]
|
127
|
+
if @api_client.config.client_side_validation && opts[:'sort_direction'] && !allowable_values.include?(opts[:'sort_direction'])
|
128
|
+
fail ArgumentError, "invalid value for \"sort_direction\", must be one of #{allowable_values}"
|
129
|
+
end
|
130
|
+
allowable_values = ["date", "amount", "status", "cardPaymentMethodDetails.cardType", "cardPaymentMethodDetails.lastFourDigits", "metadata.invoiceId", "metadata.isAutoCharge"]
|
131
|
+
if @api_client.config.client_side_validation && opts[:'sort_field'] && !allowable_values.include?(opts[:'sort_field'])
|
132
|
+
fail ArgumentError, "invalid value for \"sort_field\", must be one of #{allowable_values}"
|
133
|
+
end
|
134
|
+
# resource path
|
135
|
+
local_var_path = '/transactions'
|
136
|
+
|
137
|
+
# query parameters
|
138
|
+
query_params = opts[:query_params] || {}
|
139
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
140
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
141
|
+
query_params[:'sortDirection'] = opts[:'sort_direction'] if !opts[:'sort_direction'].nil?
|
142
|
+
query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
|
143
|
+
query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
|
144
|
+
query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
|
145
|
+
|
146
|
+
# header parameters
|
147
|
+
header_params = opts[:header_params] || {}
|
148
|
+
# HTTP header 'Accept' (if needed)
|
149
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
150
|
+
|
151
|
+
# form parameters
|
152
|
+
form_params = opts[:form_params] || {}
|
153
|
+
|
154
|
+
# http body (model)
|
155
|
+
post_body = opts[:debug_body]
|
156
|
+
|
157
|
+
# return_type
|
158
|
+
return_type = opts[:debug_return_type] || 'PaginatedTransactions'
|
159
|
+
|
160
|
+
# auth_names
|
161
|
+
auth_names = opts[:debug_auth_names] || ['OAuth2']
|
162
|
+
|
163
|
+
new_options = opts.merge(
|
164
|
+
:operation => :"TransactionsApi.transactions_get",
|
165
|
+
:header_params => header_params,
|
166
|
+
:query_params => query_params,
|
167
|
+
:form_params => form_params,
|
168
|
+
:body => post_body,
|
169
|
+
:auth_names => auth_names,
|
170
|
+
:return_type => return_type
|
171
|
+
)
|
172
|
+
|
173
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
174
|
+
if @api_client.config.debugging
|
175
|
+
@api_client.config.logger.debug "API called: TransactionsApi#transactions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
176
|
+
end
|
177
|
+
return data, status_code, headers
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|