cryptopay-ruby 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -12
  3. data/cryptopay.gemspec +7 -7
  4. data/lib/cryptopay/api/coin_withdrawals.rb +7 -2
  5. data/lib/cryptopay/api/coins.rb +30 -0
  6. data/lib/cryptopay/client.rb +3 -1
  7. data/lib/cryptopay/models/account.rb +4 -0
  8. data/lib/cryptopay/models/account_list_result.rb +14 -2
  9. data/lib/cryptopay/models/channel.rb +20 -0
  10. data/lib/cryptopay/models/channel_params.rb +11 -0
  11. data/lib/cryptopay/models/channel_payment.rb +20 -0
  12. data/lib/cryptopay/models/channel_payment_callback.rb +0 -4
  13. data/lib/cryptopay/models/channel_update_params.rb +2 -0
  14. data/lib/cryptopay/models/channels_config.rb +64 -0
  15. data/lib/cryptopay/models/coin.rb +94 -0
  16. data/lib/cryptopay/models/coin_destination_tag.rb +72 -0
  17. data/lib/cryptopay/models/coin_list_result.rb +70 -0
  18. data/lib/cryptopay/models/coin_network.rb +128 -0
  19. data/lib/cryptopay/models/coin_withdrawal.rb +20 -0
  20. data/lib/cryptopay/models/coin_withdrawal_callback.rb +0 -4
  21. data/lib/cryptopay/models/coin_withdrawal_params.rb +14 -1
  22. data/lib/cryptopay/models/coin_withdrawals_config.rb +64 -0
  23. data/lib/cryptopay/models/customer.rb +3 -1
  24. data/lib/cryptopay/models/customer_params.rb +2 -2
  25. data/lib/cryptopay/models/customer_update_params.rb +2 -2
  26. data/lib/cryptopay/models/exchange_transfer.rb +6 -0
  27. data/lib/cryptopay/models/exchange_transfer_params.rb +6 -0
  28. data/lib/cryptopay/models/invoice.rb +10 -1
  29. data/lib/cryptopay/models/invoice_callback.rb +0 -2
  30. data/lib/cryptopay/models/invoice_params.rb +8 -1
  31. data/lib/cryptopay/models/invoice_recalculation_params.rb +1 -1
  32. data/lib/cryptopay/models/invoice_refund.rb +9 -0
  33. data/lib/cryptopay/models/invoices_config.rb +64 -0
  34. data/lib/cryptopay/models/network_fee.rb +10 -2
  35. data/lib/cryptopay/models/risk_params.rb +1 -1
  36. data/lib/cryptopay/models/risk_type.rb +18 -0
  37. data/lib/cryptopay/models/transaction.rb +13 -0
  38. data/lib/cryptopay/require.rb +9 -0
  39. data/lib/cryptopay/version.rb +1 -1
  40. metadata +39 -30
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class CoinDestinationTag
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::CoinDestinationTag',
10
+ attribute_map: {
11
+ 'required': :required,
12
+ 'name': :name
13
+ },
14
+ types: {
15
+ 'required': :Boolean,
16
+ 'name': :String
17
+ },
18
+ nullables: []
19
+ )
20
+ private_constant :ENCODER
21
+
22
+ # Initializes the object
23
+ # @param [Hash] attributes Model attributes in the form of hash
24
+ def initialize(attributes = {})
25
+ @attributes = ENCODER.sanitize(attributes)
26
+ end
27
+
28
+ def required
29
+ @attributes[:required]
30
+ end
31
+
32
+ def name
33
+ @attributes[:name]
34
+ end
35
+
36
+ # Show invalid properties with the reasons. Usually used together with valid?
37
+ # @return Array for valid properties with the reasons
38
+ def invalid_properties
39
+ properties = []
40
+
41
+ properties.push('invalid value for "required", required cannot be nil.') if required.nil?
42
+
43
+ properties.push('invalid value for "name", name cannot be nil.') if name.nil?
44
+
45
+ properties
46
+ end
47
+
48
+ # Check to see if the all the properties in the model are valid
49
+ # @return true if the model is valid
50
+ def valid?
51
+ invalid_properties.empty?
52
+ end
53
+
54
+ # Builds the object from hash
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ # @return [Cryptopay::CoinDestinationTag] Returns the model itself
57
+ def self.build_from_hash(data)
58
+ attributes = ENCODER.build_from_hash(data)
59
+ new(attributes)
60
+ end
61
+
62
+ # Returns the object in the form of hash
63
+ # @return [Hash] Returns the object in the form of hash
64
+ def to_hash
65
+ ENCODER.to_hash(@attributes)
66
+ end
67
+
68
+ def inspect
69
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class CoinListResult
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::CoinListResult',
10
+ attribute_map: {
11
+ 'data': :data
12
+ },
13
+ types: {
14
+ 'data': :'Array<Coin>'
15
+ },
16
+ nullables: []
17
+ )
18
+ private_constant :ENCODER
19
+
20
+ # Initializes the object
21
+ # @param [Hash] attributes Model attributes in the form of hash
22
+ def initialize(attributes = {})
23
+ @attributes = ENCODER.sanitize(attributes)
24
+ end
25
+
26
+ def data
27
+ @attributes[:data]
28
+ end
29
+
30
+ # Show invalid properties with the reasons. Usually used together with valid?
31
+ # @return Array for valid properties with the reasons
32
+ def invalid_properties
33
+ properties = []
34
+
35
+ properties.push('invalid value for "data", data cannot be nil.') if data.nil?
36
+
37
+ data&.each_with_index do |item, index|
38
+ item.invalid_properties.each do |prop|
39
+ properties.push("invalid value for \"data.#{index}\": #{prop}")
40
+ end
41
+ end
42
+
43
+ properties
44
+ end
45
+
46
+ # Check to see if the all the properties in the model are valid
47
+ # @return true if the model is valid
48
+ def valid?
49
+ invalid_properties.empty?
50
+ end
51
+
52
+ # Builds the object from hash
53
+ # @param [Hash] attributes Model attributes in the form of hash
54
+ # @return [Cryptopay::CoinListResult] Returns the model itself
55
+ def self.build_from_hash(data)
56
+ attributes = ENCODER.build_from_hash(data)
57
+ new(attributes)
58
+ end
59
+
60
+ # Returns the object in the form of hash
61
+ # @return [Hash] Returns the object in the form of hash
62
+ def to_hash
63
+ ENCODER.to_hash(@attributes)
64
+ end
65
+
66
+ def inspect
67
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,128 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class CoinNetwork
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::CoinNetwork',
10
+ attribute_map: {
11
+ 'network': :network,
12
+ 'name': :name,
13
+ 'precision': :precision,
14
+ 'destination_tag': :destination_tag,
15
+ 'invoices': :invoices,
16
+ 'channels': :channels,
17
+ 'coin_withdrawals': :coin_withdrawals
18
+ },
19
+ types: {
20
+ 'network': :String,
21
+ 'name': :String,
22
+ 'precision': :Integer,
23
+ 'destination_tag': :CoinDestinationTag,
24
+ 'invoices': :InvoicesConfig,
25
+ 'channels': :ChannelsConfig,
26
+ 'coin_withdrawals': :CoinWithdrawalsConfig
27
+ },
28
+ nullables: [
29
+ :destination_tag
30
+ ]
31
+ )
32
+ private_constant :ENCODER
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ @attributes = ENCODER.sanitize(attributes)
38
+ end
39
+
40
+ def network
41
+ @attributes[:network]
42
+ end
43
+
44
+ def name
45
+ @attributes[:name]
46
+ end
47
+
48
+ def precision
49
+ @attributes[:precision]
50
+ end
51
+
52
+ def destination_tag
53
+ @attributes[:destination_tag]
54
+ end
55
+
56
+ def invoices
57
+ @attributes[:invoices]
58
+ end
59
+
60
+ def channels
61
+ @attributes[:channels]
62
+ end
63
+
64
+ def coin_withdrawals
65
+ @attributes[:coin_withdrawals]
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def invalid_properties
71
+ properties = []
72
+
73
+ properties.push('invalid value for "network", network cannot be nil.') if network.nil?
74
+
75
+ properties.push('invalid value for "name", name cannot be nil.') if name.nil?
76
+
77
+ properties.push('invalid value for "precision", precision cannot be nil.') if precision.nil?
78
+
79
+ destination_tag&.invalid_properties&.each do |prop|
80
+ properties.push("invalid value for \"destination_tag\": #{prop}")
81
+ end
82
+
83
+ properties.push('invalid value for "invoices", invoices cannot be nil.') if invoices.nil?
84
+
85
+ invoices&.invalid_properties&.each do |prop|
86
+ properties.push("invalid value for \"invoices\": #{prop}")
87
+ end
88
+
89
+ properties.push('invalid value for "channels", channels cannot be nil.') if channels.nil?
90
+
91
+ channels&.invalid_properties&.each do |prop|
92
+ properties.push("invalid value for \"channels\": #{prop}")
93
+ end
94
+
95
+ properties.push('invalid value for "coin_withdrawals", coin_withdrawals cannot be nil.') if coin_withdrawals.nil?
96
+
97
+ coin_withdrawals&.invalid_properties&.each do |prop|
98
+ properties.push("invalid value for \"coin_withdrawals\": #{prop}")
99
+ end
100
+
101
+ properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ invalid_properties.empty?
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Cryptopay::CoinNetwork] Returns the model itself
113
+ def self.build_from_hash(data)
114
+ attributes = ENCODER.build_from_hash(data)
115
+ new(attributes)
116
+ end
117
+
118
+ # Returns the object in the form of hash
119
+ # @return [Hash] Returns the object in the form of hash
120
+ def to_hash
121
+ ENCODER.to_hash(@attributes)
122
+ end
123
+
124
+ def inspect
125
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
126
+ end
127
+ end
128
+ end
@@ -12,6 +12,7 @@ module Cryptopay
12
12
  'custom_id': :custom_id,
