bleumi_pay_sdk_ruby 1.0.2 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +67 -47
  4. data/bleumi_pay_sdk_ruby.gemspec +4 -5
  5. data/docs/AlgorandBalance.md +28 -0
  6. data/docs/AlgorandWalletAddress.md +24 -0
  7. data/docs/AlgorandWalletInputs.md +23 -0
  8. data/docs/BadRequest.md +2 -1
  9. data/docs/Chain.md +14 -0
  10. data/docs/CheckoutToken.md +28 -0
  11. data/docs/CreateCheckoutUrlRequest.md +28 -0
  12. data/docs/CreateCheckoutUrlResponse.md +17 -0
  13. data/docs/CreatePaymentRequest.md +19 -0
  14. data/docs/CreatePaymentResponse.md +15 -0
  15. data/docs/CreatePayoutRequest.md +28 -0
  16. data/docs/CreatePayoutResponse.md +15 -0
  17. data/docs/EthereumBalance.md +30 -0
  18. data/docs/EthereumWalletAddress.md +23 -0
  19. data/docs/EthereumWalletInputs.md +23 -0
  20. data/docs/HostedCheckoutsApi.md +197 -0
  21. data/docs/PaginatedPaymentOperations.md +28 -0
  22. data/docs/PaginatedPayments.md +95 -0
  23. data/docs/PaginatedPayoutItems.md +59 -0
  24. data/docs/Payment.md +67 -0
  25. data/docs/PaymentAddresses.md +21 -0
  26. data/docs/PaymentBalances.md +21 -0
  27. data/docs/PaymentOperation.md +46 -0
  28. data/docs/PaymentOperationInputs.md +31 -0
  29. data/docs/PaymentOperationResponse.md +15 -0
  30. data/docs/PaymentRefundRequest.md +14 -0
  31. data/docs/PaymentSettleRequest.md +17 -0
  32. data/docs/PaymentsApi.md +368 -0
  33. data/docs/Payout.md +18 -0
  34. data/docs/PayoutItem.md +39 -0
  35. data/docs/PayoutItemInputs.md +28 -0
  36. data/docs/PayoutsApi.md +137 -0
  37. data/docs/RskBalance.md +28 -0
  38. data/docs/ValidateCheckoutRequest.md +21 -0
  39. data/docs/ValidateCheckoutResponse.md +15 -0
  40. data/docs/WalletBalance.md +18 -4
  41. data/hc_create.rb +40 -0
  42. data/hc_list.rb +17 -0
  43. data/hc_validate.rb +22 -0
  44. data/lib/bleumi_pay_sdk_ruby.rb +38 -17
  45. data/lib/bleumi_pay_sdk_ruby/api/hosted_checkouts_api.rb +212 -0
  46. data/lib/bleumi_pay_sdk_ruby/api/payments_api.rb +517 -0
  47. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +157 -0
  48. data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +288 -0
  49. data/lib/bleumi_pay_sdk_ruby/api_client.rb +11 -9
  50. data/lib/bleumi_pay_sdk_ruby/api_error.rb +3 -3
  51. data/lib/bleumi_pay_sdk_ruby/configuration.rb +4 -4
  52. data/lib/bleumi_pay_sdk_ruby/models/algorand_balance.rb +219 -0
  53. data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_address.rb +221 -0
  54. data/lib/bleumi_pay_sdk_ruby/models/algorand_wallet_inputs.rb +247 -0
  55. data/lib/bleumi_pay_sdk_ruby/models/bad_request.rb +15 -5
  56. data/lib/bleumi_pay_sdk_ruby/models/{eth_network.rb → chain.rb} +12 -9
  57. data/lib/bleumi_pay_sdk_ruby/models/checkout_token.rb +302 -0
  58. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_request.rb +312 -0
  59. data/lib/bleumi_pay_sdk_ruby/models/create_checkout_url_response.rb +227 -0
  60. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_input.rb → create_payment_request.rb} +33 -11
  61. data/lib/bleumi_pay_sdk_ruby/models/{wallet_create_output.rb → create_payment_response.rb} +19 -23
  62. data/lib/bleumi_pay_sdk_ruby/models/create_payout_request.rb +244 -0
  63. data/lib/bleumi_pay_sdk_ruby/models/create_payout_response.rb +212 -0
  64. data/lib/bleumi_pay_sdk_ruby/models/ethereum_balance.rb +241 -0
  65. data/lib/bleumi_pay_sdk_ruby/models/ethereum_wallet_address.rb +221 -0
  66. data/lib/bleumi_pay_sdk_ruby/models/{wallet_inputs.rb → ethereum_wallet_inputs.rb} +35 -50
  67. data/lib/bleumi_pay_sdk_ruby/models/paginated_payment_operations.rb +224 -0
  68. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallet_operations.rb → paginated_payments.rb} +19 -9
  69. data/lib/bleumi_pay_sdk_ruby/models/{paginated_wallets.rb → paginated_payout_items.rb} +19 -9
  70. data/lib/bleumi_pay_sdk_ruby/models/{wallet.rb → payment.rb} +31 -54
  71. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +231 -0
  72. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +225 -0
  73. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation.rb → payment_operation.rb} +44 -18
  74. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_inputs.rb → payment_operation_inputs.rb} +38 -12
  75. data/lib/bleumi_pay_sdk_ruby/models/{wallet_operation_output.rb → payment_operation_response.rb} +18 -8
  76. data/lib/bleumi_pay_sdk_ruby/models/{wallet_refund_operation_input.rb → payment_refund_request.rb} +18 -8
  77. data/lib/bleumi_pay_sdk_ruby/models/{wallet_settle_operation_input.rb → payment_settle_request.rb} +18 -8
  78. data/lib/bleumi_pay_sdk_ruby/models/payout.rb +237 -0
  79. data/lib/bleumi_pay_sdk_ruby/models/payout_item.rb +286 -0
  80. data/lib/bleumi_pay_sdk_ruby/models/payout_item_inputs.rb +244 -0
  81. data/lib/bleumi_pay_sdk_ruby/models/rsk_balance.rb +219 -0
  82. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_request.rb +257 -0
  83. data/lib/bleumi_pay_sdk_ruby/models/validate_checkout_response.rb +212 -0
  84. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +37 -12
  85. data/lib/bleumi_pay_sdk_ruby/version.rb +4 -4
  86. data/po_create.rb +39 -0
  87. data/po_list.rb +23 -0
  88. data/py_create.rb +48 -0
  89. data/py_get.rb +18 -0
  90. data/py_getop.rb +19 -0
  91. data/py_list.rb +24 -0
  92. data/py_listops.rb +21 -0
  93. data/py_refund.rb +43 -0
  94. data/py_settle.rb +43 -0
  95. data/spec/api/hosted_checkouts_api_spec.rb +67 -0
  96. data/spec/api/payments_api_spec.rb +123 -0
  97. data/spec/api/payouts_api_spec.rb +61 -0
  98. data/spec/api_client_spec.rb +226 -0
  99. data/spec/configuration_spec.rb +42 -0
  100. data/spec/models/algorand_balance_spec.rb +47 -0
  101. data/spec/models/algorand_wallet_address_spec.rb +47 -0
  102. data/spec/models/algorand_wallet_inputs_spec.rb +65 -0
  103. data/spec/models/bad_request_spec.rb +47 -0
  104. data/spec/models/chain_spec.rb +35 -0
  105. data/spec/models/checkout_token_spec.rb +77 -0
  106. data/spec/models/create_checkout_url_request_spec.rb +89 -0
  107. data/spec/models/create_checkout_url_response_spec.rb +47 -0
  108. data/spec/models/create_payment_request_spec.rb +59 -0
  109. data/spec/models/create_payment_response_spec.rb +41 -0
  110. data/spec/models/create_payout_request_spec.rb +53 -0
  111. data/spec/models/create_payout_response_spec.rb +41 -0
  112. data/spec/models/ethereum_balance_spec.rb +59 -0
  113. data/spec/models/ethereum_wallet_address_spec.rb +47 -0
  114. data/spec/models/ethereum_wallet_inputs_spec.rb +65 -0
  115. data/spec/models/paginated_payment_operations_spec.rb +47 -0
  116. data/spec/models/paginated_payments_spec.rb +47 -0
  117. data/spec/models/paginated_payout_items_spec.rb +47 -0
  118. data/spec/models/payment_addresses_spec.rb +53 -0
  119. data/spec/models/payment_balances_spec.rb +53 -0
  120. data/spec/models/payment_operation_inputs_spec.rb +65 -0
  121. data/spec/models/payment_operation_response_spec.rb +41 -0
  122. data/spec/models/payment_operation_spec.rb +71 -0
  123. data/spec/models/payment_refund_request_spec.rb +41 -0
  124. data/spec/models/payment_settle_request_spec.rb +47 -0
  125. data/spec/models/payment_spec.rb +65 -0
  126. data/spec/models/payout_item_inputs_spec.rb +53 -0
  127. data/spec/models/payout_item_spec.rb +71 -0
  128. data/spec/models/payout_spec.rb +53 -0
  129. data/spec/models/rsk_balance_spec.rb +47 -0
  130. data/spec/models/validate_checkout_request_spec.rb +59 -0
  131. data/spec/models/validate_checkout_response_spec.rb +41 -0
  132. data/spec/models/wallet_balance_spec.rb +65 -0
  133. data/spec/spec_helper.rb +111 -0
  134. metadata +180 -49
  135. data/docs/Erc20PaymentsApi.md +0 -334
  136. data/docs/EthAddress.md +0 -8
  137. data/docs/EthNetwork.md +0 -9
  138. data/docs/PaginatedWalletOperations.md +0 -8
  139. data/docs/PaginatedWallets.md +0 -8
  140. data/docs/Wallet.md +0 -13
  141. data/docs/WalletCreateInput.md +0 -9
  142. data/docs/WalletCreateOutput.md +0 -10
  143. data/docs/WalletInputs.md +0 -11
  144. data/docs/WalletOperation.md +0 -11
  145. data/docs/WalletOperationInputs.md +0 -10
  146. data/docs/WalletOperationOutput.md +0 -8
  147. data/docs/WalletRefundOperationInput.md +0 -7
  148. data/docs/WalletSettleOperationInput.md +0 -8
  149. data/lib/bleumi_pay_sdk_ruby/api/erc20_payments_api.rb +0 -482
  150. data/lib/bleumi_pay_sdk_ruby/models/eth_address.rb +0 -208
