bleumi_pay_sdk_ruby 1.0.6 → 1.0.7

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +22 -22
  4. data/bleumi_pay_sdk_ruby.gemspec +1 -1
  5. data/docs/AlgorandBalance.md +1 -0
  6. data/docs/Chain.md +2 -0
  7. data/docs/CreateCheckoutUrlRequest.md +2 -4
  8. data/docs/CreatePayoutRequest.md +1 -1
  9. data/docs/EthereumBalance.md +1 -0
  10. data/docs/HostedCheckoutsApi.md +12 -17
  11. data/docs/PaginatedPayments.md +4 -0
  12. data/docs/Payment.md +2 -0
  13. data/docs/PaymentAddresses.md +13 -31
  14. data/docs/PaymentBalances.md +13 -25
  15. data/docs/PaymentOperationInputs.md +1 -2
  16. data/docs/PaymentRefundRequest.md +1 -2
  17. data/docs/PaymentSettleRequest.md +1 -1
  18. data/docs/PaymentsApi.md +4 -67
  19. data/docs/PayoutsApi.md +2 -2
  20. data/docs/RskBalance.md +28 -0
  21. data/docs/WalletBalance.md +14 -10
  22. data/hc_create.rb +40 -0
  23. data/hc_list.rb +17 -0
  24. data/hc_validate.rb +22 -0
  25. data/lib/bleumi_pay_sdk_ruby.rb +1 -0
  26. data/lib/bleumi_pay_sdk_ruby/api/payouts_api.rb +5 -13
  27. data/lib/bleumi_pay_sdk_ruby/api/request_validator.rb +40 -16
  28. data/lib/bleumi_pay_sdk_ruby/api_client.rb +7 -5
  29. data/lib/bleumi_pay_sdk_ruby/models/chain.rb +2 -0
  30. data/lib/bleumi_pay_sdk_ruby/models/payment_addresses.rb +15 -4
  31. data/lib/bleumi_pay_sdk_ruby/models/payment_balances.rb +13 -4
  32. data/lib/bleumi_pay_sdk_ruby/models/rsk_balance.rb +219 -0
  33. data/lib/bleumi_pay_sdk_ruby/models/wallet_balance.rb +19 -4
  34. data/lib/bleumi_pay_sdk_ruby/version.rb +1 -1
  35. data/po_create.rb +39 -0
  36. data/po_list.rb +23 -0
  37. data/py_create.rb +48 -0
  38. data/py_get.rb +18 -0
  39. data/py_getop.rb +19 -0
  40. data/py_list.rb +24 -0
  41. data/py_listops.rb +21 -0
  42. data/py_refund.rb +43 -0
  43. data/py_settle.rb +43 -0
  44. data/spec/api_client_spec.rb +1 -1
  45. data/spec/models/payment_addresses_spec.rb +6 -0
  46. data/spec/models/payment_balances_spec.rb +6 -0
  47. data/spec/models/rsk_balance_spec.rb +47 -0
  48. data/spec/models/wallet_balance_spec.rb +6 -0
  49. metadata +22 -4
@@ -19,11 +19,14 @@ module BleumiPay
19
19
 
20
20
  attr_accessor :algorand
21
21
 
22
+ attr_accessor :rsk
23
+
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
25
27
  :'ethereum' => :'ethereum',
26
- :'algorand' => :'algorand'
28
+ :'algorand' => :'algorand',
29
+ :'rsk' => :'rsk'
27
30
  }
28
31
  end
29
32
 
@@ -31,7 +34,8 @@ module BleumiPay
31
34
  def self.openapi_types
32
35
  {
33
36
  :'ethereum' => :'EthereumBalance',
34
- :'algorand' => :'AlgorandBalance'
37
+ :'algorand' => :'AlgorandBalance',
38
+ :'rsk' => :'RskBalance'
35
39
  }
36
40
  end
37
41
 
@@ -63,6 +67,10 @@ module BleumiPay
63
67
  if attributes.key?(:'algorand')
64
68
  self.algorand = attributes[:'algorand']
65
69
  end
70
+
71
+ if attributes.key?(:'rsk')
72
+ self.rsk = attributes[:'rsk']
73
+ end
66
74
  end
67
75
 
68
76
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -84,7 +92,8 @@ module BleumiPay
84
92
  return true if self.equal?(o)
85
93
  self.class == o.class &&
86
94
  ethereum == o.ethereum &&
87
- algorand == o.algorand
95
+ algorand == o.algorand &&
96
+ rsk == o.rsk
88
97
  end
89
98
 
