cryptopay-ruby 2.2.0 → 3.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b7b5b9797e07653c96e6c8e9e89838d4ad67db7d4c31df93971c78697125446
4
- data.tar.gz: ad3a36fae0973cde9845e898b4ad6f4eb795957af856d8cfadb95215a2e1dfff
3
+ metadata.gz: ef84c8ae3650cba4ab5f4fce1e22df6e9762b9dce8cfda0671fb141eee38efc5
4
+ data.tar.gz: f740121751b90551e1caa0108fac4fab7570b9c8e08b8c2714e9dae6b42fb34d
5
5
  SHA512:
6
- metadata.gz: 84f5d30d964c10af04fff1f1a77e83b28352b42faaf63f2862b2a2a47fe81238b4545be53e95c14ef8a11f1823a1344913ad7cf9fa01dfbb3424109ab0ffce64
7
- data.tar.gz: ff88be658db23f44d892a60aa1a9da21efa9631f42a222d1f34934f8c42211fc4b4c748f826cf51a0071f19a7910106739895f5a5dd24aac334658a781291194
6
+ metadata.gz: 8833dd9bdba6ba96d906d3cb945e320cabeb7a94a625aa8eba15f0c501af05dd396e44678077246f2d6d7eaf9acb93b9d9552d65dc138c9234c26d86e4eb01c5
7
+ data.tar.gz: 50d32b002e455292b9ec8f3a47961fe92829862d9cec35ebed1f80decadb6940f016ad62eedff175bc3c182af7d93e6279982e89fbc5497babb70821dd72665a
data/README.md CHANGED
@@ -204,6 +204,19 @@ params = Cryptopay::CoinWithdrawalParams.new(
204
204
  force_commit: true
205
205
  )
206
206
 
207
+ result = client.coin_withdrawals.create(params)
208
+ p result # => <CoinWithdrawalResult data=...>
209
+ # New amounts example
210
+ params = Cryptopay::CoinWithdrawalParams.new(
211
+ address: '2Mz3bcjSVHG8uQJpNjmCxp24VdTjwaqmFcJ',
212
+ amount: '100.0',
213
+ amount_currency: 'EUR',
214
+ received_currency: 'BTC',
215
+ amount_includes_processing_fee: true,
216
+ amount_includes_network_fee: true,
217
+ force_commit: true
218
+ )
219
+
207
220
  result = client.coin_withdrawals.create(params)
208
221
  p result # => <CoinWithdrawalResult data=...>
209
222
  ```
@@ -402,9 +415,8 @@ p result # => <InvoiceRecalculationResult data=...>
402
415
 
403
416
  ```ruby
404
417
  invoice_id = '7e274430-e20f-4321-8748-20824287ae44'
405
- invoice_refund_params = Cryptopay::InvoiceRefundParams.new(address: '0xf3532c1fd002665ec54d46a50787e0c69c76cd44')
406
418
 
407
- result = client.invoices.create_refund(invoice_id, invoice_refund_params)
419
+ result = client.invoices.create_refund(invoice_id)
408
420
  p result # => <InvoiceRefundResult data=...>
