ultracart_api 3.4.9 → 3.4.13

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.
@@ -86,7 +86,7 @@ module UltracartClient
86
86
  :'mail_to_postal_code' => :'String',
87
87
  :'mail_to_store' => :'String',
88
88
  :'restrictions' => :'PaymentsConfigurationRestrictions',
89
- :'test_methods' => :'Object'
89
+ :'test_methods' => :'Array<PaymentsConfigurationTestMethod>'
90
90
  }
91
91
  end
92
92
 
@@ -147,7 +147,9 @@ module UltracartClient
147
147
  end
148
148
 
149
149
  if attributes.has_key?(:'test_methods')
150
- self.test_methods = attributes[:'test_methods']
150
+ if (value = attributes[:'test_methods']).is_a?(Array)
151
+ self.test_methods = value
152
+ end
151
153
  end
152
154
  end
153
155
 
@@ -72,12 +72,12 @@ module UltracartClient
72
72
  :'charge_during_checkout' => :'BOOLEAN',
73
73
  :'collect_cvv2' => :'BOOLEAN',
74
74
  :'configured_gateway_details' => :'String',
75
- :'failed_attempts' => :'String',
75
+ :'failed_attempts' => :'Integer',
76
76
  :'hide_connect_single_gateway' => :'BOOLEAN',
77
- :'restrictions' => :'Object',
77
+ :'restrictions' => :'Array<PaymentsConfigurationRestrictions>',
78
78
  :'send_customer_billing_update_on_decline' => :'BOOLEAN',
79
- :'supported_cards' => :'Object',
80
- :'test_methods' => :'Object'
79
+ :'supported_cards' => :'Array<PaymentsConfigurationCreditCardType>',
80
+ :'test_methods' => :'Array<PaymentsConfigurationTestMethod>'
81
81
  }
82
82
  end
83
83
 
@@ -118,7 +118,9 @@ module UltracartClient
118
118
  end
119
119
 
120
120
  if attributes.has_key?(:'restrictions')
121
- self.restrictions = attributes[:'restrictions']
121
+ if (value = attributes[:'restrictions']).is_a?(Array)
122
+ self.restrictions = value
123
+ end
122
124
  end
123
125
 
124
126
  if attributes.has_key?(:'send_customer_billing_update_on_decline')
@@ -126,11 +128,15 @@ module UltracartClient
126
128
  end
127
129
 
128
130
  if attributes.has_key?(:'supported_cards')
129
- self.supported_cards = attributes[:'supported_cards']
131
+ if (value = attributes[:'supported_cards']).is_a?(Array)
132
+ self.supported_cards = value
133
+ end
130
134
  end
131
135
 
132
136
  if attributes.has_key?(:'test_methods')
133
- self.test_methods = attributes[:'test_methods']
137
+ if (value = attributes[:'test_methods']).is_a?(Array)
138
+ self.test_methods = value
139
+ end
134
140
  end
135
141
  end
136
142
 