@@ -1,30 +1,36 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC20 payments 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
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class WalletCreateInput
17
- # Unique ID identifying the wallet; specified here to create the wallet by your system
16
+ class CreatePaymentRequest
17
+ # Unique ID identifying the payment
18
18
  attr_accessor :id
19
19
 
20
+ # (Only for Algorand Standard Asset) Asset id which will be used for payment.
21
+ attr_accessor :token
22
+
23
+ # Address of buyer. Refund operations on this payment will use this address. You can set this to your address to manually handle refunds (outside of Bleumi Pay) to your buyer. This address must be able to receive payments from smart contracts.
20
24
  attr_accessor :buyer_address
21
25
 
26
+ # Your deposit address. Settle operations on this payment will use this address. This address must be able to receive payments from smart contracts.
22
27
  attr_accessor :transfer_address
23
28
 
24
29
  # Attribute mapping from ruby-style variable name to JSON key.
25
30
  def self.attribute_map
26
31
  {
27
32
  :'id' => :'id',
33
+ :'token' => :'token',
28
34
  :'buyer_address' => :'buyerAddress',
29
35
  :'transfer_address' => :'transferAddress'
30
36
  }
@@ -34,22 +40,29 @@ module BleumiPay
34
40
  def self.openapi_types
35
41
  {
36
42
  :'id' => :'String',
37
- :'buyer_address' => :'EthAddress',
38
- :'transfer_address' => :'EthAddress'
43
+ :'token' => :'String',
44
+ :'buyer_address' => :'String',
45
+ :'transfer_address' => :'String'
39
46
  }
