ultracart_api 3.6.3 → 3.6.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,8 @@ module UltracartClient
28
28
 
29
29
  attr_accessor :echeck
30
30
 
31
+ attr_accessor :insurance
32
+
31
33
  attr_accessor :loan_hero
32
34
 
33
35
  attr_accessor :money_order
@@ -43,10 +45,6 @@ module UltracartClient
43
45
  # Internal flag used to determine if accounting codes should be shown on the screen or not. This flag is true if the merchant has a Quickbooks integration configured.
44
46
  attr_accessor :show_accounting_code
45
47
 
46
- attr_accessor :switch_to_sub_tab
47
-
48
- attr_accessor :switch_to_tab
49
-
50
48
  attr_accessor :ultracart_payments_wepay
51
49
 
52
50
  attr_accessor :wire_transfer
@@ -61,6 +59,7 @@ module UltracartClient
61
59
  :'cod' => :'cod',
62
60
  :'credit_card' => :'credit_card',
63
61
  :'echeck' => :'echeck',
62
+ :'insurance' => :'insurance',
64
63
  :'loan_hero' => :'loan_hero',
65
64
  :'money_order' => :'money_order',
66
65
  :'paypal' => :'paypal',
@@ -68,8 +67,6 @@ module UltracartClient
68
67
  :'quote_request' => :'quote_request',
69
68
  :'sezzle' => :'sezzle',
70
69
  :'show_accounting_code' => :'show_accounting_code',
71
- :'switch_to_sub_tab' => :'switchToSubTab',
72
- :'switch_to_tab' => :'switchToTab',
73
70
  :'ultracart_payments_wepay' => :'ultracart_payments_wepay',
74
71
  :'wire_transfer' => :'wire_transfer'
75
72
  }
@@ -85,6 +82,7 @@ module UltracartClient
85
82
  :'cod' => :'PaymentsConfigurationCOD',
86
83
  :'credit_card' => :'PaymentsConfigurationCreditCard',
87
84
  :'echeck' => :'PaymentsConfigurationEcheck',
85
+ :'insurance' => :'PaymentsConfigurationInsurance',
88
86
  :'loan_hero' => :'PaymentsConfigurationLoanHero',
89
87
  :'money_order' => :'PaymentsConfigurationMoneyOrder',
90
88
  :'paypal' => :'PaymentsConfigurationPayPal',
@@ -92,8 +90,6 @@ module UltracartClient
92
90
  :'quote_request' => :'PaymentsConfigurationQuoteRequest',
93
91
  :'sezzle' => :'PaymentsConfigurationSezzle',
94
92
  :'show_accounting_code' => :'BOOLEAN',
95
- :'switch_to_sub_tab' => :'String',
96
- :'switch_to_tab' => :'String',
97
93
  :'ultracart_payments_wepay' => :'PaymentsConfigurationWePay',
98
94
  :'wire_transfer' => :'PaymentsConfigurationWireTransfer'
99
95
  }
@@ -135,6 +131,10 @@ module UltracartClient
135
131
  self.echeck = attributes[:'echeck']
136
132
  end
137
133
 
134
+ if attributes.has_key?(:'insurance')
135
+ self.insurance = attributes[:'insurance']
136
+ end
137
+
138
138
  if attributes.has_key?(:'loan_hero')
139
139
  self.loan_hero = attributes[:'loan_hero']
140
140
  end
@@ -163,14 +163,6 @@ module UltracartClient
163
163
  self.show_accounting_code = attributes[:'show_accounting_code']
164
164
  end
165
165
 
166
- if attributes.has_key?(:'switchToSubTab')
167
- self.switch_to_sub_tab = attributes[:'switchToSubTab']
168
- end
169
-
170
- if attributes.has_key?(:'switchToTab')
171
- self.switch_to_tab = attributes[:'switchToTab']
172
- end
173
-
174
166
  if attributes.has_key?(:'ultracart_payments_wepay')
175
167
  self.ultracart_payments_wepay = attributes[:'ultracart_payments_wepay']
176
168
  end
@@ -205,6 +197,7 @@ module UltracartClient
205
197
  cod == o.cod &&
206
198
  credit_card == o.credit_card &&
207
199
  echeck == o.echeck &&
200
+ insurance == o.insurance &&
208
201
  loan_hero == o.loan_hero &&
209
202
  money_order == o.money_order &&
210
203
  paypal == o.paypal &&
@@ -212,8 +205,6 @@ module UltracartClient
212
205
  quote_request == o.quote_request &&
213
206
  sezzle == o.sezzle &&
214
207
  show_accounting_code == o.show_accounting_code &&
