tremendous_ruby 5.21.0 → 5.22.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tremendous/models/balance_transaction.rb +30 -3
  3. data/lib/tremendous/models/balance_transaction_order_payment.rb +32 -5
  4. data/lib/tremendous/models/campaign.rb +46 -1
  5. data/lib/tremendous/models/campaign_base.rb +46 -1
  6. data/lib/tremendous/models/connected_organization_organization.rb +11 -1
  7. data/lib/tremendous/models/create_campaign_request.rb +46 -1
  8. data/lib/tremendous/models/create_order200_response_order.rb +1 -1
  9. data/lib/tremendous/models/create_organization.rb +11 -1
  10. data/lib/tremendous/models/create_organization200_response_organization.rb +11 -1
  11. data/lib/tremendous/models/create_organization_for_response.rb +11 -1
  12. data/lib/tremendous/models/create_organization_properties.rb +11 -1
  13. data/lib/tremendous/models/create_organization_request.rb +14 -4
  14. data/lib/tremendous/models/create_topup_request.rb +1 -1
  15. data/lib/tremendous/models/fraud_config_redeemed_rewards_amount.rb +1 -1
  16. data/lib/tremendous/models/fraud_review.rb +1 -1
  17. data/lib/tremendous/models/fraud_review_related_rewards.rb +16 -5
  18. data/lib/tremendous/models/fraud_rules_list_item.rb +1 -1
  19. data/lib/tremendous/models/get_fraud_review200_response_fraud_review_related_rewards.rb +15 -5
  20. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner.rb +30 -3
  21. data/lib/tremendous/models/list_balance_transactions200_response_transactions_inner_order_payment.rb +32 -5
  22. data/lib/tremendous/models/list_campaigns200_response_campaigns_inner.rb +46 -1
  23. data/lib/tremendous/models/list_connected_organizations200_response_connected_organizations_inner_organization.rb +11 -1
  24. data/lib/tremendous/models/list_fraud_rules200_response_fraud_rules_inner.rb +1 -1
  25. data/lib/tremendous/models/list_funding_sources200_response_funding_sources_inner_meta.rb +44 -4
  26. data/lib/tremendous/models/list_orders200_response_orders_inner.rb +1 -1
  27. data/lib/tremendous/models/list_orders200_response_orders_inner_payment.rb +33 -6
  28. data/lib/tremendous/models/list_orders200_response_orders_inner_payment_refund.rb +33 -6
  29. data/lib/tremendous/models/list_organizations200_response_organizations_inner.rb +11 -1
  30. data/lib/tremendous/models/list_rewards200_response_rewards_inner_recipient.rb +1 -0
  31. data/lib/tremendous/models/list_topups200_response_topups_inner.rb +48 -7
  32. data/lib/tremendous/models/order.rb +1 -1
  33. data/lib/tremendous/models/order_base.rb +1 -1
  34. data/lib/tremendous/models/order_base_payment.rb +33 -6
  35. data/lib/tremendous/models/order_with_link.rb +1 -1
  36. data/lib/tremendous/models/order_without_link.rb +1 -1
  37. data/lib/tremendous/models/organization.rb +11 -1
  38. data/lib/tremendous/models/payment_details.rb +32 -5
  39. data/lib/tremendous/models/payment_details_refund.rb +33 -6
  40. data/lib/tremendous/models/recipient.rb +1 -0
  41. data/lib/tremendous/models/refund_details.rb +32 -5
  42. data/lib/tremendous/models/review_redeemed_rewards_amount.rb +1 -1
  43. data/lib/tremendous/models/single_reward_order_with_link_order.rb +1 -1
  44. data/lib/tremendous/models/single_reward_order_without_link_order.rb +1 -1
  45. data/lib/tremendous/models/topup.rb +48 -7
  46. data/lib/tremendous/models/topup_create_request.rb +1 -1
  47. data/lib/tremendous/models/update_campaign.rb +46 -1
  48. data/lib/tremendous/models/update_campaign_request.rb +46 -1
  49. data/lib/tremendous/version.rb +1 -1
  50. metadata +1 -1
