cryptopay-ruby 2.1.0 → 2.2.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: 18a89097b66be19ae3889c0c2279574f5b2aa917d6d66a5ace4547cd2877538b
4
- data.tar.gz: b259cd7c0ef3ebe5e8457118533e3abeb5bd2c033f14b549657c7fcc844015dd
3
+ metadata.gz: 9b7b5b9797e07653c96e6c8e9e89838d4ad67db7d4c31df93971c78697125446
4
+ data.tar.gz: ad3a36fae0973cde9845e898b4ad6f4eb795957af856d8cfadb95215a2e1dfff
5
5
  SHA512:
6
- metadata.gz: 7f4a1fa54fd517d1288a386e115ac2634293c95d0fb1af44e1e4f6af51671d215a42dd51bb4fc5fce201533f3992703a5104e24ef378830e67dfc4bafe704c67
7
- data.tar.gz: 411446bfe02bbf5ccac2c906524451bce90c0348ade8da2751038cf8abb707ca916426ed041bc1a8509a835a5473c20e594c3d4e5b0cd1b73c05b2bb344ee8c4
6
+ metadata.gz: 84f5d30d964c10af04fff1f1a77e83b28352b42faaf63f2862b2a2a47fe81238b4545be53e95c14ef8a11f1823a1344913ad7cf9fa01dfbb3424109ab0ffce64
7
+ data.tar.gz: ff88be658db23f44d892a60aa1a9da21efa9631f42a222d1f34934f8c42211fc4b4c748f826cf51a0071f19a7910106739895f5a5dd24aac334658a781291194
data/.rubocop.yml CHANGED
@@ -105,3 +105,6 @@ Metrics/MethodLength:
105
105
  Naming/PredicateName:
106
106
  Exclude:
107
107
  - lib/cryptopay/models/**/*
