postfinancecheckout-ruby-sdk 6.3.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.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +55 -13
  3. data/LICENSE +1 -1
  4. data/README.md +22 -0
  5. data/lib/postfinancecheckout-ruby-sdk/api_client.rb +1 -1
  6. data/lib/postfinancecheckout-ruby-sdk/models/bogus_express_checkout_approval_request.rb +230 -0
  7. data/lib/postfinancecheckout-ruby-sdk/models/bogus_express_checkout_payment_data.rb +241 -0
  8. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_approval_response.rb +270 -0
  9. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_create_response.rb +13 -4
  10. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_session.rb +39 -1
  11. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_session_create.rb +21 -1
  12. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_address_change_request.rb +239 -0
  13. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_address_change_response.rb +241 -0
  14. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_request.rb +231 -0
  15. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_method_change_response.rb +241 -0
  16. data/lib/postfinancecheckout-ruby-sdk/models/express_checkout_shipping_option.rb +1 -1
  17. data/lib/postfinancecheckout-ruby-sdk/models/refund.rb +13 -1
  18. data/lib/postfinancecheckout-ruby-sdk/models/refund_create.rb +13 -1
  19. data/lib/postfinancecheckout-ruby-sdk/models/scope.rb +15 -15
  20. data/lib/postfinancecheckout-ruby-sdk/models/subscription_update_request.rb +45 -22
  21. data/lib/postfinancecheckout-ruby-sdk/models/transaction_completion.rb +13 -1
  22. data/lib/postfinancecheckout-ruby-sdk/models/transaction_completion_details.rb +26 -4
  23. data/lib/postfinancecheckout-ruby-sdk/models/transaction_user_interface_type.rb +2 -1
  24. data/lib/postfinancecheckout-ruby-sdk/service/bogus_express_checkout_service.rb +114 -0
  25. data/lib/postfinancecheckout-ruby-sdk/service/express_checkout_service.rb +162 -0
  26. data/lib/postfinancecheckout-ruby-sdk/version.rb +1 -1
  27. data/lib/postfinancecheckout-ruby-sdk.rb +8 -0
  28. data/test/test_querying.rb +11 -0
  29. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42bd24175357923ed98acf47171d8eba0536e7d72cd3ce04b42490b57788eed2
4
- data.tar.gz: 9282f8c77cd066075bba5971c7111abbb50e6d9f5d6e14948a66cd9c2bf85e82
3
+ metadata.gz: 0c3fdff56d8c555fe0dd4de0f5937407e26bcf7e6a9fa7a8da3ad9758203cd8b
4
+ data.tar.gz: bd6a0c8653adcda3538a23310971c1af75fd343abcd62841074fba52641c9991
5
5
  SHA512:
6
- metadata.gz: 25c78ce4431c448f2f02a04342eb0b86cb2dd42c255bc9380046b55fe9346b1f7ee08991f11bb6b19e105166cd31733a25502b48f306e318187de8918b853139
7
- data.tar.gz: 9f25ec50222c139167f0419f9672a275c4f72ff2bd3c40faa00e3cfa8e0a6584a990544fe8e823e57b24037176973844019f01ba124b85225b49bbf823661421
6
+ metadata.gz: fee832f6d7d360d999b4d95b479629ebba0cded29743a3946fcbdb4aa2d3641b5a0aeed035fd9e57841e165065509c531590690b5e496e4cd21c7943ed58e6fe
7
+ data.tar.gz: 53e6560a9583420d0da6a6fdf258ce50b8f57539f7e57897eb1f4f572b87c56443ec88ad549cc53cb044e5391c3f0869452a8854805cb41cf977b362998a1d58
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- postfinancecheckout-ruby-sdk (6.3.0)
4
+ postfinancecheckout-ruby-sdk (6.4.0)
5
5
  concurrent-ruby (~> 1.3.5)
6
6
  faraday (~> 2.13.1, < 3.0)
7
7
  faraday-multipart (~> 1.1.0)
@@ -13,9 +13,10 @@ GEM
13
13
  specs:
14
14
  ast (2.4.3)
15
15
  base64 (0.3.0)
16
- byebug (12.0.0)
16
+ byebug (13.0.0)
17
+ reline (>= 0.6.0)
17
18
  coderay (1.1.3)
18
- concurrent-ruby (1.3.5)
19
+ concurrent-ruby (1.3.6)
19
20
  date (3.5.1)
20
21
  faraday (2.13.4)
21
22
  faraday-net_http (>= 2.0, < 3.5)
@@ -25,33 +26,37 @@ GEM
25
26
  multipart-post (~> 2.0)
26
27
  faraday-net_http (3.4.2)
27
28
  net-http (~> 0.5)
29
+ io-console (0.8.2)
28
30
  jaro_winkler (1.5.6)