215
- switch_to_sub_tab == o.switch_to_sub_tab &&
216
- switch_to_tab == o.switch_to_tab &&
217
208
  ultracart_payments_wepay == o.ultracart_payments_wepay &&
218
209
  wire_transfer == o.wire_transfer
219
210
  end
@@ -227,7 +218,7 @@ module UltracartClient
227
218
  # Calculates hash code according to all attributes.
228
219
  # @return [Fixnum] Hash code
229
220
  def hash
230
- [affirm, amazon, cash, check, cod, credit_card, echeck, loan_hero, money_order, paypal, purchase_order, quote_request, sezzle, show_accounting_code, switch_to_sub_tab, switch_to_tab, ultracart_payments_wepay, wire_transfer].hash
221
+ [affirm, amazon, cash, check, cod, credit_card, echeck, insurance, loan_hero, money_order, paypal, purchase_order, quote_request, sezzle, show_accounting_code, ultracart_payments_wepay, wire_transfer].hash
231
222
  end
232
223
 
233
224
  # Builds the object from hash
@@ -29,14 +29,36 @@ module UltracartClient
29
29
  # Optional deposit to account field for use with Quickbooks integrations
30
30
  attr_accessor :deposit_to_account
31
31
 
32
- attr_accessor :restrictions
32
+ # Environment
33
+ attr_accessor :environment
33
34
 
34
- # True if transactions should run against the Amazon sandbox. Useful for testing not configurations
35
- attr_accessor :sandbox
35
+ attr_accessor :restrictions
36
36
 
37
37
  # Amazon secret access key
38
38
  attr_accessor :secret_access_key
39
39
 
40
+ class EnumAttributeValidator
41
+ attr_reader :datatype
42
+ attr_reader :allowable_values
43
+
44
+ def initialize(datatype, allowable_values)
45
+ @allowable_values = allowable_values.map do |value|
46
+ case datatype.to_s
47
+ when /Integer/i
48
+ value.to_i
49
+ when /Float/i
50
+ value.to_f
51
+ else
52
+ value
53
+ end
54
+ end
55
+ end
56
+
57
+ def valid?(value)
58
+ !value || allowable_values.include?(value)
59
+ end
60
+ end
61
+
40
62
  # Attribute mapping from ruby-style variable name to JSON key.
41
63
  def self.attribute_map
42
64
  {
@@ -45,8 +67,8 @@ module UltracartClient
45
67
  :'accounting_code' => :'accounting_code',
46
68
  :'amazon_merchant_id' => :'amazon_merchant_id',
47
69
  :'deposit_to_account' => :'deposit_to_account',
70
+ :'environment' => :'environment',
48
71
  :'restrictions' => :'restrictions',
49
- :'sandbox' => :'sandbox',
50
72
  :'secret_access_key' => :'secret_access_key'
51
73
  }
52
74
  end
@@ -59,8 +81,8 @@ module UltracartClient
59
81
  :'accounting_code' => :'String',
60
82
  :'amazon_merchant_id' => :'String',
61
83
  :'deposit_to_account' => :'String',
84
+ :'environment' => :'String',
62
85
  :'restrictions' => :'PaymentsConfigurationRestrictions',
63
- :'sandbox' => :'BOOLEAN',
64
86
  :'secret_access_key' => :'String'
65
87
  }
66
88
  end
@@ -93,12 +115,12 @@ module UltracartClient
93
115
  self.deposit_to_account = attributes[:'deposit_to_account']
94
116
  end
95
117
 
96
- if attributes.has_key?(:'restrictions')
97
- self.restrictions = attributes[:'restrictions']
118
+ if attributes.has_key?(:'environment')
119
+ self.environment = attributes[:'environment']
98
120
  end
99
121
 
100
- if attributes.has_key?(:'sandbox')
101
- self.sandbox = attributes[:'sandbox']
122
+ if attributes.has_key?(:'restrictions')
123
+ self.restrictions = attributes[:'restrictions']
102
124
  end
103
125
 
104
126
  if attributes.has_key?(:'secret_access_key')
@@ -116,9 +138,21 @@ module UltracartClient
116
138
  # Check to see if the all the properties in the model are valid
117
139
  # @return true if the model is valid
118
140
  def valid?
141
+ environment_validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
142
+ return false unless environment_validator.valid?(@environment)
119
143
  true
120
144
  end
121
145
 
146
+ # Custom attribute writer method checking allowed values (enum).
147
+ # @param [Object] environment Object to be assigned
148
+ def environment=(environment)
149
+ validator = EnumAttributeValidator.new('String', ['Live', 'Sandbox'])
150
+ unless validator.valid?(environment)
151
+ fail ArgumentError, 'invalid value for "environment", must be one of #{validator.allowable_values}.'
152
+ end
153
+ @environment = environment
154
+ end
155
+
122
156
  # Checks equality by comparing each attribute.