@@ -0,0 +1,309 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class PaymentsConfigurationCreditCardType
17
+ # Optional field used for Quickbooks integrations to match this credit card with the corresponding payment type in Quickbooks
18
+ attr_accessor :accounting_code
19
+
20
+ # Internally used icon information for this card type
21
+ attr_accessor :card_type_icon
22
+
23
+ # Credit card type
24
+ attr_accessor :credit_card
25
+
26
+ # The name of the account to deposit funds
27
+ attr_accessor :deposit_to_account
28
+
29
+ # If true, this card type will be accepted during checkout
30
+ attr_accessor :enabled
31
+
32
+ # Optional additional fee applied to order for this card
33
+ attr_accessor :processing_fee
34
+
35
+ # Optional additional fee applied to order for this card
36
+ attr_accessor :processing_percentage
37
+
38
+ # Optional field. If integrated with Quickbooks, this code will be used when informing Quickbooks about any surcharges applied to orders
39
+ attr_accessor :surcharge_accounting_code
40
+
41
+ # An optional additional fee to charge the customer for using this card.
42
+ attr_accessor :transaction_fee
43
+
44
+ # An optional transaction percentage to charge the customer for using this card
45
+ attr_accessor :transaction_percentage
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'accounting_code' => :'accounting_code',
73
+ :'card_type_icon' => :'card_type_icon',
74
+ :'credit_card' => :'credit_card',
75
+ :'deposit_to_account' => :'deposit_to_account',
76
+ :'enabled' => :'enabled',
77
+ :'processing_fee' => :'processing_fee',
78
+ :'processing_percentage' => :'processing_percentage',
79
+ :'surcharge_accounting_code' => :'surcharge_accounting_code',
80
+ :'transaction_fee' => :'transaction_fee',
81
+ :'transaction_percentage' => :'transaction_percentage'
82
+ }
83
+ end
84
+
85
+ # Attribute type mapping.
86
+ def self.swagger_types
87
+ {
88
+ :'accounting_code' => :'String',
89
+ :'card_type_icon' => :'String',
90
+ :'credit_card' => :'String',
91
+ :'deposit_to_account' => :'String',
92
+ :'enabled' => :'BOOLEAN',
93
+ :'processing_fee' => :'Float',
94
+ :'processing_percentage' => :'Float',
95
+ :'surcharge_accounting_code' => :'String',
96
+ :'transaction_fee' => :'Float',
97
+ :'transaction_percentage' => :'Float'
98
+ }
99
+ end
100
+
101
+ # Initializes the object
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ def initialize(attributes = {})
104
+ return unless attributes.is_a?(Hash)
105
+
106
+ # convert string to symbol for hash key
107
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
108
+
109
+ if attributes.has_key?(:'accounting_code')
110
+ self.accounting_code = attributes[:'accounting_code']
111
+ end
112
+
113
+ if attributes.has_key?(:'card_type_icon')
114
+ self.card_type_icon = attributes[:'card_type_icon']
115
+ end
116
+
117
+ if attributes.has_key?(:'credit_card')
118
+ self.credit_card = attributes[:'credit_card']
119
+ end
120
+
121
+ if attributes.has_key?(:'deposit_to_account')
122
+ self.deposit_to_account = attributes[:'deposit_to_account']
123
+ end
124
+
125
+ if attributes.has_key?(:'enabled')
126
+ self.enabled = attributes[:'enabled']
127
+ end
128
+
129
+ if attributes.has_key?(:'processing_fee')
130
+ self.processing_fee = attributes[:'processing_fee']
131
+ end
132
+
133
+ if attributes.has_key?(:'processing_percentage')
134
+ self.processing_percentage = attributes[:'processing_percentage']
135
+ end
136
+
137
+ if attributes.has_key?(:'surcharge_accounting_code')
138
+ self.surcharge_accounting_code = attributes[:'surcharge_accounting_code']
139
+ end
140
+
141
+ if attributes.has_key?(:'transaction_fee')
142
+ self.transaction_fee = attributes[:'transaction_fee']
143
+ end
144
+
145
+ if attributes.has_key?(:'transaction_percentage')
146
+ self.transaction_percentage = attributes[:'transaction_percentage']
147
+ end
148
+ end
149
+
150
+ # Show invalid properties with the reasons. Usually used together with valid?
151
+ # @return Array for valid properties with the reasons
152
+ def list_invalid_properties
153
+ invalid_properties = Array.new
154
+ invalid_properties
155
+ end
156
+
157
+ # Check to see if the all the properties in the model are valid
158
+ # @return true if the model is valid
159
+ def valid?
160
+ credit_card_validator = EnumAttributeValidator.new('String', ['AMEX', 'Visa', 'Diners Club', 'Discover', 'JCB', 'MasterCard'])
161
+ return false unless credit_card_validator.valid?(@credit_card)
162
+ true
163
+ end
164
+
165
+ # Custom attribute writer method checking allowed values (enum).
166
+ # @param [Object] credit_card Object to be assigned
167
+ def credit_card=(credit_card)
168
+ validator = EnumAttributeValidator.new('String', ['AMEX', 'Visa', 'Diners Club', 'Discover', 'JCB', 'MasterCard'])
169
+ unless validator.valid?(credit_card)
170
+ fail ArgumentError, 'invalid value for "credit_card", must be one of #{validator.allowable_values}.'
171
+ end
172
+ @credit_card = credit_card
173
+ end
174
+
175
+ # Checks equality by comparing each attribute.
176
+ # @param [Object] Object to be compared
177
+ def ==(o)
178
+ return true if self.equal?(o)
179
+ self.class == o.class &&
180
+ accounting_code == o.accounting_code &&
181
+ card_type_icon == o.card_type_icon &&
182
+ credit_card == o.credit_card &&
183
+ deposit_to_account == o.deposit_to_account &&
184
+ enabled == o.enabled &&
185
+ processing_fee == o.processing_fee &&
186
+ processing_percentage == o.processing_percentage &&
187
+ surcharge_accounting_code == o.surcharge_accounting_code &&
188
+ transaction_fee == o.transaction_fee &&
189
+ transaction_percentage == o.transaction_percentage
190
+ end
191
+
192
+ # @see the `==` method
193
+ # @param [Object] Object to be compared
194
+ def eql?(o)
195
+ self == o
196
+ end
197
+
198
+ # Calculates hash code according to all attributes.
199
+ # @return [Fixnum] Hash code
200
+ def hash
201
+ [accounting_code, card_type_icon, credit_card, deposit_to_account, enabled, processing_fee, processing_percentage, surcharge_accounting_code, transaction_fee, transaction_percentage].hash
202
+ end
203
+
204
+ # Builds the object from hash
205
+ # @param [Hash] attributes Model attributes in the form of hash
206
+ # @return [Object] Returns the model itself
207
+ def build_from_hash(attributes)
208
+ return nil unless attributes.is_a?(Hash)
209
+ self.class.swagger_types.each_pair do |key, type|
210
+ if type =~ /\AArray<(.*)>/i
211
+ # check to ensure the input is an array given that the attribute
212
+ # is documented as an array but the input is not
213
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
214
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
215
+ end
216
+ elsif !attributes[self.class.attribute_map[key]].nil?
217
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
218
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
219
+ end
220
+
221
+ self
222
+ end
223
+
224
+ # Deserializes the data based on type
225
+ # @param string type Data type
226
+ # @param string value Value to be deserialized
227
+ # @return [Object] Deserialized data
228
+ def _deserialize(type, value)
229
+ case type.to_sym
230
+ when :DateTime
231
+ DateTime.parse(value)
232
+ when :Date
233
+ Date.parse(value)
234
+ when :String
235
+ value.to_s
236
+ when :Integer
237
+ value.to_i
238
+ when :Float
239
+ value.to_f
240
+ when :BOOLEAN
241
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
242
+ true
243
+ else
244
+ false
245
+ end
246
+ when :Object
247
+ # generic object (usually a Hash), return directly
248
+ value
249
+ when /\AArray<(?<inner_type>.+)>\z/
250
+ inner_type = Regexp.last_match[:inner_type]
251
+ value.map { |v| _deserialize(inner_type, v) }
252
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
253
+ k_type = Regexp.last_match[:k_type]
254
+ v_type = Regexp.last_match[:v_type]
255
+ {}.tap do |hash|
256
+ value.each do |k, v|
257
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
258
+ end
259
+ end
260
+ else # model
261
+ temp_model = UltracartClient.const_get(type).new
262
+ temp_model.build_from_hash(value)
263
+ end
264
+ end
265
+
266
+ # Returns the string representation of the object
267
+ # @return [String] String presentation of the object
268
+ def to_s
269
+ to_hash.to_s
270
+ end
271
+
272
+ # to_body is an alias to to_hash (backward compatibility)
273
+ # @return [Hash] Returns the object in the form of hash
274
+ def to_body
275
+ to_hash
276
+ end
277
+
278
+ # Returns the object in the form of hash
279
+ # @return [Hash] Returns the object in the form of hash
280
+ def to_hash
281
+ hash = {}
282
+ self.class.attribute_map.each_pair do |attr, param|
283
+ value = self.send(attr)
284
+ next if value.nil?
285
+ hash[param] = _to_hash(value)
286
+ end
287
+ hash
288
+ end
289
+
290
+ # Outputs non-array value in the form of hash
291
+ # For object, use to_hash. Otherwise, just return the value
292
+ # @param [Object] value Any valid value
293
+ # @return [Hash] Returns the value in the form of hash
294
+ def _to_hash(value)
295
+ if value.is_a?(Array)
296
+ value.compact.map { |v| _to_hash(v) }
297
+ elsif value.is_a?(Hash)
298
+ {}.tap do |hash|
299
+ value.each { |k, v| hash[k] = _to_hash(v) }
300
+ end
301
+ elsif value.respond_to? :to_hash
302
+ value.to_hash
303
+ else
304
+ value
305
+ end
306
+ end
307
+
308
+ end
309
+ end
@@ -14,6 +14,8 @@ require 'date'
14
14
 
