bleumi_pay_sdk_ruby 1.0.3 → 1.0.4

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -7
  3. data/bleumi_pay_sdk_ruby.gemspec +3 -3
  4. data/docs/AlgorandBalance.md +27 -0
  5. data/docs/BadRequest.md +1 -1
  6. data/docs/Chain.md +4 -3
  7. data/docs/CheckoutToken.md +6 -3
  8. data/docs/CreateCheckoutUrlRequest.md +7 -7
  9. data/docs/CreatePaymentRequest.md +3 -3
  10. data/docs/CreatePaymentResponse.md +1 -1
  11. data/docs/CreatePayoutRequest.md +1 -1
  12. data/docs/CreatePayoutResponse.md +1 -1
  13. data/docs/EthereumBalance.md +29 -0
  14. data/docs/HostedCheckoutsApi.md +26 -12
  15. data/docs/PaginatedPaymentOperations.md +2 -3
  16. data/docs/PaginatedPayments.md +3 -3
  17. data/docs/PaginatedPayoutItems.md +1 -1
  18. data/docs/Payment.md +0 -1
  19. data/docs/PaymentAddresses.md +2 -1
  20. data/docs/PaymentBalances.md +2 -1
  21. data/docs/PaymentOperation.md +2 -2
  22. data/docs/PaymentOperationInputs.md +4 -4
  23. data/docs/PaymentRefundRequest.md +1 -2
  24. data/docs/PaymentSettleRequest.md +1 -1
  25. data/docs/PaymentsApi.md +17 -15
  26. data/docs/Payout.md +2 -1
  27. data/docs/PayoutItem.md +1 -1
  28. data/docs/PayoutItemInputs.md +1 -1
  29. data/docs/PayoutsApi.md +10 -10
  30. data/docs/ValidateCheckoutRequest.md +1 -1
  31. data/docs/WalletAddress.md +1 -0
  32. data/docs/WalletBalance.md +1 -1
  33. data/lib/bleumi_pay_sdk_ruby.rb +5 -5
  34. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +17 -5
  35. data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +46 -17
  36. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +14 -6
  37. data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +264 -0
  38. data/lib/bleumi_pay_sdk_ruby/api_client.rb +3 -3
  39. data/lib/bleumi_pay_sdk_ruby/api_error.rb +2 -2
  40. data/lib/bleumi_pay_sdk_ruby/configuration.rb +3 -3
  41. data/lib/bleumi_pay_sdk_ruby/models/{token.rb → algorand_balance.rb} +43 -38
  42. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +3 -3
  43. data/lib/bleumi_pay_sdk_ruby/models/chain.rb +4 -5
  44. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +28 -13
  45. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +19 -7
  46. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +2 -2
  47. data/lib/bleumi_pay_sdk_ruby/models/create_payment_request.rb +17 -5
  48. data/lib/bleumi_pay_sdk_ruby/models/create_payment_response.rb +2 -2
  49. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +4 -3
  50. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +2 -2
  51. data/lib/bleumi_pay_sdk_ruby/models/{network_balance.rb → ethereum_balance.rb} +13 -46
  52. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +2 -2
  53. data/lib/bleumi_pay_sdk_ruby/models/paginated_payments.rb +2 -2
  54. data/lib/bleumi_pay_sdk_ruby/models/paginated_payout_items.rb +2 -2
  55. data/lib/bleumi_pay_sdk_ruby/models/payment.rb +2 -2
  56. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +17 -6
  57. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +15 -6
  58. data/lib/bleumi_pay_sdk_ruby/models/payment_operation.rb +4 -3
  59. data/lib/bleumi_pay_sdk_ruby/models/payment_operation_inputs.rb +3 -3
  60. data/lib/bleumi_pay_sdk_ruby/models/payment_operation_response.rb +2 -2
  61. data/lib/bleumi_pay_sdk_ruby/models/payment_refund_request.rb +3 -3
  62. data/lib/bleumi_pay_sdk_ruby/models/payment_settle_request.rb +3 -3
  63. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +16 -6
  64. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +2 -2
  65. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +2 -2
  66. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +2 -2
  67. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +2 -2
  68. data/lib/bleumi_pay_sdk_ruby/models/wallet_address.rb +2 -2
  69. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +2 -2
  70. data/lib/bleumi_pay_sdk_ruby/version.rb +3 -3
  71. data/py_create.rb +38 -0
  72. data/spec/api/payments_api_spec.rb +2 -2
  73. data/spec/models/algorand_balance_spec.rb +47 -0
  74. data/spec/models/ethereum_balance_spec.rb +59 -0
  75. metadata +14 -10
  76. data/docs/EthAddress.md +0 -13
  77. data/docs/NetworkBalance.md +0 -29
  78. data/docs/Token.md +0 -15
  79. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