29
- json (2.18.0)
31
+ json (2.18.1)
30
32
  jwt (2.10.2)
31
33
  base64
32
34
  logger (1.7.0)
33
35
  marcel (1.0.4)
34
36
  method_source (1.1.0)
35
37
  multipart-post (2.4.1)
36
- net-http (0.8.0)
38
+ net-http (0.9.1)
37
39
  uri (>= 0.11.1)
38
40
  parallel (1.27.0)
39
- parser (3.3.10.0)
41
+ parser (3.3.10.1)
40
42
  ast (~> 2.4.1)
41
43
  racc
42
44
  power_assert (3.0.1)
43
- pry (0.15.2)
45
+ pry (0.16.0)
44
46
  coderay (~> 1.1)
45
47
  method_source (~> 1.0)
46
- pry-byebug (3.11.0)
47
- byebug (~> 12.0)
48
- pry (>= 0.13, < 0.16)
49
- psych (5.3.0)
48
+ reline (>= 0.6.0)
49
+ pry-byebug (3.12.0)
50
+ byebug (~> 13.0)
51
+ pry (>= 0.13, < 0.17)
52
+ psych (5.3.1)
50
53
  date
51
54
  stringio
52
55
  racc (1.8.1)
53
56
  rainbow (3.1.1)
54
57
  rake (13.0.6)
58
+ reline (0.6.3)
59
+ io-console (~> 0.5)
55
60
  rubocop (0.66.0)
56
61
  jaro_winkler (~> 1.5.1)
57
62
  parallel (~> 1.10)
@@ -61,7 +66,7 @@ GEM
61
66
  ruby-progressbar (~> 1.7)
62
67
  unicode-display_width (>= 1.4.0, < 1.6)
63
68
  ruby-progressbar (1.13.0)
64
- stringio (3.1.9)
69
+ stringio (3.2.0)
65
70
  test-unit (3.6.9)
66
71
  power_assert
67
72
  unicode-display_width (1.5.0)
@@ -78,5 +83,42 @@ DEPENDENCIES
78
83
  rubocop (~> 0.66.0)
79
84
  test-unit (~> 3.6.7)
80
85
 
86
+ CHECKSUMS
87
+ ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
88
+ base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
89
+ byebug (13.0.0) sha256=d2263efe751941ca520fa29744b71972d39cbc41839496706f5d9b22e92ae05d
90
+ coderay (1.1.3) sha256=dc530018a4684512f8f38143cd2a096c9f02a1fc2459edcfe534787a7fc77d4b
91
+ concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
92
+ date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
93
+ faraday (2.13.4) sha256=c719ff52cfd0dbaeca79dd83ed3aeea3f621032abf8bc959d1c05666157cac26
94
+ faraday-multipart (1.1.1) sha256=77a18ff40149030fd1aef55bb4fc7a67ce46419a8a3fcd010e28c2526e8d8903
95
+ faraday-net_http (3.4.2) sha256=f147758260d3526939bf57ecf911682f94926a3666502e24c69992765875906c
96
+ io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
97
+ jaro_winkler (1.5.6) sha256=007db7805527ada1cc12f2547676181d63b0a504ec4dd7a9a2eb2424521ccd81
98
+ json (2.18.1) sha256=fe112755501b8d0466b5ada6cf50c8c3f41e897fa128ac5d263ec09eedc9f986
99
+ jwt (2.10.2) sha256=31e1ee46f7359883d5e622446969fe9c118c3da87a0b1dca765ce269c3a0c4f4
100
+ logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
101
+ marcel (1.0.4) sha256=0d5649feb64b8f19f3d3468b96c680bae9746335d02194270287868a661516a4
102
+ method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
103
+ multipart-post (2.4.1) sha256=9872d03a8e552020ca096adadbf5e3cb1cd1cdd6acd3c161136b8a5737cdb4a8
104
+ net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
105
+ parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
106
+ parser (3.3.10.1) sha256=06f6a725d2cd91e5e7f2b7c32ba143631e1f7c8ae2fb918fc4cebec187e6a688
107
+ postfinancecheckout-ruby-sdk (6.4.0)
108
+ power_assert (3.0.1) sha256=8ce9876716cc74e863fcd4cdcdc52d792bd983598d1af3447083a3a9a4d34103
109
+ pry (0.16.0) sha256=d76c69065698ed1f85e717bd33d7942c38a50868f6b0673c636192b3d1b6054e
110
+ pry-byebug (3.12.0) sha256=594e094ae8a8390a7ad4c7b36ae36e13304ed02664c67417d108dc5f7213d1b7
111
+ psych (5.3.1) sha256=eb7a57cef10c9d70173ff74e739d843ac3b2c019a003de48447b2963d81b1974
112
+ racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
113
+ rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
114
+ rake (13.0.6) sha256=5ce4bf5037b4196c24ac62834d8db1ce175470391026bd9e557d669beeb19097
115
+ reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
116
+ rubocop (0.66.0) sha256=f05a6896f367765b3f0fba663d0add120444f8de604dada405662b10a0860f5a
117
+ ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
118
+ stringio (3.2.0) sha256=c37cb2e58b4ffbd33fe5cd948c05934af997b36e0b6ca6fdf43afa234cf222e1
119
+ test-unit (3.6.9) sha256=2be6ae0354623702f004ae626c98337f5e17f2ecc0fc334a9e6fdbb2c7c534da
120
+ unicode-display_width (1.5.0) sha256=9890eebd24feb4cb0e0542c9b8c6beecb40cda27be8c7afe49312625b36156eb
121
+ uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
122
+
81
123
  BUNDLED WITH