90
99
  # @see the `==` method
@@ -96,7 +105,7 @@ module BleumiPay
96
105
  # Calculates hash code according to all attributes.
97
106
  # @return [Integer] Hash code
98
107
  def hash
99
- [ethereum, algorand].hash
108
+ [ethereum, algorand, rsk].hash
100
109
  end
101
110
 
102
111
  # Builds the object from hash
@@ -0,0 +1,219 @@
1
+ =begin
2
+ #Bleumi Pay API
3
+
4
+ #A simple and powerful REST API to integrate ERC-20, Ethereum, xDai 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 RskBalance
17
+ attr_accessor :rsk
18
+
19
+ attr_accessor :rsk_testnet
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'rsk' => :'rsk',
25
+ :'rsk_testnet' => :'rsk_testnet'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'rsk' => :'Hash<String, WalletBalance>',
33
+ :'rsk_testnet' => :'Hash<String, WalletBalance>'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BleumiPay::RskBalance` initialize method"
48
+ end
49
+
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::RskBalance`. 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
+ }
57
+
58
+ if attributes.key?(:'rsk')
59
+ if (value = attributes[:'rsk']).is_a?(Hash)
60
+ self.rsk = value
61
+ end
62
+ end
63
+
64
+ if attributes.key?(:'rsk_testnet')
65
+ if (value = attributes[:'rsk_testnet']).is_a?(Hash)
66
+ self.rsk_testnet = value
67
+ end
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ rsk == o.rsk &&
90
+ rsk_testnet == o.rsk_testnet
91
+ end
92
+
93
+ # @see the `==` method
94
+ # @param [Object] Object to be compared
95
+ def eql?(o)
96
+ self == o
97
+ end
98
+
99
+ # Calculates hash code according to all attributes.
100
+ # @return [Integer] Hash code
101
+ def hash
102
+ [rsk, rsk_testnet].hash
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def self.build_from_hash(attributes)
109
+ new.build_from_hash(attributes)
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ self.class.openapi_types.each_pair do |key, type|
118
+ if type =~ /\AArray<(.*)>/i
119
+ # check to ensure the input is an array given that the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
126
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Deserializes the data based on type
133
+ # @param string type Data type
134
+ # @param string value Value to be deserialized
135
+ # @return [Object] Deserialized data
136
+ def _deserialize(type, value)
137
+ case type.to_sym
138
+ when :DateTime
139
+ DateTime.parse(value)
140
+ when :Date
141
+ Date.parse(value)
142
+ when :String
143
+ value.to_s
144
+ when :Integer
145
+ value.to_i
146
+ when :Float
147
+ value.to_f
148
+ when :Boolean
149
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
150
+ true
151
+ else
152
+ false
153
+ end
154
+ when :Object
155
+ # generic object (usually a Hash), return directly
156
+ value
157
+ when /\AArray<(?<inner_type>.+)>\z/
158
+ inner_type = Regexp.last_match[:inner_type]
159
+ value.map { |v| _deserialize(inner_type, v) }
160
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
161
+ k_type = Regexp.last_match[:k_type]
162
+ v_type = Regexp.last_match[:v_type]
163
+ {}.tap do |hash|
164
+ value.each do |k, v|
165
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
166
+ end
167
+ end
168
+ else # model
169
+ BleumiPay.const_get(type).build_from_hash(value)
170
+ end
171
+ end
172
+
173
+ # Returns the string representation of the object
174
+ # @return [String] String presentation of the object
175
+ def to_s
176
+ to_hash.to_s
177
+ end
178
+
179
+ # to_body is an alias to to_hash (backward compatibility)
180
+ # @return [Hash] Returns the object in the form of hash
181
+ def to_body
182
+ to_hash
183
+ end
184
+
185
+ # Returns the object in the form of hash
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_hash
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
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+ end
219
+ end
@@ -26,13 +26,17 @@ module BleumiPay
26
26
  # Block in which the balance was last updated
27
27
  attr_accessor :block_num
28
28
 
29
+ # Safety level indicator
30
+ attr_accessor :safety
31
+
29
32
  # Attribute mapping from ruby-style variable name to JSON key.
30
33
  def self.attribute_map
31
34
  {
32
35
  :'balance' => :'balance',
33
36
  :'token_balance' => :'token_balance',
34
37
  :'token_decimals' => :'token_decimals',
35
- :'block_num' => :'blockNum'
38
+ :'block_num' => :'blockNum',
39
+ :'safety' => :'safety'
36
40
  }
37
41
  end
38
42
 
