cryptopay-ruby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class ExchangeTransferParams
|
8
|
+
ENCODER = Encoder.new(
|
9
|
+
name: 'Cryptopay::ExchangeTransferParams',
|
10
|
+
attribute_map: {
|
11
|
+
'charged_currency': :charged_currency,
|
12
|
+
'charged_amount': :charged_amount,
|
13
|
+
'received_currency': :received_currency,
|
14
|
+
'received_amount': :received_amount,
|
15
|
+
'custom_id': :custom_id,
|
16
|
+
'force_commit': :force_commit
|
17
|
+
},
|
18
|
+
types: {
|
19
|
+
'charged_currency': :String,
|
20
|
+
'charged_amount': :Decimal,
|
21
|
+
'received_currency': :String,
|
22
|
+
'received_amount': :Decimal,
|
23
|
+
'custom_id': :String,
|
24
|
+
'force_commit': :Boolean
|
25
|
+
},
|
26
|
+
nullables: %i[
|
27
|
+
charged_amount
|
28
|
+
received_amount
|
29
|
+
]
|
30
|
+
)
|
31
|
+
private_constant :ENCODER
|
32
|
+
|
33
|
+
# Initializes the object
|
34
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
35
|
+
def initialize(attributes = {})
|
36
|
+
@attributes = ENCODER.sanitize(attributes)
|
37
|
+
end
|
38
|
+
|
39
|
+
def charged_currency
|
40
|
+
@attributes[:charged_currency]
|
41
|
+
end
|
42
|
+
|
43
|
+
def charged_amount
|
44
|
+
@attributes[:charged_amount]
|
45
|
+
end
|
46
|
+
|
47
|
+
def received_currency
|
48
|
+
@attributes[:received_currency]
|
49
|
+
end
|
50
|
+
|
51
|
+
def received_amount
|
52
|
+
@attributes[:received_amount]
|
53
|
+
end
|
54
|
+
|
55
|
+
def custom_id
|
56
|
+
@attributes[:custom_id]
|
57
|
+
end
|
58
|
+
|
59
|
+
def force_commit
|
60
|
+
@attributes[:force_commit]
|
61
|
+
end
|
62
|
+
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
+
# @return Array for valid properties with the reasons
|
65
|
+
def invalid_properties
|
66
|
+
properties = []
|
67
|
+
|
68
|
+
properties.push('invalid value for "charged_currency", charged_currency cannot be nil.') if charged_currency.nil?
|
69
|
+
|
70
|
+
if received_currency.nil?
|
71
|
+
properties.push('invalid value for "received_currency", received_currency cannot be nil.')
|
72
|
+
end
|
73
|
+
|
74
|
+
properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
invalid_properties.empty?
|
81
|
+
end
|
82
|
+
|
83
|
+
# Builds the object from hash
|
84
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
85
|
+
# @return [Cryptopay::ExchangeTransferParams] Returns the model itself
|
86
|
+
def self.build_from_hash(data)
|
87
|
+
attributes = ENCODER.build_from_hash(data)
|
88
|
+
new(attributes)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Returns the object in the form of hash
|
92
|
+
# @return [Hash] Returns the object in the form of hash
|
93
|
+
def to_hash
|
94
|
+
ENCODER.to_hash(@attributes)
|
95
|
+
end
|
96
|
+
|
97
|
+
def inspect
|
98
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class ExchangeTransferResult
|
8
|
+
ENCODER = Encoder.new(
|
9
|
+
name: 'Cryptopay::ExchangeTransferResult',
|
10
|
+
attribute_map: {
|
11
|
+
'data': :data
|
12
|
+
},
|
13
|
+
types: {
|
14
|
+
'data': :ExchangeTransfer
|
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 data
|
27
|
+
@attributes[:data]
|
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 "data", data cannot be nil.') if data.nil?
|
36
|
+
|
37
|
+
data&.invalid_properties&.each do |prop|
|
38
|
+
properties.push("invalid value for \"data\": #{prop}")
|
39
|
+
end
|
40
|
+
|
41
|
+
properties
|
42
|
+
end
|
43
|
+
|
44
|
+
# Check to see if the all the properties in the model are valid
|
45
|
+
# @return true if the model is valid
|
46
|
+
def valid?
|
47
|
+
invalid_properties.empty?
|
48
|
+
end
|
49
|
+
|
50
|
+
# Builds the object from hash
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
# @return [Cryptopay::ExchangeTransferResult] Returns the model itself
|
53
|
+
def self.build_from_hash(data)
|
54
|
+
attributes = ENCODER.build_from_hash(data)
|
55
|
+
new(attributes)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Returns the object in the form of hash
|
59
|
+
# @return [Hash] Returns the object in the form of hash
|
60
|
+
def to_hash
|
61
|
+
ENCODER.to_hash(@attributes)
|
62
|
+
end
|
63
|
+
|
64
|
+
def inspect
|
65
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,276 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class Invoice
|
8
|
+
ENCODER = Encoder.new(
|
9
|
+
name: 'Cryptopay::Invoice',
|
10
|
+
attribute_map: {
|
11
|
+
'id': :id,
|
12
|
+
'custom_id': :custom_id,
|
13
|
+
'customer_id': :customer_id,
|
14
|
+
'status': :status,
|
15
|
+
'status_context': :status_context,
|
16
|
+
'address': :address,
|
17
|
+
'uri': :uri,
|
18
|
+
'price_amount': :price_amount,
|
19
|
+
'price_currency': :price_currency,
|
20
|
+
'fee': :fee,
|
21
|
+
'fee_currency': :fee_currency,
|
22
|
+
'pay_amount': :pay_amount,
|
23
|
+
'pay_currency': :pay_currency,
|
24
|
+
'paid_amount': :paid_amount,
|
25
|
+
'exchange': :exchange,
|
26
|
+
'transactions': :transactions,
|
27
|
+
'name': :name,
|
28
|
+
'description': :description,
|
29
|
+
'metadata': :metadata,
|
30
|
+
'success_redirect_url': :success_redirect_url,
|
31
|
+
'unsuccess_redirect_url': :unsuccess_redirect_url,
|
32
|
+
'hosted_page_url': :hosted_page_url,
|
33
|
+
'created_at': :created_at,
|
34
|
+
'expires_at': :expires_at
|
35
|
+
},
|
36
|
+
types: {
|
37
|
+
'id': :String,
|
38
|
+
'custom_id': :String,
|
39
|
+
'customer_id': :String,
|
40
|
+
'status': :InvoiceStatus,
|
41
|
+
'status_context': :InvoiceStatusContext,
|
42
|
+
'address': :String,
|
43
|
+
'uri': :String,
|
44
|
+
'price_amount': :Decimal,
|
45
|
+
'price_currency': :String,
|
46
|
+
'fee': :Decimal,
|
47
|
+
'fee_currency': :String,
|
48
|
+
'pay_amount': :Decimal,
|
49
|
+
'pay_currency': :String,
|
50
|
+
'paid_amount': :Decimal,
|
51
|
+
'exchange': :Exchange,
|
52
|
+
'transactions': :'Array<InvoiceTransaction>',
|
53
|
+
'name': :String,
|
54
|
+
'description': :String,
|
55
|
+
'metadata': :Object,
|
56
|
+
'success_redirect_url': :String,
|
57
|
+
'unsuccess_redirect_url': :String,
|
58
|
+
'hosted_page_url': :String,
|
59
|
+
'created_at': :Time,
|
60
|
+
'expires_at': :Time
|
61
|
+
},
|
62
|
+
nullables: %i[
|
63
|
+
custom_id
|
64
|
+
customer_id
|
65
|
+
status_context
|
66
|
+
name
|
67
|
+
description
|
68
|
+
metadata
|
69
|
+
success_redirect_url
|
70
|
+
unsuccess_redirect_url
|
71
|
+
]
|
72
|
+
)
|
73
|
+
private_constant :ENCODER
|
74
|
+
|
75
|
+
# Initializes the object
|
76
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
77
|
+
def initialize(attributes = {})
|
78
|
+
@attributes = ENCODER.sanitize(attributes)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Invoice ID
|
82
|
+
def id
|
83
|
+
@attributes[:id]
|
84
|
+
end
|
85
|
+
|
86
|
+
# Invoice reference ID in your system
|
87
|
+
def custom_id
|
88
|
+
@attributes[:custom_id]
|
89
|
+
end
|
90
|
+
|
91
|
+
# The internal ID of your customer that the invoice relates to
|
92
|
+
def customer_id
|
93
|
+
@attributes[:customer_id]
|
94
|
+
end
|
95
|
+
|
96
|
+
def status
|
97
|
+
@attributes[:status]
|
98
|
+
end
|
99
|
+
|
100
|
+
def status_context
|
101
|
+
@attributes[:status_context]
|
102
|
+
end
|
103
|
+
|
104
|
+
# Invoice cryptocurrency address
|
105
|
+
def address
|
106
|
+
@attributes[:address]
|
107
|
+
end
|
108
|
+
|
109
|
+
# Invoice URI. May be used for generating a QR code
|
110
|
+
def uri
|
111
|
+
@attributes[:uri]
|
112
|
+
end
|
113
|
+
|
114
|
+
# Invoice amount
|
115
|
+
def price_amount
|
116
|
+
@attributes[:price_amount]
|
117
|
+
end
|
118
|
+
|
119
|
+
# Invoice amount currency
|
120
|
+
def price_currency
|
121
|
+
@attributes[:price_currency]
|
122
|
+
end
|
123
|
+
|
124
|
+
# Processing fee
|
125
|
+
def fee
|
126
|
+
@attributes[:fee]
|
127
|
+
end
|
128
|
+
|
129
|
+
# Processing fee currency
|
130
|
+
def fee_currency
|
131
|
+
@attributes[:fee_currency]
|
132
|
+
end
|
133
|
+
|
134
|
+
# Cryptocurrency amount to pay
|
135
|
+
def pay_amount
|
136
|
+
@attributes[:pay_amount]
|
137
|
+
end
|
138
|
+
|
139
|
+
# Cryptocurrency type
|
140
|
+
def pay_currency
|
141
|
+
@attributes[:pay_currency]
|
142
|
+
end
|
143
|
+
|
144
|
+
# which amount already paid
|
145
|
+
def paid_amount
|
146
|
+
@attributes[:paid_amount]
|
147
|
+
end
|
148
|
+
|
149
|
+
def exchange
|
150
|
+
@attributes[:exchange]
|
151
|
+
end
|
152
|
+
|
153
|
+
def transactions
|
154
|
+
@attributes[:transactions]
|
155
|
+
end
|
156
|
+
|
157
|
+
# Invoice name
|
158
|
+
def name
|
159
|
+
@attributes[:name]
|
160
|
+
end
|
161
|
+
|
162
|
+
# Invoice description
|
163
|
+
def description
|
164
|
+
@attributes[:description]
|
165
|
+
end
|
166
|
+
|
167
|
+
# Key-value data
|
168
|
+
def metadata
|
169
|
+
@attributes[:metadata]
|
170
|
+
end
|
171
|
+
|
172
|
+
# URL that a customer will be redirected to upon transaction confirmation
|
173
|
+
def success_redirect_url
|
174
|
+
@attributes[:success_redirect_url]
|
175
|
+
end
|
176
|
+
|
177
|
+
def unsuccess_redirect_url
|
178
|
+
@attributes[:unsuccess_redirect_url]
|
179
|
+
end
|
180
|
+
|
181
|
+
# Invoice hosted page that renders invoice details
|
182
|
+
def hosted_page_url
|
183
|
+
@attributes[:hosted_page_url]
|
184
|
+
end
|
185
|
+
|
186
|
+
# Invoice creation date and time
|
187
|
+
def created_at
|
188
|
+
@attributes[:created_at]
|
189
|
+
end
|
190
|
+
|
191
|
+
# Invoice expiration date and time
|
192
|
+
def expires_at
|
193
|
+
@attributes[:expires_at]
|
194
|
+
end
|
195
|
+
|
196
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
197
|
+
# @return Array for valid properties with the reasons
|
198
|
+
def invalid_properties
|
199
|
+
properties = []
|
200
|
+
|
201
|
+
properties.push('invalid value for "id", id cannot be nil.') if id.nil?
|
202
|
+
|
203
|
+
properties.push('invalid value for "status", status cannot be nil.') if status.nil?
|
204
|
+
|
205
|
+
if !status.nil? && !%w[new completed unresolved refunded cancelled].include?(status)
|
206
|
+
properties.push('invalid value for status, must be one of "new", "completed", "unresolved", "refunded", "cancelled"')
|
207
|
+
end
|
208
|
+
|
209
|
+
if !status_context.nil? && !%w[overpaid underpaid paid_late illicit_resource].include?(status_context)
|
210
|
+
properties.push('invalid value for status_context, must be one of "overpaid", "underpaid", "paid_late", "illicit_resource"')
|
211
|
+
end
|
212
|
+
|
213
|
+
properties.push('invalid value for "address", address cannot be nil.') if address.nil?
|
214
|
+
|
215
|
+
properties.push('invalid value for "uri", uri cannot be nil.') if uri.nil?
|
216
|
+
|
217
|
+
properties.push('invalid value for "price_amount", price_amount cannot be nil.') if price_amount.nil?
|
218
|
+
|
219
|
+
properties.push('invalid value for "price_currency", price_currency cannot be nil.') if price_currency.nil?
|
220
|
+
|
221
|
+
properties.push('invalid value for "fee", fee cannot be nil.') if fee.nil?
|
222
|
+
|
223
|
+
properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil?
|
224
|
+
|
225
|
+
properties.push('invalid value for "pay_amount", pay_amount cannot be nil.') if pay_amount.nil?
|
226
|
+
|
227
|
+
properties.push('invalid value for "pay_currency", pay_currency cannot be nil.') if pay_currency.nil?
|
228
|
+
|
229
|
+
properties.push('invalid value for "paid_amount", paid_amount cannot be nil.') if paid_amount.nil?
|
230
|
+
|
231
|
+
exchange&.invalid_properties&.each do |prop|
|
232
|
+
properties.push("invalid value for \"exchange\": #{prop}")
|
233
|
+
end
|
234
|
+
|
235
|
+
properties.push('invalid value for "transactions", transactions cannot be nil.') if transactions.nil?
|
236
|
+
|
237
|
+
transactions&.each_with_index do |item, index|
|
238
|
+
item.invalid_properties.each do |prop|
|
239
|
+
properties.push("invalid value for \"transactions.#{index}\": #{prop}")
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
properties.push('invalid value for "hosted_page_url", hosted_page_url cannot be nil.') if hosted_page_url.nil?
|
244
|
+
|
245
|
+
properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil?
|
246
|
+
|
247
|
+
properties.push('invalid value for "expires_at", expires_at cannot be nil.') if expires_at.nil?
|
248
|
+
|
249
|
+
properties
|
250
|
+
end
|
251
|
+
|
252
|
+
# Check to see if the all the properties in the model are valid
|
253
|
+
# @return true if the model is valid
|
254
|
+
def valid?
|
255
|
+
invalid_properties.empty?
|
256
|
+
end
|
257
|
+
|
258
|
+
# Builds the object from hash
|
259
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
260
|
+
# @return [Cryptopay::Invoice] Returns the model itself
|
261
|
+
def self.build_from_hash(data)
|
262
|
+
attributes = ENCODER.build_from_hash(data)
|
263
|
+
new(attributes)
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash
|
269
|
+
ENCODER.to_hash(@attributes)
|
270
|
+
end
|
271
|
+
|
272
|
+
def inspect
|
273
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
274
|
+
end
|
275
|
+
end
|
276
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class InvoiceCallback
|
8
|
+
ENCODER = Encoder.new(
|
9
|
+
name: 'Cryptopay::InvoiceCallback',
|
10
|
+
attribute_map: {
|
11
|
+
'type': :type,
|
12
|
+
'event': :event,
|
13
|
+
'data': :data
|
14
|
+
},
|
15
|
+
types: {
|
16
|
+
'type': :String,
|
17
|
+
'event': :InvoiceCallbackEvent,
|
18
|
+
'data': :Invoice
|
19
|
+
},
|
20
|
+
nullables: []
|
21
|
+
)
|
22
|
+
private_constant :ENCODER
|
23
|
+
|
24
|
+
# Initializes the object
|
25
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
26
|
+
def initialize(attributes = {})
|
27
|
+
@attributes = ENCODER.sanitize(attributes)
|
28
|
+
end
|
29
|
+
|
30
|
+
def type
|
31
|
+
@attributes[:type]
|
32
|
+
end
|
33
|
+
|
34
|
+
def event
|
35
|
+
@attributes[:event]
|
36
|
+
end
|
37
|
+
|
38
|
+
def data
|
39
|
+
@attributes[:data]
|
40
|
+
end
|
41
|
+
|
42
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
43
|
+
# @return Array for valid properties with the reasons
|
44
|
+
def invalid_properties
|
45
|
+
properties = []
|
46
|
+
|
47
|
+
properties.push('invalid value for "type", type cannot be nil.') if type.nil?
|
48
|
+
|
49
|
+
properties.push('invalid value for type, must be one of "Invoice"') if !type.nil? && !['Invoice'].include?(type)
|
50
|
+
|
51
|
+
properties.push('invalid value for "event", event cannot be nil.') if event.nil?
|
52
|
+
|
53
|
+
if !event.nil? && !%w[created refunded recalculated status_changed transaction_created transaction_confirmed].include?(event)
|
54
|
+
properties.push('invalid value for event, must be one of "created", "refunded", "recalculated", "status_changed", "transaction_created", "transaction_confirmed"')
|
55
|
+
end
|
56
|
+
|
57
|
+
properties.push('invalid value for "data", data cannot be nil.') if data.nil?
|
58
|
+
|
59
|
+
data&.invalid_properties&.each do |prop|
|
60
|
+
properties.push("invalid value for \"data\": #{prop}")
|
61
|
+
end
|
62
|
+
|
63
|
+
properties
|
64
|
+
end
|
65
|
+
|
66
|
+
# Check to see if the all the properties in the model are valid
|
67
|
+
# @return true if the model is valid
|
68
|
+
def valid?
|
69
|
+
invalid_properties.empty?
|
70
|
+
end
|
71
|
+
|
72
|
+
# Builds the object from hash
|
73
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
74
|
+
# @return [Cryptopay::InvoiceCallback] Returns the model itself
|
75
|
+
def self.build_from_hash(data)
|
76
|
+
attributes = ENCODER.build_from_hash(data)
|
77
|
+
new(attributes)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Returns the object in the form of hash
|
81
|
+
# @return [Hash] Returns the object in the form of hash
|
82
|
+
def to_hash
|
83
|
+
ENCODER.to_hash(@attributes)
|
84
|
+
end
|
85
|
+
|
86
|
+
def inspect
|
87
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
module InvoiceCallbackEvent
|
8
|
+
CREATED = 'created'
|
9
|
+
REFUNDED = 'refunded'
|
10
|
+
RECALCULATED = 'recalculated'
|
11
|
+
STATUS_CHANGED = 'status_changed'
|
12
|
+
TRANSACTION_CREATED = 'transaction_created'
|
13
|
+
TRANSACTION_CONFIRMED = 'transaction_confirmed'
|
14
|
+
|
15
|
+
# Builds the enum from string
|
16
|
+
# @param [String] The enum value in the form of the string
|
17
|
+
# @return [String] The enum value
|
18
|
+
def self.build_from_hash(value)
|
19
|
+
value
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Auto-generated file
|
4
|
+
# DO NOT EDIT
|
5
|
+
|
6
|
+
module Cryptopay
|
7
|
+
class InvoiceListResult
|
8
|
+
ENCODER = Encoder.new(
|
9
|
+
name: 'Cryptopay::InvoiceListResult',
|
10
|
+
attribute_map: {
|
11
|
+
'data': :data,
|
12
|
+
'meta': :meta
|
13
|
+
},
|
14
|
+
types: {
|
15
|
+
'data': :'Array<Invoice>',
|
16
|
+
'meta': :Pagination
|
17
|
+
},
|
18
|
+
nullables: []
|
19
|
+
)
|
20
|
+
private_constant :ENCODER
|
21
|
+
|
22
|
+
# Initializes the object
|
23
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
24
|
+
def initialize(attributes = {})
|
25
|
+
@attributes = ENCODER.sanitize(attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def data
|
29
|
+
@attributes[:data]
|
30
|
+
end
|
31
|
+
|
32
|
+
def meta
|
33
|
+
@attributes[:meta]
|
34
|
+
end
|
35
|
+
|
36
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
37
|
+
# @return Array for valid properties with the reasons
|
38
|
+
def invalid_properties
|
39
|
+
properties = []
|
40
|
+
|
41
|
+
properties.push('invalid value for "data", data cannot be nil.') if data.nil?
|
42
|
+
|
43
|
+
data&.each_with_index do |item, index|
|
44
|
+
item.invalid_properties.each do |prop|
|
45
|
+
properties.push("invalid value for \"data.#{index}\": #{prop}")
|
46
|
+
end
|
47
|
+
end
|
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
|
+
|
55
|
+
properties
|
56
|
+
end
|
57
|
+
|
58
|
+
# Check to see if the all the properties in the model are valid
|
59
|
+
# @return true if the model is valid
|
60
|
+
def valid?
|
61
|
+
invalid_properties.empty?
|
62
|
+
end
|
63
|
+
|
64
|
+
# Builds the object from hash
|
65
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
66
|
+
# @return [Cryptopay::InvoiceListResult] Returns the model itself
|
67
|
+
def self.build_from_hash(data)
|
68
|
+
attributes = ENCODER.build_from_hash(data)
|
69
|
+
new(attributes)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Returns the object in the form of hash
|
73
|
+
# @return [Hash] Returns the object in the form of hash
|
74
|
+
def to_hash
|
75
|
+
ENCODER.to_hash(@attributes)
|
76
|
+
end
|
77
|
+
|
78
|
+
def inspect
|
79
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|