82
- 2.7.2
124
+ 4.0.4
data/LICENSE CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2025 wallee AG
189
+ Copyright 2026 wallee AG
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
data/README.md CHANGED
@@ -243,6 +243,11 @@ Web API client: [*link*](https://checkout.postfinance.ch//api/client)<br>
243
243
  &nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/bank-transactions/search
244
244
  &nbsp;&nbsp;&nbsp;&nbsp;Search bank transactions
245
245
  <br><br>
246
+ - <strong>BogusExpressCheckoutService</strong><br>
247
+ &nbsp;&nbsp;* <code>post_bogus_express_checkout_on_approve</code>
248
+ &nbsp;&nbsp;&nbsp;&nbsp;<strong>POST</strong> /bogus-express-checkout/on-approve
249
+ &nbsp;&nbsp;&nbsp;&nbsp;Approve express checkout wallet payment
250
+ <br><br>
246
251
  - <strong>ChargeAttemptsService</strong><br>
247
252
  &nbsp;&nbsp;* <code>get_payment_charge_attempts</code>
248
253
  &nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/charge-attempts
@@ -638,6 +643,16 @@ Web API client: [*link*](https://checkout.postfinance.ch//api/client)<br>
638
643
  &nbsp;&nbsp;&nbsp;&nbsp;<strong>GET</strong> /payment/dunning-flows/search
639
644
  &nbsp;&nbsp;&nbsp;&nbsp;Search dunning flows
640
645
  <br><br>
646
+ - <strong>ExpressCheckoutService</strong><br>
647
+ &nbsp;&nbsp;* <code>patch_express_checkout_shipping_address_change</code>
648
+ &nbsp;&nbsp;&nbsp;&nbsp;<strong>PATCH</strong> /express-checkout/shipping/address-change
649
+ &nbsp;&nbsp;&nbsp;&nbsp;Change shipping address
650
+ <br><br>
651
+ - <strong>ExpressCheckoutService</strong><br>
652
+ &nbsp;&nbsp;* <code>patch_express_checkout_shipping_method_change</code>
653
+ &nbsp;&nbsp;&nbsp;&nbsp;<strong>PATCH</strong> /express-checkout/shipping/method-change
654
+ &nbsp;&nbsp;&nbsp;&nbsp;Change shipping method
655
+ <br><br>
641
656
  - <strong>ExpressCheckoutService</strong><br>
642
657
  &nbsp;&nbsp;* <code>post_express_checkout_create_session</code>
643
658
  &nbsp;&nbsp;&nbsp;&nbsp;<strong>POST</strong> /express-checkout/create-session
@@ -2509,6 +2524,8 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
2509
2524
  * <strong>BillingCycleModel</strong>
2510
2525
  * <strong>BillingCycleType</strong>
2511
2526
  * <strong>BillingDayCustomization</strong>
2527
+ * <strong>BogusExpressCheckoutApprovalRequest</strong>
2528
+ * <strong>BogusExpressCheckoutPaymentData</strong>
2512
2529
  * <strong>CardAuthenticationResponse</strong>
2513
2530
  * <strong>CardAuthenticationVersion</strong>
2514
2531
  * <strong>CardCryptogram</strong>
@@ -2608,10 +2625,15 @@ Additional Api models documentation: [*link*](https://checkout.postfinance.ch/en
2608
2625
  * <strong>DunningFlowSearchResponse</strong>
2609
2626
  * <strong>DunningFlowType</strong>
2610
2627
  * <strong>Environment</strong>
2628
+ * <strong>ExpressCheckoutApprovalResponse</strong>
2611
2629
  * <strong>ExpressCheckoutCreateResponse</strong>
2612
2630
  * <strong>ExpressCheckoutSession</strong>
2613
2631
  * <strong>ExpressCheckoutSessionCreate</strong>
2614
2632
  * <strong>ExpressCheckoutSessionState</strong>
2633
+ * <strong>ExpressCheckoutShippingAddressChangeRequest</strong>
2634
+ * <strong>ExpressCheckoutShippingAddressChangeResponse</strong>
2635
+ * <strong>ExpressCheckoutShippingMethodChangeRequest</strong>
2636
+ * <strong>ExpressCheckoutShippingMethodChangeResponse</strong>
2615
2637
  * <strong>ExpressCheckoutShippingOption</strong>
2616
2638
  * <strong>ExpressCheckoutWalletType</strong>
2617
2639
  * <strong>ExternalTransferBankTransaction</strong>
@@ -118,7 +118,7 @@ module PostfinancecheckoutRubySdk
118
118
  http_method = http_method.to_sym.downcase
119
119
 
120
120
  default_headers = {
121
- 'x-meta-sdk-version': "6.3.0",
121
+ 'x-meta-sdk-version': "6.4.0",
122
122
  'x-meta-sdk-language': "ruby",
123
123
  'x-meta-sdk-provider': "postfinancecheckout",
124
124
  'x-meta-sdk-language-version': RUBY_VERSION
@@ -0,0 +1,230 @@
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 BogusExpressCheckoutApprovalRequest
28
+ attr_accessor :payment_data
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'payment_data' => :'paymentData'
34
+ }
35
+ end
36
+
37
+ # Returns attribute mapping this model knows about
38
+ def self.acceptable_attribute_map
39
+ attribute_map
40
+ end
41
+
42
+ # Returns all the JSON keys this model knows about
43
+ def self.acceptable_attributes
44
+ acceptable_attribute_map.values
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'payment_data' => :'BogusExpressCheckoutPaymentData'
51
+ }
52
+ end
53
+
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
62
+ def initialize(attributes = {})
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::BogusExpressCheckoutApprovalRequest` initialize method"
65
+ end
66
+
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ acceptable_attribute_map = self.class.acceptable_attribute_map
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!acceptable_attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::BogusExpressCheckoutApprovalRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'payment_data')
77
+ self.payment_data = attributes[:'payment_data']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ payment_data == o.payment_data
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [payment_data].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ attributes = attributes.transform_keys(&:to_sym)
122
+ transformed_hash = {}
123
+ openapi_types.each_pair do |key, type|
124
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
125
+ transformed_hash["#{key}"] = nil
126
+ elsif type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[attribute_map[key]].is_a?(Array)
130
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
131
+ end
132
+ elsif !attributes[attribute_map[key]].nil?
133
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
134
+ end
135
+ end
136
+ new(transformed_hash)
137
+ end
138
+
139
+ # Deserializes the data based on type
140
+ # @param string type Data type
141
+ # @param string value Value to be deserialized
142
+ # @return [Object] Deserialized data
143
+ def self._deserialize(type, value)
144
+ case type.to_sym
145
+ when :Time
146
+ Time.parse(value)
147
+ when :Date
148
+ Date.parse(value)
149
+ when :String
150
+ value.to_s
151
+ when :Integer
152
+ value.to_i
153
+ when :Float
154
+ value.to_f
155
+ when :Boolean
156
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
157
+ true
158
+ else
159
+ false
160
+ end
161
+ when :Object
162
+ # generic object (usually a Hash), return directly
163
+ value
164
+ when /\AArray<(?<inner_type>.+)>\z/
165
+ inner_type = Regexp.last_match[:inner_type]
166
+ value.map { |v| _deserialize(inner_type, v) }
167
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
168
+ k_type = Regexp.last_match[:k_type]
169
+ v_type = Regexp.last_match[:v_type]
170
+ {}.tap do |hash|
171
+ value.each do |k, v|
172
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
173
+ end
174
+ end
175
+ else # model
176
+ # models (e.g. Pet) or oneOf
177
+ klass = PostfinancecheckoutRubySdk.const_get(type)
178
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ if value.nil?
201
+ is_nullable = self.class.openapi_nullable.include?(attr)
202
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
203
+ end
204
+
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+
228
+ end
229
+
230
+ end
@@ -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 BogusExpressCheckoutPaymentData
28
+ # Wallet-generated payment token collected during approval.
29
+ attr_accessor :payment_token
30
+
31
+ # Wallet-generated cryptogram collected during approval.
32
+ attr_accessor :cryptogram
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'payment_token' => :'paymentToken',
38
+ :'cryptogram' => :'cryptogram'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'payment_token' => :'String',
56
+ :'cryptogram' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `PostfinancecheckoutRubySdk::BogusExpressCheckoutPaymentData` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `PostfinancecheckoutRubySdk::BogusExpressCheckoutPaymentData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'payment_token')
83
+ self.payment_token = attributes[:'payment_token']
84
+ end
85
+
86
+ if attributes.key?(:'cryptogram')
87
+ self.cryptogram = attributes[:'cryptogram']
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
+ payment_token == o.payment_token &&
112
+ cryptogram == o.cryptogram
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
+ [payment_token, cryptogram].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