40
47
  end
41
48
 
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
42
55
  # Initializes the object
43
56
  # @param [Hash] attributes Model attributes in the form of hash
44
57
  def initialize(attributes = {})
45
58
  if (!attributes.is_a?(Hash))
46
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletCreateInput` initialize method"
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::CreatePaymentRequest` initialize method"
47
60
  end
48
61
 
49
62
  # check to see if the attribute exists and convert string to symbol for hash key
50
63
  attributes = attributes.each_with_object({}) { |(k, v), h|
51
64
  if (!self.class.attribute_map.key?(k.to_sym))
52
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletCreateInput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::CreatePaymentRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
66
  end
54
67
  h[k.to_sym] = v
55
68
  }
@@ -58,6 +71,10 @@ module BleumiPay
58
71
  self.id = attributes[:'id']
59
72
  end
60
73
 
74
+ if attributes.key?(:'token')
75
+ self.token = attributes[:'token']
76
+ end
77
+
61
78
  if attributes.key?(:'buyer_address')
62
79
  self.buyer_address = attributes[:'buyer_address']
63
80
  end
@@ -101,6 +118,7 @@ module BleumiPay
101
118
  return true if self.equal?(o)
102
119
  self.class == o.class &&
103
120
  id == o.id &&
121
+ token == o.token &&
104
122
  buyer_address == o.buyer_address &&