123
157
  # @param [Object] Object to be compared
124
158
  def ==(o)
@@ -129,8 +163,8 @@ module UltracartClient
129
163
  accounting_code == o.accounting_code &&
130
164
  amazon_merchant_id == o.amazon_merchant_id &&
131
165
  deposit_to_account == o.deposit_to_account &&
166
+ environment == o.environment &&
132
167
  restrictions == o.restrictions &&
133
- sandbox == o.sandbox &&
134
168
  secret_access_key == o.secret_access_key
135
169
  end
136
170
 
@@ -143,7 +177,7 @@ module UltracartClient
143
177
  # Calculates hash code according to all attributes.
144
178
  # @return [Fixnum] Hash code
145
179
  def hash
146
- [accept_amazon, access_key_id, accounting_code, amazon_merchant_id, deposit_to_account, restrictions, sandbox, secret_access_key].hash
180
+ [accept_amazon, access_key_id, accounting_code, amazon_merchant_id, deposit_to_account, environment, restrictions, secret_access_key].hash
147
181
  end
148
182
 
149
183
  # Builds the object from hash
@@ -0,0 +1,194 @@
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 PaymentsConfigurationInsurance
17
+ # Master flag indicating this merchant accepts insurance
18
+ attr_accessor :accept_insurance
19
+
20
+ attr_accessor :restrictions
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'accept_insurance' => :'accept_insurance',
26
+ :'restrictions' => :'restrictions'
27
+ }
28
+ end
29
+
30
+ # Attribute type mapping.
31
+ def self.swagger_types
32
+ {
33
+ :'accept_insurance' => :'BOOLEAN',
34
+ :'restrictions' => :'PaymentsConfigurationRestrictions'
35
+ }
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ return unless attributes.is_a?(Hash)
42
+
43
+ # convert string to symbol for hash key
44
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
45
+
46
+ if attributes.has_key?(:'accept_insurance')
47
+ self.accept_insurance = attributes[:'accept_insurance']
48
+ end
49
+
50
+ if attributes.has_key?(:'restrictions')
51
+ self.restrictions = attributes[:'restrictions']
52
+ end
53
+ end
54
+
55
+ # Show invalid properties with the reasons. Usually used together with valid?
56
+ # @return Array for valid properties with the reasons
57
+ def list_invalid_properties
58
+ invalid_properties = Array.new
59
+ invalid_properties
60
+ end
61
+
62
+ # Check to see if the all the properties in the model are valid
63
+ # @return true if the model is valid
64
+ def valid?
65
+ true
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] Object to be compared
70
+ def ==(o)
71
+ return true if self.equal?(o)
72
+ self.class == o.class &&
73
+ accept_insurance == o.accept_insurance &&
74
+ restrictions == o.restrictions
75
+ end
76
+
77
+ # @see the `==` method
78
+ # @param [Object] Object to be compared
79
+ def eql?(o)
80
+ self == o
81
+ end
82
+
83
+ # Calculates hash code according to all attributes.
84
+ # @return [Fixnum] Hash code
85
+ def hash
86
+ [accept_insurance, restrictions].hash
87
+ end
88
+
89
+ # Builds the object from hash
90
+ # @param [Hash] attributes Model attributes in the form of hash
91
+ # @return [Object] Returns the model itself
92
+ def build_from_hash(attributes)
93
+ return nil unless attributes.is_a?(Hash)
94
+ self.class.swagger_types.each_pair do |key, type|
95
+ if type =~ /\AArray<(.*)>/i
96
+ # check to ensure the input is an array given that the attribute
97
+ # is documented as an array but the input is not
98
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
99
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
100
+ end
101
+ elsif !attributes[self.class.attribute_map[key]].nil?
102
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
103
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
104
+ end
105
+
106
+ self
107
+ end
108
+
109
+ # Deserializes the data based on type
110
+ # @param string type Data type
111
+ # @param string value Value to be deserialized
112
+ # @return [Object] Deserialized data
113
+ def _deserialize(type, value)
114
+ case type.to_sym
115
+ when :DateTime
116
+ DateTime.parse(value)
117
+ when :Date
118
+ Date.parse(value)
119
+ when :String
120
+ value.to_s
121
+ when :Integer
122
+ value.to_i
123
+ when :Float
124
+ value.to_f
125
+ when :BOOLEAN
126
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
127
+ true
128
+ else
129
+ false
130
+ end
131
+ when :Object
132
+ # generic object (usually a Hash), return directly
133
+ value
134
+ when /\AArray<(?<inner_type>.+)>\z/
135
+ inner_type = Regexp.last_match[:inner_type]
136
+ value.map { |v| _deserialize(inner_type, v) }
137
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
138
+ k_type = Regexp.last_match[:k_type]
139
+ v_type = Regexp.last_match[:v_type]
140
+ {}.tap do |hash|
141
+ value.each do |k, v|
142
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
143
+ end
144
+ end
145
+ else # model
146
+ temp_model = UltracartClient.const_get(type).new
147
+ temp_model.build_from_hash(value)
148
+ end
149
+ end
150
+
151
+ # Returns the string representation of the object
152
+ # @return [String] String presentation of the object
153
+ def to_s
154
+ to_hash.to_s
155
+ end
156
+
157
+ # to_body is an alias to to_hash (backward compatibility)
158
+ # @return [Hash] Returns the object in the form of hash
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # Returns the object in the form of hash
164
+ # @return [Hash] Returns the object in the form of hash
165
+ def to_hash
166
+ hash = {}
167
+ self.class.attribute_map.each_pair do |attr, param|
168
+ value = self.send(attr)
169
+ next if value.nil?
170
+ hash[param] = _to_hash(value)
171
+ end
172
+ hash
173
+ end
174
+
175
+ # Outputs non-array value in the form of hash
176
+ # For object, use to_hash. Otherwise, just return the value
177
+ # @param [Object] value Any valid value
178
+ # @return [Hash] Returns the value in the form of hash
179
+ def _to_hash(value)
180
+ if value.is_a?(Array)
181
+ value.compact.map { |v| _to_hash(v) }
182
+ elsif value.is_a?(Hash)
183
+ {}.tap do |hash|
184
+ value.each { |k, v| hash[k] = _to_hash(v) }
185
+ end
186
+ elsif value.respond_to? :to_hash
187
+ value.to_hash
188
+ else
189
+ value
190
+ end
191
+ end
192
+
193
+ end
194
+ end
@@ -29,9 +29,6 @@ module UltracartClient
29
29
  # Sezzle environment