13
13
  'customer_id': :customer_id,
14
14
  'address': :address,
15
+ 'network': :network,
15
16
  'txid': :txid,
16
17
  'status': :status,
17
18
  'charged_amount': :charged_amount,
@@ -31,6 +32,7 @@ module Cryptopay
31
32
  'custom_id': :String,
32
33
  'customer_id': :String,
33
34
  'address': :String,
35
+ 'network': :String,
34
36
  'txid': :String,
35
37
  'status': :CoinWithdrawalStatus,
36
38
  'charged_amount': :Decimal,
@@ -60,22 +62,32 @@ module Cryptopay
60
62
  @attributes = ENCODER.sanitize(attributes)
61
63
  end
62
64
 
65
+ # Coin withdrawal ID
63
66
  def id
64
67
  @attributes[:id]
65
68
  end
66
69
 
70
+ # Payment reference ID in your system
67
71
  def custom_id
68
72
  @attributes[:custom_id]
69
73
  end
70
74
 
75
+ # The reference ID of your customer
71
76
  def customer_id
72
77
  @attributes[:customer_id]
73
78
  end
74
79
 
80
+ # Recipient's cryptocurrency wallet address
75
81
  def address
76
82
  @attributes[:address]
77
83
  end
78
84
 
85
+ # Cryptocurrency network
86
+ def network
87
+ @attributes[:network]
88
+ end
89
+
90
+ # Cryptocurrency transaction ID on the blockchain
79
91
  def txid