@@ -27,10 +27,35 @@ module Tremendous
27
27
  # List of IDs of products (different gift cards, charity, etc.) that are available in this campaign.
28
28
  attr_accessor :products
29
29
 
30
+ # Determines whether fees for premium products are added to the order total (`SENDER`) or deducted from the recipient's reward amount (`RECIPIENT`). Campaigns with `RECIPIENT` must include at least one fee-free product.
31
+ attr_accessor :fee_charged_to
32
+
30
33
  attr_accessor :webpage_style
31
34
 
32
35
  attr_accessor :email_style
33
36
 
37
+ class EnumAttributeValidator
38
+ attr_reader :datatype
39
+ attr_reader :allowable_values
40
+
41
+ def initialize(datatype, allowable_values)
42
+ @allowable_values = allowable_values.map do |value|
43
+ case datatype.to_s
44
+ when /Integer/i
45
+ value.to_i
46
+ when /Float/i
47
+ value.to_f
48
+ else
49
+ value
50
+ end
51
+ end
52
+ end
53
+
54
+ def valid?(value)
55
+ !value || allowable_values.include?(value)
56
+ end
57
+ end
58
+
34
59
  # Attribute mapping from ruby-style variable name to JSON key.
35
60
  def self.attribute_map
36
61
  {
@@ -38,6 +63,7 @@ module Tremendous
38
63
  :'name' => :'name',
39
64
  :'description' => :'description',
40
65
  :'products' => :'products',
66
+ :'fee_charged_to' => :'fee_charged_to',
41
67
  :'webpage_style' => :'webpage_style',
42
68
  :'email_style' => :'email_style'
43
69
  }
@@ -60,6 +86,7 @@ module Tremendous
60
86
  :'name' => :'String',
61
87
  :'description' => :'String',
62
88
  :'products' => :'Array<String>',
89
+ :'fee_charged_to' => :'String',
63
90
  :'webpage_style' => :'ListCampaigns200ResponseCampaignsInnerWebpageStyle',
64
91
  :'email_style' => :'ListCampaigns200ResponseCampaignsInnerEmailStyle'
65
92
  }
@@ -69,6 +96,7 @@ module Tremendous
69
96
  def self.openapi_nullable
70
97
  Set.new([
71
98
  :'description',
99
+ :'fee_charged_to',
72
100
  ])
73
101
  end
74
102
 
@@ -112,6 +140,10 @@ module Tremendous
112
140
  self.products = nil
113
141
  end
114
142
 
143
+ if attributes.key?(:'fee_charged_to')
144
+ self.fee_charged_to = attributes[:'fee_charged_to']
145
+ end
146
+
115
147
  if attributes.key?(:'webpage_style')
116
148
  self.webpage_style = attributes[:'webpage_style']
117
149
  end
@@ -149,6 +181,8 @@ module Tremendous
149
181
  return false if !@id.nil? && @id !~ Regexp.new(/[A-Z0-9]{4,20}/)
150
182
  return false if @name.nil?
151
183
  return false if @products.nil?
184
+ fee_charged_to_validator = EnumAttributeValidator.new('String', ["SENDER", "RECIPIENT"])
185
+ return false unless fee_charged_to_validator.valid?(@fee_charged_to)
152
186
  true
153
187
  end
154
188
 
@@ -187,6 +221,16 @@ module Tremendous
187
221
  @products = products
188
222
  end
189
223
 
224
+ # Custom attribute writer method checking allowed values (enum).
225
+ # @param [Object] fee_charged_to Object to be assigned
226
+ def fee_charged_to=(fee_charged_to)
227
+ validator = EnumAttributeValidator.new('String', ["SENDER", "RECIPIENT"])
228
+ unless validator.valid?(fee_charged_to)
229
+ fail ArgumentError, "invalid value for \"fee_charged_to\", must be one of #{validator.allowable_values}."
230
+ end
231
+ @fee_charged_to = fee_charged_to
232
+ end
233
+
190
234
  # Checks equality by comparing each attribute.