@@ -15,14 +15,16 @@ require 'cgi'
15
15
  module BleumiPay
16
16
  class PayoutsApi
17
17
  attr_accessor :api_client
18
+ attr_accessor :request_validator
18
19
 
19
- def initialize(api_client = ApiClient.default)
20
+ def initialize(api_client = ApiClient.default, request_validator = RequestValidator.default)
20
21
  @api_client = api_client
22
+ @request_validator = request_validator
21
23
  end
22
24
  # Create a payout.
23
25
  # @param create_payout_request [CreatePayoutRequest] Request body - used to specify payout creation parameters.
24
26
  # @param [Hash] opts the optional parameters
25
- # @option opts [Chain] :chain Ethereum network in which payment is to be created. Please refer documentation for Supported Networks
27
+ # @option opts [Chain] :chain Network in which payment is to be created. Please refer documentation for Supported Networks
26
28
  # @return [CreatePayoutResponse]
27
29
  def create_payout(create_payout_request, opts = {})
28
30
  data, _status_code, _headers = create_payout_with_http_info(create_payout_request, opts)
@@ -32,7 +34,7 @@ module BleumiPay
32
34
  # Create a payout.
33
35
  # @param create_payout_request [CreatePayoutRequest] Request body - used to specify payout creation parameters.
34
36
  # @param [Hash] opts the optional parameters
35
- # @option opts [Chain] :chain Ethereum network in which payment is to be created. Please refer documentation for Supported Networks
37
+ # @option opts [Chain] :chain Network in which payment is to be created. Please refer documentation for Supported Networks
36
38
  # @return [Array<(CreatePayoutResponse, Integer, Hash)>] CreatePayoutResponse data, response status code and response headers
37
39
  def create_payout_with_http_info(create_payout_request, opts = {})
38
40
  if @api_client.config.debugging
@@ -42,12 +44,18 @@ module BleumiPay
42
44
  if @api_client.config.client_side_validation && create_payout_request.nil?
43
45
  fail ArgumentError, "Missing the required parameter 'create_payout_request' when calling PayoutsApi.create_payout"
44
46
  end
47
+ # verify the values in the request body are valid
48
+ chain = opts[:'chain'] if !opts[:'chain'].nil?
49
+ msg = @request_validator.validate_create_payout_request(create_payout_request, chain)
50
+ if (@request_validator.is_not_empty(msg))
51
+ fail ArgumentError, "`#{msg}` when calling PayoutsApi.create_payout"
52
+ end
45
53
  # resource path
46
54
  local_var_path = '/v1/payout'
47
55
 
48
56
  # query parameters
49
57
  query_params = opts[:query_params] || {}
50
- query_params[:'chain'] = opts[:'chain'] if !opts[:'chain'].nil?
58
+ query_params[:'chain'] = chain
51
59
 
52
60
  # header parameters
53
61
  header_params = opts[:header_params] || {}