108
+
109
+ Naming/VariableNumber:
110
+ AllowedIdentifiers: line_1, line_2
data/README.md CHANGED
@@ -19,7 +19,6 @@ For more information, please visit [Cryptopay API docs](https://developers.crypt
19
19
  * [ExchangeTransfers](#exchangetransfers)
20
20
  * [Invoices](#invoices)
21
21
  * [Rates](#rates)
22
- * [Risks](#risks)
23
22
  * [Subscriptions](#subscriptions)
24
23
  * [Transactions](#transactions)
25
24
  * [Callbacks](#callbacks)
@@ -469,24 +468,6 @@ result = client.rates.retrieve(base_currency, quote_currency)
469
468
  p result # => <RateResult data=...>
470
469
  ```
471
470
 
472
- ### Risks
473
-
474
- [Risks API docs](https://developers.cryptopay.me/guides/risks)
475
-
476
- #### Score a coin address
477
-
478
-
479
- ```ruby
480
- params = Cryptopay::RiskParams.new(
481
- address: '2N9wPGx67zdSeAbXi15qHgoZ9Hb9Uxhd2uQ',
482
- currency: 'BTC',
483
- type: 'source_of_funds'
484
- )
485
-
486
- result = client.risks.score(params)
487
- p result # => <RiskResult data=...>
488
- ```
489
-
490
471
  ### Subscriptions
491
472
 
492
473
 
@@ -26,6 +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
30
  # @param coin_withdrawal_params [CoinWithdrawalParams]
30
31
  # @param [Hash] opts the optional parameters
31
32
  # @return [CoinWithdrawalResult]
@@ -26,7 +26,7 @@ module Cryptopay
26
26
 
27
27
  private
28
28
 
29
- def setup_apis(connection) # rubocop:disable Metrics/MethodLength
29
+ def setup_apis(connection)
30
30
  @invoices = Invoices.new(connection)
31
31
  @rates = Rates.new(connection)
32
32
  @coin_withdrawals = CoinWithdrawals.new(connection)
@@ -35,7 +35,6 @@ module Cryptopay
35
35
  @transactions = Transactions.new(connection)
36
36
  @exchange_transfers = ExchangeTransfers.new(connection)
37
37
  @customers = Customers.new(connection)
38
- @risks = Risks.new(connection)
39
38
  @coins = Coins.new(connection)
40
39
  @subscriptions = Subscriptions.new(connection)
41
40
  end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ # Beneficiary information.
8
+ class Beneficiary
9
+ ENCODER = Encoder.new(
10
+ name: 'Cryptopay::Beneficiary',
11
+ attribute_map: {
12
+ 'type': :type,
13
+ 'name': :name,
14
+ 'address': :address
15
+ },
16
+ types: {
17
+ 'type': :BeneficiaryType,
18
+ 'name': :String,
19
+ 'address': :BeneficiaryAddress
20
+ },
21
+ nullables: []
22
+ )
23
+ private_constant :ENCODER
24
+
25
+ # Builds the object from hash
26
+ # @param [Hash] attributes Model attributes in the form of hash
27
+ # @return [Cryptopay::Beneficiary] Returns the model itself
28
+ def self.build_from_hash(data)
29
+ attributes = ENCODER.build_from_hash(data)
30
+ new(attributes)
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ @attributes = ENCODER.sanitize(attributes)
37
+ end
38
+
39
+ def type
40
+ @attributes[:type]
41
+ end
42
+
43
+ # The registered name of the company for a `legal_person` or the full name for a `natural_person`.
44
+ def name
45
+ @attributes[:name]
46
+ end
47
+
48
+ def address
49
+ @attributes[:address]
50
+ end
51
+
52
+ # Show invalid properties with the reasons. Usually used together with valid?
53
+ # @return Array for valid properties with the reasons
54
+ def invalid_properties
55
+ properties = []
56
+
57
+ properties.push('invalid value for "type", type cannot be nil.') if type.nil?
58
+
59
+ if !type.nil? && !%w[natural_person legal_person].include?(type)
60
+ properties.push('invalid value for type, must be one of "natural_person", "legal_person"')
61
+ end
62
+
63
+ properties.push('invalid value for "name", name cannot be nil.') if name.nil?
64
+
65
+ if name.to_s.length > 100
66
+ properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
67
+ end
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
+ address&.invalid_properties&.each do |prop|
75
+ properties.push("invalid value for \"address\": #{prop}")
76
+ end
77
+
78
+ properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ invalid_properties.empty?
85
+ end
86
+
87
+ # Returns the object in the form of hash
88
+ # @return [Hash] Returns the object in the form of hash
89
+ def to_hash
90
+ ENCODER.to_hash(@attributes)
91
+ end
92
+
93
+ def inspect
94
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class BeneficiaryAddress
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::BeneficiaryAddress',
10
+ attribute_map: {
11
+ 'country': :country,
12
+ 'city': :city,
13
+ 'line_1': :line_1,
14
+ 'line_2': :line_2,
15
+ 'post_code': :post_code
16
+ },
17
+ types: {
18
+ 'country': :String,
19
+ 'city': :String,
20
+ 'line_1': :String,
21
+ 'line_2': :String,
22
+ 'post_code': :String
23
+ },
24
+ nullables: []
25
+ )
26
+ private_constant :ENCODER
27
+
28
+ # Builds the object from hash
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ # @return [Cryptopay::BeneficiaryAddress] Returns the model itself
31
+ def self.build_from_hash(data)
32
+ attributes = ENCODER.build_from_hash(data)
33
+ new(attributes)
34
+ end
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ def initialize(attributes = {})
39
+ @attributes = ENCODER.sanitize(attributes)
40
+ end
41
+
42
+ # The 2-letter ISO country code of the address.
43
+ def country
44
+ @attributes[:country]
45
+ end
46
+
47
+ # The city of the address.
48
+ def city
49
+ @attributes[:city]
50
+ end
51
+
52
+ # First line of the address.
53
+ def line_1
54
+ @attributes[:line_1]
55
+ end
56
+
57
+ # Second line of the address.
58
+ def line_2
59
+ @attributes[:line_2]
60
+ end
61
+
62
+ # Postal code of the address.
63
+ def post_code
64
+ @attributes[:post_code]
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def invalid_properties
70
+ properties = []
71
+
72
+ properties.push('invalid value for "country", country cannot be nil.') if country.nil?
73
+
74
+ if country.to_s.length > 2
75
+ properties.push('invalid value for "country", the character length must be smaller than or equal to 2.')
76
+ end
77
+
78
+ if !city.nil? && city.to_s.length > 35
79
+ properties.push('invalid value for "city", the character length must be smaller than or equal to 35.')
80
+ end
81
+
82
+ if !line_1.nil? && line_1.to_s.length > 70
83
+ properties.push('invalid value for "line_1", the character length must be smaller than or equal to 70.')
84
+ end
85
+
86
+ if !line_2.nil? && line_2.to_s.length > 70
87
+ properties.push('invalid value for "line_2", the character length must be smaller than or equal to 70.')
88
+ end
89
+
90
+ if !post_code.nil? && post_code.to_s.length > 16
91
+ properties.push('invalid value for "post_code", the character length must be smaller than or equal to 16.')
92
+ end
93
+
94
+ properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ invalid_properties.empty?
101
+ end
102
+
103
+ # Returns the object in the form of hash
104
+ # @return [Hash] Returns the object in the form of hash
105
+ def to_hash
106
+ ENCODER.to_hash(@attributes)
107
+ end
108
+
109
+ def inspect
110
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ module BeneficiaryType
8
+ NATURAL_PERSON = 'natural_person'
9
+ LEGAL_PERSON = 'legal_person'
10
+
11
+ # Builds the enum from string
12
+ # @param [String] The enum value in the form of the string
13
+ # @return [String] The enum value
14
+ def self.build_from_hash(value)
15
+ value
16
+ end
17
+ end
18
+ end
@@ -18,7 +18,9 @@ module Cryptopay
18
18
  'custom_id': :custom_id,
19
19
  'customer_id': :customer_id,
20
20
  'network_fee_level': :network_fee_level,
21
- 'force_commit': :force_commit
21
+ 'force_commit': :force_commit,
22
+ 'travel_rule_compliant': :travel_rule_compliant,
23
+ 'beneficiary': :beneficiary
22
24
  },
23
25
  types: {
24
26
  'address': :String,
@@ -31,7 +33,9 @@ module Cryptopay
31
33
  'custom_id': :String,
32
34
  'customer_id': :String,
33
35
  'network_fee_level': :NetworkFeeLevel,
34
- 'force_commit': :Boolean
36
+ 'force_commit': :Boolean,
37
+ 'travel_rule_compliant': :Boolean,
38
+ 'beneficiary': :Beneficiary
35
39
  },
36
40
  nullables: %i[
37
41
  charged_amount
@@ -75,17 +79,17 @@ module Cryptopay
75
79
  @attributes[:network]
76
80
  end
77
81
 
78
- # All applicable fees will be deducted from this amount before processing a transaction instead of adding them on top it
82
+ # The exact amount to debit from your account in `charged_currency`. All applicable fees will be deducted from this amount before processing a transaction instead of adding them on top it.
79
83
  def charged_amount
80
84
  @attributes[:charged_amount]
81
85
  end
82
86
 
83
- # An exact transaction amount to send. All applicable fees will be added on top of this amount and debited from your account
87
+ # The exact transaction amount to send in `charged_currency`. All applicable fees will be added on top of this amount and debited from your account.
84
88
  def charged_amount_to_send
85
89
  @attributes[:charged_amount_to_send]
86
90
  end
87
91
 
88
- # An exact transaction amount to send. All applicable fees will be added on top of this amount and debited from your account. Use this parameter if you want to send a transaction from cryptocurrency accounts only
92
+ # The exact transaction amount to send in `received_currency`. All applicable fees will be added on top of this amount and debited from your account.
89
93
  def received_amount
90
94
  @attributes[:received_amount]
91
95
  end
@@ -109,6 +113,15 @@ module Cryptopay
109
113
  @attributes[:force_commit]
110
114
  end
111
115
 
116
+ # Is `false` if omitted. Set `true` to turn on beneficiary data validations
117
+ def travel_rule_compliant
118
+ @attributes[:travel_rule_compliant]
119
+ end
120
+
121
+ def beneficiary
122
+ @attributes[:beneficiary]
123
+ end
124
+
112
125
  # Show invalid properties with the reasons. Usually used together with valid?
113
126
  # @return Array for valid properties with the reasons
114
127
  def invalid_properties
@@ -126,6 +139,10 @@ module Cryptopay
126
139
  properties.push('invalid value for network_fee_level, must be one of "fast", "average", "slow"')
127
140
  end
128
141
 
142
+ beneficiary&.invalid_properties&.each do |prop|
143
+ properties.push("invalid value for \"beneficiary\": #{prop}")
144
+ end
145
+
129
146
  properties
130
147
  end
131
148
 
@@ -6,6 +6,9 @@
6
6
  # Models
7
7
  require 'cryptopay/models/account'
8
8
  require 'cryptopay/models/account_list_result'
9
+ require 'cryptopay/models/beneficiary'
10
+ require 'cryptopay/models/beneficiary_address'
11
+ require 'cryptopay/models/beneficiary_type'
9
12
  require 'cryptopay/models/callback'
10
13
  require 'cryptopay/models/channel'
11
14
  require 'cryptopay/models/channel_list_result'
@@ -69,9 +72,6 @@ require 'cryptopay/models/rate_result'
69
72
  require 'cryptopay/models/rates_result'
70
73
  require 'cryptopay/models/risk'
71
74
  require 'cryptopay/models/risk_level'
72
- require 'cryptopay/models/risk_params'
73
- require 'cryptopay/models/risk_result'
74
- require 'cryptopay/models/risk_type'
75
75
  require 'cryptopay/models/subscription'
76
76
  require 'cryptopay/models/subscription_callback'
77
77
  require 'cryptopay/models/subscription_callback_event'
@@ -93,6 +93,5 @@ require 'cryptopay/api/customers'
93
93
  require 'cryptopay/api/exchange_transfers'
94
94
  require 'cryptopay/api/invoices'
95
95
  require 'cryptopay/api/rates'
96
- require 'cryptopay/api/risks'
97
96
  require 'cryptopay/api/subscriptions'
98
97
  require 'cryptopay/api/transactions'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cryptopay
4
- VERSION = '2.1.0'
4
+ VERSION = '2.2.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.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cryptopay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-18 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -165,6 +165,9 @@ files:
165
165
  - lib/cryptopay/errors.rb
166
166
  - lib/cryptopay/models/account.rb
167
167
  - lib/cryptopay/models/account_list_result.rb
168
+ - lib/cryptopay/models/beneficiary.rb
169
+ - lib/cryptopay/models/beneficiary_address.rb
170
+ - lib/cryptopay/models/beneficiary_type.rb
168
171
  - lib/cryptopay/models/callback.rb
169
172
  - lib/cryptopay/models/channel.rb
170
173
  - lib/cryptopay/models/channel_list_result.rb
@@ -268,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
271
  - !ruby/object:Gem::Version
269
272
  version: '0'
270
273
  requirements: []
271
- rubygems_version: 3.3.20
274
+ rubygems_version: 3.5.22
272
275
  signing_key:
273
276
  specification_version: 4
274
277
  summary: The official Ruby gem for the Cryptopay API