105
123
  transfer_address == o.transfer_address
106
124
  end
@@ -114,7 +132,7 @@ module BleumiPay
114
132
  # Calculates hash code according to all attributes.
115
133
  # @return [Integer] Hash code
116
134
  def hash
117
- [id, buyer_address, transfer_address].hash
135
+ [id, token, buyer_address, transfer_address].hash
118
136
  end
119
137
 
120
138
  # Builds the object from hash
@@ -203,7 +221,11 @@ module BleumiPay
203
221
  hash = {}
204
222
  self.class.attribute_map.each_pair do |attr, param|
205
223
  value = self.send(attr)
206
- next if value.nil?
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
207
229
  hash[param] = _to_hash(value)
208
230
  end
209
231
  hash
@@ -1,28 +1,25 @@
1
1
  =begin
2
- #Bleumi Pay API
2
+ #Bleumi Pay REST API
3
3
 
4
- #A simple and powerful REST API to integrate ERC20 payments 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
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.2.0
9
+ OpenAPI Generator version: 4.2.2
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module BleumiPay
16
- class WalletCreateOutput
17
- attr_accessor :chain
18
-
19
- # Address of the newly created wallet
16
+ class CreatePaymentResponse
17
+ # Address of the newly created payment
20
18
  attr_accessor :addr
21
19
 
22
20
  # Attribute mapping from ruby-style variable name to JSON key.
23
21
  def self.attribute_map
24
22
  {
25
- :'chain' => :'chain',
26
23
  :'addr' => :'addr'
27
24
  }
28
25
  end
@@ -30,30 +27,31 @@ module BleumiPay
30
27
  # Attribute type mapping.
31
28
  def self.openapi_types
32
29
  {
33
- :'chain' => :'EthNetwork',
34
30
  :'addr' => :'String'
35
31
  }
36
32
  end
37
33
 
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
38
40
  # Initializes the object
39
41
  # @param [Hash] attributes Model attributes in the form of hash
40
42
  def initialize(attributes = {})
41
43
  if (!attributes.is_a?(Hash))
42
- fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::WalletCreateOutput` initialize method"
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::CreatePaymentResponse` initialize method"
43
45
  end
44
46
 
45
47
  # check to see if the attribute exists and convert string to symbol for hash key
