wallee-ruby-sdk 2.2.3 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/wallee-ruby-sdk.rb +63 -8
- data/lib/wallee-ruby-sdk/api/bank_account_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/charge_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/currency_bank_account_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/external_transfer_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/internal_transfer_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/payment_terminal_till_service_api.rb +170 -0
- data/lib/wallee-ruby-sdk/api/refund_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/refund_recovery_bank_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/shopify_subscriber_service_api.rb +62 -0
- data/lib/wallee-ruby-sdk/api/shopify_subscription_service_api.rb +124 -0
- data/lib/wallee-ruby-sdk/api/shopify_transaction_service_api.rb +213 -0
- data/lib/wallee-ruby-sdk/api/subscriber_service_api.rb +3 -3
- data/lib/wallee-ruby-sdk/api/subscription_service_api.rb +67 -0
- data/lib/wallee-ruby-sdk/api/token_service_api.rb +189 -0
- data/lib/wallee-ruby-sdk/api/transaction_terminal_service_api.rb +21 -32
- data/lib/wallee-ruby-sdk/api/web_app_service_api.rb +200 -0
- data/lib/wallee-ruby-sdk/api_client.rb +7 -4
- data/lib/wallee-ruby-sdk/configuration.rb +2 -2
- data/lib/wallee-ruby-sdk/models/abstract_account_update.rb +11 -1
- data/lib/wallee-ruby-sdk/models/abstract_payment_link_update.rb +15 -15
- data/lib/wallee-ruby-sdk/models/{abstract_shopify_subscription_product_active.rb → abstract_shopify_subscription_product_update.rb} +2 -12
- data/lib/wallee-ruby-sdk/models/abstract_space_update.rb +11 -1
- data/lib/wallee-ruby-sdk/models/abstract_subscription_product_active.rb +11 -1
- data/lib/wallee-ruby-sdk/models/abstract_transaction_pending.rb +59 -1
- data/lib/wallee-ruby-sdk/models/abstract_webhook_url_update.rb +24 -0
- data/lib/wallee-ruby-sdk/models/account.rb +31 -1
- data/lib/wallee-ruby-sdk/models/account_create.rb +11 -1
- data/lib/wallee-ruby-sdk/models/account_update.rb +11 -1
- data/lib/wallee-ruby-sdk/models/authenticated_card_data.rb +221 -0
- data/lib/wallee-ruby-sdk/models/{unencrypted_card_data.rb → authenticated_card_data_create.rb} +86 -12
- data/lib/wallee-ruby-sdk/models/bank_account.rb +291 -0
- data/lib/wallee-ruby-sdk/models/bank_account_environment.rb +35 -0
- data/lib/wallee-ruby-sdk/models/bank_account_state.rb +37 -0
- data/lib/wallee-ruby-sdk/models/bank_account_type.rb +227 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction.rb +387 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_flow_direction.rb +35 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_source.rb +215 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_state.rb +35 -0
- data/lib/wallee-ruby-sdk/models/bank_transaction_type.rb +215 -0
- data/lib/wallee-ruby-sdk/models/card_authentication_response.rb +38 -0
- data/lib/wallee-ruby-sdk/models/card_authentication_version.rb +35 -0
- data/lib/wallee-ruby-sdk/models/card_cryptogram.rb +201 -0
- data/lib/wallee-ruby-sdk/models/card_cryptogram_create.rb +211 -0
- data/lib/wallee-ruby-sdk/models/card_cryptogram_type.rb +34 -0
- data/lib/wallee-ruby-sdk/models/cardholder_authentication.rb +231 -0
- data/lib/wallee-ruby-sdk/models/cardholder_authentication_create.rb +241 -0
- data/lib/wallee-ruby-sdk/models/charge_attempt.rb +11 -1
- data/lib/wallee-ruby-sdk/models/charge_bank_transaction.rb +291 -0
- data/lib/wallee-ruby-sdk/models/currency_bank_account.rb +241 -0
- data/lib/wallee-ruby-sdk/models/debt_collection_case.rb +1 -1
- data/lib/wallee-ruby-sdk/models/debt_collection_case_create.rb +1 -1
- data/lib/wallee-ruby-sdk/models/external_transfer_bank_transaction.rb +251 -0
- data/lib/wallee-ruby-sdk/models/internal_transfer_bank_transaction.rb +231 -0
- data/lib/wallee-ruby-sdk/models/payment_adjustment.rb +231 -0
- data/lib/wallee-ruby-sdk/models/payment_adjustment_type.rb +215 -0
- data/lib/wallee-ruby-sdk/models/payment_connector_configuration.rb +13 -1
- data/lib/wallee-ruby-sdk/models/payment_contract.rb +1 -25
- data/lib/wallee-ruby-sdk/models/payment_link.rb +16 -40
- data/lib/wallee-ruby-sdk/models/payment_link_active.rb +15 -15
- data/lib/wallee-ruby-sdk/models/payment_link_address_handling_mode.rb +36 -0
- data/lib/wallee-ruby-sdk/models/payment_link_create.rb +16 -44
- data/lib/wallee-ruby-sdk/models/payment_link_update.rb +15 -15
- data/lib/wallee-ruby-sdk/models/payment_terminal.rb +11 -1
- data/lib/wallee-ruby-sdk/models/payment_terminal_address.rb +0 -60
- data/lib/wallee-ruby-sdk/models/payment_terminal_configuration_version.rb +11 -1
- data/lib/wallee-ruby-sdk/models/payment_terminal_location.rb +2 -22
- data/lib/wallee-ruby-sdk/models/payment_terminal_receipt_type.rb +215 -0
- data/lib/wallee-ruby-sdk/models/permission.rb +14 -4
- data/lib/wallee-ruby-sdk/models/recurring_indicator.rb +37 -0
- data/lib/wallee-ruby-sdk/models/refund_bank_transaction.rb +281 -0
- data/lib/wallee-ruby-sdk/models/refund_recovery_bank_transaction.rb +293 -0
- data/lib/wallee-ruby-sdk/models/rendered_terminal_receipt.rb +26 -6
- data/lib/wallee-ruby-sdk/models/role.rb +1 -1
- data/lib/wallee-ruby-sdk/models/role_state.rb +37 -0
- data/lib/wallee-ruby-sdk/models/sales_channel.rb +34 -4
- data/lib/wallee-ruby-sdk/models/shopify_additional_line_item_data.rb +35 -0
- data/lib/wallee-ruby-sdk/models/shopify_integration.rb +73 -31
- data/lib/wallee-ruby-sdk/models/shopify_integration_payment_app_version.rb +34 -0
- data/lib/wallee-ruby-sdk/models/{shopify_integration_app_version.rb → shopify_integration_subscription_app_version.rb} +3 -3
- data/lib/wallee-ruby-sdk/models/shopify_subscriber.rb +1 -1
- data/lib/wallee-ruby-sdk/models/shopify_subscriber_active.rb +241 -0
- data/lib/wallee-ruby-sdk/models/shopify_subscriber_creation.rb +216 -0
- data/lib/wallee-ruby-sdk/models/shopify_subscription.rb +61 -7
- data/lib/wallee-ruby-sdk/models/shopify_subscription_address.rb +0 -60
- data/lib/wallee-ruby-sdk/models/{payment_terminal_contact_address.rb → shopify_subscription_address_create.rb} +152 -2
- data/lib/wallee-ruby-sdk/models/shopify_subscription_creation_request.rb +363 -0
- data/lib/wallee-ruby-sdk/models/shopify_subscription_model_billing_configuration.rb +271 -0
- data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_item.rb → shopify_subscription_model_item.rb} +2 -2
- data/lib/wallee-ruby-sdk/models/{shopify_subscription_edit_model_tax_line.rb → shopify_subscription_model_tax_line.rb} +1 -1
- data/lib/wallee-ruby-sdk/models/shopify_subscription_product_create.rb +9 -14
- data/lib/wallee-ruby-sdk/models/{shopify_subscription_product_active.rb → shopify_subscription_product_update.rb} +2 -12
- data/lib/wallee-ruby-sdk/models/shopify_subscription_update_addresses_request.rb +211 -0
- data/lib/wallee-ruby-sdk/models/shopify_subscription_update_request.rb +11 -81
- data/lib/wallee-ruby-sdk/models/shopify_subscription_version.rb +11 -1
- data/lib/wallee-ruby-sdk/models/space.rb +31 -1
- data/lib/wallee-ruby-sdk/models/space_create.rb +11 -1
- data/lib/wallee-ruby-sdk/models/space_update.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscriber.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscriber_create.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscription.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscription_affiliate.rb +1 -25
- data/lib/wallee-ruby-sdk/models/subscription_affiliate_create.rb +1 -29
- data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleted.rb +1 -25
- data/lib/wallee-ruby-sdk/models/subscription_affiliate_deleting.rb +1 -25
- data/lib/wallee-ruby-sdk/models/subscription_charge.rb +49 -1
- data/lib/wallee-ruby-sdk/models/subscription_charge_create.rb +49 -1
- data/lib/wallee-ruby-sdk/models/subscription_create_request.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscription_ledger_entry.rb +12 -2
- data/lib/wallee-ruby-sdk/models/subscription_ledger_entry_create.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscription_product.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_active.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_component.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_component_update.rb +1 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_create.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_version.rb +11 -1
- data/lib/wallee-ruby-sdk/models/subscription_product_version_pending.rb +14 -4
- data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +206 -0
- data/lib/wallee-ruby-sdk/models/tax_calculation.rb +35 -0
- data/lib/wallee-ruby-sdk/models/terminal_receipt_fetch_request.rb +221 -0
- data/lib/wallee-ruby-sdk/models/terminal_receipt_format.rb +35 -0
- data/lib/wallee-ruby-sdk/models/token.rb +1 -25
- data/lib/wallee-ruby-sdk/models/token_create.rb +1 -29
- data/lib/wallee-ruby-sdk/models/tokenized_card_data.rb +211 -0
- data/lib/wallee-ruby-sdk/models/{unencrypted_card_data_create.rb → tokenized_card_data_create.rb} +60 -5
- data/lib/wallee-ruby-sdk/models/transaction.rb +132 -4
- data/lib/wallee-ruby-sdk/models/transaction_completion.rb +26 -1
- data/lib/wallee-ruby-sdk/models/transaction_completion_behavior.rb +36 -0
- data/lib/wallee-ruby-sdk/models/transaction_completion_request.rb +26 -1
- data/lib/wallee-ruby-sdk/models/transaction_create.rb +59 -1
- data/lib/wallee-ruby-sdk/models/transaction_pending.rb +59 -1
- data/lib/wallee-ruby-sdk/models/web_app_confirmation_request.rb +206 -0
- data/lib/wallee-ruby-sdk/models/web_app_confirmation_response.rb +231 -0
- data/lib/wallee-ruby-sdk/models/webhook_url.rb +35 -1
- data/lib/wallee-ruby-sdk/models/webhook_url_create.rb +24 -0
- data/lib/wallee-ruby-sdk/models/webhook_url_update.rb +24 -0
- data/lib/wallee-ruby-sdk/version.rb +1 -1
- data/test/condition_type_service_test.rb +22 -0
- data/wallee-ruby-sdk.gemspec +3 -2
- metadata +93 -17
@@ -0,0 +1,38 @@
|
|
1
|
+
=begin
|
2
|
+
The wallee API allows an easy interaction with the wallee web service.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'date'
|
19
|
+
|
20
|
+
module Wallee
|
21
|
+
class CardAuthenticationResponse
|
22
|
+
|
23
|
+
ENROLLMENT_VERIFICATION_ERROR = 'ENROLLMENT_VERIFICATION_ERROR'.freeze
|
24
|
+
NOT_ENROLLED = 'NOT_ENROLLED'.freeze
|
25
|
+
AUTHENTICATION_ERROR = 'AUTHENTICATION_ERROR'.freeze
|
26
|
+
AUTHENTICATION_NOT_REQUIRED = 'AUTHENTICATION_NOT_REQUIRED'.freeze
|
27
|
+
FULLY_AUTHENTICATED = 'FULLY_AUTHENTICATED'.freeze
|
28
|
+
|
29
|
+
# Builds the enum from string
|
30
|
+
# @param [String] The enum value in the form of the string
|
31
|
+
# @return [String] The enum value
|
32
|
+
def build_from_hash(value)
|
33
|
+
constantValues = CardAuthenticationResponse.constants.select { |c| CardAuthenticationResponse::const_get(c) == value }
|
34
|
+
raise "Invalid ENUM value #{value} for class #CardAuthenticationResponse" if constantValues.empty?
|
35
|
+
value
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
=begin
|
2
|
+
The wallee API allows an easy interaction with the wallee web service.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'date'
|
19
|
+
|
20
|
+
module Wallee
|
21
|
+
class CardAuthenticationVersion
|
22
|
+
|
23
|
+
V1 = 'V1'.freeze
|
24
|
+
V2 = 'V2'.freeze
|
25
|
+
|
26
|
+
# Builds the enum from string
|
27
|
+
# @param [String] The enum value in the form of the string
|
28
|
+
# @return [String] The enum value
|
29
|
+
def build_from_hash(value)
|
30
|
+
constantValues = CardAuthenticationVersion.constants.select { |c| CardAuthenticationVersion::const_get(c) == value }
|
31
|
+
raise "Invalid ENUM value #{value} for class #CardAuthenticationVersion" if constantValues.empty?
|
32
|
+
value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
=begin
|
2
|
+
The wallee API allows an easy interaction with the wallee web service.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'date'
|
19
|
+
|
20
|
+
module Wallee
|
21
|
+
# This model holds the additional card authentication.
|
22
|
+
class CardCryptogram
|
23
|
+
#
|
24
|
+
attr_accessor :type
|
25
|
+
|
26
|
+
#
|
27
|
+
attr_accessor :value
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'type' => :'type',
|
33
|
+
:'value' => :'value'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'type' => :'CardCryptogramType',
|
41
|
+
:'value' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
|
+
|
53
|
+
if attributes.has_key?(:'type')
|
54
|
+
self.type = attributes[:'type']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'value')
|
58
|
+
self.value = attributes[:'value']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
63
|
+
# @return Array for valid properties with the reasons
|
64
|
+
def list_invalid_properties
|
65
|
+
invalid_properties = Array.new
|
66
|
+
invalid_properties
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check to see if the all the properties in the model are valid
|
70
|
+
# @return true if the model is valid
|
71
|
+
def valid?
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
# Checks equality by comparing each attribute.
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def ==(o)
|
78
|
+
return true if self.equal?(o)
|
79
|
+
self.class == o.class &&
|
80
|
+
type == o.type &&
|
81
|
+
value == o.value
|
82
|
+
end
|
83
|
+
|
84
|
+
# @see the `==` method
|
85
|
+
# @param [Object] Object to be compared
|
86
|
+
def eql?(o)
|
87
|
+
self == o
|
88
|
+
end
|
89
|
+
|
90
|
+
# Calculates hash code according to all attributes.
|
91
|
+
# @return [Fixnum] Hash code
|
92
|
+
def hash
|
93
|
+
[type, value].hash
|
94
|
+
end
|
95
|
+
|
96
|
+
# Builds the object from hash
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
+
# @return [Object] Returns the model itself
|
99
|
+
def build_from_hash(attributes)
|
100
|
+
return nil unless attributes.is_a?(Hash)
|
101
|
+
self.class.swagger_types.each_pair do |key, type|
|
102
|
+
if type =~ /\AArray<(.*)>/i
|
103
|
+
# check to ensure the input is an array given that the attribute
|
104
|
+
# is documented as an array but the input is not
|
105
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
106
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
107
|
+
end
|
108
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
109
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
110
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
111
|
+
end
|
112
|
+
|
113
|
+
self
|
114
|
+
end
|
115
|
+
|
116
|
+
# Deserializes the data based on type
|
117
|
+
# @param string type Data type
|
118
|
+
# @param string value Value to be deserialized
|
119
|
+
# @return [Object] Deserialized data
|
120
|
+
def _deserialize(type, value)
|
121
|
+
case type.to_sym
|
122
|
+
when :DateTime
|
123
|
+
DateTime.parse(value)
|
124
|
+
when :Date
|
125
|
+
Date.parse(value)
|
126
|
+
when :String
|
127
|
+
value.to_s
|
128
|
+
when :Integer
|
129
|
+
value.to_i
|
130
|
+
when :Float
|
131
|
+
value.to_f
|
132
|
+
when :BOOLEAN
|
133
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
134
|
+
true
|
135
|
+
else
|
136
|
+
false
|
137
|
+
end
|
138
|
+
when :Object
|
139
|
+
# generic object (usually a Hash), return directly
|
140
|
+
value
|
141
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
142
|
+
inner_type = Regexp.last_match[:inner_type]
|
143
|
+
value.map { |v| _deserialize(inner_type, v) }
|
144
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
145
|
+
k_type = Regexp.last_match[:k_type]
|
146
|
+
v_type = Regexp.last_match[:v_type]
|
147
|
+
{}.tap do |hash|
|
148
|
+
value.each do |k, v|
|
149
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
else # model
|
153
|
+
temp_model = Wallee.const_get(type).new
|
154
|
+
temp_model.build_from_hash(value)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Returns the string representation of the object
|
159
|
+
# @return [String] String presentation of the object
|
160
|
+
def to_s
|
161
|
+
to_hash.to_s
|
162
|
+
end
|
163
|
+
|
164
|
+
# to_body is an alias to to_hash (backward compatibility)
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_body
|
167
|
+
to_hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Returns the object in the form of hash
|
171
|
+
# @return [Hash] Returns the object in the form of hash
|
172
|
+
def to_hash
|
173
|
+
hash = {}
|
174
|
+
self.class.attribute_map.each_pair do |attr, param|
|
175
|
+
value = self.send(attr)
|
176
|
+
next if value.nil?
|
177
|
+
hash[param] = _to_hash(value)
|
178
|
+
end
|
179
|
+
hash
|
180
|
+
end
|
181
|
+
|
182
|
+
# Outputs non-array value in the form of hash
|
183
|
+
# For object, use to_hash. Otherwise, just return the value
|
184
|
+
# @param [Object] value Any valid value
|
185
|
+
# @return [Hash] Returns the value in the form of hash
|
186
|
+
def _to_hash(value)
|
187
|
+
if value.is_a?(Array)
|
188
|
+
value.compact.map{ |v| _to_hash(v) }
|
189
|
+
elsif value.is_a?(Hash)
|
190
|
+
{}.tap do |hash|
|
191
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
192
|
+
end
|
193
|
+
elsif value.respond_to? :to_hash
|
194
|
+
value.to_hash
|
195
|
+
else
|
196
|
+
value
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,211 @@
|
|
1
|
+
=begin
|
2
|
+
The wallee API allows an easy interaction with the wallee web service.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
|
16
|
+
=end
|
17
|
+
|
18
|
+
require 'date'
|
19
|
+
|
20
|
+
module Wallee
|
21
|
+
# This model holds the additional card authentication.
|
22
|
+
class CardCryptogramCreate
|
23
|
+
#
|
24
|
+
attr_accessor :type
|
25
|
+
|
26
|
+
#
|
27
|
+
attr_accessor :value
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'type' => :'type',
|
33
|
+
:'value' => :'value'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Attribute type mapping.
|
38
|
+
def self.swagger_types
|
39
|
+
{
|
40
|
+
:'type' => :'CardCryptogramType',
|
41
|
+
:'value' => :'String'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
return unless attributes.is_a?(Hash)
|
49
|
+
|
50
|
+
# convert string to symbol for hash key
|
51
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
|
+
|
53
|
+
if attributes.has_key?(:'type')
|
54
|
+
self.type = attributes[:'type']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'value')
|
58
|
+
self.value = attributes[:'value']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
63
|
+
# @return Array for valid properties with the reasons
|
64
|
+
def list_invalid_properties
|
65
|
+
invalid_properties = Array.new
|
66
|
+
if @type.nil?
|
67
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
68
|
+
end
|
69
|
+
|
70
|
+
if @value.nil?
|
71
|
+
invalid_properties.push('invalid value for "value", value cannot be nil.')
|
72
|
+
end
|
73
|
+
|
74
|
+
invalid_properties
|
75
|
+
end
|
76
|
+
|
77
|
+
# Check to see if the all the properties in the model are valid
|
78
|
+
# @return true if the model is valid
|
79
|
+
def valid?
|
80
|
+
return false if @type.nil?
|
81
|
+
return false if @value.nil?
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
# Checks equality by comparing each attribute.
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def ==(o)
|
88
|
+
return true if self.equal?(o)
|
89
|
+
self.class == o.class &&
|
90
|
+
type == o.type &&
|
91
|
+
value == o.value
|
92
|
+
end
|
93
|
+
|
94
|
+
# @see the `==` method
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def eql?(o)
|
97
|
+
self == o
|
98
|
+
end
|
99
|
+
|
100
|
+
# Calculates hash code according to all attributes.
|
101
|
+
# @return [Fixnum] Hash code
|
102
|
+
def hash
|
103
|
+
[type, value].hash
|
104
|
+
end
|
105
|
+
|
106
|
+
# Builds the object from hash
|
107
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
108
|
+
# @return [Object] Returns the model itself
|
109
|
+
def build_from_hash(attributes)
|
110
|
+
return nil unless attributes.is_a?(Hash)
|
111
|
+
self.class.swagger_types.each_pair do |key, type|
|
112
|
+
if type =~ /\AArray<(.*)>/i
|
113
|
+
# check to ensure the input is an array given that the attribute
|
114
|
+
# is documented as an array but the input is not
|
115
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
116
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
117
|
+
end
|
118
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
119
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
120
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
# Deserializes the data based on type
|
127
|
+
# @param string type Data type
|
128
|
+
# @param string value Value to be deserialized
|
129
|
+
# @return [Object] Deserialized data
|
130
|
+
def _deserialize(type, value)
|
131
|
+
case type.to_sym
|
132
|
+
when :DateTime
|
133
|
+
DateTime.parse(value)
|
134
|
+
when :Date
|
135
|
+
Date.parse(value)
|
136
|
+
when :String
|
137
|
+
value.to_s
|
138
|
+
when :Integer
|
139
|
+
value.to_i
|
140
|
+
when :Float
|
141
|
+
value.to_f
|
142
|
+
when :BOOLEAN
|
143
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
144
|
+
true
|
145
|
+
else
|
146
|
+
false
|
147
|
+
end
|
148
|
+
when :Object
|
149
|
+
# generic object (usually a Hash), return directly
|
150
|
+
value
|
151
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
152
|
+
inner_type = Regexp.last_match[:inner_type]
|
153
|
+
value.map { |v| _deserialize(inner_type, v) }
|
154
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
155
|
+
k_type = Regexp.last_match[:k_type]
|
156
|
+
v_type = Regexp.last_match[:v_type]
|
157
|
+
{}.tap do |hash|
|
158
|
+
value.each do |k, v|
|
159
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
else # model
|
163
|
+
temp_model = Wallee.const_get(type).new
|
164
|
+
temp_model.build_from_hash(value)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Returns the string representation of the object
|
169
|
+
# @return [String] String presentation of the object
|
170
|
+
def to_s
|
171
|
+
to_hash.to_s
|
172
|
+
end
|
173
|
+
|
174
|
+
# to_body is an alias to to_hash (backward compatibility)
|
175
|
+
# @return [Hash] Returns the object in the form of hash
|
176
|
+
def to_body
|
177
|
+
to_hash
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the object in the form of hash
|
181
|
+
# @return [Hash] Returns the object in the form of hash
|
182
|
+
def to_hash
|
183
|
+
hash = {}
|
184
|
+
self.class.attribute_map.each_pair do |attr, param|
|
185
|
+
value = self.send(attr)
|
186
|
+
next if value.nil?
|
187
|
+
hash[param] = _to_hash(value)
|
188
|
+
end
|
189
|
+
hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Outputs non-array value in the form of hash
|
193
|
+
# For object, use to_hash. Otherwise, just return the value
|
194
|
+
# @param [Object] value Any valid value
|
195
|
+
# @return [Hash] Returns the value in the form of hash
|
196
|
+
def _to_hash(value)
|
197
|
+
if value.is_a?(Array)
|
198
|
+
value.compact.map{ |v| _to_hash(v) }
|
199
|
+
elsif value.is_a?(Hash)
|
200
|
+
{}.tap do |hash|
|
201
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
202
|
+
end
|
203
|
+
elsif value.respond_to? :to_hash
|
204
|
+
value.to_hash
|
205
|
+
else
|
206
|
+
value
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
end
|