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,131 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class InvoiceParams
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::InvoiceParams',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'price_amount': :price_amount,
|
|
12
|
+
'price_currency': :price_currency,
|
|
13
|
+
'pay_currency': :pay_currency,
|
|
14
|
+
'custom_id': :custom_id,
|
|
15
|
+
'customer_id': :customer_id,
|
|
16
|
+
'name': :name,
|
|
17
|
+
'description': :description,
|
|
18
|
+
'metadata': :metadata,
|
|
19
|
+
'success_redirect_url': :success_redirect_url,
|
|
20
|
+
'unsuccess_redirect_url': :unsuccess_redirect_url
|
|
21
|
+
},
|
|
22
|
+
types: {
|
|
23
|
+
'price_amount': :Decimal,
|
|
24
|
+
'price_currency': :String,
|
|
25
|
+
'pay_currency': :String,
|
|
26
|
+
'custom_id': :String,
|
|
27
|
+
'customer_id': :String,
|
|
28
|
+
'name': :String,
|
|
29
|
+
'description': :String,
|
|
30
|
+
'metadata': :Object,
|
|
31
|
+
'success_redirect_url': :String,
|
|
32
|
+
'unsuccess_redirect_url': :String
|
|
33
|
+
},
|
|
34
|
+
nullables: []
|
|
35
|
+
)
|
|
36
|
+
private_constant :ENCODER
|
|
37
|
+
|
|
38
|
+
# Initializes the object
|
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
40
|
+
def initialize(attributes = {})
|
|
41
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# The invoice amount
|
|
45
|
+
def price_amount
|
|
46
|
+
@attributes[:price_amount]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# The invoice amount currency
|
|
50
|
+
def price_currency
|
|
51
|
+
@attributes[:price_currency]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# The cryptocurrency that the invoice must be paid in
|
|
55
|
+
def pay_currency
|
|
56
|
+
@attributes[:pay_currency]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# The payment reference ID in your system
|
|
60
|
+
def custom_id
|
|
61
|
+
@attributes[:custom_id]
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# The internal ID of your customer that the invoice relates to. See Customers for more information
|
|
65
|
+
def customer_id
|
|
66
|
+
@attributes[:customer_id]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# The invoice name
|
|
70
|
+
def name
|
|
71
|
+
@attributes[:name]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# The invoice description
|
|
75
|
+
def description
|
|
76
|
+
@attributes[:description]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Custom key-valued data
|
|
80
|
+
def metadata
|
|
81
|
+
@attributes[:metadata]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# The URL that the customer will be redirected to upon transaction confirmation
|
|
85
|
+
def success_redirect_url
|
|
86
|
+
@attributes[:success_redirect_url]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def unsuccess_redirect_url
|
|
90
|
+
@attributes[:unsuccess_redirect_url]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
94
|
+
# @return Array for valid properties with the reasons
|
|
95
|
+
def invalid_properties
|
|
96
|
+
properties = []
|
|
97
|
+
|
|
98
|
+
properties.push('invalid value for "price_amount", price_amount cannot be nil.') if price_amount.nil?
|
|
99
|
+
|
|
100
|
+
properties.push('invalid value for "price_currency", price_currency cannot be nil.') if price_currency.nil?
|
|
101
|
+
|
|
102
|
+
properties.push('invalid value for "pay_currency", pay_currency cannot be nil.') if pay_currency.nil?
|
|
103
|
+
|
|
104
|
+
properties
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Check to see if the all the properties in the model are valid
|
|
108
|
+
# @return true if the model is valid
|
|
109
|
+
def valid?
|
|
110
|
+
invalid_properties.empty?
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Builds the object from hash
|
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
115
|
+
# @return [Cryptopay::InvoiceParams] Returns the model itself
|
|
116
|
+
def self.build_from_hash(data)
|
|
117
|
+
attributes = ENCODER.build_from_hash(data)
|
|
118
|
+
new(attributes)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Returns the object in the form of hash
|
|
122
|
+
# @return [Hash] Returns the object in the form of hash
|
|
123
|
+
def to_hash
|
|
124
|
+
ENCODER.to_hash(@attributes)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def inspect
|
|
128
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class InvoiceRecalculation
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::InvoiceRecalculation',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'id': :id,
|
|
12
|
+
'invoice_id': :invoice_id,
|
|
13
|
+
'pay_amount': :pay_amount,
|
|
14
|
+
'pay_currency': :pay_currency,
|
|
15
|
+
'price_amount': :price_amount,
|
|
16
|
+
'price_currency': :price_currency,
|
|
17
|
+
'fee': :fee,
|
|
18
|
+
'fee_currency': :fee_currency,
|
|
19
|
+
'previous_pay_amount': :previous_pay_amount,
|
|
20
|
+
'previous_price_amount': :previous_price_amount,
|
|
21
|
+
'previous_exchange_rate': :previous_exchange_rate,
|
|
22
|
+
'exchange': :exchange,
|
|
23
|
+
'created_at': :created_at
|
|
24
|
+
},
|
|
25
|
+
types: {
|
|
26
|
+
'id': :String,
|
|
27
|
+
'invoice_id': :String,
|
|
28
|
+
'pay_amount': :Decimal,
|
|
29
|
+
'pay_currency': :String,
|
|
30
|
+
'price_amount': :Decimal,
|
|
31
|
+
'price_currency': :String,
|
|
32
|
+
'fee': :String,
|
|
33
|
+
'fee_currency': :String,
|
|
34
|
+
'previous_pay_amount': :Decimal,
|
|
35
|
+
'previous_price_amount': :Decimal,
|
|
36
|
+
'previous_exchange_rate': :Decimal,
|
|
37
|
+
'exchange': :Exchange,
|
|
38
|
+
'created_at': :Time
|
|
39
|
+
},
|
|
40
|
+
nullables: [
|
|
41
|
+
:previous_exchange_rate
|
|
42
|
+
]
|
|
43
|
+
)
|
|
44
|
+
private_constant :ENCODER
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Recalculation ID
|
|
53
|
+
def id
|
|
54
|
+
@attributes[:id]
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Invoice ID
|
|
58
|
+
def invoice_id
|
|
59
|
+
@attributes[:invoice_id]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Cryptocurrency amount received
|
|
63
|
+
def pay_amount
|
|
64
|
+
@attributes[:pay_amount]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Cryptocurrency type
|
|
68
|
+
def pay_currency
|
|
69
|
+
@attributes[:pay_currency]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# New invoice amount
|
|
73
|
+
def price_amount
|
|
74
|
+
@attributes[:price_amount]
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Invoice amount currency
|
|
78
|
+
def price_currency
|
|
79
|
+
@attributes[:price_currency]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Processing fee
|
|
83
|
+
def fee
|
|
84
|
+
@attributes[:fee]
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Processing fee currency
|
|
88
|
+
def fee_currency
|
|
89
|
+
@attributes[:fee_currency]
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Previous amount to pay
|
|
93
|
+
def previous_pay_amount
|
|
94
|
+
@attributes[:previous_pay_amount]
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Previous invoice amount
|
|
98
|
+
def previous_price_amount
|
|
99
|
+
@attributes[:previous_price_amount]
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Previous exchange rate
|
|
103
|
+
def previous_exchange_rate
|
|
104
|
+
@attributes[:previous_exchange_rate]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def exchange
|
|
108
|
+
@attributes[:exchange]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Recalculation creation date and time
|
|
112
|
+
def created_at
|
|
113
|
+
@attributes[:created_at]
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
117
|
+
# @return Array for valid properties with the reasons
|
|
118
|
+
def invalid_properties
|
|
119
|
+
properties = []
|
|
120
|
+
|
|
121
|
+
properties.push('invalid value for "id", id cannot be nil.') if id.nil?
|
|
122
|
+
|
|
123
|
+
properties.push('invalid value for "invoice_id", invoice_id cannot be nil.') if invoice_id.nil?
|
|
124
|
+
|
|
125
|
+
properties.push('invalid value for "pay_amount", pay_amount cannot be nil.') if pay_amount.nil?
|
|
126
|
+
|
|
127
|
+
properties.push('invalid value for "pay_currency", pay_currency cannot be nil.') if pay_currency.nil?
|
|
128
|
+
|
|
129
|
+
properties.push('invalid value for "price_amount", price_amount cannot be nil.') if price_amount.nil?
|
|
130
|
+
|
|
131
|
+
properties.push('invalid value for "price_currency", price_currency cannot be nil.') if price_currency.nil?
|
|
132
|
+
|
|
133
|
+
properties.push('invalid value for "fee", fee cannot be nil.') if fee.nil?
|
|
134
|
+
|
|
135
|
+
properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil?
|
|
136
|
+
|
|
137
|
+
if previous_pay_amount.nil?
|
|
138
|
+
properties.push('invalid value for "previous_pay_amount", previous_pay_amount cannot be nil.')
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if previous_price_amount.nil?
|
|
142
|
+
properties.push('invalid value for "previous_price_amount", previous_price_amount cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
exchange&.invalid_properties&.each do |prop|
|
|
146
|
+
properties.push("invalid value for \"exchange\": #{prop}")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil?
|
|
150
|
+
|
|
151
|
+
properties
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Check to see if the all the properties in the model are valid
|
|
155
|
+
# @return true if the model is valid
|
|
156
|
+
def valid?
|
|
157
|
+
invalid_properties.empty?
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Builds the object from hash
|
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
162
|
+
# @return [Cryptopay::InvoiceRecalculation] Returns the model itself
|
|
163
|
+
def self.build_from_hash(data)
|
|
164
|
+
attributes = ENCODER.build_from_hash(data)
|
|
165
|
+
new(attributes)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Returns the object in the form of hash
|
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
|
170
|
+
def to_hash
|
|
171
|
+
ENCODER.to_hash(@attributes)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def inspect
|
|
175
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class InvoiceRecalculationParams
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::InvoiceRecalculationParams',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'force_commit': :force_commit
|
|
12
|
+
},
|
|
13
|
+
types: {
|
|
14
|
+
'force_commit': :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
|
+
# Set `true` by default. Set `false` for two-step recalculation and commit it within 30 seconds
|
|
27
|
+
def force_commit
|
|
28
|
+
@attributes[:force_commit]
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
32
|
+
# @return Array for valid properties with the reasons
|
|
33
|
+
def invalid_properties
|
|
34
|
+
[]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Check to see if the all the properties in the model are valid
|
|
38
|
+
# @return true if the model is valid
|
|
39
|
+
def valid?
|
|
40
|
+
invalid_properties.empty?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Builds the object from hash
|
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
45
|
+
# @return [Cryptopay::InvoiceRecalculationParams] Returns the model itself
|
|
46
|
+
def self.build_from_hash(data)
|
|
47
|
+
attributes = ENCODER.build_from_hash(data)
|
|
48
|
+
new(attributes)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns the object in the form of hash
|
|
52
|
+
# @return [Hash] Returns the object in the form of hash
|
|
53
|
+
def to_hash
|
|
54
|
+
ENCODER.to_hash(@attributes)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def inspect
|
|
58
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
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 InvoiceRecalculationResult
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::InvoiceRecalculationResult',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'data': :data
|
|
12
|
+
},
|
|
13
|
+
types: {
|
|
14
|
+
'data': :InvoiceRecalculation
|
|
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::InvoiceRecalculationResult] 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,154 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class InvoiceRefund
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::InvoiceRefund',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'id': :id,
|
|
12
|
+
'invoice_id': :invoice_id,
|
|
13
|
+
'custom_id': :custom_id,
|
|
14
|
+
'amount': :amount,
|
|
15
|
+
'amount_currency': :amount_currency,
|
|
16
|
+
'fee': :fee,
|
|
17
|
+
'fee_currency': :fee_currency,
|
|
18
|
+
'address': :address,
|
|
19
|
+
'txid': :txid,
|
|
20
|
+
'risk': :risk,
|
|
21
|
+
'created_at': :created_at
|
|
22
|
+
},
|
|
23
|
+
types: {
|
|
24
|
+
'id': :String,
|
|
25
|
+
'invoice_id': :String,
|
|
26
|
+
'custom_id': :String,
|
|
27
|
+
'amount': :Decimal,
|
|
28
|
+
'amount_currency': :String,
|
|
29
|
+
'fee': :Decimal,
|
|
30
|
+
'fee_currency': :String,
|
|
31
|
+
'address': :String,
|
|
32
|
+
'txid': :String,
|
|
33
|
+
'risk': :Risk,
|
|
34
|
+
'created_at': :Time
|
|
35
|
+
},
|
|
36
|
+
nullables: %i[
|
|
37
|
+
custom_id
|
|
38
|
+
address
|
|
39
|
+
txid
|
|
40
|
+
]
|
|
41
|
+
)
|
|
42
|
+
private_constant :ENCODER
|
|
43
|
+
|
|
44
|
+
# Initializes the object
|
|
45
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
46
|
+
def initialize(attributes = {})
|
|
47
|
+
@attributes = ENCODER.sanitize(attributes)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Refund ID
|
|
51
|
+
def id
|
|
52
|
+
@attributes[:id]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Invoice ID
|
|
56
|
+
def invoice_id
|
|
57
|
+
@attributes[:invoice_id]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Refund `custom_id`. The value is being inherited from the parent invoice
|
|
61
|
+
def custom_id
|
|
62
|
+
@attributes[:custom_id]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Refund amount
|
|
66
|
+
def amount
|
|
67
|
+
@attributes[:amount]
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Refund currency
|
|
71
|
+
def amount_currency
|
|
72
|
+
@attributes[:amount_currency]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Processing fee
|
|
76
|
+
def fee
|
|
77
|
+
@attributes[:fee]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Processing fee currency
|
|
81
|
+
def fee_currency
|
|
82
|
+
@attributes[:fee_currency]
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Cryptocurrency address the refund transaction sent to
|
|
86
|
+
def address
|
|
87
|
+
@attributes[:address]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Cryptocurrency transaction ID on the blockchain
|
|
91
|
+
def txid
|
|
92
|
+
@attributes[:txid]
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def risk
|
|
96
|
+
@attributes[:risk]
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Refund transaction creation date and time
|
|
100
|
+
def created_at
|
|
101
|
+
@attributes[:created_at]
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
105
|
+
# @return Array for valid properties with the reasons
|
|
106
|
+
def invalid_properties
|
|
107
|
+
properties = []
|
|
108
|
+
|
|
109
|
+
properties.push('invalid value for "id", id cannot be nil.') if id.nil?
|
|
110
|
+
|
|
111
|
+
properties.push('invalid value for "invoice_id", invoice_id cannot be nil.') if invoice_id.nil?
|
|
112
|
+
|
|
113
|
+
properties.push('invalid value for "amount", amount cannot be nil.') if amount.nil?
|
|
114
|
+
|
|
115
|
+
properties.push('invalid value for "amount_currency", amount_currency cannot be nil.') if amount_currency.nil?
|
|
116
|
+
|
|
117
|
+
properties.push('invalid value for "fee", fee cannot be nil.') if fee.nil?
|
|
118
|
+
|
|
119
|
+
properties.push('invalid value for "fee_currency", fee_currency cannot be nil.') if fee_currency.nil?
|
|
120
|
+
|
|
121
|
+
risk&.invalid_properties&.each do |prop|
|
|
122
|
+
properties.push("invalid value for \"risk\": #{prop}")
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
properties.push('invalid value for "created_at", created_at cannot be nil.') if created_at.nil?
|
|
126
|
+
|
|
127
|
+
properties
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Check to see if the all the properties in the model are valid
|
|
131
|
+
# @return true if the model is valid
|
|
132
|
+
def valid?
|
|
133
|
+
invalid_properties.empty?
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Builds the object from hash
|
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
138
|
+
# @return [Cryptopay::InvoiceRefund] Returns the model itself
|
|
139
|
+
def self.build_from_hash(data)
|
|
140
|
+
attributes = ENCODER.build_from_hash(data)
|
|
141
|
+
new(attributes)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Returns the object in the form of hash
|
|
145
|
+
# @return [Hash] Returns the object in the form of hash
|
|
146
|
+
def to_hash
|
|
147
|
+
ENCODER.to_hash(@attributes)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def inspect
|
|
151
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Auto-generated file
|
|
4
|
+
# DO NOT EDIT
|
|
5
|
+
|
|
6
|
+
module Cryptopay
|
|
7
|
+
class InvoiceRefundListResult
|
|
8
|
+
ENCODER = Encoder.new(
|
|
9
|
+
name: 'Cryptopay::InvoiceRefundListResult',
|
|
10
|
+
attribute_map: {
|
|
11
|
+
'data': :data
|
|
12
|
+
},
|
|
13
|
+
types: {
|
|
14
|
+
'data': :'Array<InvoiceRefund>'
|
|
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&.each_with_index do |item, index|
|
|
38
|
+
item.invalid_properties.each do |prop|
|
|
39
|
+
properties.push("invalid value for \"data.#{index}\": #{prop}")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
properties
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Check to see if the all the properties in the model are valid
|
|
47
|
+
# @return true if the model is valid
|
|
48
|
+
def valid?
|
|
49
|
+
invalid_properties.empty?
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Builds the object from hash
|
|
53
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
54
|
+
# @return [Cryptopay::InvoiceRefundListResult] Returns the model itself
|
|
55
|
+
def self.build_from_hash(data)
|
|
56
|
+
attributes = ENCODER.build_from_hash(data)
|
|
57
|
+
new(attributes)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Returns the object in the form of hash
|
|
61
|
+
# @return [Hash] Returns the object in the form of hash
|
|
62
|
+
def to_hash
|
|
63
|
+
ENCODER.to_hash(@attributes)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def inspect
|
|
67
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|