cryptopay-ruby 0.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -15
- data/bin/console +2 -1
- data/cryptopay.gemspec +7 -7
- data/lib/cryptopay/api/coin_withdrawals.rb +7 -2
- data/lib/cryptopay/api/coins.rb +30 -0
- data/lib/cryptopay/client.rb +3 -1
- data/lib/cryptopay/models/account.rb +4 -0
- data/lib/cryptopay/models/account_list_result.rb +14 -2
- data/lib/cryptopay/models/channel.rb +20 -0
- data/lib/cryptopay/models/channel_params.rb +11 -0
- data/lib/cryptopay/models/channel_payment.rb +20 -0
- data/lib/cryptopay/models/channel_payment_callback.rb +0 -4
- data/lib/cryptopay/models/channel_update_params.rb +2 -0
- data/lib/cryptopay/models/channels_config.rb +64 -0
- data/lib/cryptopay/models/coin.rb +94 -0
- data/lib/cryptopay/models/coin_destination_tag.rb +72 -0
- data/lib/cryptopay/models/coin_list_result.rb +70 -0
- data/lib/cryptopay/models/coin_network.rb +128 -0
- data/lib/cryptopay/models/coin_withdrawal.rb +20 -0
- data/lib/cryptopay/models/coin_withdrawal_callback.rb +0 -4
- data/lib/cryptopay/models/coin_withdrawal_params.rb +14 -1
- data/lib/cryptopay/models/coin_withdrawals_config.rb +64 -0
- data/lib/cryptopay/models/customer.rb +12 -4
- data/lib/cryptopay/models/customer_address.rb +83 -0
- data/lib/cryptopay/models/customer_params.rb +11 -5
- data/lib/cryptopay/models/customer_update_params.rb +14 -6
- data/lib/cryptopay/models/exchange_transfer.rb +6 -0
- data/lib/cryptopay/models/exchange_transfer_params.rb +6 -0
- data/lib/cryptopay/models/invoice.rb +10 -1
- data/lib/cryptopay/models/invoice_callback.rb +0 -2
- data/lib/cryptopay/models/invoice_params.rb +8 -1
- data/lib/cryptopay/models/invoice_recalculation_params.rb +1 -1
- data/lib/cryptopay/models/invoice_refund.rb +9 -0
- data/lib/cryptopay/models/invoices_config.rb +64 -0
- data/lib/cryptopay/models/network_fee.rb +10 -2
- data/lib/cryptopay/models/risk_params.rb +1 -1
- data/lib/cryptopay/models/risk_type.rb +18 -0
- data/lib/cryptopay/models/transaction.rb +13 -0
- data/lib/cryptopay/require.rb +10 -0
- data/lib/cryptopay/version.rb +1 -1
- data/lib/cryptopay.rb +8 -9
- metadata +41 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb93a5d512a5c50963761dae68e58c82f02d97ac0b645f3a9850ed0c098d30a0
|
4
|
+
data.tar.gz: 0b2590bd8ddebe472f255fd777214fb095f182b28ba05ea993df4217b10dcf98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 502490fdeb6d82851be75a541838219ee3058de3836ee1abb8381b8fe3df1236cc71e8149d27f38fb76907fd1f777ea9fab1a596d3efec5a0a3b2e8574d87660
|
7
|
+
data.tar.gz: 3aaaa5115bee1d8983a756bd59425e656ce7a1f1607fbd324803c09e1cbccd3aa897f021f71992e8fa0286c1724a6cad7b3b20aa51d413b20be97c73b63666aa
|
data/README.md
CHANGED
@@ -14,6 +14,7 @@ For more information, please visit [Cryptopay API docs](https://developers.crypt
|
|
14
14
|
* [Accounts](#accounts)
|
15
15
|
* [Channels](#channels)
|
16
16
|
* [CoinWithdrawals](#coinwithdrawals)
|
17
|
+
* [Coins](#coins)
|
17
18
|
* [Customers](#customers)
|
18
19
|
* [ExchangeTransfers](#exchangetransfers)
|
19
20
|
* [Invoices](#invoices)
|
@@ -67,7 +68,6 @@ end
|
|
67
68
|
|
68
69
|
### Accounts
|
69
70
|
|
70
|
-
[Accounts API docs](https://developers.cryptopay.me/reference/accounts)
|
71
71
|
|
72
72
|
#### List accounts
|
73
73
|
|
@@ -91,7 +91,7 @@ p result # => <TransactionListResult data=...>
|
|
91
91
|
|
92
92
|
A channel is a static cryptocurrency address that may be assigned to each one of your customers.
|
93
93
|
|
94
|
-
[Channels API docs](https://developers.cryptopay.me/
|
94
|
+
[Channels API docs](https://developers.cryptopay.me/guides/channels)
|
95
95
|
|
96
96
|
#### Create a channel
|
97
97
|
|
@@ -173,7 +173,7 @@ p result # => <ChannelResult data=...>
|
|
173
173
|
|
174
174
|
In addition to accepting payments through the Cryptopay payment gateway, it is also possible to make payments to your customers in any of the cryptocurrency currently supported by Cryptopay. In Cryptopay, these payments are called “Coin Withdrawal”. The process of requesting coin withdrawal is almost the same for a customer in Cashier as the process of making a deposit with one exception - the customer will need to specify the address of the wallet he wants to send the cryptocurrency to.
|
175
175
|
|
176
|
-
[Coin withdrawals API docs](https://developers.cryptopay.me/
|
176
|
+
[Coin withdrawals API docs](https://developers.cryptopay.me/guides/payouts)
|
177
177
|
|
178
178
|
#### Commit a withdrawal
|
179
179
|
|
@@ -244,18 +244,28 @@ result = client.coin_withdrawals.retrieve_by_custom_id(custom_id)
|
|
244
244
|
p result # => <CoinWithdrawalResult data=...>
|
245
245
|
```
|
246
246
|
|
247
|
+
### Coins
|
248
|
+
|
249
|
+
|
250
|
+
#### List supported coins
|
251
|
+
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
result = client.coins.list
|
255
|
+
p result # => <CoinListResult data=...>
|
256
|
+
```
|
257
|
+
|
247
258
|
### Customers
|
248
259
|
|
249
|
-
Customer objects allow you to reject High-Risk transactions automatically, and to track multiple transactions, that are associated with the same customer
|
260
|
+
Customer objects allow you to reject High-Risk transactions automatically, and to track multiple transactions, that are associated with the same customer.
|
250
261
|
|
251
|
-
[Customers API docs](https://developers.cryptopay.me/reference/customers)
|
252
262
|
|
253
263
|
#### Create a customer
|
254
264
|
|
255
265
|
|
256
266
|
```ruby
|
257
267
|
params = Cryptopay::CustomerParams.new(
|
258
|
-
id: '
|
268
|
+
id: '500b71259c48d4e212693a21e0d10c60',
|
259
269
|
currency: 'EUR'
|
260
270
|
)
|
261
271
|
|
@@ -275,7 +285,7 @@ p result # => <CustomerListResult data=...>
|
|
275
285
|
|
276
286
|
|
277
287
|
```ruby
|
278
|
-
customer_id =
|
288
|
+
customer_id = "CUSTOMER-123"
|
279
289
|
|
280
290
|
result = client.customers.retrieve(customer_id)
|
281
291
|
p result # => <CustomerResult data=...>
|
@@ -287,9 +297,13 @@ p result # => <CustomerResult data=...>
|
|
287
297
|
```ruby
|
288
298
|
customer_id = 'CUSTOMER-123'
|
289
299
|
params = Cryptopay::CustomerUpdateParams.new(
|
290
|
-
|
291
|
-
|
292
|
-
|
300
|
+
addresses: [
|
301
|
+
Cryptopay::CustomerAddress.new(
|
302
|
+
address: '2N9wPGx67zdSeAbXi15qHgoZ9Hb9Uxhd2uQ',
|
303
|
+
currency: 'BTC',
|
304
|
+
network: 'bitcoin'
|
305
|
+
)
|
306
|
+
]
|
293
307
|
)
|
294
308
|
|
295
309
|
result = client.customers.update(customer_id, params)
|
@@ -298,7 +312,6 @@ p result # => <CustomerResult data=...>
|
|
298
312
|
|
299
313
|
### ExchangeTransfers
|
300
314
|
|
301
|
-
[Exchange transfers API docs](https://developers.cryptopay.me/reference/exchange)
|
302
315
|
|
303
316
|
#### Commit an exchange transfer
|
304
317
|
|
@@ -346,7 +359,7 @@ p result # => <ExchangeTransferResult data=...>
|
|
346
359
|
|
347
360
|
An invoice is a request for a cryptocurrency payment which contains a unique BTC, LTC, ETH or XRP address and the amount that has to be paid while the invoice is valid.
|
348
361
|
|
349
|
-
[Invoices API docs](https://developers.cryptopay.me/
|
362
|
+
[Invoices API docs](https://developers.cryptopay.me/guides/invoices)
|
350
363
|
|
351
364
|
#### Commit invoice recalculation
|
352
365
|
|
@@ -435,7 +448,6 @@ p result # => <InvoiceResult data=...>
|
|
435
448
|
|
436
449
|
### Rates
|
437
450
|
|
438
|
-
[Public rates API docs](https://developers.cryptopay.me/reference/public-rates)
|
439
451
|
|
440
452
|
#### Retrieve all rates
|
441
453
|
|
@@ -458,7 +470,7 @@ p result # => <RateResult data=...>
|
|
458
470
|
|
459
471
|
### Risks
|
460
472
|
|
461
|
-
[Risks API docs](https://developers.cryptopay.me/
|
473
|
+
[Risks API docs](https://developers.cryptopay.me/guides/risks)
|
462
474
|
|
463
475
|
#### Score a coin address
|
464
476
|
|
@@ -476,7 +488,7 @@ p result # => <RiskResult data=...>
|
|
476
488
|
|
477
489
|
### Transactions
|
478
490
|
|
479
|
-
[Transactions API docs](https://developers.cryptopay.me/
|
491
|
+
[Transactions API docs](https://developers.cryptopay.me/guides/transactions)
|
480
492
|
|
481
493
|
#### List transactions
|
482
494
|
|
data/bin/console
CHANGED
data/cryptopay.gemspec
CHANGED
@@ -30,11 +30,11 @@ Gem::Specification.new do |s|
|
|
30
30
|
|
31
31
|
s.add_runtime_dependency('faraday', '~> 1.0', '>= 1.0.1')
|
32
32
|
|
33
|
-
s.add_development_dependency('dotenv')
|
34
|
-
s.add_development_dependency('pry-byebug')
|
35
|
-
s.add_development_dependency('rake')
|
36
|
-
s.add_development_dependency('rspec')
|
37
|
-
s.add_development_dependency('rubocop')
|
38
|
-
s.add_development_dependency('vcr')
|
39
|
-
s.add_development_dependency('webmock')
|
33
|
+
s.add_development_dependency('dotenv', '~> 2.7')
|
34
|
+
s.add_development_dependency('pry-byebug', '~> 3.9')
|
35
|
+
s.add_development_dependency('rake', '~> 13.0')
|
36
|
+
s.add_development_dependency('rspec', '~> 3.11')
|
37
|
+
s.add_development_dependency('rubocop', '~> 1.25')
|
38
|
+
s.add_development_dependency('vcr', '~> 6.0')
|
39
|
+
s.add_development_dependency('webmock', '~> 3.14')
|
40
40
|
end
|
@@ -64,13 +64,18 @@ module Cryptopay
|
|
64
64
|
|
65
65
|
# List network fees
|
66
66
|
# @param [Hash] opts the optional parameters
|
67
|
+
# @option opts [Boolean] :all_networks Is `false` if omitted. Set `true` to return network fees for all cryptocurrency networks
|
67
68
|
# @return [NetworkFeeListResult]
|
68
|
-
def list_network_fees(
|
69
|
+
def list_network_fees(opts = {})
|
69
70
|
path = '/api/coin_withdrawals/network_fees'
|
70
71
|
|
72
|
+
query_params = {}
|
73
|
+
query_params[:all_networks] = opts[:all_networks] unless opts[:all_networks].nil?
|
74
|
+
|
71
75
|
req = Request.new(
|
72
76
|
method: :get,
|
73
|
-
path: path
|
77
|
+
path: path,
|
78
|
+
query_params: query_params
|
74
79
|
)
|
75
80
|
|
76
81
|
connection.call(req, return_type: NetworkFeeListResult)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class Coins
|
8
|
+
def initialize(connection)
|
9
|
+
@connection = connection
|
10
|
+
end
|
11
|
+
|
12
|
+
# List supported coins
|
13
|
+
# @param [Hash] opts the optional parameters
|
14
|
+
# @return [CoinListResult]
|
15
|
+
def list(_opts = {})
|
16
|
+
path = '/api/coins'
|
17
|
+
|
18
|
+
req = Request.new(
|
19
|
+
method: :get,
|
20
|
+
path: path
|
21
|
+
)
|
22
|
+
|
23
|
+
connection.call(req, return_type: CoinListResult)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
attr_reader :connection
|
29
|
+
end
|
30
|
+
end
|
data/lib/cryptopay/client.rb
CHANGED
@@ -11,7 +11,8 @@ module Cryptopay
|
|
11
11
|
:exchange_transfers,
|
12
12
|
:customers,
|
13
13
|
:risks,
|
14
|
-
:callbacks
|
14
|
+
:callbacks,
|
15
|
+
:coins
|
15
16
|
|
16
17
|
def initialize(&block)
|
17
18
|
config = Config.new(&block)
|
@@ -34,6 +35,7 @@ module Cryptopay
|
|
34
35
|
@exchange_transfers = ExchangeTransfers.new(connection)
|
35
36
|
@customers = Customers.new(connection)
|
36
37
|
@risks = Risks.new(connection)
|
38
|
+
@coins = Coins.new(connection)
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
@@ -29,18 +29,22 @@ module Cryptopay
|
|
29
29
|
@attributes = ENCODER.sanitize(attributes)
|
30
30
|
end
|
31
31
|
|
32
|
+
# Account ID
|
32
33
|
def id
|
33
34
|
@attributes[:id]
|
34
35
|
end
|
35
36
|
|
37
|
+
# Account currency
|
36
38
|
def currency
|
37
39
|
@attributes[:currency]
|
38
40
|
end
|
39
41
|
|
42
|
+
# Account balance
|
40
43
|
def balance
|
41
44
|
@attributes[:balance]
|
42
45
|
end
|
43
46
|
|
47
|
+
# Project ID which the account belongs to
|
44
48
|
def project_id
|
45
49
|
@attributes[:project_id]
|
46
50
|
end
|
@@ -8,10 +8,12 @@ module Cryptopay
|
|
8
8
|
ENCODER = Encoder.new(
|
9
9
|
name: 'Cryptopay::AccountListResult',
|
10
10
|
attribute_map: {
|
11
|
-
'data': :data
|
11
|
+
'data': :data,
|
12
|
+
'meta': :meta
|
12
13
|
},
|
13
14
|
types: {
|
14
|
-
'data': :'Array<Account>'
|
15
|
+
'data': :'Array<Account>',
|
16
|
+
'meta': :Pagination
|
15
17
|
},
|
16
18
|
nullables: []
|
17
19
|
)
|
@@ -27,6 +29,10 @@ module Cryptopay
|
|
27
29
|
@attributes[:data]
|
28
30
|
end
|
29
31
|
|
32
|
+
def meta
|
33
|
+
@attributes[:meta]
|
34
|
+
end
|
35
|
+
|
30
36
|
# Show invalid properties with the reasons. Usually used together with valid?
|
31
37
|
# @return Array for valid properties with the reasons
|
32
38
|
def invalid_properties
|
@@ -40,6 +46,12 @@ module Cryptopay
|
|
40
46
|
end
|
41
47
|
end
|
42
48
|
|
49
|
+
properties.push('invalid value for "meta", meta cannot be nil.') if meta.nil?
|
50
|
+
|
51
|
+
meta&.invalid_properties&.each do |prop|
|
52
|
+
properties.push("invalid value for \"meta\": #{prop}")
|
53
|
+
end
|
54
|
+
|
43
55
|
properties
|
44
56
|
end
|
45
57
|
|
@@ -15,6 +15,7 @@ module Cryptopay
|
|
15
15
|
'pay_currency': :pay_currency,
|
16
16
|
'receiver_currency': :receiver_currency,
|
17
17
|
'address': :address,
|
18
|
+
'network': :network,
|
18
19
|
'project_id': :project_id,
|
19
20
|
'custom_id': :custom_id,
|
20
21
|
'customer_id': :customer_id,
|
@@ -29,6 +30,7 @@ module Cryptopay
|
|
29
30
|
'pay_currency': :String,
|
30
31
|
'receiver_currency': :String,
|
31
32
|
'address': :String,
|
33
|
+
'network': :String,
|
32
34
|
'project_id': :String,
|
33
35
|
'custom_id': :String,
|
34
36
|
'customer_id': :String,
|
@@ -49,6 +51,7 @@ module Cryptopay
|
|
49
51
|
@attributes = ENCODER.sanitize(attributes)
|
50
52
|
end
|
51
53
|
|
54
|
+
# Channel ID
|
52
55
|
def id
|
53
56
|
@attributes[:id]
|
54
57
|
end
|
@@ -57,42 +60,57 @@ module Cryptopay
|
|
57
60
|
@attributes[:status]
|
58
61
|
end
|
59
62
|
|
63
|
+
# Channel name
|
60
64
|
def name
|
61
65
|
@attributes[:name]
|
62
66
|
end
|
63
67
|
|
68
|
+
# Channel description
|
64
69
|
def description
|
65
70
|
@attributes[:description]
|
66
71
|
end
|
67
72
|
|
73
|
+
# The cryptocurrency which you want to accept
|
68
74
|
def pay_currency
|
69
75
|
@attributes[:pay_currency]
|
70
76
|
end
|
71
77
|
|
78
|
+
# The currency which all incoming transactions will be converted to
|
72
79
|
def receiver_currency
|
73
80
|
@attributes[:receiver_currency]
|
74
81
|
end
|
75
82
|
|
83
|
+
# Channel description
|
76
84
|
def address
|
77
85
|
@attributes[:address]
|
78
86
|
end
|
79
87
|
|
88
|
+
# Cryptocurrency network
|
89
|
+
def network
|
90
|
+
@attributes[:network]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Project ID
|
80
94
|
def project_id
|
81
95
|
@attributes[:project_id]
|
82
96
|
end
|
83
97
|
|
98
|
+
# The channel reference ID in your system
|
84
99
|
def custom_id
|
85
100
|
@attributes[:custom_id]
|
86
101
|
end
|
87
102
|
|
103
|
+
# The reference ID of your customer
|
88
104
|
def customer_id
|
89
105
|
@attributes[:customer_id]
|
90
106
|
end
|
91
107
|
|
108
|
+
# Channel URI. May be used for generating a QR code
|
92
109
|
def uri
|
93
110
|
@attributes[:uri]
|
94
111
|
end
|
95
112
|
|
113
|
+
# Channel hosted page that renders channel details
|
96
114
|
def hosted_page_url
|
97
115
|
@attributes[:hosted_page_url]
|
98
116
|
end
|
@@ -120,6 +138,8 @@ module Cryptopay
|
|
120
138
|
|
121
139
|
properties.push('invalid value for "address", address cannot be nil.') if address.nil?
|
122
140
|
|
141
|
+
properties.push('invalid value for "network", network cannot be nil.') if network.nil?
|
142
|
+
|
123
143
|
properties.push('invalid value for "project_id", project_id cannot be nil.') if project_id.nil?
|
124
144
|
|
125
145
|
properties.push('invalid value for "uri", uri cannot be nil.') if uri.nil?
|
@@ -11,6 +11,7 @@ module Cryptopay
|
|
11
11
|
'name': :name,
|
12
12
|
'description': :description,
|
13
13
|
'pay_currency': :pay_currency,
|
14
|
+
'network': :network,
|
14
15
|
'receiver_currency': :receiver_currency,
|
15
16
|
'custom_id': :custom_id,
|
16
17
|
'customer_id': :customer_id
|
@@ -19,6 +20,7 @@ module Cryptopay
|
|
19
20
|
'name': :String,
|
20
21
|
'description': :String,
|
21
22
|
'pay_currency': :String,
|
23
|
+
'network': :String,
|
22
24
|
'receiver_currency': :String,
|
23
25
|
'custom_id': :String,
|
24
26
|
'customer_id': :String
|
@@ -33,18 +35,27 @@ module Cryptopay
|
|
33
35
|
@attributes = ENCODER.sanitize(attributes)
|
34
36
|
end
|
35
37
|
|
38
|
+
# Channel name
|
36
39
|
def name
|
37
40
|
@attributes[:name]
|
38
41
|
end
|
39
42
|
|
43
|
+
# Channel description
|
40
44
|
def description
|
41
45
|
@attributes[:description]
|
42
46
|
end
|
43
47
|
|
48
|
+
# The cryptocurrency which you want to accept
|
44
49
|
def pay_currency
|
45
50
|
@attributes[:pay_currency]
|
46
51
|
end
|
47
52
|
|
53
|
+
# Cryptocurrency network
|
54
|
+
def network
|
55
|
+
@attributes[:network]
|
56
|
+
end
|
57
|
+
|
58
|
+
# The currency which all incoming transactions will be converted to
|
48
59
|
def receiver_currency
|
49
60
|
@attributes[:receiver_currency]
|
50
61
|
end
|
@@ -26,6 +26,7 @@ module Cryptopay
|
|
26
26
|
'custom_id': :custom_id,
|
27
27
|
'customer_id': :customer_id,
|
28
28
|
'address': :address,
|
29
|
+
'network': :network,
|
29
30
|
'created_at': :created_at
|
30
31
|
},
|
31
32
|
types: {
|
@@ -47,6 +48,7 @@ module Cryptopay
|
|
47
48
|
'custom_id': :String,
|
48
49
|
'customer_id': :String,
|
49
50
|
'address': :String,
|
51
|
+
'network': :String,
|
50
52
|
'created_at': :Time
|
51
53
|
},
|
52
54
|
nullables: %i[
|
@@ -65,38 +67,47 @@ module Cryptopay
|
|
65
67
|
@attributes = ENCODER.sanitize(attributes)
|
66
68
|
end
|
67
69
|
|
70
|
+
# Channel payment ID
|
68
71
|
def id
|
69
72
|
@attributes[:id]
|
70
73
|
end
|
71
74
|
|
75
|
+
# Channel ID
|
72
76
|
def channel_id
|
73
77
|
@attributes[:channel_id]
|
74
78
|
end
|
75
79
|
|
80
|
+
# Cryptocurrency transaction amount that was received
|
76
81
|
def paid_amount
|
77
82
|
@attributes[:paid_amount]
|
78
83
|
end
|
79
84
|
|
85
|
+
# Cryptocurrency type
|
80
86
|
def paid_currency
|
81
87
|
@attributes[:paid_currency]
|
82
88
|
end
|
83
89
|
|
90
|
+
# Amount credited to your Cryptopay account
|
84
91
|
def received_amount
|
85
92
|
@attributes[:received_amount]
|
86
93
|
end
|
87
94
|
|
95
|
+
# Account currency
|
88
96
|
def received_currency
|
89
97
|
@attributes[:received_currency]
|
90
98
|
end
|
91
99
|
|
100
|
+
# Processing fee
|
92
101
|
def fee
|
93
102
|
@attributes[:fee]
|
94
103
|
end
|
95
104
|
|
105
|
+
# Processing fee currency
|
96
106
|
def fee_currency
|
97
107
|
@attributes[:fee_currency]
|
98
108
|
end
|
99
109
|
|
110
|
+
# Cryptocurrency transaction ID on the blockchain
|
100
111
|
def txid
|
101
112
|
@attributes[:txid]
|
102
113
|
end
|
@@ -125,18 +136,27 @@ module Cryptopay
|
|
125
136
|
@attributes[:coin_withdrawal_id]
|
126
137
|
end
|
127
138
|
|
139
|
+
# Channel payment custom_id value inherited from its parent channel
|
128
140
|
def custom_id
|
129
141
|
@attributes[:custom_id]
|
130
142
|
end
|
131
143
|
|
144
|
+
# The reference ID of your customer
|
132
145
|
def customer_id
|
133
146
|
@attributes[:customer_id]
|
134
147
|
end
|
135
148
|
|
149
|
+
# Channel cryptocurrency address
|
136
150
|
def address
|
137
151
|
@attributes[:address]
|
138
152
|
end
|
139
153
|
|
154
|
+
# Cryptocurrency network
|
155
|
+
def network
|
156
|
+
@attributes[:network]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Channel payment creation date and time
|
140
160
|
def created_at
|
141
161
|
@attributes[:created_at]
|
142
162
|
end
|
@@ -46,10 +46,6 @@ module Cryptopay
|
|
46
46
|
|
47
47
|
properties.push('invalid value for "type", type cannot be nil.') if type.nil?
|
48
48
|
|
49
|
-
if !type.nil? && !['ChannelPayment'].include?(type)
|
50
|
-
properties.push('invalid value for type, must be one of "ChannelPayment"')
|
51
|
-
end
|
52
|
-
|
53
49
|
properties.push('invalid value for "event", event cannot be nil.') if event.nil?
|
54
50
|
|
55
51
|
if !event.nil? && !%w[created on_hold completed refunded cancelled].include?(event)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class ChannelsConfig
|
8
|
+
ENCODER = Encoder.new(
|
9
|
+
name: 'Cryptopay::ChannelsConfig',
|
10
|
+
attribute_map: {
|
11
|
+
'enabled': :enabled
|
12
|
+
},
|
13
|
+
types: {
|
14
|
+
'enabled': :Boolean
|
15
|
+
},
|
16
|
+
nullables: []
|
17
|
+
)
|
18
|
+
private_constant :ENCODER
|
19
|
+
|
20
|
+
# Initializes the object
|
21
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
22
|
+
def initialize(attributes = {})
|
23
|
+
@attributes = ENCODER.sanitize(attributes)
|
24
|
+
end
|
25
|
+
|
26
|
+
def enabled
|
27
|
+
@attributes[:enabled]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
31
|
+
# @return Array for valid properties with the reasons
|
32
|
+
def invalid_properties
|
33
|
+
properties = []
|
34
|
+
|
35
|
+
properties.push('invalid value for "enabled", enabled cannot be nil.') if enabled.nil?
|
36
|
+
|
37
|
+
properties
|
38
|
+
end
|
39
|
+
|
40
|
+
# Check to see if the all the properties in the model are valid
|
41
|
+
# @return true if the model is valid
|
42
|
+
def valid?
|
43
|
+
invalid_properties.empty?
|
44
|
+
end
|
45
|
+
|
46
|
+
# Builds the object from hash
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
|
+
# @return [Cryptopay::ChannelsConfig] Returns the model itself
|
49
|
+
def self.build_from_hash(data)
|
50
|
+
attributes = ENCODER.build_from_hash(data)
|
51
|
+
new(attributes)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Returns the object in the form of hash
|
55
|
+
# @return [Hash] Returns the object in the form of hash
|
56
|
+
def to_hash
|
57
|
+
ENCODER.to_hash(@attributes)
|
58
|
+
end
|
59
|
+
|
60
|
+
def inspect
|
61
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|