bleumi_pay_sdk_ruby 1.0.3 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +31 -26
- data/assets/images/BleumiPay.png +0 -0
- data/bleumi_pay_sdk_ruby.gemspec +4 -4
- data/docs/AlgorandAddress.md +28 -0
- data/docs/AlgorandBalance.md +28 -0
- data/docs/AlgorandWalletAddress.md +24 -0
- data/docs/AlgorandWalletInputs.md +23 -0
- data/docs/BadRequest.md +1 -1
- data/docs/Chain.md +6 -3
- data/docs/CheckoutToken.md +8 -3
- data/docs/CreateCheckoutUrlRequest.md +7 -8
- data/docs/CreatePayoutRequest.md +1 -1
- data/docs/CreatePayoutResponse.md +1 -1
- data/docs/EthereumAddress.md +29 -0
- data/docs/EthereumBalance.md +30 -0
- data/docs/EthereumWalletAddress.md +23 -0
- data/docs/EthereumWalletInputs.md +23 -0
- data/docs/HostedCheckoutsApi.md +31 -23
- data/docs/PaginatedPaymentOperations.md +2 -3
- data/docs/PaginatedPayments.md +41 -10
- data/docs/PaginatedPayoutItems.md +1 -1
- data/docs/Payment.md +13 -7
- data/docs/PaymentAddresses.md +29 -7
- data/docs/PaymentBalances.md +20 -8
- data/docs/PaymentOperation.md +2 -2
- data/docs/PaymentOperationInputs.md +3 -4
- data/docs/PaymentRefundRequest.md +1 -3
- data/docs/PaymentSettleRequest.md +1 -1
- data/docs/PaymentsApi.md +15 -73
- data/docs/Payout.md +2 -1
- data/docs/PayoutItem.md +1 -1
- data/docs/PayoutItemInputs.md +1 -1
- data/docs/PayoutsApi.md +10 -10
- data/docs/RskAddress.md +29 -0
- data/docs/RskBalance.md +28 -0
- data/docs/ValidateCheckoutRequest.md +2 -2
- data/docs/WalletBalance.md +13 -9
- data/lib/bleumi_pay_sdk_ruby.rb +13 -8
- data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +17 -5
- data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +34 -78
- data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +261 -0
- data/lib/bleumi_pay_sdk_ruby/api_client.rb +10 -8
- data/lib/bleumi_pay_sdk_ruby/api_error.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/configuration.rb +3 -3
- data/lib/bleumi_pay_sdk_ruby/models/algorand_address.rb +219 -0
- data/lib/bleumi_pay_sdk_ruby/models/algorand_balance.rb +219 -0
- data/lib/bleumi_pay_sdk_ruby/models/{create_payment_response.rb → algorand_wallet_address.rb} +20 -11
- data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_inputs.rb +247 -0
- data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +3 -3
- data/lib/bleumi_pay_sdk_ruby/models/chain.rb +6 -5
- data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +46 -16
- data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +26 -13
- data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +4 -3
- data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/{create_payment_request.rb → ethereum_address.rb} +39 -38
- data/lib/bleumi_pay_sdk_ruby/models/{network_balance.rb → ethereum_balance.rb} +13 -46
- data/lib/bleumi_pay_sdk_ruby/models/{wallet_address.rb → ethereum_wallet_address.rb} +19 -10
- data/lib/bleumi_pay_sdk_ruby/models/ethereum_wallet_inputs.rb +247 -0
- data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/paginated_payments.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/paginated_payout_items.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/payment.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +25 -9
- data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +24 -6
- data/lib/bleumi_pay_sdk_ruby/models/payment_operation.rb +4 -3
- data/lib/bleumi_pay_sdk_ruby/models/payment_operation_inputs.rb +3 -3
- data/lib/bleumi_pay_sdk_ruby/models/payment_operation_response.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/payment_refund_request.rb +3 -3
- data/lib/bleumi_pay_sdk_ruby/models/payment_settle_request.rb +3 -3
- data/lib/bleumi_pay_sdk_ruby/models/payout.rb +16 -6
- data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/rsk_address.rb +219 -0
- data/lib/bleumi_pay_sdk_ruby/models/{token.rb → rsk_balance.rb} +41 -36
- data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +2 -2
- data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +21 -6
- data/lib/bleumi_pay_sdk_ruby/version.rb +3 -3
- data/spec/api/hosted_checkouts_api_spec.rb +1 -1
- data/spec/api/payments_api_spec.rb +6 -17
- data/spec/api_client_spec.rb +1 -1
- data/spec/models/{create_payment_response_spec.rb → algorand_address_spec.rb} +13 -7
- data/spec/models/{token_spec.rb → algorand_balance_spec.rb} +15 -9
- data/spec/models/algorand_wallet_address_spec.rb +47 -0
- data/spec/models/algorand_wallet_inputs_spec.rb +65 -0
- data/spec/models/checkout_token_spec.rb +13 -1
- data/spec/models/create_checkout_url_request_spec.rb +7 -1
- data/spec/models/{create_payment_request_spec.rb → ethereum_address_spec.rb} +15 -9
- data/spec/models/{network_balance_spec.rb → ethereum_balance_spec.rb} +9 -27
- data/spec/models/ethereum_wallet_address_spec.rb +47 -0
- data/spec/models/ethereum_wallet_inputs_spec.rb +65 -0
- data/spec/models/payment_addresses_spec.rb +12 -0
- data/spec/models/payment_balances_spec.rb +12 -0
- data/spec/models/payout_spec.rb +6 -0
- data/spec/models/{eth_address_spec.rb → rsk_address_spec.rb} +13 -7
- data/spec/models/{wallet_address_spec.rb → rsk_balance_spec.rb} +13 -7
- data/spec/models/wallet_balance_spec.rb +6 -0
- metadata +48 -28
- data/docs/CreatePaymentRequest.md +0 -19
- data/docs/CreatePaymentResponse.md +0 -15
- data/docs/EthAddress.md +0 -13
- data/docs/NetworkBalance.md +0 -29
- data/docs/Token.md +0 -15
- data/docs/WalletAddress.md +0 -14
- data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
data/docs/Payout.md
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**transfer_address** | **String** | Address of receiver. This address must be able to receive payments from smart contracts. |
|
8
|
-
**amount** | **String** | Amount of token to transfer |
|
8
|
+
**amount** | **String** | Amount of token to transfer |
|
9
|
+
**authorization** <br> (Optional)| **String** | (Only for Algorand) Base64 serialization of an encoded LogicSig signed by the source of the payout |
|
9
10
|
|
10
11
|
## Example
|
11
12
|
|
data/docs/PayoutItem.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**txid** | **String** | Unique identifier for this payout |
|
8
|
-
**status** | **Boolean** | <b>null</b> - Operation in progress </br> <b>true</b> - Operation confirmed by network </br> <b>false</b> - Operation rejected by network </br> |
|
8
|
+
**status** | **Boolean** | <b>null</b> - Operation in progress </br> <b>true</b> - Operation confirmed by network </br> <b>false</b> - Operation rejected by network </br> |
|
9
9
|
**hash** | **String** | Transaction hash of the operation submitted to the network. This field is blank when the operation is in progress. |
|
10
10
|
**created_at** | **Integer** | UNIX timestamp when the payout was created |
|
11
11
|
**updated_at** | **Integer** | UNIX timestamp when the lastest operation was performed |
|
data/docs/PayoutItemInputs.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Name | Type | Description | Notes
|
6
6
|
------------ | ------------- | ------------- | -------------
|
7
7
|
**salt** | **String** | Unique identifier generated for the txid of the payout (specified during Create a Payout). |
|
8
|
-
**token** | **String** | Token used for the payout |
|
8
|
+
**token** | **String** | Token used for the payout | <b>ETH</b> - for Ethereum <br/> <b>XDAI</b> - for xDai <br/> <b>XDAIT</b> - for xDai Testnet <br/> <b>ALGO</b> - for Algo <br/> <b><asset id></b> - for Algorand Standard Asset payouts <br/> <b> <contract address of ERC-20 token></b> - for ERC-20 payouts; Please refer to [ERC-20 Tokens](https://pay.bleumi.com/docs/#erc-20) for contract address; |
|
9
9
|
**payouts** | [**Array<Payout>**](Payout.md) | Array of payments to be made in this payout. This is an atomic transaction (i.e. either all payments are processed or all of them are rejected). |
|
10
10
|
|
11
11
|
## Example
|
data/docs/PayoutsApi.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# BleumiPay::PayoutsApi
|
2
2
|
|
3
|
-
Payouts are available only for the Ethereum
|
4
|
-
|
3
|
+
Payouts are available only for the Ethereum, xDAI and RSK networks today and require you to set up a Private Payment Processor and link it to your account. Please contact support@bleumi.com if you want to enable payouts for your account.
|
5
4
|
|
6
5
|
## create_payout
|
7
6
|
|
@@ -23,7 +22,7 @@ end
|
|
23
22
|
api_instance = BleumiPay::PayoutsApi.new
|
24
23
|
|
25
24
|
opts = {
|
26
|
-
chain: BleumiPay::Chain::
|
25
|
+
chain: BleumiPay::Chain::GOERLI # Chain | Network in which payment is to be created.
|
27
26
|
}
|
28
27
|
|
29
28
|
begin
|
@@ -42,14 +41,14 @@ begin
|
|
42
41
|
payouts = [payout1, payout2]
|
43
42
|
|
44
43
|
create_payout_request.txid = '<TXID>' # str | Replace with unique payout ID
|
45
|
-
create_payout_request.token =
|
44
|
+
create_payout_request.token = '<TOKEN>' # str | Replace <TOKEN> by anyone of the following values: 'ETH' or 'XDAI' or 'XDAIT' or ECR-20 Contract Address or 'RBTC' or RSK ECR-20 Contract Address or 'Asset ID' of Algorand Standard Asset.
|
46
45
|
create_payout_request.payouts = payouts # setting the payouts array to the payout create request
|
47
46
|
|
48
47
|
#Create a payout.
|
49
48
|
result = api_instance.create_payout(create_payout_request, opts)
|
50
49
|
p result
|
51
50
|
rescue BleumiPay::ApiError => e
|
52
|
-
puts "Exception when calling
|
51
|
+
puts "Exception when calling create_payout: #{e}"
|
53
52
|
end
|
54
53
|
```
|
55
54
|
|
@@ -58,8 +57,9 @@ end
|
|
58
57
|
|
59
58
|
Name | Type | Description | Notes
|
60
59
|
------------- | ------------- | ------------- | -------------
|
61
|
-
**create_payout_request** | [**CreatePayoutRequest**](CreatePayoutRequest.md)|
|
62
|
-
**chain** | [**Chain**](.md)|
|
60
|
+
**create_payout_request** | [**CreatePayoutRequest**](CreatePayoutRequest.md)| Specify payout creation parameters. |
|
61
|
+
**chain** | [**Chain**](Chain.md)| Network in which the payout is to be made. Please refer documentation for [Supported Networks](https://pay.bleumi.com/docs/#supported-networks) |
|
62
|
+
|
63
63
|
|
64
64
|
### Return type
|
65
65
|
|
@@ -108,7 +108,7 @@ api_instance = BleumiPay::PayoutsApi.new
|
|
108
108
|
opts = {
|
109
109
|
next_token: '', # String | Cursor to start results from
|
110
110
|
sort_by: '<SORT_BY>', # String | Sort payouts by (optional) | Eg. "createdAt"
|
111
|
-
start_at: '<START_TIMESTAMP>', # String | Get payouts from this timestamp (optional) | Eg.
|
111
|
+
start_at: '<START_TIMESTAMP>', # String | Get payouts from this timestamp (optional) | Eg. 1577836800 for 1-JAN-2020
|
112
112
|
end_at: '' # String | Get payouts till this timestamp (optional)
|
113
113
|
}
|
114
114
|
|
@@ -117,7 +117,7 @@ begin
|
|
117
117
|
result = api_instance.list_payouts(opts)
|
118
118
|
p result
|
119
119
|
rescue BleumiPay::ApiError => e
|
120
|
-
puts "Exception when calling
|
120
|
+
puts "Exception when calling list_payouts: #{e}"
|
121
121
|
end
|
122
122
|
```
|
123
123
|
|
@@ -127,7 +127,7 @@ end
|
|
127
127
|
Name | Type | Description | Notes
|
128
128
|
------------- | ------------- | ------------- | -------------
|
129
129
|
**next_token** | **String**| Cursor to start results from | [optional]
|
130
|
-
**sort_by** | **String**| Sort
|
130
|
+
**sort_by** | **String**| Sort payouts by | [optional] 'createdAt' - results will be sorted by created time in ascending order. <br>'updatedAt' - results will be sorted by last updated time in ascending order.
|
131
131
|
**start_at** | **String**| Get payouts from this timestamp (unix) | [optional]
|
132
132
|
**end_at** | **String**| Get payouts till this timestamp (unix) | [optional]
|
133
133
|
|
data/docs/RskAddress.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# BleumiPay::RskAddress
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**rsk** <br> (Optional)| [**Hash<String, EthereumWalletAddress>**](EthereumWalletAddress.md) | A dictionary which gives the address of the wallet generated for Rsk MainNet |
|
8
|
+
**rsk_testnet** <br> (Optional)| [**Hash<String, EthereumWalletAddress>**](EthereumWalletAddress.md) | A dictionary which gives the address of the wallet generated for Rsk TestNet |
|
9
|
+
|
10
|
+
## Example
|
11
|
+
|
12
|
+
```json
|
13
|
+
{
|
14
|
+
"rsk": {
|
15
|
+
"rsk_testnet": {
|
16
|
+
"0x5db2d6542d55b2aec1f10d0c0df3b0169bf41e41|0x5db2d6542d55b2aec1f10d0c0df3b0169bf41e41": {
|
17
|
+
"inputs": {
|
18
|
+
"salt": "0x5d5fe1e5024cb6e9175da30a963919054db612f2f857cbfe3151747e96267f58",
|
19
|
+
"walletProxy": "0xe5f208073c717c076271b695324112779c6f8820",
|
20
|
+
"walletLibrary": "0x8cdf9b11ad8db65f94197d21d25fbff107cd02de",
|
21
|
+
"buyer": "0x5db2d6542d55b2aec1f10d0c0df3b0169bf41e41",
|
22
|
+
"merchant": "0x5db2d6542d55b2aec1f10d0c0df3b0169bf41e41"
|
23
|
+
},
|
24
|
+
"addr": "0xbe17b427aad1a29bff91e1e85d8324bc34b033b0"
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
```
|
data/docs/RskBalance.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# BleumiPay::RskBalance
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
|
5
|
+
Name | Type | Description | Notes
|
6
|
+
------------ | ------------- | ------------- | -------------
|
7
|
+
**rsk** <br>(Optional) | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in RSK MainNet |
|
8
|
+
**rsk_testnet** <br>(Optional) | [**Hash<String, WalletBalance>**](WalletBalance.md) | A dictionary which gives the token balances in RSK TestNet |
|
9
|
+
|
10
|
+
## Example - TestNet
|
11
|
+
|
12
|
+
```json
|
13
|
+
{
|
14
|
+
"balances": {
|
15
|
+
"rsk": {
|
16
|
+
"rsk_testnet": {
|
17
|
+
"0x1efeabf46ca3270a9a41d324350692664f1ea105": {
|
18
|
+
"blockNum": "889362",
|
19
|
+
"token_balance": "300",
|
20
|
+
"balance": "3",
|
21
|
+
"safety": "high",
|
22
|
+
"token_decimals": 2
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
```
|
@@ -13,9 +13,9 @@ Name | Type | Description | Notes
|
|
13
13
|
|
14
14
|
```json
|
15
15
|
{
|
16
|
-
"hmac_input": "
|
16
|
+
"hmac_input": "rsk_testnet|0xbed61c55cc290b55c1c4c327148bdede56a831f4|0xb9f624160bb2755aa25366cc307ed27e39a4f296|10|0|0x16e54beb3ea4b4206b62ca32b1d2cf4ad15d9af2234564c2166ff3ccc817d5c1",
|
17
17
|
"hmac_keyId": "v1",
|
18
18
|
"hmac_alg": "HMAC-SHA256-HEX",
|
19
|
-
"hmac_value": "
|
19
|
+
"hmac_value": "c782cbad4394383599b7cf9f9d62990f289649b35edd82cd1c7d58dd65e9fc03"
|
20
20
|
}
|
21
21
|
```
|
data/docs/WalletBalance.md
CHANGED
@@ -8,14 +8,18 @@ Name | Type | Description | Notes
|
|
8
8
|
**token_balance** | **String** | Token balance for the wallet in Ethereum format |
|
9
9
|
**token_decimals** | **Integer** | Token decimal places |
|
10
10
|
**block_num** | **String** | Block in which the balance was last updated |
|
11
|
+
**safety** | **String** | Safety level indicator |
|
12
|
+
|
13
|
+
## Code Sample
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'BleumiPay'
|
17
|
+
|
18
|
+
instance = BleumiPay::WalletBalance.new(balance: null,
|
19
|
+
token_balance: null,
|
20
|
+
token_decimals: null,
|
21
|
+
block_num: null,
|
22
|
+
safety: null)
|
23
|
+
```
|
11
24
|
|
12
|
-
## Example
|
13
25
|
|
14
|
-
```json
|
15
|
-
{
|
16
|
-
"balance": "1",
|
17
|
-
"token_decimals": 15,
|
18
|
-
"blockNum": "1698324",
|
19
|
-
"token_balance": "1000000000000000"
|
20
|
-
}
|
21
|
-
```
|
data/lib/bleumi_pay_sdk_ruby.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
=begin
|
2
|
-
#Bleumi Pay API
|
2
|
+
#Bleumi Pay REST API
|
3
3
|
|
4
|
-
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
|
4
|
+
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
|
5
5
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: info@bleumi.com
|
@@ -17,17 +17,21 @@ require 'bleumi_pay_sdk_ruby/version'
|
|
17
17
|
require 'bleumi_pay_sdk_ruby/configuration'
|
18
18
|
|
19
19
|
# Models
|
20
|
+
require 'bleumi_pay_sdk_ruby/models/algorand_address'
|
21
|
+
require 'bleumi_pay_sdk_ruby/models/algorand_balance'
|
22
|
+
require 'bleumi_pay_sdk_ruby/models/algorand_wallet_address'
|
23
|
+
require 'bleumi_pay_sdk_ruby/models/algorand_wallet_inputs'
|
20
24
|
require 'bleumi_pay_sdk_ruby/models/bad_request'
|
21
25
|
require 'bleumi_pay_sdk_ruby/models/chain'
|
22
26
|
require 'bleumi_pay_sdk_ruby/models/checkout_token'
|
23
27
|
require 'bleumi_pay_sdk_ruby/models/create_checkout_url_request'
|
24
28
|
require 'bleumi_pay_sdk_ruby/models/create_checkout_url_response'
|
25
|
-
require 'bleumi_pay_sdk_ruby/models/create_payment_request'
|
26
|
-
require 'bleumi_pay_sdk_ruby/models/create_payment_response'
|
27
29
|
require 'bleumi_pay_sdk_ruby/models/create_payout_request'
|
28
30
|
require 'bleumi_pay_sdk_ruby/models/create_payout_response'
|
29
|
-
require 'bleumi_pay_sdk_ruby/models/
|
30
|
-
require 'bleumi_pay_sdk_ruby/models/
|
31
|
+
require 'bleumi_pay_sdk_ruby/models/ethereum_address'
|
32
|
+
require 'bleumi_pay_sdk_ruby/models/ethereum_balance'
|
33
|
+
require 'bleumi_pay_sdk_ruby/models/ethereum_wallet_address'
|
34
|
+
require 'bleumi_pay_sdk_ruby/models/ethereum_wallet_inputs'
|
31
35
|
require 'bleumi_pay_sdk_ruby/models/paginated_payment_operations'
|
32
36
|
require 'bleumi_pay_sdk_ruby/models/paginated_payments'
|
33
37
|
require 'bleumi_pay_sdk_ruby/models/paginated_payout_items'
|
@@ -42,16 +46,17 @@ require 'bleumi_pay_sdk_ruby/models/payment_settle_request'
|
|
42
46
|
require 'bleumi_pay_sdk_ruby/models/payout'
|
43
47
|
require 'bleumi_pay_sdk_ruby/models/payout_item'
|
44
48
|
require 'bleumi_pay_sdk_ruby/models/payout_item_inputs'
|
45
|
-
require 'bleumi_pay_sdk_ruby/models/
|
49
|
+
require 'bleumi_pay_sdk_ruby/models/rsk_address'
|
50
|
+
require 'bleumi_pay_sdk_ruby/models/rsk_balance'
|
46
51
|
require 'bleumi_pay_sdk_ruby/models/validate_checkout_request'
|
47
52
|
require 'bleumi_pay_sdk_ruby/models/validate_checkout_response'
|
48
|
-
require 'bleumi_pay_sdk_ruby/models/wallet_address'
|
49
53
|
require 'bleumi_pay_sdk_ruby/models/wallet_balance'
|
50
54
|
|
51
55
|
# APIs
|
52
56
|
require 'bleumi_pay_sdk_ruby/api/hosted_checkouts_api'
|
53
57
|
require 'bleumi_pay_sdk_ruby/api/payments_api'
|
54
58
|
require 'bleumi_pay_sdk_ruby/api/payouts_api'
|
59
|
+
require 'bleumi_pay_sdk_ruby/api/request_validator'
|
55
60
|
|
56
61
|
module BleumiPay
|
57
62
|
class << self
|
@@ -1,7 +1,7 @@
|
|
1
1
|
=begin
|
2
|
-
#Bleumi Pay API
|
2
|
+
#Bleumi Pay REST API
|
3
3
|
|
4
|
-
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
|
4
|
+
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
|
5
5
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: info@bleumi.com
|
@@ -15,9 +15,11 @@ require 'cgi'
|
|
15
15
|
module BleumiPay
|
16
16
|
class HostedCheckoutsApi
|
17
17
|
attr_accessor :api_client
|
18
|
+
attr_accessor :request_validator
|
18
19
|
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
+
def initialize(api_client = ApiClient.default, request_validator = RequestValidator.default)
|
20
21
|
@api_client = api_client
|
22
|
+
@request_validator = request_validator
|
21
23
|
end
|
22
24
|
# Generate a unique checkout URL to accept payment.
|
23
25
|
# @param create_checkout_url_request [CreateCheckoutUrlRequest] Specify checkout URL creation parameters.
|
@@ -40,6 +42,11 @@ module BleumiPay
|
|
40
42
|
if @api_client.config.client_side_validation && create_checkout_url_request.nil?
|
41
43
|
fail ArgumentError, "Missing the required parameter 'create_checkout_url_request' when calling HostedCheckoutsApi.create_checkout_url"
|
42
44
|
end
|
45
|
+
# verify the values in the request body are valid
|
46
|
+
msg = @request_validator.validate_create_checkout_url_request(create_checkout_url_request)
|
47
|
+
if (@request_validator.is_not_empty(msg))
|
48
|
+
fail ArgumentError, "`#{msg}` when calling HostedCheckoutsApi.create_checkout_url"
|
49
|
+
end
|
43
50
|
# resource path
|
44
51
|
local_var_path = '/v1/payment/hc'
|
45
52
|
|
@@ -81,7 +88,7 @@ module BleumiPay
|
|
81
88
|
return data, status_code, headers
|
82
89
|
end
|
83
90
|
|
84
|
-
# Retrieve all tokens configured for the Hosted Checkout in your account in the
|
91
|
+
# Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard.
|
85
92
|
# @param [Hash] opts the optional parameters
|
86
93
|
# @return [Array<CheckoutToken>]
|
87
94
|
def list_tokens(opts = {})
|
@@ -89,7 +96,7 @@ module BleumiPay
|
|
89
96
|
data
|
90
97
|
end
|
91
98
|
|
92
|
-
# Retrieve all tokens configured for the Hosted Checkout in your account in the
|
99
|
+
# Retrieve all tokens configured for the Hosted Checkout in your account in the Bleumi Pay Dashboard.
|
93
100
|
# @param [Hash] opts the optional parameters
|
94
101
|
# @return [Array<(Array<CheckoutToken>, Integer, Hash)>] Array<CheckoutToken> data, response status code and response headers
|
95
102
|
def list_tokens_with_http_info(opts = {})
|
@@ -156,6 +163,11 @@ module BleumiPay
|
|
156
163
|
if @api_client.config.client_side_validation && validate_checkout_request.nil?
|
157
164
|
fail ArgumentError, "Missing the required parameter 'validate_checkout_request' when calling HostedCheckoutsApi.validate_checkout_payment"
|
158
165
|
end
|
166
|
+
# verify the values in the request body are valid
|
167
|
+
msg = @request_validator.validate_checkout_payment_params(validate_checkout_request)
|
168
|
+
if (@request_validator.is_not_empty(msg))
|
169
|
+
fail ArgumentError, "`#{msg}` when calling HostedCheckoutsApi.validate_checkout_payment"
|
170
|
+
end
|
159
171
|
# resource path
|
160
172
|
local_var_path = '/v1/payment/hc/validate'
|
161
173
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
=begin
|
2
|
-
#Bleumi Pay API
|
2
|
+
#Bleumi Pay REST API
|
3
3
|
|
4
|
-
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
|
4
|
+
#A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
|
5
5
|
|
6
6
|
The version of the OpenAPI document: 1.0.0
|
7
7
|
Contact: info@bleumi.com
|
@@ -15,77 +15,14 @@ require 'cgi'
|
|
15
15
|
module BleumiPay
|
16
16
|
class PaymentsApi
|
17
17
|
attr_accessor :api_client
|
18
|
+
attr_accessor :request_validator
|
18
19
|
|
19
|
-
def initialize(api_client = ApiClient.default)
|
20
|
+
def initialize(api_client = ApiClient.default, request_validator = RequestValidator.default)
|
20
21
|
@api_client = api_client
|
22
|
+
@request_validator = request_validator
|
21
23
|
end
|
22
|
-
# Generate a unique wallet address in the specified network to accept payment
|
23
|
-
# @param create_payment_request [CreatePaymentRequest]
|
24
|
-
# @param [Hash] opts the optional parameters
|
25
|
-
# @option opts [Chain] :chain Ethereum network in which payment is to be created. Please refer documentation for Supported Networks
|
26
|
-
# @return [CreatePaymentResponse]
|
27
|
-
def create_payment(create_payment_request, opts = {})
|
28
|
-
data, _status_code, _headers = create_payment_with_http_info(create_payment_request, opts)
|
29
|
-
data
|
30
|
-
end
|
31
|
-
|
32
|
-
# Generate a unique wallet address in the specified network to accept payment
|
33
|
-
# @param create_payment_request [CreatePaymentRequest]
|
34
|
-
# @param [Hash] opts the optional parameters
|
35
|
-
# @option opts [Chain] :chain Ethereum network in which payment is to be created. Please refer documentation for Supported Networks
|
36
|
-
# @return [Array<(CreatePaymentResponse, Integer, Hash)>] CreatePaymentResponse data, response status code and response headers
|
37
|
-
def create_payment_with_http_info(create_payment_request, opts = {})
|
38
|
-
if @api_client.config.debugging
|
39
|
-
@api_client.config.logger.debug 'Calling API: PaymentsApi.create_payment ...'
|
40
|
-
end
|
41
|
-
# verify the required parameter 'create_payment_request' is set
|
42
|
-
if @api_client.config.client_side_validation && create_payment_request.nil?
|
43
|
-
fail ArgumentError, "Missing the required parameter 'create_payment_request' when calling PaymentsApi.create_payment"
|
44
|
-
end
|
45
|
-
# resource path
|
46
|
-
local_var_path = '/v1/payment'
|
47
|
-
|
48
|
-
# query parameters
|
49
|
-
query_params = opts[:query_params] || {}
|
50
|
-
query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?
|
51
|
-
|
52
|
-
# header parameters
|
53
|
-
header_params = opts[:header_params] || {}
|
54
|
-
# HTTP header 'Accept' (if needed)
|
55
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
56
|
-
# HTTP header 'Content-Type'
|
57
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
|
58
|
-
|
59
|
-
# form parameters
|
60
|
-
form_params = opts[:form_params] || {}
|
61
|
-
|
62
|
-
# http body (model)
|
63
|
-
post_body = opts[:body] || @api_client.object_to_http_body(create_payment_request)
|
64
|
-
|
65
|
-
# return_type
|
66
|
-
return_type = opts[:return_type] || 'CreatePaymentResponse'
|
67
|
-
|
68
|
-
# auth_names
|
69
|
-
auth_names = opts[:auth_names] || ['ApiKeyAuth']
|
70
|
-
|
71
|
-
new_options = opts.merge(
|
72
|
-
:header_params => header_params,
|
73
|
-
:query_params => query_params,
|
74
|
-
:form_params => form_params,
|
75
|
-
:body => post_body,
|
76
|
-
:auth_names => auth_names,
|
77
|
-
:return_type => return_type
|
78
|
-
)
|
79
|
-
|
80
|
-
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
81
|
-
if @api_client.config.debugging
|
82
|
-
@api_client.config.logger.debug "API called: PaymentsApi#create_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
83
|
-
end
|
84
|
-
return data, status_code, headers
|
85
|
-
end
|
86
|
-
|
87
24
|
# Retrieve the wallet addresses & token balances for a given payment
|
88
|
-
# @param id [String] Unique identifier of the payment (specified during
|
25
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment) to retrieve
|
89
26
|
# @param [Hash] opts the optional parameters
|
90
27
|
# @return [Payment]
|
91
28
|
def get_payment(id, opts = {})
|
@@ -94,7 +31,7 @@ module BleumiPay
|
|
94
31
|
end
|
95
32
|
|
96
33
|
# Retrieve the wallet addresses & token balances for a given payment
|
97
|
-
# @param id [String] Unique identifier of the payment (specified during
|
34
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment) to retrieve
|
98
35
|
# @param [Hash] opts the optional parameters
|
99
36
|
# @return [Array<(Payment, Integer, Hash)>] Payment data, response status code and response headers
|
100
37
|
def get_payment_with_http_info(id, opts = {})
|
@@ -277,6 +214,7 @@ module BleumiPay
|
|
277
214
|
# @param [Hash] opts the optional parameters
|
278
215
|
# @option opts [String] :next_token Cursor to start results from
|
279
216
|
# @option opts [String] :sort_by Sort payments by
|
217
|
+
# @option opts [String] :sort_order Sort Order
|
280
218
|
# @option opts [String] :start_at Get payments from this timestamp (unix)
|
281
219
|
# @option opts [String] :end_at Get payments till this timestamp (unix)
|
282
220
|
# @return [PaginatedPayments]
|
@@ -289,6 +227,7 @@ module BleumiPay
|
|
289
227
|
# @param [Hash] opts the optional parameters
|
290
228
|
# @option opts [String] :next_token Cursor to start results from
|
291
229
|
# @option opts [String] :sort_by Sort payments by
|
230
|
+
# @option opts [String] :sort_order Sort Order
|
292
231
|
# @option opts [String] :start_at Get payments from this timestamp (unix)
|
293
232
|
# @option opts [String] :end_at Get payments till this timestamp (unix)
|
294
233
|
# @return [Array<(PaginatedPayments, Integer, Hash)>] PaginatedPayments data, response status code and response headers
|
@@ -300,6 +239,10 @@ module BleumiPay
|
|
300
239
|
if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
|
301
240
|
fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
|
302
241
|
end
|
242
|
+
allowable_values = ["ascending", "descending"]
|
243
|
+
if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
|
244
|
+
fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
|
245
|
+
end
|
303
246
|
# resource path
|
304
247
|
local_var_path = '/v1/payment'
|
305
248
|
|
@@ -307,6 +250,7 @@ module BleumiPay
|
|
307
250
|
query_params = opts[:query_params] || {}
|
308
251
|
query_params[:'nextToken'] = opts[:'next_token'] if !opts[:'next_token'].nil?
|
309
252
|
query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
|
253
|
+
query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
|
310
254
|
query_params[:'startAt'] = opts[:'start_at'] if !opts[:'start_at'].nil?
|
311
255
|
query_params[:'endAt'] = opts[:'end_at'] if !opts[:'end_at'].nil?
|
312
256
|
|
@@ -344,10 +288,10 @@ module BleumiPay
|
|
344
288
|
end
|
345
289
|
|
346
290
|
# Refund the balance of a token for a given payment to the buyerAddress
|
347
|
-
# @param id [String] Unique identifier of the payment (specified during
|
291
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
348
292
|
# @param payment_refund_request [PaymentRefundRequest] Request body - used to specify the token to refund.
|
349
293
|
# @param [Hash] opts the optional parameters
|
350
|
-
# @option opts [Chain] :chain
|
294
|
+
# @option opts [Chain] :chain Network in which payment is to be refunded.
|
351
295
|
# @return [PaymentOperationResponse]
|
352
296
|
def refund_payment(id, payment_refund_request, opts = {})
|
353
297
|
data, _status_code, _headers = refund_payment_with_http_info(id, payment_refund_request, opts)
|
@@ -355,10 +299,10 @@ module BleumiPay
|
|
355
299
|
end
|
356
300
|
|
357
301
|
# Refund the balance of a token for a given payment to the buyerAddress
|
358
|
-
# @param id [String] Unique identifier of the payment (specified during
|
302
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
359
303
|
# @param payment_refund_request [PaymentRefundRequest] Request body - used to specify the token to refund.
|
360
304
|
# @param [Hash] opts the optional parameters
|
361
|
-
# @option opts [Chain] :chain
|
305
|
+
# @option opts [Chain] :chain Network in which payment is to be refunded.
|
362
306
|
# @return [Array<(PaymentOperationResponse, Integer, Hash)>] PaymentOperationResponse data, response status code and response headers
|
363
307
|
def refund_payment_with_http_info(id, payment_refund_request, opts = {})
|
364
308
|
if @api_client.config.debugging
|
@@ -372,6 +316,12 @@ module BleumiPay
|
|
372
316
|
if @api_client.config.client_side_validation && payment_refund_request.nil?
|
373
317
|
fail ArgumentError, "Missing the required parameter 'payment_refund_request' when calling PaymentsApi.refund_payment"
|
374
318
|
end
|
319
|
+
# verify the values in the request body are valid
|
320
|
+
chain = opts[:'chain'] if !opts[:'chain'].nil?
|
321
|
+
msg = @request_validator.validate_refund_payment_request(payment_refund_request, chain)
|
322
|
+
if (@request_validator.is_not_empty(msg))
|
323
|
+
fail ArgumentError, "`#{msg}` when calling PaymentsApi.refund_payment"
|
324
|
+
end
|
375
325
|
# resource path
|
376
326
|
local_var_path = '/v1/payment/{id}/refund'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
377
327
|
|
@@ -415,10 +365,10 @@ module BleumiPay
|
|
415
365
|
end
|
416
366
|
|
417
367
|
# Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress
|
418
|
-
# @param id [String] Unique identifier of the payment (specified during
|
368
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
419
369
|
# @param payment_settle_request [PaymentSettleRequest] Request body - used to specify the amount to settle.
|
420
370
|
# @param [Hash] opts the optional parameters
|
421
|
-
# @option opts [Chain] :chain
|
371
|
+
# @option opts [Chain] :chain Network in which payment is to be settled.
|
422
372
|
# @return [PaymentOperationResponse]
|
423
373
|
def settle_payment(id, payment_settle_request, opts = {})
|
424
374
|
data, _status_code, _headers = settle_payment_with_http_info(id, payment_settle_request, opts)
|
@@ -426,10 +376,10 @@ module BleumiPay
|
|
426
376
|
end
|
427
377
|
|
428
378
|
# Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress
|
429
|
-
# @param id [String] Unique identifier of the payment (specified during
|
379
|
+
# @param id [String] Unique identifier of the payment (specified during createPayment)
|
430
380
|
# @param payment_settle_request [PaymentSettleRequest] Request body - used to specify the amount to settle.
|
431
381
|
# @param [Hash] opts the optional parameters
|
432
|
-
# @option opts [Chain] :chain
|
382
|
+
# @option opts [Chain] :chain Network in which payment is to be settled.
|
433
383
|
# @return [Array<(PaymentOperationResponse, Integer, Hash)>] PaymentOperationResponse data, response status code and response headers
|
434
384
|
def settle_payment_with_http_info(id, payment_settle_request, opts = {})
|
435
385
|
if @api_client.config.debugging
|
@@ -443,6 +393,12 @@ module BleumiPay
|
|
443
393
|
if @api_client.config.client_side_validation && payment_settle_request.nil?
|
444
394
|
fail ArgumentError, "Missing the required parameter 'payment_settle_request' when calling PaymentsApi.settle_payment"
|
445
395
|
end
|
396
|
+
# verify the values in the request body are valid
|
397
|
+
chain = opts[:'chain'] if !opts[:'chain'].nil?
|
398
|
+
msg = @request_validator.validate_settle_payment_request(payment_settle_request, chain)
|
399
|
+
if (@request_validator.is_not_empty(msg))
|
400
|
+
fail ArgumentError, "`#{msg}` when calling PaymentsApi.settle_payment"
|
401
|
+
end
|
446
402
|
# resource path
|
447
403
|
local_var_path = '/v1/payment/{id}/settle'.sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
448
404
|
|