@@ -0,0 +1,264 @@
1
+ =begin
2
+ #Bleumi Pay REST API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
+
6
+ Contact: info@bleumi.com
7
+
8
+ =end
9
+ module BleumiPay
10
+ class RequestValidator
11
+
12
+ def self.default
13
+ @@default ||= RequestValidator.new
14
+ end
15
+
16
+ def eth_address?(str)
17
+ # We use !! to convert the return value to a boolean
18
+ !!(str =~ /^0x[a-fA-F0-9]{40}$/)
19
+ end
20
+
21
+ def algo_address?(str)
22
+ # We use !! to convert the return value to a boolean
23
+ !!(str =~ /^[A-Z2-7+=*]{58}$/)
24
+ end
25
+
26
+ def is_not_empty(str)
27
+ if (str == nil || str == "") then
28
+ return false
29
+ end
30
+ return true
31
+ end
32
+
33
+ def check_eth_addr(name, input)
34
+ if !((eth_address?(input))||(input == "ETH")||(input == "XDAI")||(input == "XDAIT")) then
35
+ return "`#{name}` is not a valid Ethereum address"
36
+ end
37
+ return nil
38
+ end
39
+
40
+ def check_alg_addr(name, input)
41
+ if !((algo_address?(input))||(input == "ALGO")) then
42
+ return "`#{name}` is not a valid Algorand address"
43
+ end
44
+ return nil
45
+ end
46
+
47
+ def is_algo_network(chain)
48
+ return ((chain == "alg_mainnet")||(chain == "alg_testnet"))
49
+ end
50
+
51
+ def check_req_param(name, input)
52
+ if (input == nil || input == "")
53
+ return "Missing required parameter `#{name}`"
54
+ end
55
+ return nil
56
+ end
57
+
58
+ def check_network_addr(name, input, chain, mandatory)
59
+ if mandatory then
60
+ msg = check_req_param(name, input)
61
+ if is_not_empty(msg) then
62
+ return msg
63
+ end
64
+ end
65
+ if is_not_empty(input) then
66
+ msg = nil
67
+ if is_algo_network(chain) then
68
+ msg = check_alg_addr(name, input)
69
+ else
70
+ msg = check_eth_addr(name, input)
71
+ end
72
+ if is_not_empty(msg) then
73
+ return msg
74
+ end
75
+ end
76
+ return nil
77
+ end
78
+
79
+ def validate_create_payment_request(params, chain)
80
+ # check if chain is provided
81
+ msg = check_req_param("Chain", chain)
82
+ if is_not_empty(msg) then
83
+ return msg
84
+ end
85
+ # check if buyer_address is valid address in the network
86
+ msg = check_network_addr("BuyerAddress", params.buyer_address, chain, mandatory=true)
87
+ if is_not_empty(msg) then
88
+ return msg
89
+ end
90
+ # check if transfer_address is valid address in the network
91
+ msg = check_network_addr("TransferAddress", params.transfer_address, chain, mandatory=true)
92
+ if is_not_empty(msg) then
93
+ return msg
94
+ end
95
+
96
+ # check if token is valid address in the network (if provided)
97
+ if is_not_empty(params.token) then
98
+ msg = check_network_addr("Token", params.token, chain, mandatory=false)
99
+ if is_not_empty(msg) then
100
+ return msg
101
+ end
102
+ end
103
+ return nil
104
+ end
105
+
106
+ def validate_refund_payment_request(params, chain)
107
+ # check if chain is provided
108
+ msg = check_req_param("Chain", chain)
109
+ if is_not_empty(msg) then
110
+ return msg
111
+ end
112
+ # check if token is valid address in the network
113
+ msg = check_network_addr("Token", params.token, chain, mandatory=true)
114
+ if is_not_empty(msg) then
115
+ return msg
116
+ end
117
+ return nil
118
+ end
119
+
120
+ def validate_settle_payment_request(params, chain)
121
+ # check if chain is provided
122
+ msg = check_req_param("Chain", chain)
123
+ if is_not_empty(msg) then
124
+ return msg
125
+ end
126
+ # check if token is valid address in the network
127
+ msg = check_network_addr("Token", params.token, chain, mandatory=true)
128
+ if is_not_empty(msg) then
129
+ return msg
130
+ end
131
+ # check if amount to settle is provided
132
+ msg = check_req_param("Amount", params.amount)
133
+ if is_not_empty(msg) then
134
+ return msg
135
+ end
136
+ return nil
137
+ end
138
+
139
+ def validate_create_checkout_url_request(params)
140
+ # check if id is provided while creating checkout url
141
+ msg = check_req_param("Id", params.id)
142
+ if is_not_empty(msg) then
143
+ return msg
144
+ end
145
+
146
+ # check if currency is provided while creating checkout url
147
+ msg = check_req_param("Currency", params.currency)
148
+ if is_not_empty(msg) then
149
+ return msg
150
+ end
151
+
152
+ # check if amount is provided while creating checkout url
153
+ msg = check_req_param("Amount", params.amount)
154
+ if is_not_empty(msg) then
155
+ return msg
156
+ end
157
+
158
+ # check if cancel_url is provided while creating checkout url
159
+ msg = check_req_param("CancelUrl", params.cancel_url)
160
+ if is_not_empty(msg) then
161
+ return msg
162
+ end
163
+
164
+ # check if success_url is provided while creating checkout url
165
+ msg = check_req_param("SuccessUrl", params.success_url)
166
+ if is_not_empty(msg) then
167
+ return msg
168
+ end
169
+
170
+ # check if token is valid address in the network (if provided)
171
+ if is_not_empty(params.token) then
172
+
173
+ # check if chain is provided in the request, when token is provided, this is required
174
+ msg = check_req_param("Chain", params.chain)
175
+ if is_not_empty(msg) then
176
+ return msg
177
+ end
178
+
179
+ # check if token is valid address in the network (if provided)
180
+ msg = check_network_addr("Token", params.token, params.chain, mandatory=false)
181
+ if is_not_empty(msg) then
182
+ return msg
183
+ end
184
+
185
+ # check if buyer_address is valid address in the network (if provided)
186
+ if is_not_empty(params.buyer_address) then
187
+ msg = check_network_addr("BuyerAddress", params.buyer_address, params.chain, mandatory=false)
188
+ if is_not_empty(msg) then
189
+ return msg
190
+ end
191
+ end
192
+ end
193
+ return nil
194
+ end
195
+
196
+ def validate_checkout_payment_params(params)
197
+
198
+ # check if hmac_alg is provided while creating checkout payment parameters request
199
+ msg = check_req_param("HmacAlg", params.hmac_alg)
200
+ if is_not_empty(msg) then
201
+ return msg
202
+ end
203
+
204
+ # check if hmac_input is provided while creating checkout payment parameters request
205
+ msg = check_req_param("HmacInput", params.hmac_input)
206
+ if is_not_empty(msg) then
207
+ return msg
208
+ end
209
+
210
+ # check if hmac_key_id is provided while creating checkout payment parameters request
211
+ msg = check_req_param("HmacKeyId", params.hmac_key_id)
212
+ if is_not_empty(msg) then
213
+ return msg
214
+ end
215
+
216
+ # check if hmac_value is provided while creating checkout payment parameters request
217
+ msg = check_req_param("HmacValue", params.hmac_value)
218
+ if is_not_empty(msg) then
219
+ return msg
220
+ end
221
+ return nil
222
+ end
223
+
224
+ def validate_create_payout_request(params, chain)
225
+ msg = check_req_param("Chain", chain)
226
+ if is_not_empty(msg) then
227
+ return msg
228
+ end
229
+ # check if token is valid address in the network
230
+ msg = check_network_addr("Token", params.token, chain, mandatory=true)
231
+ if is_not_empty(msg) then
232
+ return msg
233
+ end
234
+
235
+ payouts = params.payouts
236
+ if payouts.length == 0 then
237
+ return "Payouts not defined."
238
+ end
239
+
240
+ for payout in payouts
241
+ # check if payout.transfer_address is valid address in the network
242
+ msg = check_network_addr("TransferAddress", payout.transfer_address, chain, mandatory=true)
243
+ if is_not_empty(msg) then
244
+ return msg
245
+ end
246
+
247
+ # check if payout.amount is provided for payout
248
+ msg = check_req_param("Amount", payout.amount)
249
+ if is_not_empty(msg) then
250
+ return msg
251
+ end
252
+
253
+ if is_algo_network(chain) then
254
+ # check if payout.authorization is provided for Algorand payout
255
+ msg = check_req_param("Authorization", payout.authorization)
256
+ if is_not_empty(msg) then
257
+ return msg
258
+ end
259
+ end
260
+ end
261
+ return nil
262
+ end
263
+ end
264
+ end
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
@@ -30,7 +30,7 @@ module BleumiPay
30
30
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
31
31
  def initialize(config = Configuration.default)