191
235
  # @param [Object] Object to be compared
192
236
  def ==(o)
@@ -196,6 +240,7 @@ module Tremendous
196
240
  name == o.name &&
197
241
  description == o.description &&
198
242
  products == o.products &&
243
+ fee_charged_to == o.fee_charged_to &&
199
244
  webpage_style == o.webpage_style &&
200
245
  email_style == o.email_style
201
246
  end
@@ -209,7 +254,7 @@ module Tremendous
209
254
  # Calculates hash code according to all attributes.
210
255
  # @return [Integer] Hash code
211
256
  def hash
212
- [id, name, description, products, webpage_style, email_style].hash
257
+ [id, name, description, products, fee_charged_to, webpage_style, email_style].hash
213
258
  end
214
259
 
215
260
  # Builds the object from hash
@@ -24,6 +24,9 @@ module Tremendous
24
24
  # URL of the website of that organization
25
25
  attr_accessor :website
26
26
 
27
+ # Currency used for this organization's balances, orders, and transactions.
28
+ attr_accessor :currency_code
29
+
27
30
  # Status of the organization. Organizations need to be approved to be able to use them to send out rewards.
28
31
  attr_accessor :status
29
32
 
@@ -58,6 +61,7 @@ module Tremendous
58
61
  :'id' => :'id',
59
62
  :'name' => :'name',
60
63
  :'website' => :'website',
64
+ :'currency_code' => :'currency_code',
61
65
  :'status' => :'status',
62
66
  :'created_at' => :'created_at'
63
67
  }
@@ -79,6 +83,7 @@ module Tremendous
79
83
  :'id' => :'String',
80
84
  :'name' => :'String',
81
85
  :'website' => :'String',
86
+ :'currency_code' => :'String',
82
87
  :'status' => :'String',
83
88
  :'created_at' => :'Date'
84
89
  }
@@ -122,6 +127,10 @@ module Tremendous
122
127
  self.website = nil
123
128
  end
124
129
 
130
+ if attributes.key?(:'currency_code')
131
+ self.currency_code = attributes[:'currency_code']
132
+ end
133
+
125
134
  if attributes.key?(:'status')
126
135
  self.status = attributes[:'status']
127
136
  end
@@ -217,6 +226,7 @@ module Tremendous
217
226
  id == o.id &&
218
227
  name == o.name &&
219
228
  website == o.website &&
229
+ currency_code == o.currency_code &&
220
230
  status == o.status &&
221
231
  created_at == o.created_at
222
232
  end
@@ -230,7 +240,7 @@ module Tremendous
230
240
  # Calculates hash code according to all attributes.
231
241
  # @return [Integer] Hash code
232
242
  def hash
233
- [id, name, website, status, created_at].hash
243
+ [id, name, website, currency_code, status, created_at].hash
234
244
  end
235
245
 
236
246
  # Builds the object from hash
@@ -16,7 +16,7 @@ require 'time'
16
16
  module Tremendous
17
17
  # An active fraud rule
18
18
  class ListFraudRules200ResponseFraudRulesInner