15
15
  module UltracartClient
16
16
  class PaymentsConfigurationRestrictions
17
+ attr_accessor :descriptions
18
+
17
19
  # Maximum subtotal
18
20
  attr_accessor :maximum_subtotal
19
21
 
@@ -50,9 +52,12 @@ module UltracartClient
50
52
  # US Territories restriction
51
53
  attr_accessor :restriction_us_territories
52
54
 
55
+ attr_accessor :themes
56
+
53
57
  # Attribute mapping from ruby-style variable name to JSON key.
54
58
  def self.attribute_map
55
59
  {
60
+ :'descriptions' => :'descriptions',
56
61
  :'maximum_subtotal' => :'maximum_subtotal',
57
62
  :'minimum_subtotal' => :'minimum_subtotal',
58
63
  :'payment_method' => :'payment_method',
@@ -64,15 +69,17 @@ module UltracartClient
64
69
  :'restriction_international_only' => :'restriction_international_only',
65
70
  :'restriction_po_box' => :'restriction_po_box',
66
71
  :'restriction_puerto_rico' => :'restriction_puerto_rico',
67
- :'restriction_us_territories' => :'restriction_us_territories'
72
+ :'restriction_us_territories' => :'restriction_us_territories',
73
+ :'themes' => :'themes'
68
74
  }
