ultracart_api 3.4.7 → 3.4.11
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 +4 -4
- data/README.md +11 -4
- data/docs/PaymentsConfiguration.md +5 -3
- data/docs/PaymentsConfigurationAffirm.md +7 -7
- data/docs/PaymentsConfigurationAmazon.md +7 -7
- data/docs/PaymentsConfigurationCOD.md +5 -5
- data/docs/PaymentsConfigurationCash.md +1 -1
- data/docs/PaymentsConfigurationCheck.md +12 -17
- data/docs/PaymentsConfigurationCreditCard.md +11 -8
- data/docs/PaymentsConfigurationCreditCardType.md +17 -0
- data/docs/PaymentsConfigurationEcheck.md +11 -0
- data/docs/PaymentsConfigurationLoanHero.md +4 -4
- data/docs/PaymentsConfigurationMoneyOrder.md +11 -0
- data/docs/PaymentsConfigurationPayPal.md +28 -28
- data/docs/PaymentsConfigurationPurchaseOrder.md +3 -3
- data/docs/PaymentsConfigurationQuoteRequest.md +2 -2
- data/docs/PaymentsConfigurationRestrictions.md +14 -12
- data/docs/PaymentsConfigurationRestrictionsTheme.md +10 -0
- data/docs/PaymentsConfigurationSezzle.md +8 -7
- data/docs/PaymentsConfigurationTestMethod.md +18 -0
- data/docs/PaymentsConfigurationWePay.md +26 -26
- data/docs/PaymentsConfigurationWireTransfer.md +10 -10
- data/lib/ultracart_api.rb +5 -0
- data/lib/ultracart_api/models/payments_configuration.rb +50 -31
- data/lib/ultracart_api/models/payments_configuration_affirm.rb +81 -40
- data/lib/ultracart_api/models/payments_configuration_amazon.rb +51 -44
- data/lib/ultracart_api/models/payments_configuration_cash.rb +4 -3
- data/lib/ultracart_api/models/payments_configuration_check.rb +72 -103
- data/lib/ultracart_api/models/payments_configuration_cod.rb +39 -34
- data/lib/ultracart_api/models/payments_configuration_credit_card.rb +78 -34
- data/lib/ultracart_api/models/payments_configuration_credit_card_type.rb +309 -0
- data/lib/ultracart_api/models/payments_configuration_echeck.rb +214 -0
- data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +23 -19
- data/lib/ultracart_api/models/payments_configuration_money_order.rb +214 -0
- data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +270 -172
- data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +19 -16
- data/lib/ultracart_api/models/payments_configuration_quote_request.rb +12 -10
- data/lib/ultracart_api/models/payments_configuration_restrictions.rb +75 -41
- data/lib/ultracart_api/models/payments_configuration_restrictions_theme.rb +202 -0
- data/lib/ultracart_api/models/payments_configuration_sezzle.rb +99 -46
- data/lib/ultracart_api/models/payments_configuration_test_method.rb +319 -0
- data/lib/ultracart_api/models/payments_configuration_we_pay.rb +186 -160
- data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +71 -61
- data/lib/ultracart_api/version.rb +1 -1
- metadata +12 -2
@@ -14,27 +14,32 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class PaymentsConfigurationCOD
|
17
|
+
# Master flag indicating this merchant accepts COD
|
17
18
|
attr_accessor :accept_cod
|
18
19
|
|
19
|
-
|
20
|
+
# If true, only approved customers may pay with COD
|
21
|
+
attr_accessor :approved_customers_only
|
20
22
|
|
21
|
-
attr_accessor :
|
23
|
+
attr_accessor :restrictions
|
22
24
|
|
23
|
-
|
25
|
+
# Optional field, if surcharge is set, this is the accounting code the surcharge is tagged with when sent to Quickbooks
|
26
|
+
attr_accessor :surcharge_accounting_code
|
24
27
|
|
25
|
-
|
28
|
+
# Additional cost for using COD
|
29
|
+
attr_accessor :surcharge_fee
|
26
30
|
|
27
|
-
|
31
|
+
# Additional percentage cost for using COD
|
32
|
+
attr_accessor :surcharge_percentage
|
28
33
|
|
29
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
35
|
def self.attribute_map
|
31
36
|
{
|
32
|
-
:'accept_cod' => :'
|
33
|
-
:'
|
34
|
-
:'
|
35
|
-
:'
|
36
|
-
:'
|
37
|
-
:'
|
37
|
+
:'accept_cod' => :'accept_cod',
|
38
|
+
:'approved_customers_only' => :'approved_customers_only',
|
39
|
+
:'restrictions' => :'restrictions',
|
40
|
+
:'surcharge_accounting_code' => :'surcharge_accounting_code',
|
41
|
+
:'surcharge_fee' => :'surcharge_fee',
|
42
|
+
:'surcharge_percentage' => :'surcharge_percentage'
|
38
43
|
}
|
39
44
|
end
|
40
45
|
|
@@ -42,11 +47,11 @@ module UltracartClient
|
|
42
47
|
def self.swagger_types
|
43
48
|
{
|
44
49
|
:'accept_cod' => :'BOOLEAN',
|
45
|
-
:'
|
46
|
-
:'
|
47
|
-
:'
|
48
|
-
:'
|
49
|
-
:'
|
50
|
+
:'approved_customers_only' => :'BOOLEAN',
|
51
|
+
:'restrictions' => :'PaymentsConfigurationRestrictions',
|
52
|
+
:'surcharge_accounting_code' => :'String',
|
53
|
+
:'surcharge_fee' => :'String',
|
54
|
+
:'surcharge_percentage' => :'String'
|
50
55
|
}
|
51
56
|
end
|
52
57
|
|
@@ -58,28 +63,28 @@ module UltracartClient
|
|
58
63
|
# convert string to symbol for hash key
|
59
64
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
60
65
|
|
61
|
-
if attributes.has_key?(:'
|
62
|
-
self.accept_cod = attributes[:'
|
66
|
+
if attributes.has_key?(:'accept_cod')
|
67
|
+
self.accept_cod = attributes[:'accept_cod']
|
63
68
|
end
|
64
69
|
|
65
|
-
if attributes.has_key?(:'
|
66
|
-
self.
|
70
|
+
if attributes.has_key?(:'approved_customers_only')
|
71
|
+
self.approved_customers_only = attributes[:'approved_customers_only']
|
67
72
|
end
|
68
73
|
|
69
|
-
if attributes.has_key?(:'
|
70
|
-
self.
|
74
|
+
if attributes.has_key?(:'restrictions')
|
75
|
+
self.restrictions = attributes[:'restrictions']
|
71
76
|
end
|
72
77
|
|
73
|
-
if attributes.has_key?(:'
|
74
|
-
self.
|
78
|
+
if attributes.has_key?(:'surcharge_accounting_code')
|
79
|
+
self.surcharge_accounting_code = attributes[:'surcharge_accounting_code']
|
75
80
|
end
|
76
81
|
|
77
|
-
if attributes.has_key?(:'
|
78
|
-
self.
|
82
|
+
if attributes.has_key?(:'surcharge_fee')
|
83
|
+
self.surcharge_fee = attributes[:'surcharge_fee']
|
79
84
|
end
|
80
85
|
|
81
|
-
if attributes.has_key?(:'
|
82
|
-
self.
|
86
|
+
if attributes.has_key?(:'surcharge_percentage')
|
87
|
+
self.surcharge_percentage = attributes[:'surcharge_percentage']
|
83
88
|
end
|
84
89
|
end
|
85
90
|
|
@@ -102,11 +107,11 @@ module UltracartClient
|
|
102
107
|
return true if self.equal?(o)
|
103
108
|
self.class == o.class &&
|
104
109
|
accept_cod == o.accept_cod &&
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
+
approved_customers_only == o.approved_customers_only &&
|
111
|
+
restrictions == o.restrictions &&
|
112
|
+
surcharge_accounting_code == o.surcharge_accounting_code &&
|
113
|
+
surcharge_fee == o.surcharge_fee &&
|
114
|
+
surcharge_percentage == o.surcharge_percentage
|
110
115
|
end
|
111
116
|
|
112
117
|
# @see the `==` method
|
@@ -118,7 +123,7 @@ module UltracartClient
|
|
118
123
|
# Calculates hash code according to all attributes.
|
119
124
|
# @return [Fixnum] Hash code
|
120
125
|
def hash
|
121
|
-
[accept_cod,
|
126
|
+
[accept_cod, approved_customers_only, restrictions, surcharge_accounting_code, surcharge_fee, surcharge_percentage].hash
|
122
127
|
end
|
123
128
|
|
124
129
|
# Builds the object from hash
|
@@ -14,47 +14,70 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class PaymentsConfigurationCreditCard
|
17
|
-
|
17
|
+
# Master flag indicating whether this merchant accepts credit card payments
|
18
|
+
attr_accessor :accept_credit_card
|
18
19
|
|
20
|
+
# Description that appears on customer statements
|
19
21
|
attr_accessor :billed_by
|
20
22
|
|
23
|
+
# If false, order will be accepted and placed into Accounts Receivable without charging card first
|
21
24
|
attr_accessor :charge_during_checkout
|
22
25
|
|
26
|
+
# UltraCart will require customer to enter cvv if this is true
|
23
27
|
attr_accessor :collect_cvv2
|
24
28
|
|
25
|
-
|
29
|
+
# Human readable description of the credit card gateway currently configured
|
30
|
+
attr_accessor :configured_gateway_details
|
26
31
|
|
32
|
+
# The number of failed attempts before the order is placed into Accounts Receivable for manual intervention
|
27
33
|
attr_accessor :failed_attempts
|
28
34
|
|
35
|
+
# This internal flag aids the UI in determining which buttons to show.
|
29
36
|
attr_accessor :hide_connect_single_gateway
|
30
37
|
|
38
|
+
# Restrictions for this payment method
|
39
|
+
attr_accessor :restrictions
|
40
|
+
|
41
|
+
# UltraCart will send customers emails to update their credit card if the card is declined
|
31
42
|
attr_accessor :send_customer_billing_update_on_decline
|
32
43
|
|
44
|
+
# A list of credit cards the merchant wishes to accept.
|
45
|
+
attr_accessor :supported_cards
|
46
|
+
|
47
|
+
# An array of test methods for placing test orders. The cards defined here may be real or fake, but any order placed with them will be marked as Test orders
|
48
|
+
attr_accessor :test_methods
|
49
|
+
|
33
50
|
# Attribute mapping from ruby-style variable name to JSON key.
|
34
51
|
def self.attribute_map
|
35
52
|
{
|
36
|
-
:'
|
37
|
-
:'billed_by' => :'
|
38
|
-
:'charge_during_checkout' => :'
|
39
|
-
:'collect_cvv2' => :'
|
40
|
-
:'
|
41
|
-
:'failed_attempts' => :'
|
42
|
-
:'hide_connect_single_gateway' => :'
|
43
|
-
:'
|
53
|
+
:'accept_credit_card' => :'accept_credit_card',
|
54
|
+
:'billed_by' => :'billed_by',
|
55
|
+
:'charge_during_checkout' => :'charge_during_checkout',
|
56
|
+
:'collect_cvv2' => :'collect_cvv2',
|
57
|
+
:'configured_gateway_details' => :'configured_gateway_details',
|
58
|
+
:'failed_attempts' => :'failed_attempts',
|
59
|
+
:'hide_connect_single_gateway' => :'hide_connect_single_gateway',
|
60
|
+
:'restrictions' => :'restrictions',
|
61
|
+
:'send_customer_billing_update_on_decline' => :'send_customer_billing_update_on_decline',
|
62
|
+
:'supported_cards' => :'supported_cards',
|
63
|
+
:'test_methods' => :'test_methods'
|
44
64
|
}
|
45
65
|
end
|
46
66
|
|
47
67
|
# Attribute type mapping.
|
48
68
|
def self.swagger_types
|
49
69
|
{
|
50
|
-
:'
|
70
|
+
:'accept_credit_card' => :'BOOLEAN',
|
51
71
|
:'billed_by' => :'String',
|
52
72
|
:'charge_during_checkout' => :'BOOLEAN',
|
53
73
|
:'collect_cvv2' => :'BOOLEAN',
|
54
|
-
:'
|
55
|
-
:'failed_attempts' => :'
|
74
|
+
:'configured_gateway_details' => :'String',
|
75
|
+
:'failed_attempts' => :'Integer',
|
56
76
|
:'hide_connect_single_gateway' => :'BOOLEAN',
|
57
|
-
:'
|
77
|
+
:'restrictions' => :'Array<PaymentsConfigurationRestrictions>',
|
78
|
+
:'send_customer_billing_update_on_decline' => :'BOOLEAN',
|
79
|
+
:'supported_cards' => :'Array<PaymentsConfigurationCreditCardType>',
|
80
|
+
:'test_methods' => :'Array<PaymentsConfigurationTestMethod>'
|
58
81
|
}
|
59
82
|
end
|
60
83
|
|
@@ -66,36 +89,54 @@ module UltracartClient
|
|
66
89
|
# convert string to symbol for hash key
|
67
90
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
68
91
|
|
69
|
-
if attributes.has_key?(:'
|
70
|
-
self.
|
92
|
+
if attributes.has_key?(:'accept_credit_card')
|
93
|
+
self.accept_credit_card = attributes[:'accept_credit_card']
|
94
|
+
end
|
95
|
+
|
96
|
+
if attributes.has_key?(:'billed_by')
|
97
|
+
self.billed_by = attributes[:'billed_by']
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes.has_key?(:'charge_during_checkout')
|
101
|
+
self.charge_during_checkout = attributes[:'charge_during_checkout']
|
102
|
+
end
|
103
|
+
|
104
|
+
if attributes.has_key?(:'collect_cvv2')
|
105
|
+
self.collect_cvv2 = attributes[:'collect_cvv2']
|
71
106
|
end
|
72
107
|
|
73
|
-
if attributes.has_key?(:'
|
74
|
-
self.
|
108
|
+
if attributes.has_key?(:'configured_gateway_details')
|
109
|
+
self.configured_gateway_details = attributes[:'configured_gateway_details']
|
75
110
|
end
|
76
111
|
|
77
|
-
if attributes.has_key?(:'
|
78
|
-
self.
|
112
|
+
if attributes.has_key?(:'failed_attempts')
|
113
|
+
self.failed_attempts = attributes[:'failed_attempts']
|
79
114
|
end
|
80
115
|
|
81
|
-
if attributes.has_key?(:'
|
82
|
-
self.
|
116
|
+
if attributes.has_key?(:'hide_connect_single_gateway')
|
117
|
+
self.hide_connect_single_gateway = attributes[:'hide_connect_single_gateway']
|
83
118
|
end
|
84
119
|
|
85
|
-
if attributes.has_key?(:'
|
86
|
-
|
120
|
+
if attributes.has_key?(:'restrictions')
|
121
|
+
if (value = attributes[:'restrictions']).is_a?(Array)
|
122
|
+
self.restrictions = value
|
123
|
+
end
|
87
124
|
end
|
88
125
|
|
89
|
-
if attributes.has_key?(:'
|
90
|
-
self.
|
126
|
+
if attributes.has_key?(:'send_customer_billing_update_on_decline')
|
127
|
+
self.send_customer_billing_update_on_decline = attributes[:'send_customer_billing_update_on_decline']
|
91
128
|
end
|
92
129
|
|
93
|
-
if attributes.has_key?(:'
|
94
|
-
|
130
|
+
if attributes.has_key?(:'supported_cards')
|
131
|
+
if (value = attributes[:'supported_cards']).is_a?(Array)
|
132
|
+
self.supported_cards = value
|
133
|
+
end
|
95
134
|
end
|
96
135
|
|
97
|
-
if attributes.has_key?(:'
|
98
|
-
|
136
|
+
if attributes.has_key?(:'test_methods')
|
137
|
+
if (value = attributes[:'test_methods']).is_a?(Array)
|
138
|
+
self.test_methods = value
|
139
|
+
end
|
99
140
|
end
|
100
141
|
end
|
101
142
|
|
@@ -117,14 +158,17 @@ module UltracartClient
|
|
117
158
|
def ==(o)
|
118
159
|
return true if self.equal?(o)
|
119
160
|
self.class == o.class &&
|
120
|
-
|
161
|
+
accept_credit_card == o.accept_credit_card &&
|
121
162
|
billed_by == o.billed_by &&
|
122
163
|
charge_during_checkout == o.charge_during_checkout &&
|
123
164
|
collect_cvv2 == o.collect_cvv2 &&
|
124
|
-
|
165
|
+
configured_gateway_details == o.configured_gateway_details &&
|
125
166
|
failed_attempts == o.failed_attempts &&
|
126
167
|
hide_connect_single_gateway == o.hide_connect_single_gateway &&
|
127
|
-
|
168
|
+
restrictions == o.restrictions &&
|
169
|
+
send_customer_billing_update_on_decline == o.send_customer_billing_update_on_decline &&
|
170
|
+
supported_cards == o.supported_cards &&
|
171
|
+
test_methods == o.test_methods
|
128
172
|
end
|
129
173
|
|
130
174
|
# @see the `==` method
|
@@ -136,7 +180,7 @@ module UltracartClient
|
|
136
180
|
# Calculates hash code according to all attributes.
|
137
181
|
# @return [Fixnum] Hash code
|
138
182
|
def hash
|
139
|
-
[
|
183
|
+
[accept_credit_card, billed_by, charge_during_checkout, collect_cvv2, configured_gateway_details, failed_attempts, hide_connect_single_gateway, restrictions, send_customer_billing_update_on_decline, supported_cards, test_methods].hash
|
140
184
|
end
|
141
185
|
|
142
186
|
# Builds the object from hash
|
@@ -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' => :'String',
|
94
|
+
:'processing_percentage' => :'String',
|
95
|
+
:'surcharge_accounting_code' => :'String',
|
96
|
+
:'transaction_fee' => :'String',
|
97
|
+
:'transaction_percentage' => :'String'
|
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
|