19
- # * `review_country` - Flags when the recipient's IP country matches the criteria in the rule * `review_ip` - Flags when recipient's IP matches one in the list * `review_email` - Flags when the recipient's email matches one in the list * `review_redeemed_rewards_count` - Flags when the recipient redeemed more than the number of rewards specified in the config * `review_redeemed_rewards_amount` - Flags when the recipient redeemed more than the total amount specified in the config * `review_multiple_emails` - Flags when recipient's device or account has multiple emails associated * `review_vpn` - Flags when VPN is suspected * `review_tremendous_flag_list` - Flags rewards when redemption attributes match at least one criteria defined by the Tremendous flag list * `review_previously_blocked_recipients` - Flags rewards when the recipient has been blocked before * `allow_ip` - Releases a reward when a recipient's IP matches one in the list * `allow_email` - Releases a reward when the recipient's email matches one in the list
19
+ # * `review_country` - Flags when the recipient's IP country matches the criteria in the rule * `review_ip` - Flags when recipient's IP matches one in the list * `review_email` - Flags when the recipient's email matches one in the list * `review_redeemed_rewards_count` - Flags when the recipient redeemed more than the number of rewards specified in the config * `review_redeemed_rewards_amount` - Flags when the recipient redeemed more than the total amount specified in the config. The amount is denominated in the organization's currency. * `review_multiple_emails` - Flags when recipient's device or account has multiple emails associated * `review_vpn` - Flags when VPN is suspected * `review_tremendous_flag_list` - Flags rewards when redemption attributes match at least one criteria defined by the Tremendous flag list * `review_previously_blocked_recipients` - Flags rewards when the recipient has been blocked before * `allow_ip` - Releases a reward when a recipient's IP matches one in the list * `allow_email` - Releases a reward when the recipient's email matches one in the list
20
20
  attr_accessor :rule_type
21
21
 
22
22
  # The configuration associated with the rule. The properties allowed depend on the type of rule. This property is only present for rules that require configuration.
@@ -15,13 +15,25 @@ require 'time'
15
15
 
16
16
  module Tremendous
17
17
  class ListFundingSources200ResponseFundingSourcesInnerMeta
18
- # **Only exists for balance and commercial invoicing.** For balance: available amount (in cents USD) For commercial invoicing: available credit amount calculated as (credit limit - outstanding balance) (in cents USD) *Caution: In the \"list funding sources\" endpoint this value is cached and may not be up to date. Use the \"get funding source\" endpoint to get the most up to date value.*
18
+ # **Only exists for balance and commercial invoicing.** For balance: available amount denominated in `currency_code`. For commercial invoicing: available credit amount denominated in `currency_code`, calculated as (credit limit - outstanding balance). *Caution: In the \"list funding sources\" endpoint this value is cached and may not be up to date. Use the \"get funding source\" endpoint to get the most up to date value.*
19
+ attr_accessor :available_amount
20
+
21
+ # Same as `available_amount`, but in cents.
19
22
  attr_accessor :available_cents
20
23
 
21
- # **Only available when `method` is set to `balance`.** Funds that are already registered on your Tremendous account but which have not yet been deposited in your account (e.g. payments that need to be manually reviewed by our ops team) (in Cents USD).
24
+ # **Only exists for balance and commercial invoicing.** The currency of the balance or credit amounts (e.g. `available_amount`, `pending_amount`, `credit_limit_amount`). Always matches the organization's currency.
25
+ attr_accessor :currency_code
26
+
27
+ # **Only available when `method` is set to `balance`.** Funds registered on your Tremendous account but not yet deposited in your account (e.g. payments that need to be manually reviewed by our ops team). Denominated in `currency_code`.
28
+ attr_accessor :pending_amount
29
+
30
+ # Same as `pending_amount`, but in cents.
22
31
  attr_accessor :pending_cents
23
32
 
24
- # **Only exists for commercial invoicing.** Available credit limit (in cents USD)
33
+ # **Only exists for commercial invoicing.** Available credit limit denominated in `currency_code`.
34
+ attr_accessor :credit_limit_amount
35
+
36
+ # Same as `credit_limit_amount`, but in cents.
25
37
  attr_accessor :credit_limit_cents
26
38
 
27
39
  # **Only available when `method` is set to `bank_account` or `credit_card`.** Name of the holder of the bank account or credit_card
@@ -123,8 +135,12 @@ module Tremendous
123
135
  # Attribute mapping from ruby-style variable name to JSON key.