@@ -42,7 +46,8 @@ module BleumiPay
42
46
  :'balance' => :'String',
43
47
  :'token_balance' => :'String',
44
48
  :'token_decimals' => :'Integer',
45
- :'block_num' => :'String'
49
+ :'block_num' => :'String',
50
+ :'safety' => :'String'
46
51
  }
47
52
  end
48
53
 
@@ -82,6 +87,10 @@ module BleumiPay
82
87
  if attributes.key?(:'block_num')
83
88
  self.block_num = attributes[:'block_num']
84
89
  end
90
+
91
+ if attributes.key?(:'safety')
92
+ self.safety = attributes[:'safety']
93
+ end
85
94
  end
86
95
 
87
96
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -104,6 +113,10 @@ module BleumiPay
104
113
  invalid_properties.push('invalid value for "block_num", block_num cannot be nil.')
105
114
  end
106
115
 
116
+ if @safety.nil?
117
+ invalid_properties.push('invalid value for "safety", safety cannot be nil.')
118
+ end
119
+
107
120
  invalid_properties
108
121
  end
109
122
 
@@ -114,6 +127,7 @@ module BleumiPay
114
127
  return false if @token_balance.nil?
115
128
  return false if @token_decimals.nil?
116
129
  return false if @block_num.nil?
130
+ return false if @safety.nil?
117
131
  true
118
132
  end
119
133
 
@@ -125,7 +139,8 @@ module BleumiPay
125
139
  balance == o.balance &&
126
140
  token_balance == o.token_balance &&
127
141
  token_decimals == o.token_decimals &&
128
- block_num == o.block_num
142
+ block_num == o.block_num &&
143
+ safety == o.safety
129
144
  end
130
145
 
131
146
  # @see the `==` method
@@ -137,7 +152,7 @@ module BleumiPay
137
152
  # Calculates hash code according to all attributes.
138
153
  # @return [Integer] Hash code
139
154
  def hash
140
- [balance, token_balance, token_decimals, block_num].hash
155
+ [balance, token_balance, token_decimals, block_num, safety].hash
141
156
  end
142
157
 
143
158
  # Builds the object from hash
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.2.2
11
11
  =end
12
12
 
13
13
  module BleumiPay
14
- VERSION = '1.0.6'
14
+ VERSION = '1.0.7'
15
15
  end