80
92
  @attributes[:txid]
81
93
  end
@@ -84,22 +96,27 @@ module Cryptopay
84
96
  @attributes[:status]
85
97
  end
86
98
 
99
+ # Payment amount. Amount charged from your account
87
100
  def charged_amount
88
101
  @attributes[:charged_amount]
89
102
  end
90
103
 
104
+ # Account currency the payment has been sent from
91
105
  def charged_currency
92
106
  @attributes[:charged_currency]
93
107
  end
94
108
 
109
+ # Cryptocurrency transaction amount. Exact amount received by a recipient
95
110
  def received_amount
96
111
  @attributes[:received_amount]
97
112
  end
98
113
 
114
+ # Cryptocurrency type
99
115
  def received_currency
100
116
  @attributes[:received_currency]
101
117
  end
102
118
 
119
+ # Network fee amount
103
120
  def network_fee
104
121
  @attributes[:network_fee]
105
122
  end
@@ -124,6 +141,7 @@ module Cryptopay
124
141
  @attributes[:risk]
125
142
  end
126
143
 
144
+ # Coin withdrawal creation date and time
127
145
  def created_at
128
146
  @attributes[:created_at]
129
147
  end
@@ -135,6 +153,8 @@ module Cryptopay
135
153
 
136
154
  properties.push('invalid value for "address", address cannot be nil.') if address.nil?
137
155
 