124
136
  def self.attribute_map
125
137
  {
138
+ :'available_amount' => :'available_amount',
126
139
  :'available_cents' => :'available_cents',
140
+ :'currency_code' => :'currency_code',
141
+ :'pending_amount' => :'pending_amount',
127
142
  :'pending_cents' => :'pending_cents',
143
+ :'credit_limit_amount' => :'credit_limit_amount',
128
144
  :'credit_limit_cents' => :'credit_limit_cents',
129
145
  :'accountholder_name' => :'accountholder_name',
130
146
  :'account_type' => :'account_type',
@@ -167,8 +183,12 @@ module Tremendous
167
183
  # Attribute type mapping.
168
184
  def self.openapi_types
169
185
  {
186
+ :'available_amount' => :'Float',
170
187
  :'available_cents' => :'Integer',
188
+ :'currency_code' => :'String',
189
+ :'pending_amount' => :'Float',
171
190
  :'pending_cents' => :'Integer',
191
+ :'credit_limit_amount' => :'Float',
172
192
  :'credit_limit_cents' => :'Integer',
173
193
  :'accountholder_name' => :'String',
174
194
  :'account_type' => :'String',
@@ -232,14 +252,30 @@ module Tremendous
232
252
  h[k.to_sym] = v
233
253
  }
234
254
 
255
+ if attributes.key?(:'available_amount')
256
+ self.available_amount = attributes[:'available_amount']
257
+ end
258
+
235
259
  if attributes.key?(:'available_cents')
236
260
  self.available_cents = attributes[:'available_cents']
237
261
  end
238
262
 
263
+ if attributes.key?(:'currency_code')
264
+ self.currency_code = attributes[:'currency_code']
265
+ end
266
+
267
+ if attributes.key?(:'pending_amount')
268
+ self.pending_amount = attributes[:'pending_amount']
269
+ end
270
+
239
271
  if attributes.key?(:'pending_cents')
240
272
  self.pending_cents = attributes[:'pending_cents']
241
273
  end
242
274
 
275
+ if attributes.key?(:'credit_limit_amount')
276
+ self.credit_limit_amount = attributes[:'credit_limit_amount']
277
+ end
278
+
243
279
  if attributes.key?(:'credit_limit_cents')
244
280
  self.credit_limit_cents = attributes[:'credit_limit_cents']
245
281
  end
@@ -452,8 +488,12 @@ module Tremendous
452
488
  def ==(o)
453
489
  return true if self.equal?(o)
454
490
  self.class == o.class &&
491
+ available_amount == o.available_amount &&
455
492
  available_cents == o.available_cents &&
493
+ currency_code == o.currency_code &&
494
+ pending_amount == o.pending_amount &&
456
495
  pending_cents == o.pending_cents &&
496
+ credit_limit_amount == o.credit_limit_amount &&
457
497
  credit_limit_cents == o.credit_limit_cents &&
458
498
  accountholder_name == o.accountholder_name &&
459
499
  account_type == o.account_type &&
@@ -491,7 +531,7 @@ module Tremendous
491
531
  # Calculates hash code according to all attributes.
492
532
  # @return [Integer] Hash code
493
533
  def hash
494
- [available_cents, pending_cents, credit_limit_cents, accountholder_name, account_type, bank_name, account_number_mask, account_routing_mask, refundable, network, last4, expired, year, month, last_payment_failed_at, invoice_type, interval, day_of_week, net, company_name, address_1, address_2, city, state, zip, phone, emails, failure_details].hash
534
+ [available_amount, available_cents, currency_code, pending_amount, pending_cents, credit_limit_amount, credit_limit_cents, accountholder_name, account_type, bank_name, account_number_mask, account_routing_mask, refundable, network, last4, expired, year, month, last_payment_failed_at, invoice_type, interval, day_of_week, net, company_name, address_1, address_2, city, state, zip, phone, emails, failure_details].hash
495
535
  end
496
536
 
497
537
  # Builds the object from hash
@@ -25,7 +25,7 @@ module Tremendous
25
25
  # ID of the campaign in your account, that defines the available products (different gift cards, charity, etc.) that the recipient can choose from.
26
26
  attr_accessor :campaign_id
27
27
 
28
- # Date the order has been created
28
+ # Date the order was created
29
29
  attr_accessor :created_at
30
30
 
31
31
  # Execution status of a given order <table> <thead> <tr> <th> Status </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> <code> CANCELED </code> </td> <td> The order and all of its rewards were canceled. </td> </tr> <tr> <td> <code> OPEN </code> </td> <td> The order has been created, but hasn't yet been processed. </td> </tr> <tr> <td> <code> EXECUTED </code> </td> <td> The order has been executed. Payment has been handled and rewards are being delivered (if applicable). </td> </tr> <tr> <td> <code> FAILED </code> </td> <td> The order could not be processed due to an error. E.g. due to insufficient funds in the account. </td> </tr> <tr> <td> <code> PENDING APPROVAL </code> </td> <td> The order has been created but needs approval to be executed. </td> </tr> <tr> <td> <code> PENDING INTERNAL PAYMENT APPROVAL </code> </td> <td> The order has been created but it is under review and requires approval from our team. </td> </tr> <tr> <td> <code> PENDING SETTLEMENT </code> </td> <td> The order has been created but the funds are being held until the settlement window clears. </td> </tr> </tbody> </table>
@@ -14,20 +14,23 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Tremendous
17
- # Cost breakdown of the order (cost of rewards + fees). Cost and fees are always denominated in USD, independent from the currency of the ordered rewards. Note that this property will only appear for processed orders (`status` is `EXECUTED`).
17
+ # Cost breakdown of the order (cost of rewards + fees). Cost and fees are denominated in the organization's currency (see payment `currency_code`), independent of the ordered rewards' currency. Note that this property will only appear for processed orders (`status` is `EXECUTED`).
18
18
  class ListOrders200ResponseOrdersInnerPayment
19
- # Total price of the order before fees (in USD)
19
+ # Total price of the order before fees, denominated in `currency_code`.
20
20
  attr_accessor :subtotal
21
21
 
22
- # Total price of the order including fees (in USD)
22
+ # Total price of the order including fees, denominated in `currency_code`.
23
23
  attr_accessor :total
24
24
 
25
- # Fees for the order (in USD)
25
+ # Fees for the order, denominated in `currency_code`.
26
26
  attr_accessor :fees
27
27
 
28
- # Discount for the order (in USD)
28
+ # Discount for the order, denominated in `currency_code`.
29
29
  attr_accessor :discount
30
30
 
31
+ # Currency in which the payment amounts (subtotal, total, fees, discount, refund) are denominated. This always matches the organization's currency.
32
+ attr_accessor :currency_code
33
+
31
34
  attr_accessor :refund
32
35
 
33
36
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -37,6 +40,7 @@ module Tremendous
37
40
  :'total' => :'total',
38
41
  :'fees' => :'fees',
39
42
  :'discount' => :'discount',
43
+ :'currency_code' => :'currency_code',
40
44
  :'refund' => :'refund'
41
45
  }