69
75
  end
70
76
 
71
77
  # Attribute type mapping.
72
78
  def self.swagger_types
73
79
  {
74
- :'maximum_subtotal' => :'String',
75
- :'minimum_subtotal' => :'String',
80
+ :'descriptions' => :'Array<String>',
81
+ :'maximum_subtotal' => :'Float',
82
+ :'minimum_subtotal' => :'Float',
76
83
  :'payment_method' => :'String',
77
84
  :'restriction_alaska_hawaii' => :'String',
78
85
  :'restriction_apo_fpo' => :'String',
@@ -82,7 +89,8 @@ module UltracartClient
82
89
  :'restriction_international_only' => :'String',
83
90
  :'restriction_po_box' => :'String',
84
91
  :'restriction_puerto_rico' => :'String',
85
- :'restriction_us_territories' => :'String'
92
+ :'restriction_us_territories' => :'String',
93
+ :'themes' => :'Array<PaymentsConfigurationRestrictionsTheme>'
86
94
  }
87
95
  end
88
96
 
@@ -94,6 +102,12 @@ module UltracartClient
94
102
  # convert string to symbol for hash key
95
103
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
96
104
 
105
+ if attributes.has_key?(:'descriptions')
106
+ if (value = attributes[:'descriptions']).is_a?(Array)
107
+ self.descriptions = value
108
+ end
109
+ end
110
+
97
111
  if attributes.has_key?(:'maximum_subtotal')
98
112
  self.maximum_subtotal = attributes[:'maximum_subtotal']
99
113
  end
@@ -141,6 +155,12 @@ module UltracartClient
141
155
  if attributes.has_key?(:'restriction_us_territories')
142
156
  self.restriction_us_territories = attributes[:'restriction_us_territories']
143
157
  end
158
+
159
+ if attributes.has_key?(:'themes')
160
+ if (value = attributes[:'themes']).is_a?(Array)
161
+ self.themes = value
162
+ end
163
+ end
144
164
  end
145
165
 
146
166
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -161,6 +181,7 @@ module UltracartClient
161
181
  def ==(o)
162
182
  return true if self.equal?(o)
163
183
  self.class == o.class &&
184
+ descriptions == o.descriptions &&
164
185
  maximum_subtotal == o.maximum_subtotal &&
165
186
  minimum_subtotal == o.minimum_subtotal &&
166
187
  payment_method == o.payment_method &&
@@ -172,7 +193,8 @@ module UltracartClient
172
193
  restriction_international_only == o.restriction_international_only &&
173
194
  restriction_po_box == o.restriction_po_box &&
174
195
  restriction_puerto_rico == o.restriction_puerto_rico &&
175
- restriction_us_territories == o.restriction_us_territories
196
+ restriction_us_territories == o.restriction_us_territories &&
197
+ themes == o.themes
176
198
  end
177
199
 
178
200
  # @see the `==` method
@@ -184,7 +206,7 @@ module UltracartClient
184
206
  # Calculates hash code according to all attributes.
185
207
  # @return [Fixnum] Hash code
186
208
  def hash
187
- [maximum_subtotal, minimum_subtotal, payment_method, restriction_alaska_hawaii, restriction_apo_fpo, restriction_canada, restriction_continental_us, restriction_domestic_only, restriction_international_only, restriction_po_box, restriction_puerto_rico, restriction_us_territories].hash
209
+ [descriptions, maximum_subtotal, minimum_subtotal, payment_method, restriction_alaska_hawaii, restriction_apo_fpo, restriction_canada, restriction_continental_us, restriction_domestic_only, restriction_international_only, restriction_po_box, restriction_puerto_rico, restriction_us_territories, themes].hash
188
210
  end
189
211
 
190
212
  # Builds the object from hash