156
+ properties.push('invalid value for "network", network cannot be nil.') if network.nil?
157
+
138
158
  properties.push('invalid value for "status", status cannot be nil.') if status.nil?
139
159
 
140
160
  if !status.nil? && !%w[new pending on_hold processing sent completed failed cancelled].include?(status)
@@ -46,10 +46,6 @@ module Cryptopay
46
46
 
47
47
  properties.push('invalid value for "type", type cannot be nil.') if type.nil?
48
48
 
49
- if !type.nil? && !['CoinWithdrawal'].include?(type)
50
- properties.push('invalid value for type, must be one of "CoinWithdrawal"')
51
- end
52
-
53
49
  properties.push('invalid value for "event", event cannot be nil.') if event.nil?
54
50
 
55
51
  if !event.nil? && !%w[created status_changed].include?(event)
@@ -11,6 +11,7 @@ module Cryptopay
11
11
  'address': :address,
12
12
  'charged_currency': :charged_currency,
13
13
  'received_currency': :received_currency,
14
+ 'network': :network,
14
15
  'charged_amount': :charged_amount,
15
16
  'charged_amount_to_send': :charged_amount_to_send,
16
17
  'received_amount': :received_amount,
@@ -23,6 +24,7 @@ module Cryptopay
23
24
  'address': :String,
24
25
  'charged_currency': :String,
25
26
  'received_currency': :String,
27
+ 'network': :String,
26
28
  'charged_amount': :Decimal,
27
29
  'charged_amount_to_send': :Decimal,
28
30
  'received_amount': :Decimal,
@@ -45,26 +47,37 @@ module Cryptopay
45
47
  @attributes = ENCODER.sanitize(attributes)
46
48
  end
47
49
 
50
+ # A recipient's cryptocurrency wallet address
48
51
  def address
49
52
  @attributes[:address]
50
53
  end
51
54
 
55
+ # An account currency to send a transaction from
52
56
  def charged_currency
53
57
  @attributes[:charged_currency]
54
58
  end
55
59
 
60
+ # Cryptocurrency type
56
61
  def received_currency
57
62
  @attributes[:received_currency]
58
63
  end
59
64
 
65
+ # Cryptocurrency network
66
+ def network
67
+ @attributes[:network]
68
+ end
69
+
70
+ # All applicable fees will be deducted from this amount before processing a transaction instead of adding them on top it
60
71
  def charged_amount
61
72
  @attributes[:charged_amount]
62
73
  end
63
74
 
75
+ # An exact transaction amount to send. All applicable fees will be added on top of this amount and debited from your account
64
76
  def charged_amount_to_send
65
77
  @attributes[:charged_amount_to_send]
66
78
  end
67
79
 
80
+ # 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
68
81
  def received_amount
69
82
  @attributes[:received_amount]
70
83
  end
@@ -83,7 +96,7 @@ module Cryptopay
83
96
  @attributes[:network_fee_level]
84
97
  end
85
98
 
86
- # Set `true` by default. Set `false` for two-step withdrawal and commit it within 30 seconds
99
+ # Is `false` if omitted. Set `true` to turn off two-step withdrawal. Set `false` for two-step withdrawal and commit it within 30 seconds
87
100
  def force_commit
88
101
  @attributes[:force_commit]