42
46
  end
@@ -58,6 +62,7 @@ module Tremendous
58
62
  :'total' => :'Float',
59
63
  :'fees' => :'Float',
60
64
  :'discount' => :'Float',
65
+ :'currency_code' => :'String',
61
66
  :'refund' => :'ListOrders200ResponseOrdersInnerPaymentRefund'
62
67
  }
63
68
  end
@@ -108,6 +113,12 @@ module Tremendous
108
113
  self.discount = nil
109
114
  end
110
115
 
116
+ if attributes.key?(:'currency_code')
117
+ self.currency_code = attributes[:'currency_code']
118
+ else
119
+ self.currency_code = nil
120
+ end
121
+
111
122
  if attributes.key?(:'refund')
112
123
  self.refund = attributes[:'refund']
113
124
  end
@@ -150,6 +161,10 @@ module Tremendous
150
161
  invalid_properties.push('invalid value for "discount", must be greater than or equal to 0.')
151
162
  end
152
163
 
164
+ if @currency_code.nil?
165
+ invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.')
166
+ end
167
+
153
168
  invalid_properties
154
169
  end
155
170
 
@@ -165,6 +180,7 @@ module Tremendous
165
180
  return false if @fees < 0
166
181
  return false if @discount.nil?
167
182
  return false if @discount < 0
