postfinancecheckout-ruby-sdk 6.2.0 → 6.4.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +56 -14
- data/LICENSE +1 -1
- data/README.md +57 -29
- data/lib/postfinancecheckout-ruby-sdk/api_client.rb +1 -1
- data/lib/postfinancecheckout-ruby-sdk/api_exception_error_codes.rb +60 -0
- data/lib/postfinancecheckout-ruby-sdk/models/bogus_express_checkout_approval_request.rb +230 -0
- data/lib/postfinancecheckout-ruby-sdk/models/bogus_express_checkout_payment_data.rb +241 -0
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_approval_response.rb +270 -0
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_create_response.rb +13 -4
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_session.rb +39 -1
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_session_create.rb +21 -1
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_address_change_request.rb +239 -0
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_address_change_response.rb +241 -0
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_request.rb +231 -0
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_response.rb +241 -0
- data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_option.rb +1 -1
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_address.rb +43 -5
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_dcc_transaction_sum.rb +302 -0
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_transaction_sum.rb +332 -0
- data/lib/postfinancecheckout-ruby-sdk/models/payment_terminal_transaction_summary.rb +347 -0
- data/lib/postfinancecheckout-ruby-sdk/models/refund.rb +13 -1
- data/lib/postfinancecheckout-ruby-sdk/models/refund_create.rb +13 -1
- data/lib/postfinancecheckout-ruby-sdk/models/rendered_terminal_transaction_summary.rb +241 -0
- data/lib/postfinancecheckout-ruby-sdk/models/scope.rb +15 -15
- data/lib/postfinancecheckout-ruby-sdk/models/subscription_update_request.rb +45 -22
- data/lib/postfinancecheckout-ruby-sdk/models/terminal_transaction_summary_list_response.rb +253 -0
- data/lib/postfinancecheckout-ruby-sdk/models/terminal_transaction_summary_search_response.rb +263 -0
- data/lib/postfinancecheckout-ruby-sdk/models/transaction_completion.rb +13 -1
- data/lib/postfinancecheckout-ruby-sdk/models/transaction_completion_details.rb +26 -4
- data/lib/postfinancecheckout-ruby-sdk/models/transaction_user_interface_type.rb +2 -1
- data/lib/postfinancecheckout-ruby-sdk/postfinancecheckout_sdk_exception.rb +2 -33
- data/lib/postfinancecheckout-ruby-sdk/sdk_exception_error_codes.rb +55 -0
- data/lib/postfinancecheckout-ruby-sdk/service/bogus_express_checkout_service.rb +114 -0
- data/lib/postfinancecheckout-ruby-sdk/service/express_checkout_service.rb +162 -0
- data/lib/postfinancecheckout-ruby-sdk/service/payment_terminal_transaction_summaries_service.rb +372 -0
- data/lib/postfinancecheckout-ruby-sdk/service/webhook_encryption_keys_service.rb +2 -2
- data/lib/postfinancecheckout-ruby-sdk/utils/encryption_util.rb +5 -5
- data/lib/postfinancecheckout-ruby-sdk/version.rb +1 -1
- data/lib/postfinancecheckout-ruby-sdk.rb +20 -1
- data/test/test_querying.rb +11 -0
- metadata +19 -2
data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_request.rb
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
# PostFinance Ruby SDK
|
|
3
|
+
#
|
|
4
|
+
# This library allows to interact with the PostFinance payment service.
|
|
5
|
+
#
|
|
6
|
+
# Copyright owner: Wallee AG
|
|
7
|
+
# Website: https://www.postfinance.ch/en/private.html
|
|
8
|
+
# Developer email: ecosystem-team@wallee.com
|
|
9
|
+
#
|
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
# you may not use this file except in compliance with the License.
|
|
12
|
+
# You may obtain a copy of the License at
|
|
13
|
+
#
|
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
#
|
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
# See the License for the specific language governing permissions and
|
|
20
|
+
# limitations under the License.
|
|
21
|
+
=end
|
|
22
|
+
|
|
23
|
+
require 'date'
|
|
24
|
+
require 'time'
|
|
25
|
+
|
|
26
|
+
module PostfinancecheckoutRubySdk
|
|
27
|
+
class ExpressCheckoutShippingMethodChangeRequest
|
|
28
|
+
# Identifier of the selected shipping option.
|
|
29
|
+
attr_accessor :shipping_method_id
|
|
30
|
+
|
|
31
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
32
|
+
def self.attribute_map
|
|
33
|
+
{
|
|
34
|
+
:'shipping_method_id' => :'shippingMethodId'
|
|
35
|
+
}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns attribute mapping this model knows about
|
|
39
|
+
def self.acceptable_attribute_map
|
|
40
|
+
attribute_map
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Returns all the JSON keys this model knows about
|
|
44
|
+
def self.acceptable_attributes
|
|
45
|
+
acceptable_attribute_map.values
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Attribute type mapping.
|
|
49
|
+
def self.openapi_types
|
|
50
|
+
{
|
|
51
|
+
:'shipping_method_id' => :'String'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of attributes with nullable: true
|
|
56
|
+
def self.openapi_nullable
|
|
57
|
+
Set.new([
|
|
58
|
+
])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Initializes the object
|
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
63
|
+
def initialize(attributes = {})
|
|
64
|
+
if (!attributes.is_a?(Hash))
|
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::ExpressCheckoutShippingMethodChangeRequest` initialize method"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
69
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::ExpressCheckoutShippingMethodChangeRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
73
|
+
end
|
|
74
|
+
h[k.to_sym] = v
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'shipping_method_id')
|
|
78
|
+
self.shipping_method_id = attributes[:'shipping_method_id']
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
83
|
+
# @return Array for valid properties with the reasons
|
|
84
|
+
def list_invalid_properties
|
|
85
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
86
|
+
invalid_properties = Array.new
|
|
87
|
+
invalid_properties
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Check to see if the all the properties in the model are valid
|
|
91
|
+
# @return true if the model is valid
|
|
92
|
+
def valid?
|
|
93
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
94
|
+
true
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Checks equality by comparing each attribute.
|
|
98
|
+
# @param [Object] Object to be compared
|
|
99
|
+
def ==(o)
|
|
100
|
+
return true if self.equal?(o)
|
|
101
|
+
self.class == o.class &&
|
|
102
|
+
shipping_method_id == o.shipping_method_id
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# @see the `==` method
|
|
106
|
+
# @param [Object] Object to be compared
|
|
107
|
+
def eql?(o)
|
|
108
|
+
self == o
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Calculates hash code according to all attributes.
|
|
112
|
+
# @return [Integer] Hash code
|
|
113
|
+
def hash
|
|
114
|
+
[shipping_method_id].hash
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Builds the object from hash
|
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
119
|
+
# @return [Object] Returns the model itself
|
|
120
|
+
def self.build_from_hash(attributes)
|
|
121
|
+
return nil unless attributes.is_a?(Hash)
|
|
122
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
123
|
+
transformed_hash = {}
|
|
124
|
+
openapi_types.each_pair do |key, type|
|
|
125
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
126
|
+
transformed_hash["#{key}"] = nil
|
|
127
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
128
|
+
# check to ensure the input is an array given that the attribute
|
|
129
|
+
# is documented as an array but the input is not
|
|
130
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
131
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
132
|
+
end
|
|
133
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
134
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
new(transformed_hash)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Deserializes the data based on type
|
|
141
|
+
# @param string type Data type
|
|
142
|
+
# @param string value Value to be deserialized
|
|
143
|
+
# @return [Object] Deserialized data
|
|
144
|
+
def self._deserialize(type, value)
|
|
145
|
+
case type.to_sym
|
|
146
|
+
when :Time
|
|
147
|
+
Time.parse(value)
|
|
148
|
+
when :Date
|
|
149
|
+
Date.parse(value)
|
|
150
|
+
when :String
|
|
151
|
+
value.to_s
|
|
152
|
+
when :Integer
|
|
153
|
+
value.to_i
|
|
154
|
+
when :Float
|
|
155
|
+
value.to_f
|
|
156
|
+
when :Boolean
|
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
158
|
+
true
|
|
159
|
+
else
|
|
160
|
+
false
|
|
161
|
+
end
|
|
162
|
+
when :Object
|
|
163
|
+
# generic object (usually a Hash), return directly
|
|
164
|
+
value
|
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
|
171
|
+
{}.tap do |hash|
|
|
172
|
+
value.each do |k, v|
|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
else # model
|
|
177
|
+
# models (e.g. Pet) or oneOf
|
|
178
|
+
klass = PostfinancecheckoutRubySdk.const_get(type)
|
|
179
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# Returns the string representation of the object
|
|
184
|
+
# @return [String] String presentation of the object
|
|
185
|
+
def to_s
|
|
186
|
+
to_hash.to_s
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
|
191
|
+
def to_body
|
|
192
|
+
to_hash
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Returns the object in the form of hash
|
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
|
197
|
+
def to_hash
|
|
198
|
+
hash = {}
|
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
200
|
+
value = self.send(attr)
|
|
201
|
+
if value.nil?
|
|
202
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
203
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
hash[param] = _to_hash(value)
|
|
207
|
+
end
|
|
208
|
+
hash
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Outputs non-array value in the form of hash
|
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
213
|
+
# @param [Object] value Any valid value
|
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
|
215
|
+
def _to_hash(value)
|
|
216
|
+
if value.is_a?(Array)
|
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
|
218
|
+
elsif value.is_a?(Hash)
|
|
219
|
+
{}.tap do |hash|
|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
221
|
+
end
|
|
222
|
+
elsif value.respond_to? :to_hash
|
|
223
|
+
value.to_hash
|
|
224
|
+
else
|
|
225
|
+
value
|
|
226
|
+
end
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
end
|
data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_response.rb
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
# PostFinance Ruby SDK
|
|
3
|
+
#
|
|
4
|
+
# This library allows to interact with the PostFinance payment service.
|
|
5
|
+
#
|
|
6
|
+
# Copyright owner: Wallee AG
|
|
7
|
+
# Website: https://www.postfinance.ch/en/private.html
|
|
8
|
+
# Developer email: ecosystem-team@wallee.com
|
|
9
|
+
#
|
|
10
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
# you may not use this file except in compliance with the License.
|
|
12
|
+
# You may obtain a copy of the License at
|
|
13
|
+
#
|
|
14
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
#
|
|
16
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
# See the License for the specific language governing permissions and
|
|
20
|
+
# limitations under the License.
|
|
21
|
+
=end
|
|
22
|
+
|
|
23
|
+
require 'date'
|
|
24
|
+
require 'time'
|
|
25
|
+
|
|
26
|
+
module PostfinancecheckoutRubySdk
|
|
27
|
+
class ExpressCheckoutShippingMethodChangeResponse
|
|
28
|
+
attr_accessor :line_items
|
|
29
|
+
|
|
30
|
+
attr_accessor :order_total
|
|
31
|
+
|
|
32
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
|
+
def self.attribute_map
|
|
34
|
+
{
|
|
35
|
+
:'line_items' => :'lineItems',
|
|
36
|
+
:'order_total' => :'orderTotal'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns attribute mapping this model knows about
|
|
41
|
+
def self.acceptable_attribute_map
|
|
42
|
+
attribute_map
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Returns all the JSON keys this model knows about
|
|
46
|
+
def self.acceptable_attributes
|
|
47
|
+
acceptable_attribute_map.values
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Attribute type mapping.
|
|
51
|
+
def self.openapi_types
|
|
52
|
+
{
|
|
53
|
+
:'line_items' => :'Array<LineItem>',
|
|
54
|
+
:'order_total' => :'Float'
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# List of attributes with nullable: true
|
|
59
|
+
def self.openapi_nullable
|
|
60
|
+
Set.new([
|
|
61
|
+
])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# Initializes the object
|
|
65
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
66
|
+
def initialize(attributes = {})
|
|
67
|
+
if (!attributes.is_a?(Hash))
|
|
68
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::ExpressCheckoutShippingMethodChangeResponse` initialize method"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
72
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
73
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
74
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
75
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::ExpressCheckoutShippingMethodChangeResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
76
|
+
end
|
|
77
|
+
h[k.to_sym] = v
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'line_items')
|
|
81
|
+
if (value = attributes[:'line_items']).is_a?(Array)
|
|
82
|
+
self.line_items = value
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if attributes.key?(:'order_total')
|
|
87
|
+
self.order_total = attributes[:'order_total']
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
92
|
+
# @return Array for valid properties with the reasons
|
|
93
|
+
def list_invalid_properties
|
|
94
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
95
|
+
invalid_properties = Array.new
|
|
96
|
+
invalid_properties
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Check to see if the all the properties in the model are valid
|
|
100
|
+
# @return true if the model is valid
|
|
101
|
+
def valid?
|
|
102
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
103
|
+
true
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Checks equality by comparing each attribute.
|
|
107
|
+
# @param [Object] Object to be compared
|
|
108
|
+
def ==(o)
|
|
109
|
+
return true if self.equal?(o)
|
|
110
|
+
self.class == o.class &&
|
|
111
|
+
line_items == o.line_items &&
|
|
112
|
+
order_total == o.order_total
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# @see the `==` method
|
|
116
|
+
# @param [Object] Object to be compared
|
|
117
|
+
def eql?(o)
|
|
118
|
+
self == o
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Calculates hash code according to all attributes.
|
|
122
|
+
# @return [Integer] Hash code
|
|
123
|
+
def hash
|
|
124
|
+
[line_items, order_total].hash
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Builds the object from hash
|
|
128
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
129
|
+
# @return [Object] Returns the model itself
|
|
130
|
+
def self.build_from_hash(attributes)
|
|
131
|
+
return nil unless attributes.is_a?(Hash)
|
|
132
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
133
|
+
transformed_hash = {}
|
|
134
|
+
openapi_types.each_pair do |key, type|
|
|
135
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
136
|
+
transformed_hash["#{key}"] = nil
|
|
137
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
138
|
+
# check to ensure the input is an array given that the attribute
|
|
139
|
+
# is documented as an array but the input is not
|
|
140
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
141
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
142
|
+
end
|
|
143
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
144
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
new(transformed_hash)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Deserializes the data based on type
|
|
151
|
+
# @param string type Data type
|
|
152
|
+
# @param string value Value to be deserialized
|
|
153
|
+
# @return [Object] Deserialized data
|
|
154
|
+
def self._deserialize(type, value)
|
|
155
|
+
case type.to_sym
|
|
156
|
+
when :Time
|
|
157
|
+
Time.parse(value)
|
|
158
|
+
when :Date
|
|
159
|
+
Date.parse(value)
|
|
160
|
+
when :String
|
|
161
|
+
value.to_s
|
|
162
|
+
when :Integer
|
|
163
|
+
value.to_i
|
|
164
|
+
when :Float
|
|
165
|
+
value.to_f
|
|
166
|
+
when :Boolean
|
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
168
|
+
true
|
|
169
|
+
else
|
|
170
|
+
false
|
|
171
|
+
end
|
|
172
|
+
when :Object
|
|
173
|
+
# generic object (usually a Hash), return directly
|
|
174
|
+
value
|
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
|
181
|
+
{}.tap do |hash|
|
|
182
|
+
value.each do |k, v|
|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
else # model
|
|
187
|
+
# models (e.g. Pet) or oneOf
|
|
188
|
+
klass = PostfinancecheckoutRubySdk.const_get(type)
|
|
189
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# Returns the string representation of the object
|
|
194
|
+
# @return [String] String presentation of the object
|
|
195
|
+
def to_s
|
|
196
|
+
to_hash.to_s
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
|
201
|
+
def to_body
|
|
202
|
+
to_hash
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
# Returns the object in the form of hash
|
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
|
207
|
+
def to_hash
|
|
208
|
+
hash = {}
|
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
210
|
+
value = self.send(attr)
|
|
211
|
+
if value.nil?
|
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
hash[param] = _to_hash(value)
|
|
217
|
+
end
|
|
218
|
+
hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Outputs non-array value in the form of hash
|
|
222
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
223
|
+
# @param [Object] value Any valid value
|
|
224
|
+
# @return [Hash] Returns the value in the form of hash
|
|
225
|
+
def _to_hash(value)
|
|
226
|
+
if value.is_a?(Array)
|
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
|
228
|
+
elsif value.is_a?(Hash)
|
|
229
|
+
{}.tap do |hash|
|
|
230
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
231
|
+
end
|
|
232
|
+
elsif value.respond_to? :to_hash
|
|
233
|
+
value.to_hash
|
|
234
|
+
else
|
|
235
|
+
value
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
end
|
|
@@ -205,12 +205,20 @@ module PostfinancecheckoutRubySdk
|
|
|
205
205
|
invalid_properties.push('invalid value for "mobile_phone_number", the character length must be smaller than or equal to 100.')
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
+
if !@postcode.nil? && @postcode.to_s.length > 12
|
|
209
|
+
invalid_properties.push('invalid value for "postcode", the character length must be smaller than or equal to 12.')
|
|
210
|
+
end
|
|
211
|
+
|
|
208
212
|
if !@dependent_locality.nil? && @dependent_locality.to_s.length > 100
|
|
209
213
|
invalid_properties.push('invalid value for "dependent_locality", the character length must be smaller than or equal to 100.')
|
|
210
214
|
end
|
|
211
215
|
|
|
212
|
-
if !@email_address.nil? && @email_address.to_s.length >
|
|
213
|
-
invalid_properties.push('invalid value for "email_address", the character length must be smaller than or equal to
|
|
216
|
+
if !@email_address.nil? && @email_address.to_s.length > 80
|
|
217
|
+
invalid_properties.push('invalid value for "email_address", the character length must be smaller than or equal to 80.')
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if !@phone_number.nil? && @phone_number.to_s.length > 20
|
|
221
|
+
invalid_properties.push('invalid value for "phone_number", the character length must be smaller than or equal to 20.')
|
|
214
222
|
end
|
|
215
223
|
|
|
216
224
|
if !@sorting_code.nil? && @sorting_code.to_s.length > 100
|
|
@@ -229,8 +237,10 @@ module PostfinancecheckoutRubySdk
|
|
|
229
237
|
def valid?
|
|
230
238
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
231
239
|
return false if !@mobile_phone_number.nil? && @mobile_phone_number.to_s.length > 100
|
|
240
|
+
return false if !@postcode.nil? && @postcode.to_s.length > 12
|
|
232
241
|
return false if !@dependent_locality.nil? && @dependent_locality.to_s.length > 100
|
|
233
|
-
return false if !@email_address.nil? && @email_address.to_s.length >
|
|
242
|
+
return false if !@email_address.nil? && @email_address.to_s.length > 80
|
|
243
|
+
return false if !@phone_number.nil? && @phone_number.to_s.length > 20
|
|
234
244
|
return false if !@sorting_code.nil? && @sorting_code.to_s.length > 100
|
|
235
245
|
return false if !@salutation.nil? && @salutation.to_s.length > 20
|
|
236
246
|
true
|
|
@@ -250,6 +260,20 @@ module PostfinancecheckoutRubySdk
|
|
|
250
260
|
@mobile_phone_number = mobile_phone_number
|
|
251
261
|
end
|
|
252
262
|
|
|
263
|
+
# Custom attribute writer method with validation
|
|
264
|
+
# @param [Object] postcode Value to be assigned
|
|
265
|
+
def postcode=(postcode)
|
|
266
|
+
if postcode.nil?
|
|
267
|
+
fail ArgumentError, 'postcode cannot be nil'
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
if postcode.to_s.length > 12
|
|
271
|
+
fail ArgumentError, 'invalid value for "postcode", the character length must be smaller than or equal to 12.'
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
@postcode = postcode
|
|
275
|
+
end
|
|
276
|
+
|
|
253
277
|
# Custom attribute writer method with validation
|
|
254
278
|
# @param [Object] dependent_locality Value to be assigned
|
|
255
279
|
def dependent_locality=(dependent_locality)
|
|
@@ -271,13 +295,27 @@ module PostfinancecheckoutRubySdk
|
|
|
271
295
|
fail ArgumentError, 'email_address cannot be nil'
|
|
272
296
|
end
|
|
273
297
|
|
|
274
|
-
if email_address.to_s.length >
|
|
275
|
-
fail ArgumentError, 'invalid value for "email_address", the character length must be smaller than or equal to
|
|
298
|
+
if email_address.to_s.length > 80
|
|
299
|
+
fail ArgumentError, 'invalid value for "email_address", the character length must be smaller than or equal to 80.'
|
|
276
300
|
end
|
|
277
301
|
|
|
278
302
|
@email_address = email_address
|
|
279
303
|
end
|
|
280
304
|
|
|
305
|
+
# Custom attribute writer method with validation
|
|
306
|
+
# @param [Object] phone_number Value to be assigned
|
|
307
|
+
def phone_number=(phone_number)
|
|
308
|
+
if phone_number.nil?
|
|
309
|
+
fail ArgumentError, 'phone_number cannot be nil'
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if phone_number.to_s.length > 20
|
|
313
|
+
fail ArgumentError, 'invalid value for "phone_number", the character length must be smaller than or equal to 20.'
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
@phone_number = phone_number
|
|
317
|
+
end
|
|
318
|
+
|
|
281
319
|
# Custom attribute writer method with validation
|
|
282
320
|
# @param [Object] sorting_code Value to be assigned
|
|
283
321
|
def sorting_code=(sorting_code)
|