32
32
  @config = config
33
- @user_agent = "BleumiPay/#{VERSION}/ruby"
33
+ @user_agent = "bleumi_pay_sdk_ruby/#{VERSION}/ruby"
34
34
  @default_headers = {
35
35
  'Content-Type' => 'application/json',
36
36
  'User-Agent' => @user_agent
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
@@ -208,7 +208,7 @@ module BleumiPay
208
208
  [
209
209
  {
210
210
  url: "https://api.pay.bleumi.com/",
211
- description: "Bleumi Pay API",
211
+ description: "Bleumi Pay REST API",
212
212
  }
213
213
  ]
214
214
  end
@@ -1,7 +1,7 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai payments and/or payouts into your business or application
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai, Algorand payments and/or payouts into your business or application
5
5
 
6
6
  The version of the OpenAPI document: 1.0.0
7
7
  Contact: info@bleumi.com
@@ -13,21 +13,24 @@ OpenAPI Generator version: 4.2.2
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class Token
17
- # ETH - for Ethereum ; XDAI - for xDai ; XDAIT - for xDai Testnet ; <contract address of ERC-20 token> - for ERC-20 Tokens;
18
- attr_accessor :addr
16
+ class AlgorandBalance
17
+ attr_accessor :alg_mainnet
18
+
19
+ attr_accessor :alg_testnet
19
20
 
20
21
  # Attribute mapping from ruby-style variable name to JSON key.
21
22
  def self.attribute_map
22
23
  {
23
- :'addr' => :'addr'
24
+ :'alg_mainnet' => :'alg_mainnet',
25
+ :'alg_testnet' => :'alg_testnet'
24
26
  }
25
27
  end
26
28
 
27
29
  # Attribute type mapping.
28
30
  def self.openapi_types
29
31
  {
30
- :'addr' => :'String'
32
+ :'alg_mainnet' => :'Hash<String, WalletBalance>',
33
+ :'alg_testnet' => :'Hash<String, WalletBalance>'
31
34
  }
32
35
  end
33
36
 
@@ -37,46 +40,44 @@ module BleumiPay
37
40
  ])