183
+ return false if @currency_code.nil?
168
184
  true
169
185
  end
170
186
 
@@ -224,6 +240,16 @@ module Tremendous
224
240
  @discount = discount
225
241
  end
226
242
 
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] currency_code Value to be assigned
245
+ def currency_code=(currency_code)
246
+ if currency_code.nil?
247
+ fail ArgumentError, 'currency_code cannot be nil'
248
+ end
249
+
250
+ @currency_code = currency_code
251
+ end
252
+
227
253
  # Checks equality by comparing each attribute.
228
254
  # @param [Object] Object to be compared
229
255
  def ==(o)
@@ -233,6 +259,7 @@ module Tremendous
233
259
  total == o.total &&
234
260
  fees == o.fees &&
235
261
  discount == o.discount &&
262
+ currency_code == o.currency_code &&
236
263
  refund == o.refund
237
264
  end
238
265
 
@@ -245,7 +272,7 @@ module Tremendous
245
272
  # Calculates hash code according to all attributes.
246
273
  # @return [Integer] Hash code
247
274
  def hash
248
- [subtotal, total, fees, discount, refund].hash
275
+ [subtotal, total, fees, discount, currency_code, refund].hash
249
276
  end
250
277
 
251
278
  # Builds the object from hash
@@ -14,15 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Tremendous
17
- # Breakdown of the order refunds (total amount in USD, independent from the currency of the ordered rewards). Note that this property will only appear for canceled orders or orders with canceled rewards.
17
+ # Breakdown of the order refunds (total denominated in `currency_code`, independent of the ordered rewards' currency). Note that this property will only appear for canceled orders or orders with canceled rewards.
18
18
  class ListOrders200ResponseOrdersInnerPaymentRefund
19
- # Total amount of the order refunds (in USD)
19
+ # Total amount of the order refunds, denominated in `currency_code`.
20
20
  attr_accessor :total
21
21
 
22
+ # Currency of the refund. Always matches the organization's currency.
23
+ attr_accessor :currency_code
24
+
22
25
  # Attribute mapping from ruby-style variable name to JSON key.
23
26
  def self.attribute_map
24
27
  {
25
- :'total' => :'total'
28
+ :'total' => :'total',
29
+ :'currency_code' => :'currency_code'
26
30
  }
27
31
  end
28
32
 
@@ -39,7 +43,8 @@ module Tremendous
39
43
  # Attribute type mapping.
40
44
  def self.openapi_types
41
45
  {
42
- :'total' => :'Float'
46
+ :'total' => :'Float',
47
+ :'currency_code' => :'String'
43
48
  }
44
49
  end
45
50
 
@@ -70,6 +75,12 @@ module Tremendous
70
75
  else
71
76
  self.total = nil
72
77
  end
78
+
79
+ if attributes.key?(:'currency_code')
80
+ self.currency_code = attributes[:'currency_code']
81
+ else
82
+ self.currency_code = nil
83
+ end
73
84
  end
74
85
 
75
86
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -85,6 +96,10 @@ module Tremendous
85
96
  invalid_properties.push('invalid value for "total", must be greater than or equal to 0.')
86
97
  end
87
98
 