@@ -0,0 +1,39 @@
1
+ # Load the gem
2
+ require 'bleumi_pay_sdk_ruby'
3
+
4
+ # Setup authorization
5
+ BleumiPay.configure do |config|
6
+ # Configure API key authorization: ApiKeyAuth
7
+ config.api_key['x-api-key'] = 'gCix0pemxoUt76Ufef16jwvbV6cC7H60HdryEJj0'
8
+ end
9
+
10
+ api_instance = BleumiPay::PayoutsApi.new
11
+
12
+ opts = {
13
+ chain: BleumiPay::Chain::GOERLI # Chain | Ethereum network in which payment is to be created.
14
+ }
15
+
16
+ create_payout_request = BleumiPay::CreatePayoutRequest.new # CreatePayoutRequest | Specify payout creation parameters.
17
+ create_payout_request = BleumiPay::CreatePayoutRequest.new # CreatePayoutRequest | Request body - used to specify payout creation parameters.
18
+ # This example shows 2 payouts being created
19
+ # Creating Payout-1
20
+ payout1 = BleumiPay::Payout.new
21
+ payout1.amount = '1' # str | Replace <PAYOUT_AMT_1> with the 1st payout's amount
22
+ payout1.transfer_address = '0x5db2d6542d55B2aEC1f10D0C0Df3B0169Bf41E41' # str | Replace <PAYOUT_ADDR_1> with the 1st payout's receiver's address
23
+ # Creating Payout-2
24
+ payout2 = BleumiPay::Payout.new
25
+ payout2.amount = '1' # str | Replace <PAYOUT_AMT_2> with the 2nd payout's amount
26
+ payout2.transfer_address = '0x195797609aDcF24b9ca3a105D221293fCA0c476F' # str | Replace <PAYOUT_ADDR_2> with the 2nd payout's receiver's address
27
+ # Creating a payouts array with both the payouts created above
28
+ payouts = [payout1, payout2]
29
+
30
+ create_payout_request.txid = '3' # str | Replace with unique payout ID
31
+ create_payout_request.token = '0x115615DbD0f835344725146Fa6343219315F15E5' # str | Replace <TOKEN> with Token. Eg. ETH or ECR-20 token contract address or XDAI or XDAIT
32
+ create_payout_request.payouts = payouts # setting the payouts array to the payout create request
33
+ begin
34
+ #Create an unique wallet address to accept payments for an ERC-20 token from a buyer
35
+ result = api_instance.create_payout(create_payout_request, opts)
36
+ p result
37
+ rescue BleumiPay::ApiError => e
38
+ puts "Exception when calling PayoutsApi->create_payout: #{e}"
39
+ end
@@ -0,0 +1,23 @@
1
+ # load the gem
2
+ require 'bleumi_pay_sdk_ruby'
3
+ # setup authorization
4
+ BleumiPay.configure do |config|
5
+ # Configure API key authorization: ApiKeyAuth
6
+ config.api_key['x-api-key'] = 'gCix0pemxoUt76Ufef16jwvbV6cC7H60HdryEJj0'
7
+ end
8
+
9
+ api_instance = BleumiPay::PayoutsApi.new
10
+ opts = {
11
+ next_token: '', # String | Cursor to start results from
12
+ sort_by: 'createdAt', # String | Sort wallets by
13
+ start_at: '1577836800', # String | Get wallets from this timestamp
14
+ end_at: '' # String | Get wallets till this timestamp
15
+ }
16
+
17
+ begin
18
+ #Returns a list of wallets
19
+ result = api_instance.list_payouts(opts)
20
+ p result
21
+ rescue BleumiPay::ApiError => e
22
+ puts "Exception when calling PayoutsApi->list_payouts: #{e}"
23
+ end
@@ -0,0 +1,48 @@
1
+ # Load the gem
2
+ require 'bleumi_pay_sdk_ruby'
3
+
4
+ # Setup authorization
5
+ BleumiPay.configure do |config|
6
+ # Configure API key authorization: ApiKeyAuth
7
+ config.api_key['x-api-key'] = 'gCix0pemxoUt76Ufef16jwvbV6cC7H60HdryEJj0'
8
+ end
9
+
10
+ api_instance = BleumiPay::PaymentsApi.new
11
+
12
+ create_payment_request = BleumiPay::CreatePaymentRequest.new # CreatePayoutRequest | Specify payout creation parameters.
13
+ # opts = {
14
+ # chain: BleumiPay::Chain::GOERLI # Chain | Ethereum network in which payment is to be created. Please refer documentation for Supported Networks
15
+ # }
16
+ buyer_address = '0x713883BF69B786f0A7aB6E2248a70C50577F6b34'
17
+ transfer_address = '0x5db2d6542d55B2aEC1f10D0C0Df3B0169Bf41E41'
18
+ # token = '0x115615DbD0f835344725146Fa6343219315F15E5-'
19
+
20
+ # opts = {
21
+ # chain: BleumiPay::Chain::ALG_TESTNET # Chain | Ethereum network in which payment is to be created. Please refer documentation for Supported Networks
22
+ # }
23
+ # buyer_address = 'W5XU4IWCTVBTYXSYIGJYXEPXH2O5S6RPHLF4JK25NEPYT3RACD4Z3EBS4A'
24
+ # transfer_address = 'CQRMTAHZJA3SIEOTEMZXCAIZKUWE2CCLBCFYQI4NINU43IOTEWT4LOT4IY'
25
+
26
+ # RSK
27
+ # USD p18 - 0xB3A4A821434bDFbE55872C240D3888c412c68B9B
28
+ # USD p6 - 0xb9F624160Bb2755aa25366cc307ED27e39A4f296
29
+ # USD p2 - 0x1efEaBf46Ca3270A9a41D324350692664f1eA105
30
+ # EUR p2 - 0xd7a5c209194AC2E8e3E6Ca1dbF3C55484adb06e1
31
+ # Chain: RSK_TESTNET
32
+ token = '0xb9F624160Bb2755aa25366cc307ED27e39A4f296'
33
+ opts = {
34
+ chain: BleumiPay::Chain::RSK_TESTNET # Chain | RSK network in which payment is to be created. Please refer documentation for Supported Networks
35
+ }
36
+
37
+ create_payment_request.id = '16'
38
+ create_payment_request.buyer_address = buyer_address
39
+ create_payment_request.transfer_address = transfer_address
40
+ create_payment_request.token = token
41
+
42
+ begin
43
+ #Create an unique wallet address to accept payments for an ERC-20 token from a buyer
44
+ result = api_instance.create_payment(create_payment_request, opts)
45
+ p result
46
+ rescue BleumiPay::ApiError => e
47
+ puts "Exception when calling create_payment: #{e}"
48
+ end