46
48
  attributes = attributes.each_with_object({}) { |(k, v), h|
47
49
  if (!self.class.attribute_map.key?(k.to_sym))
48
- fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::WalletCreateOutput`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::CreatePaymentResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
51
  end
50
52
  h[k.to_sym] = v
51
53
  }
52
54
 
53
- if attributes.key?(:'chain')
54
- self.chain = attributes[:'chain']
55
- end
56
-
57
55
  if attributes.key?(:'addr')
58
56
  self.addr = attributes[:'addr']
59
57
  end
@@ -63,10 +61,6 @@ module BleumiPay
63
61
  # @return Array for valid properties with the reasons
64
62
  def list_invalid_properties
65
63
  invalid_properties = Array.new
66
- if @chain.nil?
67
- invalid_properties.push('invalid value for "chain", chain cannot be nil.')
68
- end
69
-
70
64
  if @addr.nil?
71
65
  invalid_properties.push('invalid value for "addr", addr cannot be nil.')
72
66
  end
@@ -77,7 +71,6 @@ module BleumiPay
77
71
  # Check to see if the all the properties in the model are valid
78
72
  # @return true if the model is valid
79
73
  def valid?
80
- return false if @chain.nil?
81
74
  return false if @addr.nil?
82
75
  true
83
76
  end
@@ -87,7 +80,6 @@ module BleumiPay
87
80
  def ==(o)
88
81
  return true if self.equal?(o)
89
82
  self.class == o.class &&
90
- chain == o.chain &&
91
83
  addr == o.addr
92
84
  end
93
85
 
@@ -100,7 +92,7 @@ module BleumiPay
100
92
  # Calculates hash code according to all attributes.
101
93
  # @return [Integer] Hash code
102
94
  def hash
103
- [chain, addr].hash
95
+ [addr].hash
104
96
  end
105
97
 
106
98
  # Builds the object from hash
@@ -189,7 +181,11 @@ module BleumiPay
189
181
  hash = {}
190
182
  self.class.attribute_map.each_pair do |attr, param|
191
183
  value = self.send(attr)
192
- next if value.nil?
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
193
189
  hash[param] = _to_hash(value)
194
190
  end
195
191
  hash
@@ -0,0 +1,244 @@
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
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: info@bleumi.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module BleumiPay
16
+ class CreatePayoutRequest
17
+ # Unique identifier for this payout
18
+ attr_accessor :txid
19
+
20
+ # ETH - for Ethereum ; XDAI - for xDai ; XDAIT - for xDai Testnet ; ALGO - Algo; <asset id> - for Algorand Standard Asset; <contract address of ERC-20 token> - for ERC-20 Tokens;
21
+ attr_accessor :token
22
+
23
+ # Array of payments to be made in this payout. This is an atomic transaction (i.e. either all payments are processed or all of them are rejected).
24
+ attr_accessor :payouts
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'txid' => :'txid',
30
+ :'token' => :'token',
31
+ :'payouts' => :'payouts'
32
+ }
33
+ end
34
+
35
+ # Attribute type mapping.
36
+ def self.openapi_types
37
+ {
38
+ :'txid' => :'String',
39
+ :'token' => :'String',
40
+ :'payouts' => :'Array<Payout>'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::CreatePayoutRequest` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BleumiPay::CreatePayoutRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'txid')
66
+ self.txid = attributes[:'txid']
67
+ end
68
+
69
+ if attributes.key?(:'token')
70
+ self.token = attributes[:'token']
71
+ end
72
+
73
+ if attributes.key?(:'payouts')
74
+ if (value = attributes[:'payouts']).is_a?(Array)
75
+ self.payouts = value
76
+ end
77
+ end
78
+ end
79
+
80
+ # Show invalid properties with the reasons. Usually used together with valid?
81
+ # @return Array for valid properties with the reasons
82
+ def list_invalid_properties
83
+ invalid_properties = Array.new
84
+ if @txid.nil?
85
+ invalid_properties.push('invalid value for "txid", txid cannot be nil.')
86
+ end
87
+
88
+ if @token.nil?
89
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
90
+ end
91
+
92
+ if @payouts.nil?
93
+ invalid_properties.push('invalid value for "payouts", payouts cannot be nil.')
94
+ end
95
+
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return false if @txid.nil?
103
+ return false if @token.nil?
104
+ return false if @payouts.nil?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ txid == o.txid &&
114
+ token == o.token &&
115
+ payouts == o.payouts
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [txid, token, payouts].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ new.build_from_hash(attributes)
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :DateTime
164
+ DateTime.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ BleumiPay.const_get(type).build_from_hash(value)
195
+ end
196
+ end
197
+
198
+ # Returns the string representation of the object
199
+ # @return [String] String presentation of the object
200
+ def to_s
201
+ to_hash.to_s
202
+ end
203
+
204
+ # to_body is an alias to to_hash (backward compatibility)
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_body
207
+ to_hash
208
+ end
209
+
210
+ # Returns the object in the form of hash
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_hash
213
+ hash = {}
214
+ self.class.attribute_map.each_pair do |attr, param|
215
+ value = self.send(attr)
216
+ if value.nil?
217
+ is_nullable = self.class.openapi_nullable.include?(attr)
218
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
219
+ end
220
+
221
+ hash[param] = _to_hash(value)
222
+ end
223
+ hash
224
+ end
225
+
226
+ # Outputs non-array value in the form of hash
227
+ # For object, use to_hash. Otherwise, just return the value
228
+ # @param [Object] value Any valid value
229
+ # @return [Hash] Returns the value in the form of hash
230
+ def _to_hash(value)
231
+ if value.is_a?(Array)
232
+ value.compact.map { |v| _to_hash(v) }
233
+ elsif value.is_a?(Hash)
234
+ {}.tap do |hash|
235
+ value.each { |k, v| hash[k] = _to_hash(v) }
236
+ end
237
+ elsif value.respond_to? :to_hash
238
+ value.to_hash
239
+ else
240
+ value
241
+ end
242
+ end
243
+ end
244
+ end