99
+ if @currency_code.nil?
100
+ invalid_properties.push('invalid value for "currency_code", currency_code cannot be nil.')
101
+ end
102
+
88
103
  invalid_properties
89
104
  end
90
105
 
@@ -94,6 +109,7 @@ module Tremendous
94
109
  warn '[DEPRECATED] the `valid?` method is obsolete'
95
110
  return false if @total.nil?
96
111
  return false if @total < 0
112
+ return false if @currency_code.nil?
97
113
  true
98
114
  end
99
115
 
@@ -111,12 +127,23 @@ module Tremendous
111
127
  @total = total
112
128
  end
113
129
 
130
+ # Custom attribute writer method with validation
131
+ # @param [Object] currency_code Value to be assigned
132
+ def currency_code=(currency_code)
133
+ if currency_code.nil?
134
+ fail ArgumentError, 'currency_code cannot be nil'
135
+ end
136
+
137
+ @currency_code = currency_code
138
+ end
139
+
114
140
  # Checks equality by comparing each attribute.
115
141
  # @param [Object] Object to be compared
116
142
  def ==(o)
117
143
  return true if self.equal?(o)
118
144
  self.class == o.class &&
119
- total == o.total
145
+ total == o.total &&
146
+ currency_code == o.currency_code
120
147
  end
121
148
 
122
149
  # @see the `==` method
@@ -128,7 +155,7 @@ module Tremendous
128
155
  # Calculates hash code according to all attributes.
129
156
  # @return [Integer] Hash code
130
157
  def hash
131
- [total].hash
158
+ [total, currency_code].hash
132
159
  end
133
160
 
134
161
  # Builds the object from hash
@@ -24,6 +24,9 @@ module Tremendous
24
24
  # URL of the website of that organization
25
25
  attr_accessor :website
26
26
 
27
+ # Currency used for this organization's balances, orders, and transactions.
28
+ attr_accessor :currency_code
29
+
27
30
  # Status of the organization. Organizations need to be approved to be able to use them to send out rewards.
28
31
  attr_accessor :status
29
32
 
@@ -58,6 +61,7 @@ module Tremendous
58
61
  :'id' => :'id',
59
62
  :'name' => :'name',
60
63
  :'website' => :'website',
64
+ :'currency_code' => :'currency_code',
61
65
  :'status' => :'status',
62
66
  :'created_at' => :'created_at'
63
67
  }
@@ -79,6 +83,7 @@ module Tremendous
79
83
  :'id' => :'String',
80
84
  :'name' => :'String',
81
85
  :'website' => :'String',
86
+ :'currency_code' => :'String',
82
87
  :'status' => :'String',
83
88
  :'created_at' => :'Date'
84
89
  }
@@ -122,6 +127,10 @@ module Tremendous
122
127
  self.website = nil
123
128
  end
124
129
 
130
+ if attributes.key?(:'currency_code')
131
+ self.currency_code = attributes[:'currency_code']
132
+ end
133
+
125
134
  if attributes.key?(:'status')
126
135
  self.status = attributes[:'status']
127
136
  end
@@ -217,6 +226,7 @@ module Tremendous
217
226
  id == o.id &&
218
227
  name == o.name &&
219
228
  website == o.website &&
229
+ currency_code == o.currency_code &&
220
230
  status == o.status &&
221
231
  created_at == o.created_at
222
232
  end
@@ -230,7 +240,7 @@ module Tremendous
230
240
  # Calculates hash code according to all attributes.
231
241
  # @return [Integer] Hash code
232
242
  def hash
233
- [id, name, website, status, created_at].hash
243
+ [id, name, website, currency_code, status, created_at].hash
234
244
  end
235
245
 
236
246
  # Builds the object from hash
@@ -56,6 +56,7 @@ module Tremendous
56
56
  # List of attributes with nullable: true
57
57
  def self.openapi_nullable
58
58
  Set.new([
59
+ :'name',
59
60
  ])
60
61
  end
61
62