cryptopay-ruby 0.1.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/.github/workflows/ci.yml +36 -0
- data/.gitignore +38 -0
- data/.rspec +2 -0
- data/.rubocop.yml +104 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +521 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/cryptopay.gemspec +40 -0
- data/lib/cryptopay/api/accounts.rb +51 -0
- data/lib/cryptopay/api/channels.rb +142 -0
- data/lib/cryptopay/api/coin_withdrawals.rb +115 -0
- data/lib/cryptopay/api/customers.rb +85 -0
- data/lib/cryptopay/api/exchange_transfers.rb +64 -0
- data/lib/cryptopay/api/invoices.rb +163 -0
- data/lib/cryptopay/api/rates.rb +50 -0
- data/lib/cryptopay/api/risks.rb +32 -0
- data/lib/cryptopay/api/transactions.rb +47 -0
- data/lib/cryptopay/authentication.rb +30 -0
- data/lib/cryptopay/callbacks.rb +38 -0
- data/lib/cryptopay/client.rb +39 -0
- data/lib/cryptopay/config.rb +48 -0
- data/lib/cryptopay/connection.rb +48 -0
- data/lib/cryptopay/encoder.rb +113 -0
- data/lib/cryptopay/errors.rb +32 -0
- data/lib/cryptopay/models/account.rb +88 -0
- data/lib/cryptopay/models/account_list_result.rb +70 -0
- data/lib/cryptopay/models/callback.rb +25 -0
- data/lib/cryptopay/models/channel.rb +156 -0
- data/lib/cryptopay/models/channel_list_result.rb +82 -0
- data/lib/cryptopay/models/channel_params.rb +102 -0
- data/lib/cryptopay/models/channel_payment.rb +216 -0
- data/lib/cryptopay/models/channel_payment_callback.rb +92 -0
- data/lib/cryptopay/models/channel_payment_callback_event.rb +21 -0
- data/lib/cryptopay/models/channel_payment_list_result.rb +82 -0
- data/lib/cryptopay/models/channel_payment_result.rb +68 -0
- data/lib/cryptopay/models/channel_payment_status.rb +21 -0
- data/lib/cryptopay/models/channel_payment_status_context.rb +18 -0
- data/lib/cryptopay/models/channel_result.rb +68 -0
- data/lib/cryptopay/models/channel_status.rb +18 -0
- data/lib/cryptopay/models/channel_update_params.rb +85 -0
- data/lib/cryptopay/models/coin_withdrawal.rb +205 -0
- data/lib/cryptopay/models/coin_withdrawal_callback.rb +92 -0
- data/lib/cryptopay/models/coin_withdrawal_callback_event.rb +18 -0
- data/lib/cryptopay/models/coin_withdrawal_list_result.rb +82 -0
- data/lib/cryptopay/models/coin_withdrawal_params.rb +135 -0
- data/lib/cryptopay/models/coin_withdrawal_result.rb +68 -0
- data/lib/cryptopay/models/coin_withdrawal_status.rb +24 -0
- data/lib/cryptopay/models/customer.rb +81 -0
- data/lib/cryptopay/models/customer_list_result.rb +82 -0
- data/lib/cryptopay/models/customer_params.rb +81 -0
- data/lib/cryptopay/models/customer_result.rb +68 -0
- data/lib/cryptopay/models/customer_update_params.rb +68 -0
- data/lib/cryptopay/models/exchange.rb +89 -0
- data/lib/cryptopay/models/exchange_transfer.rb +116 -0
- data/lib/cryptopay/models/exchange_transfer_params.rb +101 -0
- data/lib/cryptopay/models/exchange_transfer_result.rb +68 -0
- data/lib/cryptopay/models/invoice.rb +276 -0
- data/lib/cryptopay/models/invoice_callback.rb +90 -0
- data/lib/cryptopay/models/invoice_callback_event.rb +22 -0
- data/lib/cryptopay/models/invoice_list_result.rb +82 -0
- data/lib/cryptopay/models/invoice_params.rb +131 -0
- data/lib/cryptopay/models/invoice_recalculation.rb +178 -0
- data/lib/cryptopay/models/invoice_recalculation_params.rb +61 -0
- data/lib/cryptopay/models/invoice_recalculation_result.rb +68 -0
- data/lib/cryptopay/models/invoice_refund.rb +154 -0
- data/lib/cryptopay/models/invoice_refund_list_result.rb +70 -0
- data/lib/cryptopay/models/invoice_refund_params.rb +61 -0
- data/lib/cryptopay/models/invoice_refund_result.rb +68 -0
- data/lib/cryptopay/models/invoice_result.rb +68 -0
- data/lib/cryptopay/models/invoice_status.rb +21 -0
- data/lib/cryptopay/models/invoice_status_context.rb +20 -0
- data/lib/cryptopay/models/invoice_transaction.rb +76 -0
- data/lib/cryptopay/models/network_fee.rb +84 -0
- data/lib/cryptopay/models/network_fee_level.rb +19 -0
- data/lib/cryptopay/models/network_fee_list_result.rb +70 -0
- data/lib/cryptopay/models/pagination.rb +72 -0
- data/lib/cryptopay/models/rate.rb +74 -0
- data/lib/cryptopay/models/rate_result.rb +68 -0
- data/lib/cryptopay/models/rates_result.rb +64 -0
- data/lib/cryptopay/models/risk.rb +98 -0
- data/lib/cryptopay/models/risk_level.rb +19 -0
- data/lib/cryptopay/models/risk_params.rb +86 -0
- data/lib/cryptopay/models/risk_result.rb +68 -0
- data/lib/cryptopay/models/transaction.rb +174 -0
- data/lib/cryptopay/models/transaction_list_result.rb +82 -0
- data/lib/cryptopay/models/transaction_reference_type.rb +25 -0
- data/lib/cryptopay/request.rb +46 -0
- data/lib/cryptopay/require.rb +79 -0
- data/lib/cryptopay/types.rb +11 -0
- data/lib/cryptopay/version.rb +5 -0
- data/lib/cryptopay.rb +26 -0
- metadata +256 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class Channels
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Create a channel
|
|
13
|
+
# @param channel_params [ChannelParams]
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @return [ChannelResult]
|
|
16
|
+
def create(channel_params, _opts = {})
|
|
17
|
+
path = '/api/channels'
|
|
18
|
+
|
|
19
|
+
req = Request.new(
|
|
20
|
+
method: :post,
|
|
21
|
+
path: path,
|
|
22
|
+
body_params: channel_params
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
connection.call(req, return_type: ChannelResult)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# List channels
|
|
29
|
+
# @param [Hash] opts the optional parameters
|
|
30
|
+
# @option opts [String] :customer_id The internal ID of your customer that the transaction relates to
|
|
31
|
+
# @option opts [String] :starting_after Pagination parameter. ID to start after
|
|
32
|
+
# @return [ChannelListResult]
|
|
33
|
+
def list(opts = {})
|
|
34
|
+
path = '/api/channels'
|
|
35
|
+
|
|
36
|
+
query_params = {}
|
|
37
|
+
query_params[:customer_id] = opts[:customer_id] unless opts[:customer_id].nil?
|
|
38
|
+
query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil?
|
|
39
|
+
|
|
40
|
+
req = Request.new(
|
|
41
|
+
method: :get,
|
|
42
|
+
path: path,
|
|
43
|
+
query_params: query_params
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
connection.call(req, return_type: ChannelListResult)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# List channel payments
|
|
50
|
+
# @param channel_id [String] Channel ID
|
|
51
|
+
# @param [Hash] opts the optional parameters
|
|
52
|
+
# @option opts [String] :starting_after Pagination parameter. ID to start after
|
|
53
|
+
# @return [ChannelPaymentListResult]
|
|
54
|
+
def list_payments(channel_id, opts = {})
|
|
55
|
+
path = '/api/channels/{channel_id}/payments'
|
|
56
|
+
path = path.sub('{channel_id}', CGI.escape(channel_id.to_s))
|
|
57
|
+
|
|
58
|
+
query_params = {}
|
|
59
|
+
query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil?
|
|
60
|
+
|
|
61
|
+
req = Request.new(
|
|
62
|
+
method: :get,
|
|
63
|
+
path: path,
|
|
64
|
+
query_params: query_params
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
connection.call(req, return_type: ChannelPaymentListResult)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Retrieve a channel
|
|
71
|
+
# @param channel_id [String] Channel ID
|
|
72
|
+
# @param [Hash] opts the optional parameters
|
|
73
|
+
# @return [ChannelResult]
|
|
74
|
+
def retrieve(channel_id, _opts = {})
|
|
75
|
+
path = '/api/channels/{channel_id}'
|
|
76
|
+
path = path.sub('{channel_id}', CGI.escape(channel_id.to_s))
|
|
77
|
+
|
|
78
|
+
req = Request.new(
|
|
79
|
+
method: :get,
|
|
80
|
+
path: path
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
connection.call(req, return_type: ChannelResult)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Retrieve a channel by custom id
|
|
87
|
+
# @param custom_id [String]
|
|
88
|
+
# @param [Hash] opts the optional parameters
|
|
89
|
+
# @return [ChannelResult]
|
|
90
|
+
def retrieve_by_custom_id(custom_id, _opts = {})
|
|
91
|
+
path = '/api/channels/custom_id/{custom_id}'
|
|
92
|
+
path = path.sub('{custom_id}', CGI.escape(custom_id.to_s))
|
|
93
|
+
|
|
94
|
+
req = Request.new(
|
|
95
|
+
method: :get,
|
|
96
|
+
path: path
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
connection.call(req, return_type: ChannelResult)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Retrieve a channel payment
|
|
103
|
+
# @param channel_id [String] Channel ID
|
|
104
|
+
# @param channel_payment_id [String] Channel payment ID
|
|
105
|
+
# @param [Hash] opts the optional parameters
|
|
106
|
+
# @return [ChannelPaymentResult]
|
|
107
|
+
def retrieve_payment(channel_id, channel_payment_id, _opts = {})
|
|
108
|
+
path = '/api/channels/{channel_id}/payments/{channel_payment_id}'
|
|
109
|
+
path = path.sub('{channel_id}', CGI.escape(channel_id.to_s))
|
|
110
|
+
path = path.sub('{channel_payment_id}', CGI.escape(channel_payment_id.to_s))
|
|
111
|
+
|
|
112
|
+
req = Request.new(
|
|
113
|
+
method: :get,
|
|
114
|
+
path: path
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
connection.call(req, return_type: ChannelPaymentResult)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Update a channel
|
|
121
|
+
# @param channel_id [String] Channel ID
|
|
122
|
+
# @param channel_update_params [ChannelUpdateParams]
|
|
123
|
+
# @param [Hash] opts the optional parameters
|
|
124
|
+
# @return [ChannelResult]
|
|
125
|
+
def update(channel_id, channel_update_params, _opts = {})
|
|
126
|
+
path = '/api/channels/{channel_id}'
|
|
127
|
+
path = path.sub('{channel_id}', CGI.escape(channel_id.to_s))
|
|
128
|
+
|
|
129
|
+
req = Request.new(
|
|
130
|
+
method: :patch,
|
|
131
|
+
path: path,
|
|
132
|
+
body_params: channel_update_params
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
connection.call(req, return_type: ChannelResult)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
private
|
|
139
|
+
|
|
140
|
+
attr_reader :connection
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class CoinWithdrawals
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Commit a withdrawal
|
|
13
|
+
# @param coin_withdrawal_id [String] Coin withdrawal ID
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @return [CoinWithdrawalResult]
|
|
16
|
+
def commit(coin_withdrawal_id, _opts = {})
|
|
17
|
+
path = '/api/coin_withdrawals/{coin_withdrawal_id}/commit'
|
|
18
|
+
path = path.sub('{coin_withdrawal_id}', CGI.escape(coin_withdrawal_id.to_s))
|
|
19
|
+
|
|
20
|
+
req = Request.new(
|
|
21
|
+
method: :post,
|
|
22
|
+
path: path
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
connection.call(req, return_type: CoinWithdrawalResult)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Create a withdrawal
|
|
29
|
+
# @param coin_withdrawal_params [CoinWithdrawalParams]
|
|
30
|
+
# @param [Hash] opts the optional parameters
|
|
31
|
+
# @return [CoinWithdrawalResult]
|
|
32
|
+
def create(coin_withdrawal_params, _opts = {})
|
|
33
|
+
path = '/api/coin_withdrawals'
|
|
34
|
+
|
|
35
|
+
req = Request.new(
|
|
36
|
+
method: :post,
|
|
37
|
+
path: path,
|
|
38
|
+
body_params: coin_withdrawal_params
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
connection.call(req, return_type: CoinWithdrawalResult)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# List withdrawals
|
|
45
|
+
# @param [Hash] opts the optional parameters
|
|
46
|
+
# @option opts [String] :customer_id The internal ID of your customer that the transaction relates to
|
|
47
|
+
# @option opts [String] :starting_after Pagination parameter. ID to start after
|
|
48
|
+
# @return [CoinWithdrawalListResult]
|
|
49
|
+
def list(opts = {})
|
|
50
|
+
path = '/api/coin_withdrawals'
|
|
51
|
+
|
|
52
|
+
query_params = {}
|
|
53
|
+
query_params[:customer_id] = opts[:customer_id] unless opts[:customer_id].nil?
|
|
54
|
+
query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil?
|
|
55
|
+
|
|
56
|
+
req = Request.new(
|
|
57
|
+
method: :get,
|
|
58
|
+
path: path,
|
|
59
|
+
query_params: query_params
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
connection.call(req, return_type: CoinWithdrawalListResult)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# List network fees
|
|
66
|
+
# @param [Hash] opts the optional parameters
|
|
67
|
+
# @return [NetworkFeeListResult]
|
|
68
|
+
def list_network_fees(_opts = {})
|
|
69
|
+
path = '/api/coin_withdrawals/network_fees'
|
|
70
|
+
|
|
71
|
+
req = Request.new(
|
|
72
|
+
method: :get,
|
|
73
|
+
path: path
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
connection.call(req, return_type: NetworkFeeListResult)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Retrieve a withdrawal
|
|
80
|
+
# @param coin_withdrawal_id [String] Coin withdrawal ID
|
|
81
|
+
# @param [Hash] opts the optional parameters
|
|
82
|
+
# @return [CoinWithdrawalResult]
|
|
83
|
+
def retrieve(coin_withdrawal_id, _opts = {})
|
|
84
|
+
path = '/api/coin_withdrawals/{coin_withdrawal_id}'
|
|
85
|
+
path = path.sub('{coin_withdrawal_id}', CGI.escape(coin_withdrawal_id.to_s))
|
|
86
|
+
|
|
87
|
+
req = Request.new(
|
|
88
|
+
method: :get,
|
|
89
|
+
path: path
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
connection.call(req, return_type: CoinWithdrawalResult)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Retrieve a withdrawal by custom id
|
|
96
|
+
# @param custom_id [String]
|
|
97
|
+
# @param [Hash] opts the optional parameters
|
|
98
|
+
# @return [CoinWithdrawalResult]
|
|
99
|
+
def retrieve_by_custom_id(custom_id, _opts = {})
|
|
100
|
+
path = '/api/coin_withdrawals/custom_id/{custom_id}'
|
|
101
|
+
path = path.sub('{custom_id}', CGI.escape(custom_id.to_s))
|
|
102
|
+
|
|
103
|
+
req = Request.new(
|
|
104
|
+
method: :get,
|
|
105
|
+
path: path
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
connection.call(req, return_type: CoinWithdrawalResult)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
private
|
|
112
|
+
|
|
113
|
+
attr_reader :connection
|
|
114
|
+
end
|
|
115
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class Customers
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Create a customer
|
|
13
|
+
# @param customer_params [CustomerParams]
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @return [CustomerResult]
|
|
16
|
+
def create(customer_params, _opts = {})
|
|
17
|
+
path = '/api/customers'
|
|
18
|
+
|
|
19
|
+
req = Request.new(
|
|
20
|
+
method: :post,
|
|
21
|
+
path: path,
|
|
22
|
+
body_params: customer_params
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
connection.call(req, return_type: CustomerResult)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# List customers
|
|
29
|
+
# @param [Hash] opts the optional parameters
|
|
30
|
+
# @option opts [String] :starting_after Pagination parameter. ID to start after
|
|
31
|
+
# @return [CustomerListResult]
|
|
32
|
+
def list(opts = {})
|
|
33
|
+
path = '/api/customers'
|
|
34
|
+
|
|
35
|
+
query_params = {}
|
|
36
|
+
query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil?
|
|
37
|
+
|
|
38
|
+
req = Request.new(
|
|
39
|
+
method: :get,
|
|
40
|
+
path: path,
|
|
41
|
+
query_params: query_params
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
connection.call(req, return_type: CustomerListResult)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Retrieve a customer
|
|
48
|
+
# @param customer_id [String] The customer's reference ID in your system
|
|
49
|
+
# @param [Hash] opts the optional parameters
|
|
50
|
+
# @return [CustomerResult]
|
|
51
|
+
def retrieve(customer_id, _opts = {})
|
|
52
|
+
path = '/api/customers/{customer_id}'
|
|
53
|
+
path = path.sub('{customer_id}', CGI.escape(customer_id.to_s))
|
|
54
|
+
|
|
55
|
+
req = Request.new(
|
|
56
|
+
method: :get,
|
|
57
|
+
path: path
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
connection.call(req, return_type: CustomerResult)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Update a customer
|
|
64
|
+
# @param customer_id [String] The customer's reference ID in your system
|
|
65
|
+
# @param customer_update_params [CustomerUpdateParams]
|
|
66
|
+
# @param [Hash] opts the optional parameters
|
|
67
|
+
# @return [CustomerResult]
|
|
68
|
+
def update(customer_id, customer_update_params, _opts = {})
|
|
69
|
+
path = '/api/customers/{customer_id}'
|
|
70
|
+
path = path.sub('{customer_id}', CGI.escape(customer_id.to_s))
|
|
71
|
+
|
|
72
|
+
req = Request.new(
|
|
73
|
+
method: :patch,
|
|
74
|
+
path: path,
|
|
75
|
+
body_params: customer_update_params
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
connection.call(req, return_type: CustomerResult)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
attr_reader :connection
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class ExchangeTransfers
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Commit an exchange transfer
|
|
13
|
+
# @param exchange_transfer_id [String] Exchange transfer ID
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @return [ExchangeTransferResult]
|
|
16
|
+
def commit(exchange_transfer_id, _opts = {})
|
|
17
|
+
path = '/api/exchange_transfers/{exchange_transfer_id}/commit'
|
|
18
|
+
path = path.sub('{exchange_transfer_id}', CGI.escape(exchange_transfer_id.to_s))
|
|
19
|
+
|
|
20
|
+
req = Request.new(
|
|
21
|
+
method: :post,
|
|
22
|
+
path: path
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
connection.call(req, return_type: ExchangeTransferResult)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Create an exchange transfer
|
|
29
|
+
# @param exchange_transfer_params [ExchangeTransferParams]
|
|
30
|
+
# @param [Hash] opts the optional parameters
|
|
31
|
+
# @return [ExchangeTransferResult]
|
|
32
|
+
def create(exchange_transfer_params, _opts = {})
|
|
33
|
+
path = '/api/exchange_transfers'
|
|
34
|
+
|
|
35
|
+
req = Request.new(
|
|
36
|
+
method: :post,
|
|
37
|
+
path: path,
|
|
38
|
+
body_params: exchange_transfer_params
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
connection.call(req, return_type: ExchangeTransferResult)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Retrieve an exchange transfer
|
|
45
|
+
# @param exchange_transfer_id [String] Exchange transfer ID
|
|
46
|
+
# @param [Hash] opts the optional parameters
|
|
47
|
+
# @return [ExchangeTransferResult]
|
|
48
|
+
def retrieve(exchange_transfer_id, _opts = {})
|
|
49
|
+
path = '/api/exchange_transfers/{exchange_transfer_id}'
|
|
50
|
+
path = path.sub('{exchange_transfer_id}', CGI.escape(exchange_transfer_id.to_s))
|
|
51
|
+
|
|
52
|
+
req = Request.new(
|
|
53
|
+
method: :get,
|
|
54
|
+
path: path
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
connection.call(req, return_type: ExchangeTransferResult)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
attr_reader :connection
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class Invoices
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Commit invoice recalculation
|
|
13
|
+
# This endpoint allows you to commit invoice recalculation.
|
|
14
|
+
# @param invoice_id [String] Invoice ID
|
|
15
|
+
# @param recalculation_id [String] Recalculation ID
|
|
16
|
+
# @param [Hash] opts the optional parameters
|
|
17
|
+
# @return [InvoiceRecalculationResult]
|
|
18
|
+
def commit_recalculation(invoice_id, recalculation_id, _opts = {})
|
|
19
|
+
path = '/api/invoices/{invoice_id}/recalculations/{recalculation_id}/commit'
|
|
20
|
+
path = path.sub('{invoice_id}', CGI.escape(invoice_id.to_s))
|
|
21
|
+
path = path.sub('{recalculation_id}', CGI.escape(recalculation_id.to_s))
|
|
22
|
+
|
|
23
|
+
req = Request.new(
|
|
24
|
+
method: :post,
|
|
25
|
+
path: path
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
connection.call(req, return_type: InvoiceRecalculationResult)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Create an invoice
|
|
32
|
+
# This endpoint allows you to create invoices.
|
|
33
|
+
# @param invoice_params [InvoiceParams]
|
|
34
|
+
# @param [Hash] opts the optional parameters
|
|
35
|
+
# @return [InvoiceResult]
|
|
36
|
+
def create(invoice_params, _opts = {})
|
|
37
|
+
path = '/api/invoices'
|
|
38
|
+
|
|
39
|
+
req = Request.new(
|
|
40
|
+
method: :post,
|
|
41
|
+
path: path,
|
|
42
|
+
body_params: invoice_params
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
connection.call(req, return_type: InvoiceResult)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Create invoice recalculation
|
|
49
|
+
# This endpoint allows you to recalculate invoices.
|
|
50
|
+
# @param invoice_id [String] Invoice ID
|
|
51
|
+
# @param invoice_recalculation_params [InvoiceRecalculationParams]
|
|
52
|
+
# @param [Hash] opts the optional parameters
|
|
53
|
+
# @return [InvoiceRecalculationResult]
|
|
54
|
+
def create_recalculation(invoice_id, invoice_recalculation_params, _opts = {})
|
|
55
|
+
path = '/api/invoices/{invoice_id}/recalculations'
|
|
56
|
+
path = path.sub('{invoice_id}', CGI.escape(invoice_id.to_s))
|
|
57
|
+
|
|
58
|
+
req = Request.new(
|
|
59
|
+
method: :post,
|
|
60
|
+
path: path,
|
|
61
|
+
body_params: invoice_recalculation_params
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
connection.call(req, return_type: InvoiceRecalculationResult)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Create invoice refund
|
|
68
|
+
# This endpoint allows you to create invoice refunds.
|
|
69
|
+
# @param invoice_id [String] Invoice ID
|
|
70
|
+
# @param invoice_refund_params [InvoiceRefundParams]
|
|
71
|
+
# @param [Hash] opts the optional parameters
|
|
72
|
+
# @return [InvoiceRefundResult]
|
|
73
|
+
def create_refund(invoice_id, invoice_refund_params, _opts = {})
|
|
74
|
+
path = '/api/invoices/{invoice_id}/refunds'
|
|
75
|
+
path = path.sub('{invoice_id}', CGI.escape(invoice_id.to_s))
|
|
76
|
+
|
|
77
|
+
req = Request.new(
|
|
78
|
+
method: :post,
|
|
79
|
+
path: path,
|
|
80
|
+
body_params: invoice_refund_params
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
connection.call(req, return_type: InvoiceRefundResult)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# List invoices
|
|
87
|
+
# This endpoint allows you to retrieve a list of all invoices.
|
|
88
|
+
# @param [Hash] opts the optional parameters
|
|
89
|
+
# @option opts [String] :customer_id The internal ID of your customer that the transaction relates to
|
|
90
|
+
# @option opts [String] :starting_after Pagination parameter. ID to start after
|
|
91
|
+
# @return [InvoiceListResult]
|
|
92
|
+
def list(opts = {})
|
|
93
|
+
path = '/api/invoices'
|
|
94
|
+
|
|
95
|
+
query_params = {}
|
|
96
|
+
query_params[:customer_id] = opts[:customer_id] unless opts[:customer_id].nil?
|
|
97
|
+
query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil?
|
|
98
|
+
|
|
99
|
+
req = Request.new(
|
|
100
|
+
method: :get,
|
|
101
|
+
path: path,
|
|
102
|
+
query_params: query_params
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
connection.call(req, return_type: InvoiceListResult)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# List invoice refunds
|
|
109
|
+
# This endpoint allows you to retrieve a list of a particular invoice refunds.
|
|
110
|
+
# @param invoice_id [String] Invoice ID
|
|
111
|
+
# @param [Hash] opts the optional parameters
|
|
112
|
+
# @return [InvoiceRefundListResult]
|
|
113
|
+
def list_refunds(invoice_id, _opts = {})
|
|
114
|
+
path = '/api/invoices/{invoice_id}/refunds'
|
|
115
|
+
path = path.sub('{invoice_id}', CGI.escape(invoice_id.to_s))
|
|
116
|
+
|
|
117
|
+
req = Request.new(
|
|
118
|
+
method: :get,
|
|
119
|
+
path: path
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
connection.call(req, return_type: InvoiceRefundListResult)
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Retrieve an invoice
|
|
126
|
+
# This endpoint allows you to retrieve the invoice details.
|
|
127
|
+
# @param invoice_id [String] Invoice ID
|
|
128
|
+
# @param [Hash] opts the optional parameters
|
|
129
|
+
# @return [InvoiceResult]
|
|
130
|
+
def retrieve(invoice_id, _opts = {})
|
|
131
|
+
path = '/api/invoices/{invoice_id}'
|
|
132
|
+
path = path.sub('{invoice_id}', CGI.escape(invoice_id.to_s))
|
|
133
|
+
|
|
134
|
+
req = Request.new(
|
|
135
|
+
method: :get,
|
|
136
|
+
path: path
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
connection.call(req, return_type: InvoiceResult)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Retrieve an invoice by custom_id
|
|
143
|
+
# This endpoint allows you to retrieve invoice details by its custom_id.
|
|
144
|
+
# @param custom_id [String]
|
|
145
|
+
# @param [Hash] opts the optional parameters
|
|
146
|
+
# @return [InvoiceResult]
|
|
147
|
+
def retrieve_by_custom_id(custom_id, _opts = {})
|
|
148
|
+
path = '/api/invoices/custom_id/{custom_id}'
|
|
149
|
+
path = path.sub('{custom_id}', CGI.escape(custom_id.to_s))
|
|
150
|
+
|
|
151
|
+
req = Request.new(
|
|
152
|
+
method: :get,
|
|
153
|
+
path: path
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
connection.call(req, return_type: InvoiceResult)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
private
|
|
160
|
+
|
|
161
|
+
attr_reader :connection
|
|
162
|
+
end
|
|
163
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class Rates
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Retrieve all rates
|
|
13
|
+
# This endpoint allows you to retrieve all public rates.
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @return [RatesResult]
|
|
16
|
+
def all(_opts = {})
|
|
17
|
+
path = '/api/rates'
|
|
18
|
+
|
|
19
|
+
req = Request.new(
|
|
20
|
+
method: :get,
|
|
21
|
+
path: path
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
connection.call(req, return_type: RatesResult)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Retrieve a pair rate
|
|
28
|
+
# This endpoint allows you to retrieve a public rate by currency pair.
|
|
29
|
+
# @param base_currency [String] Base currency of pair
|
|
30
|
+
# @param quote_currency [String] Quote currency of pair
|
|
31
|
+
# @param [Hash] opts the optional parameters
|
|
32
|
+
# @return [RateResult]
|
|
33
|
+
def retrieve(base_currency, quote_currency, _opts = {})
|
|
34
|
+
path = '/api/rates/{base_currency}/{quote_currency}'
|
|
35
|
+
path = path.sub('{base_currency}', CGI.escape(base_currency.to_s))
|
|
36
|
+
path = path.sub('{quote_currency}', CGI.escape(quote_currency.to_s))
|
|
37
|
+
|
|
38
|
+
req = Request.new(
|
|
39
|
+
method: :get,
|
|
40
|
+
path: path
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
connection.call(req, return_type: RateResult)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
private
|
|
47
|
+
|
|
48
|
+
attr_reader :connection
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class Risks
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Score a coin address
|
|
13
|
+
# @param risk_params [RiskParams]
|
|
14
|
+
# @param [Hash] opts the optional parameters
|
|
15
|
+
# @return [RiskResult]
|
|
16
|
+
def score(risk_params, _opts = {})
|
|
17
|
+
path = '/api/risks/score'
|
|
18
|
+
|
|
19
|
+
req = Request.new(
|
|
20
|
+
method: :post,
|
|
21
|
+
path: path,
|
|
22
|
+
body_params: risk_params
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
connection.call(req, return_type: RiskResult)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
attr_reader :connection
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class Transactions
|
|
8
|
+
def initialize(connection)
|
|
9
|
+
@connection = connection
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# List transactions
|
|
13
|
+
# @param [Hash] opts the optional parameters
|
|
14
|
+
# @option opts [Time] :created_at_from Date and time in iso8601 format
|
|
15
|
+
# @option opts [Time] :created_at_to Date and time in iso8601 format
|
|
16
|
+
# @option opts [TransactionReferenceType] :reference_type Transaction reference type
|
|
17
|
+
# @option opts [String] :currency Transaction currency
|
|
18
|
+
# @option opts [String] :status Transaction status
|
|
19
|
+
# @option opts [RiskLevel] :risk_level Transaction risk level
|
|
20
|
+
# @option opts [String] :starting_after Pagination parameter. ID to start after
|
|
21
|
+
# @return [TransactionListResult]
|
|
22
|
+
def list(opts = {})
|
|
23
|
+
path = '/api/transactions'
|
|
24
|
+
|
|
25
|
+
query_params = {}
|
|
26
|
+
query_params[:created_at_from] = opts[:created_at_from] unless opts[:created_at_from].nil?
|
|
27
|
+
query_params[:created_at_to] = opts[:created_at_to] unless opts[:created_at_to].nil?
|
|
28
|
+
query_params[:reference_type] = opts[:reference_type] unless opts[:reference_type].nil?
|
|
29
|
+
query_params[:currency] = opts[:currency] unless opts[:currency].nil?
|
|
30
|
+
query_params[:status] = opts[:status] unless opts[:status].nil?
|
|
31
|
+
query_params[:risk_level] = opts[:risk_level] unless opts[:risk_level].nil?
|
|
32
|
+
query_params[:starting_after] = opts[:starting_after] unless opts[:starting_after].nil?
|
|
33
|
+
|
|
34
|
+
req = Request.new(
|
|
35
|
+
method: :get,
|
|
36
|
+
path: path,
|
|
37
|
+
query_params: query_params
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
connection.call(req, return_type: TransactionListResult)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
attr_reader :connection
|
|
46
|
+
end
|
|
47
|
+
end
|