409
421
  ```
410
422
 
@@ -26,7 +26,7 @@ module Cryptopay
26
26
  end
27
27
 
28
28
  # Create a withdrawal
29
- # To create a withdrawal you need to use either &#x60;charged_amount&#x60;, &#x60;charged_amount_to_send&#x60; or &#x60;received_amount&#x60; parameters in your request body.
29
+ # To create a withdrawal you must provide either the legacy amount fields (&#x60;charged_amount&#x60;, &#x60;charged_amount_to_send&#x60;, &#x60;received_amount&#x60;) or the new amount fields (&#x60;amount&#x60;, &#x60;amount_currency&#x60;, &#x60;amount_includes_processing_fee&#x60;, &#x60;amount_includes_network_fee&#x60;). Mixing legacy and new amount fields in one request is not allowed.
30
30
  # @param coin_withdrawal_params [CoinWithdrawalParams]
31
31
  # @param [Hash] opts the optional parameters
32
32
  # @return [CoinWithdrawalResult]
@@ -65,19 +65,19 @@ module Cryptopay
65
65
  end
66
66
 
67
67
  # Create invoice refund
68
- # This endpoint allows you to create invoice refunds.
68
+ # This endpoint allows you to create invoice refunds to your cryptocurrency account.
69
69
  # @param invoice_id [String] Invoice ID
70
- # @param invoice_refund_params [InvoiceRefundParams]
71
70
  # @param [Hash] opts the optional parameters
71
+ # @option opts [Object] :body
72
72
  # @return [InvoiceRefundResult]
73
- def create_refund(invoice_id, invoice_refund_params, _opts = {})
73
+ def create_refund(invoice_id, opts = {})
74
74
  path = '/api/invoices/{invoice_id}/refunds'
75
75
  path = path.sub('{invoice_id}', CGI.escape(invoice_id.to_s))
76
76
 
77
77
  req = Request.new(
78
78
  method: :post,
79
79
  path: path,
80
- body_params: invoice_refund_params
80
+ body_params: opts[:body] || {}
81
81
  )
82
82
 
83
83
  connection.call(req, return_type: InvoiceRefundResult)
@@ -40,7 +40,7 @@ module Cryptopay
40
40
  @attributes[:type]
41
41
  end
42
42
 
43
- # The registered name of the company for a `legal_person` or the full name for a `natural_person`.
43
+ # The registered name of the company for a `legal_person` or the full name for a `natural_person`. Note that only following symbols will be stored, regardless of the input value: letters of any language, digits `0-9`, symbols `&` `!` `,` `.` `-` and single spaces. Symbols `\\`, `/`, newlines and tabs will be replaced with spaces. Everything else will be removed, including double spaces and spaces in the end.
44
44
  def name
45
45
  @attributes[:name]
46
46
  end
@@ -66,11 +66,6 @@ module Cryptopay
66
66
  properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
67
67
  end
68
68
 
69
- pattern = Regexp.new(/^[a-zA-Z0-9\s-]+$/)
70
- properties.push("invalid value for \"name\", must conform to the pattern #{pattern}.") if name !~ pattern
71
-
72
- properties.push('invalid value for "address", address cannot be nil.') if address.nil?
73
-
74
69
  address&.invalid_properties&.each do |prop|
75
70
  properties.push("invalid value for \"address\": #{prop}")
76
71
  end
@@ -69,9 +69,7 @@ module Cryptopay
69
69
  def invalid_properties
70
70
  properties = []
71
71
 
72
- properties.push('invalid value for "country", country cannot be nil.') if country.nil?
73
-
74
- if country.to_s.length > 2
72
+ if !country.nil? && country.to_s.length > 2
75
73
  properties.push('invalid value for "country", the character length must be smaller than or equal to 2.')
76
74
  end
77
75
 
@@ -20,7 +20,11 @@ module Cryptopay
20
20
  'network_fee_level': :network_fee_level,
21
21
  'force_commit': :force_commit,
22
22
  'travel_rule_compliant': :travel_rule_compliant,
23
- 'beneficiary': :beneficiary
23
+ 'beneficiary': :beneficiary,
24
+ 'amount': :amount,
25
+ 'amount_currency': :amount_currency,
26
+ 'amount_includes_processing_fee': :amount_includes_processing_fee,
27
+ 'amount_includes_network_fee': :amount_includes_network_fee
24
28
  },
25
29
  types: {
26
30
  'address': :String,
@@ -35,7 +39,11 @@ module Cryptopay
35
39
  'network_fee_level': :NetworkFeeLevel,
36
40
  'force_commit': :Boolean,
37
41
  'travel_rule_compliant': :Boolean,
38
- 'beneficiary': :Beneficiary
42
+ 'beneficiary': :Beneficiary,
43
+ 'amount': :Decimal,
44
+ 'amount_currency': :String,
45
+ 'amount_includes_processing_fee': :Boolean,
46
+ 'amount_includes_network_fee': :Boolean
39
47
  },
40
48
  nullables: %i[
41
49
  charged_amount
@@ -122,6 +130,26 @@ module Cryptopay
122
130
  @attributes[:beneficiary]
123
131
  end
124
132
 
133
+ # Transaction amount for new calculation
134
+ def amount
135
+ @attributes[:amount]
136
+ end
137
+
138
+ # An currency of the transaction amount
139
+ def amount_currency
140
+ @attributes[:amount_currency]
141
+ end
142
+
143
+ # Whether the amount includes processing fee
144
+ def amount_includes_processing_fee
145
+ @attributes[:amount_includes_processing_fee]
146
+ end
147
+
148
+ # Whether the amount includes network fee
149
+ def amount_includes_network_fee
150
+ @attributes[:amount_includes_network_fee]
151
+ end
152
+
125
153
  # Show invalid properties with the reasons. Usually used together with valid?
126
154
  # @return Array for valid properties with the reasons
127
155
  def invalid_properties
@@ -56,7 +56,6 @@ require 'cryptopay/models/invoice_recalculation_params'
56
56
  require 'cryptopay/models/invoice_recalculation_result'
57
57
  require 'cryptopay/models/invoice_refund'
58
58
  require 'cryptopay/models/invoice_refund_list_result'
59
- require 'cryptopay/models/invoice_refund_params'
60
59
  require 'cryptopay/models/invoice_refund_result'
61
60
  require 'cryptopay/models/invoice_result'
62
61
  require 'cryptopay/models/invoice_status'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptopay
4
- VERSION = '2.2.0'
4
+ VERSION = '3.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptopay-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cryptopay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-23 00:00:00.000000000 Z
11
+ date: 2025-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
273
  requirements: []
274
- rubygems_version: 3.5.22
274
+ rubygems_version: 3.3.26
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: The official Ruby gem for the Cryptopay API