89
102
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Auto-generated file
4
+ # DO NOT EDIT
5
+
6
+ module Cryptopay
7
+ class CoinWithdrawalsConfig
8
+ ENCODER = Encoder.new(
9
+ name: 'Cryptopay::CoinWithdrawalsConfig',
10
+ attribute_map: {
11
+ 'enabled': :enabled
12
+ },
13
+ types: {
14
+ 'enabled': :Boolean
15
+ },
16
+ nullables: []
17
+ )
18
+ private_constant :ENCODER
19
+
20
+ # Initializes the object
21
+ # @param [Hash] attributes Model attributes in the form of hash
22
+ def initialize(attributes = {})
23
+ @attributes = ENCODER.sanitize(attributes)
24
+ end
25
+
26
+ def enabled
27
+ @attributes[:enabled]
28
+ end
29
+
30
+ # Show invalid properties with the reasons. Usually used together with valid?
31
+ # @return Array for valid properties with the reasons
32
+ def invalid_properties
33
+ properties = []
34
+
35
+ properties.push('invalid value for "enabled", enabled cannot be nil.') if enabled.nil?
36
+
37
+ properties
38
+ end
39
+
40
+ # Check to see if the all the properties in the model are valid
41
+ # @return true if the model is valid
42
+ def valid?
43
+ invalid_properties.empty?
44
+ end
45
+
46
+ # Builds the object from hash
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ # @return [Cryptopay::CoinWithdrawalsConfig] Returns the model itself
49
+ def self.build_from_hash(data)
50
+ attributes = ENCODER.build_from_hash(data)
51
+ new(attributes)
52
+ end
53
+
54
+ # Returns the object in the form of hash
55
+ # @return [Hash] Returns the object in the form of hash
56
+ def to_hash
57
+ ENCODER.to_hash(@attributes)
58
+ end
59
+
60
+ def inspect
61
+ "#<#{self.class}:0x#{object_id.to_s(16)}> JSON: " + JSON.pretty_generate(to_hash)
62
+ end
63
+ end
64
+ end
@@ -15,7 +15,7 @@ module Cryptopay
15
15
  types: {
16
16
  'id': :String,
17
17
  'currency': :String,
18
- 'refund_addresses': :Object
18
+ 'refund_addresses': :'Hash<String, String>'
19
19
  },
20
20
  nullables: []
21
21
  )
@@ -51,6 +51,8 @@ module Cryptopay
51
51
 
52
52
  properties.push('invalid value for "currency", currency cannot be nil.') if currency.nil?
53
53
 
54
+ properties.push('invalid value for "refund_addresses", refund_addresses cannot be nil.') if refund_addresses.nil?
55
+
54
56
  properties
55
57
  end
56
58
 
@@ -15,7 +15,7 @@ module Cryptopay
15
15
  types: {
16
16
  'id': :String,
17
17
  'currency': :String,
18
- 'refund_addresses': :Object
18
+ 'refund_addresses': :'Hash<String, String>'
19
19
  },
20
20
  nullables: []
21
21
  )
@@ -37,7 +37,7 @@ module Cryptopay
37
37
  @attributes[:currency]
38
38
  end
39
39
 
40
- # This object allows you specify 1 cryptocurrency address for each type of supported cryptocurrencies i.e. BTC, ETH, XRP, LTC and BCH. In case Cryptopay detects a High-Risk transaction, such transaction will not be processed. Instead, it will be sent to the address specified for respective cryptocurrency. If you do not specify any addresses here, High-Risk payments will be put on hold
40
+ # This object allows you to specify 1 cryptocurrency address for each type of supported cryptocurrencies i.e. BTC, ETH, XRP, LTC and BCH. In case Cryptopay detects a High-Risk transaction, such transaction will not be processed. Instead, it will be sent to the address specified for respective cryptocurrency. If you do not specify any addresses here, High-Risk payments will be put on hold
41
41
  def refund_addresses
42
42
  @attributes[:refund_addresses]
43
43
  end
@@ -13,7 +13,7 @@ module Cryptopay
13
13
  },
14
14
  types: {
15
15
  'currency': :String,
16
- 'refund_addresses': :Object
16
+ 'refund_addresses': :'Hash<String, String>'
17
17
  },
18
18
  nullables: []
19
19
  )
@@ -30,7 +30,7 @@ module Cryptopay
30
30
  @attributes[:currency]
31
31
  end
32
32
 
33
- # This object allows you specify 1 cryptocurrency address for each type of supported cryptocurrencies i.e. BTC, ETH, XRP, LTC and BCH. In case Cryptopay detects a High-Risk transaction, such transaction will not be processed. Instead, it will be sent to the address specified for respective cryptocurrency. If you do not specify any addresses here, High-Risk payments will be put on hold
33
+ # This object allows you to specify 1 cryptocurrency address for each type of supported cryptocurrencies i.e. BTC, ETH, XRP, LTC and BCH. In case Cryptopay detects a High-Risk transaction, such transaction will not be processed. Instead, it will be sent to the address specified for respective cryptocurrency. If you do not specify any addresses here, High-Risk payments will be put on hold
34
34
  def refund_addresses
35
35
  @attributes[:refund_addresses]
36
36
  end
@@ -37,26 +37,32 @@ module Cryptopay
37
37
  @attributes = ENCODER.sanitize(attributes)
38
38
  end
39
39
 
40
+ # Exchange transaction ID
40
41
  def id
41
42
  @attributes[:id]