30
30
  attr_accessor :environment
31
31
 
32
- # List of environments possible
33
- attr_accessor :environments
34
-
35
32
  # Private API key
36
33
  attr_accessor :private_api_key
37
34
 
@@ -70,7 +67,6 @@ module UltracartClient
70
67
  :'business_id' => :'business_id',
71
68
  :'deposit_to_account' => :'deposit_to_account',
72
69
  :'environment' => :'environment',
73
- :'environments' => :'environments',
74
70
  :'private_api_key' => :'private_api_key',
75
71
  :'public_api_key' => :'public_api_key',
76
72
  :'restrictions' => :'restrictions'
@@ -85,7 +81,6 @@ module UltracartClient
85
81
  :'business_id' => :'String',
86
82
  :'deposit_to_account' => :'String',
87
83
  :'environment' => :'String',
88
- :'environments' => :'Array<String>',
89
84
  :'private_api_key' => :'String',
90
85
  :'public_api_key' => :'String',
91
86
  :'restrictions' => :'PaymentsConfigurationRestrictions'
@@ -120,12 +115,6 @@ module UltracartClient
120
115
  self.environment = attributes[:'environment']
121
116
  end
122
117
 
123
- if attributes.has_key?(:'environments')
124
- if (value = attributes[:'environments']).is_a?(Array)
125
- self.environments = value
126
- end
127
- end
128
-
129
118
  if attributes.has_key?(:'private_api_key')
130
119
  self.private_api_key = attributes[:'private_api_key']
131
120
  end
@@ -174,7 +163,6 @@ module UltracartClient
174
163
  business_id == o.business_id &&
175
164
  deposit_to_account == o.deposit_to_account &&
176
165
  environment == o.environment &&
177
- environments == o.environments &&
178
166
  private_api_key == o.private_api_key &&
179
167
  public_api_key == o.public_api_key &&
180
168
  restrictions == o.restrictions
@@ -189,7 +177,7 @@ module UltracartClient
189
177
  # Calculates hash code according to all attributes.
190
178
  # @return [Fixnum] Hash code
191
179
  def hash
192
- [accept_sezzle, accounting_code, business_id, deposit_to_account, environment, environments, private_api_key, public_api_key, restrictions].hash
180
+ [accept_sezzle, accounting_code, business_id, deposit_to_account, environment, private_api_key, public_api_key, restrictions].hash
193
181
  end
194
182
 
195
183
  # Builds the object from hash