38
41
  end
39
42
 
40
- def eth_address?(str)
41
- # We use !! to convert the return value to a boolean
42
- !!(str =~ /^0x[a-fA-F0-9]{40}$/)
43
- end
44
-
45
43
  # Initializes the object
46
44
  # @param [Hash] attributes Model attributes in the form of hash
47
- def initialize(value)
48
-
49
- if (!eth_address?(value))
50
- fail ArgumentError, "`#{value}` The input argument must be valid Ethereum Address `BleumiPay::EthAddress` initialize method"
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::AlgorandBalance` initialize method"
51
48
  end
52
49
 
53
- self.addr = value
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::AlgorandBalance`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
54
57
 
55
- end
58
+ if attributes.key?(:'alg_mainnet')
59
+ if (value = attributes[:'alg_mainnet']).is_a?(Hash)
60
+ self.alg_mainnet = value
61
+ end
62
+ end
56
63
 
57
- # validation for updating addr using setter of addr
58
- def addr=(new_addr)
59
- if ((eth_address?(new_addr))||(new_addr == "ETH")||(new_addr == "XDAI")||(new_addr == "XDAIT"))
60
- fail ArgumentError, "`#{new_addr}` The input argument must be valid Token `BleumiPay::Token` initialize method"
64
+ if attributes.key?(:'alg_testnet')
65
+ if (value = attributes[:'alg_testnet']).is_a?(Hash)
66
+ self.alg_testnet = value
67
+ end
61
68
  end
62
- @addr = new_addr
63
69
  end
64
70
 
65
71
  # Show invalid properties with the reasons. Usually used together with valid?
66
72
  # @return Array for valid properties with the reasons
67
73
  def list_invalid_properties
68
74
  invalid_properties = Array.new
69
- if @addr.nil?
70
- invalid_properties.push('invalid value for "addr", addr cannot be nil.')
71
- end
72
-
73
75
  invalid_properties
74
76
  end
75
77
 
76
78
  # Check to see if the all the properties in the model are valid
77
79
  # @return true if the model is valid
78
80
  def valid?
79
- return false if @addr.nil?
80
81
  true
81
82
  end
82
83
 
@@ -85,7 +86,8 @@ module BleumiPay
85
86
  def ==(o)
86
87
  return true if self.equal?(o)
87
88
  self.class == o.class &&
88
- addr == o.addr
89
+ alg_mainnet == o.alg_mainnet &&
90
+ alg_testnet == o.alg_testnet
89
91
  end
90
92
 
91
93
  # @see the `==` method
@@ -97,7 +99,7 @@ module BleumiPay
97
99
  # Calculates hash code according to all attributes.
98
100
  # @return [Integer] Hash code
99
101
  def hash
100
- [addr].hash
102
+ [alg_mainnet, alg_testnet].hash
101
103
  end
102
104
 
103
105
  # Builds the object from hash
@@ -183,14 +185,17 @@ module BleumiPay
183
185
  # Returns the object in the form of hash
184
186
  # @return [Hash] Returns the object in the form of hash
185
187
  def to_hash
186
- # hash = {}
187
- # self.class.attribute_map.each_pair do |attr, param|
188
- # value = self.send(attr)
189
- # next if value.nil?
190
- # hash[param] = _to_hash(value)
191
- # end
192
- # hash
193
- addr
188
+ hash = {}
189
+ self.class.attribute_map.each_pair do |attr, param|
190
+ value = self.send(attr)
191
+ if value.nil?
192
+ is_nullable = self.class.openapi_nullable.include?(attr)
193
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
194
+ end
195
+
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
194
199
  end
195
200
 
196
201
  # Outputs non-array value in the form of hash