42
43
  end
43
44
 
45
+ # Amount converted
44
46
  def charged_amount
45
47
  @attributes[:charged_amount]
46
48
  end
47
49
 
50
+ # Account currency the funds converted from
48
51
  def charged_currency
49
52
  @attributes[:charged_currency]
50
53
  end
51
54
 
55
+ # Amount to be received upon exchange execution
52
56
  def received_amount
53
57
  @attributes[:received_amount]
54
58
  end
55
59
 
60
+ # Account currency the funds converted to
56
61
  def received_currency
57
62
  @attributes[:received_currency]
58
63
  end
59
64
 
65
+ # Exchange transaction reference ID in your system
60
66
  def custom_id
61
67
  @attributes[:custom_id]
62
68
  end
@@ -36,26 +36,32 @@ module Cryptopay
36
36
  @attributes = ENCODER.sanitize(attributes)
37
37
  end
38
38
 
39
+ # Account currency the funds to be converted from
39
40
  def charged_currency
40
41
  @attributes[:charged_currency]
41
42
  end
42
43
 
44
+ # Amount to be converted
43
45
  def charged_amount
44
46
  @attributes[:charged_amount]
45
47
  end
46
48
 
49
+ # Account currency the funds to be converted to
47
50
  def received_currency
48
51
  @attributes[:received_currency]
49
52
  end
50
53
 
54
+ # Amount to be received upon exchange execution
51
55
  def received_amount
52
56
  @attributes[:received_amount]
53
57
  end
54
58
 
59
+ # Exchange transaction reference ID in your system
55
60
  def custom_id
56
61
  @attributes[:custom_id]
57
62
  end
58
63
 
64
+ # Is `false` if omitted. Set `true` to turn off two-step exchange. Set `false` for two-step exchange and commit it within 30 seconds
59
65
  def force_commit
60
66
  @attributes[:force_commit]
61
67
  end
@@ -14,6 +14,7 @@ module Cryptopay
14
14
  'status': :status,
15
15
  'status_context': :status_context,
16
16
  'address': :address,
17
+ 'network': :network,
17
18
  'uri': :uri,
18
19
  'price_amount': :price_amount,
19
20
  'price_currency': :price_currency,
@@ -40,6 +41,7 @@ module Cryptopay
40
41
  'status': :InvoiceStatus,
41
42
  'status_context': :InvoiceStatusContext,
42
43
  'address': :String,
44
+ 'network': :String,
43
45
  'uri': :String,
44
46
  'price_amount': :Decimal,
45
47
  'price_currency': :String,
@@ -52,7 +54,7 @@ module Cryptopay
52
54
  'transactions': :'Array<InvoiceTransaction>',
53
55
  'name': :String,
54
56
  'description': :String,
55
- 'metadata': :Object,
57
+ 'metadata': :'Hash<String, String>',
56
58
  'success_redirect_url': :String,
57
59
  'unsuccess_redirect_url': :String,
58
60
  'hosted_page_url': :String,
@@ -106,6 +108,11 @@ module Cryptopay
106
108
  @attributes[:address]
107
109
  end
108
110
 
111
+ # Cryptocurrency network
112
+ def network
113
+ @attributes[:network]
114
+ end
115
+
109
116
  # Invoice URI. May be used for generating a QR code
110
117
  def uri
111
118
  @attributes[:uri]
@@ -212,6 +219,8 @@ module Cryptopay
212
219
 
213
220
  properties.push('invalid value for "address", address cannot be nil.') if address.nil?
214
221
 
222
+ properties.push('invalid value for "network", network cannot be nil.') if network.nil?
223
+
215
224
  properties.push('invalid value for "uri", uri cannot be nil.') if uri.nil?
216
225
 
217
226
  properties.push('invalid value for "price_amount", price_amount cannot be nil.') if price_amount.nil?
@@ -46,8 +46,6 @@ module Cryptopay
46
46
 
47
47
  properties.push('invalid value for "type", type cannot be nil.') if type.nil?
48
48
 
49
- properties.push('invalid value for type, must be one of "Invoice"') if !type.nil? && !['Invoice'].include?(type)
50
-
51
49
  properties.push('invalid value for "event", event cannot be nil.') if event.nil?
52
50
 
53
51
  if !event.nil? && !%w[created refunded recalculated status_changed transaction_created transaction_confirmed].include?(event)