citypay_api_client 1.0.3 → 1.1.1
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 +105 -34
- data/citypay_api_client.gemspec +4 -5
- data/docs/AccountCreate.md +10 -9
- data/docs/AccountStatus.md +8 -7
- data/docs/Acknowledgement.md +14 -13
- data/docs/AclCheckRequest.md +18 -0
- data/docs/AclCheckResponseModel.md +24 -0
- data/docs/AirlineAdvice.md +38 -37
- data/docs/AirlineSegment.md +22 -21
- data/docs/AuthReference.md +34 -33
- data/docs/AuthReferences.md +8 -7
- data/docs/AuthRequest.md +50 -49
- data/docs/AuthResponse.md +60 -59
- data/docs/AuthenRequired.md +12 -11
- data/docs/AuthorisationAndPaymentApi.md +559 -0
- data/docs/Batch.md +22 -0
- data/docs/BatchProcessingApi.md +214 -0
- data/docs/BatchReportRequest.md +20 -0
- data/docs/BatchReportResponseModel.md +28 -0
- data/docs/BatchTransaction.md +24 -0
- data/docs/BatchTransactionResultModel.md +40 -0
- data/docs/Bin.md +34 -0
- data/docs/BinLookup.md +18 -0
- data/docs/CResAuthRequest.md +8 -7
- data/docs/CaptureRequest.md +18 -17
- data/docs/Card.md +46 -41
- data/docs/CardHolderAccount.md +24 -21
- data/docs/CardHolderAccountApi.md +326 -105
- data/docs/CardStatus.md +10 -9
- data/docs/ChargeRequest.md +36 -31
- data/docs/CheckBatchStatus.md +20 -0
- data/docs/CheckBatchStatusResponse.md +18 -0
- data/docs/ContactDetails.md +32 -31
- data/docs/Decision.md +12 -11
- data/docs/DirectPostApi.md +365 -0
- data/docs/DirectPostRequest.md +58 -0
- data/docs/DirectTokenAuthRequest.md +24 -0
- data/docs/DomainKeyCheckRequest.md +18 -0
- data/docs/DomainKeyRequest.md +22 -0
- data/docs/DomainKeyResponse.md +26 -0
- data/docs/Error.md +16 -13
- data/docs/EventDataModel.md +26 -0
- data/docs/Exists.md +22 -0
- data/docs/ExternalMPI.md +16 -15
- data/docs/ListMerchantsResponse.md +12 -11
- data/docs/MCC6012.md +14 -13
- data/docs/Merchant.md +16 -15
- data/docs/OperationalApi.md +124 -22
- data/docs/OperationalFunctionsApi.md +355 -0
- data/docs/PaResAuthRequest.md +10 -9
- data/docs/PaylinkAddress.md +30 -0
- data/docs/PaylinkAdjustmentRequest.md +22 -0
- data/docs/PaylinkApi.md +630 -0
- data/docs/PaylinkAttachmentRequest.md +26 -0
- data/docs/PaylinkAttachmentResult.md +22 -0
- data/docs/PaylinkBillPaymentTokenRequest.md +32 -0
- data/docs/PaylinkCardHolder.md +36 -0
- data/docs/PaylinkCart.md +30 -0
- data/docs/PaylinkCartItemModel.md +32 -0
- data/docs/PaylinkConfig.md +60 -0
- data/docs/PaylinkCustomParam.md +36 -0
- data/docs/PaylinkEmailNotificationPath.md +26 -0
- data/docs/PaylinkErrorCode.md +20 -0
- data/docs/PaylinkFieldGuardModel.md +30 -0
- data/docs/PaylinkPartPayments.md +28 -0
- data/docs/PaylinkSMSNotificationPath.md +20 -0
- data/docs/PaylinkStateEvent.md +22 -0
- data/docs/PaylinkTokenCreated.md +44 -0
- data/docs/PaylinkTokenRequestModel.md +38 -0
- data/docs/PaylinkTokenStatus.md +72 -0
- data/docs/PaylinkTokenStatusChangeRequest.md +26 -0
- data/docs/PaylinkTokenStatusChangeResponse.md +20 -0
- data/docs/PaylinkUI.md +24 -0
- data/docs/PaymentProcessingApi.md +307 -68
- data/docs/Ping.md +8 -7
- data/docs/ProcessBatchRequest.md +24 -0
- data/docs/ProcessBatchResponse.md +20 -0
- data/docs/RefundRequest.md +26 -0
- data/docs/RegisterCard.md +16 -13
- data/docs/RequestChallenged.md +16 -15
- data/docs/RetrieveRequest.md +12 -11
- data/docs/ThreeDSecure.md +32 -15
- data/docs/TokenisationResponseModel.md +36 -0
- data/docs/VoidRequest.md +12 -13
- data/lib/.DS_Store +0 -0
- data/lib/citypay_api_client/api/authorisation_and_payment_api__.rb +565 -0
- data/lib/citypay_api_client/api/batch_processing_api__.rb +225 -0
- data/lib/citypay_api_client/api/{card_holder_account_api.rb → card_holder_account_api__.rb} +136 -46
- data/lib/citypay_api_client/api/direct_post_api__.rb +373 -0
- data/lib/citypay_api_client/api/operational_functions_api__.rb +356 -0
- data/lib/citypay_api_client/api/paylink_api__.rb +614 -0
- data/lib/citypay_api_client/api_client.rb +59 -59
- data/lib/citypay_api_client/api_error.rb +2 -2
- data/lib/citypay_api_client/configuration.rb +53 -15
- data/lib/citypay_api_client/models/account_create.rb +21 -8
- data/lib/citypay_api_client/models/account_status.rb +21 -8
- data/lib/citypay_api_client/models/acknowledgement.rb +21 -8
- data/lib/citypay_api_client/models/acl_check_request.rb +224 -0
- data/lib/citypay_api_client/models/acl_check_response_model.rb +249 -0
- data/lib/citypay_api_client/models/airline_advice.rb +23 -10
- data/lib/citypay_api_client/models/airline_segment.rb +21 -8
- data/lib/citypay_api_client/models/auth_reference.rb +45 -11
- data/lib/citypay_api_client/models/auth_references.rb +21 -8
- data/lib/citypay_api_client/models/auth_request.rb +79 -35
- data/lib/citypay_api_client/models/auth_response.rb +43 -106
- data/lib/citypay_api_client/models/authen_required.rb +21 -8
- data/lib/citypay_api_client/models/batch.rb +264 -0
- data/lib/citypay_api_client/models/batch_report_request.rb +277 -0
- data/lib/citypay_api_client/models/batch_report_response_model.rb +357 -0
- data/lib/citypay_api_client/models/batch_transaction.rb +321 -0
- data/lib/citypay_api_client/models/batch_transaction_result_model.rb +421 -0
- data/lib/citypay_api_client/models/bin.rb +299 -0
- data/lib/citypay_api_client/models/bin_lookup.rb +234 -0
- data/lib/citypay_api_client/models/c_res_auth_request.rb +21 -8
- data/lib/citypay_api_client/models/capture_request.rb +38 -22
- data/lib/citypay_api_client/models/card.rb +67 -10
- data/lib/citypay_api_client/models/card_holder_account.rb +35 -12
- data/lib/citypay_api_client/models/card_status.rb +21 -8
- data/lib/citypay_api_client/models/charge_request.rb +96 -26
- data/lib/citypay_api_client/models/check_batch_status.rb +259 -0
- data/lib/citypay_api_client/models/check_batch_status_response.rb +220 -0
- data/lib/citypay_api_client/models/contact_details.rb +87 -44
- data/lib/citypay_api_client/models/decision.rb +21 -8
- data/lib/citypay_api_client/models/direct_post_request.rb +670 -0
- data/lib/citypay_api_client/models/direct_token_auth_request.rb +249 -0
- data/lib/citypay_api_client/models/domain_key_check_request.rb +252 -0
- data/lib/citypay_api_client/models/domain_key_request.rb +250 -0
- data/lib/citypay_api_client/models/domain_key_response.rb +294 -0
- data/lib/citypay_api_client/models/error.rb +35 -12
- data/lib/citypay_api_client/models/event_data_model.rb +259 -0
- data/lib/citypay_api_client/models/exists.rb +244 -0
- data/lib/citypay_api_client/models/external_mpi.rb +27 -8
- data/lib/citypay_api_client/models/list_merchants_response.rb +21 -8
- data/lib/citypay_api_client/models/mcc6012.rb +21 -8
- data/lib/citypay_api_client/models/merchant.rb +21 -8
- data/lib/citypay_api_client/models/pa_res_auth_request.rb +22 -9
- data/lib/citypay_api_client/models/paylink_address.rb +402 -0
- data/lib/citypay_api_client/models/paylink_adjustment_request.rb +269 -0
- data/lib/citypay_api_client/models/paylink_attachment_request.rb +269 -0
- data/lib/citypay_api_client/models/paylink_attachment_result.rb +249 -0
- data/lib/citypay_api_client/models/paylink_bill_payment_token_request.rb +292 -0
- data/lib/citypay_api_client/models/paylink_card_holder.rb +353 -0
- data/lib/citypay_api_client/models/paylink_cart.rb +280 -0
- data/lib/citypay_api_client/models/paylink_cart_item_model.rb +289 -0
- data/lib/citypay_api_client/models/paylink_config.rb +433 -0
- data/lib/citypay_api_client/models/paylink_custom_param.rb +314 -0
- data/lib/citypay_api_client/models/paylink_email_notification_path.rb +268 -0
- data/lib/citypay_api_client/models/paylink_error_code.rb +239 -0
- data/lib/citypay_api_client/models/paylink_field_guard_model.rb +279 -0
- data/lib/citypay_api_client/models/paylink_part_payments.rb +269 -0
- data/lib/citypay_api_client/models/paylink_sms_notification_path.rb +234 -0
- data/lib/citypay_api_client/models/paylink_state_event.rb +239 -0
- data/lib/citypay_api_client/models/paylink_token_created.rb +364 -0
- data/lib/citypay_api_client/models/paylink_token_request_model.rb +374 -0
- data/lib/citypay_api_client/models/paylink_token_status.rb +490 -0
- data/lib/citypay_api_client/models/paylink_token_status_change_request.rb +270 -0
- data/lib/citypay_api_client/models/paylink_token_status_change_response.rb +235 -0
- data/lib/citypay_api_client/models/paylink_ui.rb +249 -0
- data/lib/citypay_api_client/models/ping.rb +21 -8
- data/lib/citypay_api_client/models/process_batch_request.rb +308 -0
- data/lib/citypay_api_client/models/process_batch_response.rb +234 -0
- data/lib/citypay_api_client/models/refund_request.rb +332 -0
- data/lib/citypay_api_client/models/register_card.rb +59 -12
- data/lib/citypay_api_client/models/request_challenged.rb +29 -16
- data/lib/citypay_api_client/models/retrieve_request.rb +21 -8
- data/lib/citypay_api_client/models/three_d_secure.rb +106 -13
- data/lib/citypay_api_client/models/tokenisation_response_model.rb +333 -0
- data/lib/citypay_api_client/models/void_request.rb +22 -21
- data/lib/citypay_api_client/utils/digest_utils.rb +18 -0
- data/lib/citypay_api_client/utils/direct_post_mac.rb +22 -0
- data/lib/citypay_api_client/version.rb +3 -4
- data/lib/citypay_api_client.rb +53 -6
- data/spec/.DS_Store +0 -0
- data/spec/api/authorisation_and_payment_api___spec.rb +130 -0
- data/spec/api/batch_processing_api___spec.rb +70 -0
- data/spec/api/{card_holder_account_api_spec.rb → card_holder_account_api___spec.rb} +15 -3
- data/spec/api/direct_post_api___spec.rb +98 -0
- data/spec/api/operational_functions_api___spec.rb +94 -0
- data/spec/api/paylink_api___spec.rb +131 -0
- data/spec/api_client_spec.rb +4 -4
- data/spec/configuration_spec.rb +5 -5
- data/spec/it_api_sandbox_spec.rb +126 -58
- data/spec/models/acknowledgement_spec.rb +7 -22
- data/spec/models/acl_check_request_spec.rb +33 -0
- data/spec/models/acl_check_response_model_spec.rb +51 -0
- data/spec/models/auth_references_spec.rb +7 -8
- data/spec/models/auth_response_spec.rb +29 -30
- data/spec/models/batch_report_request_spec.rb +39 -0
- data/spec/models/batch_report_response_model_spec.rb +63 -0
- data/spec/models/batch_spec.rb +45 -0
- data/spec/models/batch_transaction_result_model_spec.rb +87 -0
- data/spec/models/batch_transaction_spec.rb +51 -0
- data/spec/models/bin_lookup_spec.rb +33 -0
- data/spec/models/bin_spec.rb +81 -0
- data/spec/models/card_holder_account_spec.rb +8 -5
- data/spec/models/check_batch_status_response_spec.rb +45 -0
- data/spec/models/check_batch_status_spec.rb +39 -0
- data/spec/models/decision_spec.rb +1 -1
- data/spec/models/direct_post_request_spec.rb +153 -0
- data/spec/models/direct_token_auth_request_spec.rb +51 -0
- data/spec/models/domain_key_check_request_spec.rb +33 -0
- data/spec/models/domain_key_request_spec.rb +45 -0
- data/spec/models/domain_key_response_spec.rb +57 -0
- data/spec/models/event_data_model_spec.rb +57 -0
- data/spec/{api/operational_api_spec.rb → models/exists_spec.rb} +14 -20
- data/spec/models/list_merchants_response_spec.rb +2 -2
- data/spec/models/paylink_address_spec.rb +69 -0
- data/spec/models/paylink_adjustment_request_spec.rb +45 -0
- data/spec/models/paylink_attachment_request_spec.rb +45 -0
- data/spec/models/paylink_attachment_result_spec.rb +45 -0
- data/spec/models/paylink_bill_payment_token_request_spec.rb +63 -0
- data/spec/models/paylink_card_holder_spec.rb +87 -0
- data/spec/models/paylink_cart_item_model_spec.rb +75 -0
- data/spec/models/paylink_cart_spec.rb +69 -0
- data/spec/models/paylink_config_spec.rb +159 -0
- data/spec/models/paylink_custom_param_spec.rb +87 -0
- data/spec/models/paylink_email_notification_path_spec.rb +57 -0
- data/spec/models/paylink_error_code_spec.rb +39 -0
- data/spec/models/paylink_field_guard_model_spec.rb +45 -0
- data/spec/models/paylink_part_payments_spec.rb +63 -0
- data/spec/models/paylink_sms_notification_path_spec.rb +39 -0
- data/spec/models/paylink_state_event_spec.rb +45 -0
- data/spec/models/paylink_token_created_spec.rb +111 -0
- data/spec/models/paylink_token_request_model_spec.rb +93 -0
- data/spec/models/paylink_token_status_change_request_spec.rb +57 -0
- data/spec/models/paylink_token_status_change_response_spec.rb +39 -0
- data/spec/models/paylink_token_status_spec.rb +195 -0
- data/spec/models/paylink_ui_spec.rb +51 -0
- data/spec/models/process_batch_request_spec.rb +51 -0
- data/spec/models/process_batch_response_spec.rb +39 -0
- data/spec/models/refund_request_spec.rb +64 -0
- data/spec/models/tokenisation_response_model_spec.rb +87 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/utils/direct_post_mac_spec.rb +13 -0
- metadata +210 -37
- data/Gemfile.lock +0 -70
- data/git_push.sh +0 -58
- data/lib/citypay_api_client/api/operational_api.rb +0 -147
- data/lib/citypay_api_client/api/payment_processing_api.rb +0 -405
- data/lib/citypay_api_client/test.rb +0 -20
- data/spec/api/payment_processing_api_spec.rb +0 -106
@@ -1,11 +1,11 @@
|
|
1
1
|
=begin
|
2
2
|
#CityPay Payment API
|
3
3
|
|
4
|
-
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security
|
4
|
+
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
5
|
|
6
6
|
Contact: support@citypay.com
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
|
-
OpenAPI Generator version:
|
8
|
+
OpenAPI Generator version: 6.2.1
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
@@ -13,6 +13,7 @@ require 'date'
|
|
13
13
|
require 'json'
|
14
14
|
require 'logger'
|
15
15
|
require 'tempfile'
|
16
|
+
require 'time'
|
16
17
|
require 'typhoeus'
|
17
18
|
|
18
19
|
module CityPayApiClient
|
@@ -32,7 +33,8 @@ module CityPayApiClient
|
|
32
33
|
@user_agent = "OpenAPI-Ruby/#{VERSION}"
|
33
34
|
@default_headers = {
|
34
35
|
'Content-Type' => 'application/json',
|
35
|
-
'User-Agent' => @user_agent
|
36
|
+
'User-Agent' => @user_agent,
|
37
|
+
'cp-sdk' => "CP-Ruby/#{VERSION}"
|
36
38
|
}
|
37
39
|
end
|
38
40
|
|
@@ -85,12 +87,13 @@ module CityPayApiClient
|
|
85
87
|
# @option opts [Object] :body HTTP body (JSON/XML)
|
86
88
|
# @return [Typhoeus::Request] A Typhoeus Request
|
87
89
|
def build_request(http_method, path, opts = {})
|
88
|
-
url = build_request_url(path)
|
90
|
+
url = build_request_url(path, opts)
|
89
91
|
http_method = http_method.to_sym.downcase
|
90
92
|
|
91
93
|
header_params = @default_headers.merge(opts[:header_params] || {})
|
92
94
|
query_params = opts[:query_params] || {}
|
93
95
|
form_params = opts[:form_params] || {}
|
96
|
+
follow_location = opts[:follow_location] || true
|
94
97
|
|
95
98
|
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
96
99
|
|
@@ -107,7 +110,8 @@ module CityPayApiClient
|
|
107
110
|
:ssl_verifyhost => _verify_ssl_host,
|
108
111
|
:sslcert => @config.cert_file,
|
109
112
|
:sslkey => @config.key_file,
|
110
|
-
:verbose => @config.debugging
|
113
|
+
:verbose => @config.debugging,
|
114
|
+
:followlocation => follow_location
|
111
115
|
}
|
112
116
|
|
113
117
|
# set custom cert, if provided
|
@@ -154,6 +158,44 @@ module CityPayApiClient
|
|
154
158
|
data
|
155
159
|
end
|
156
160
|
|
161
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
162
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
163
|
+
# The response body is written to the file in chunks in order to handle files which
|
164
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
165
|
+
# process can use.
|
166
|
+
#
|
167
|
+
# @see Configuration#temp_folder_path
|
168
|
+
def download_file(request)
|
169
|
+
tempfile = nil
|
170
|
+
encoding = nil
|
171
|
+
request.on_headers do |response|
|
172
|
+
content_disposition = response.headers['Content-Disposition']
|
173
|
+
if content_disposition && content_disposition =~ /filename=/i
|
174
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
175
|
+
prefix = sanitize_filename(filename)
|
176
|
+
else
|
177
|
+
prefix = 'download-'
|
178
|
+
end
|
179
|
+
prefix = prefix + '-' unless prefix.end_with?('-')
|
180
|
+
encoding = response.body.encoding
|
181
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
182
|
+
@tempfile = tempfile
|
183
|
+
end
|
184
|
+
request.on_body do |chunk|
|
185
|
+
chunk.force_encoding(encoding)
|
186
|
+
tempfile.write(chunk)
|
187
|
+
end
|
188
|
+
request.on_complete do |response|
|
189
|
+
if tempfile
|
190
|
+
tempfile.close
|
191
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
192
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
193
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
194
|
+
"explicitly with `tempfile.delete`"
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
157
199
|
# Check if the given MIME is a JSON MIME.
|
158
200
|
# JSON MIME examples:
|
159
201
|
# application/json
|
@@ -190,7 +232,7 @@ module CityPayApiClient
|
|
190
232
|
begin
|
191
233
|
data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
|
192
234
|
rescue JSON::ParserError => e
|
193
|
-
if %w(String Date
|
235
|
+
if %w(String Date Time).include?(return_type)
|
194
236
|
data = body
|
195
237
|
else
|
196
238
|
raise e
|
@@ -215,9 +257,9 @@ module CityPayApiClient
|
|
215
257
|
data.to_f
|
216
258
|
when 'Boolean'
|
217
259
|
data == true
|
218
|
-
when '
|
260
|
+
when 'Time'
|
219
261
|
# parse date time (expecting ISO 8601 format)
|
220
|
-
|
262
|
+
Time.parse data
|
221
263
|
when 'Date'
|
222
264
|
# parse date time (expecting ISO 8601 format)
|
223
265
|
Date.parse data
|
@@ -235,51 +277,9 @@ module CityPayApiClient
|
|
235
277
|
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
236
278
|
end
|
237
279
|
else
|
238
|
-
# models
|
239
|
-
|
240
|
-
|
241
|
-
CityPayApiClient.const_get(return_type).build_from_hash(data[return_type.to_sym])
|
242
|
-
else
|
243
|
-
CityPayApiClient.const_get(return_type).build_from_hash(data)
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
# Save response body into a file in (the defined) temporary folder, using the filename
|
249
|
-
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
250
|
-
# The response body is written to the file in chunks in order to handle files which
|
251
|
-
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
252
|
-
# process can use.
|
253
|
-
#
|
254
|
-
# @see Configuration#temp_folder_path
|
255
|
-
def download_file(request)
|
256
|
-
tempfile = nil
|
257
|
-
encoding = nil
|
258
|
-
request.on_headers do |response|
|
259
|
-
content_disposition = response.headers['Content-Disposition']
|
260
|
-
if content_disposition && content_disposition =~ /filename=/i
|
261
|
-
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
262
|
-
prefix = sanitize_filename(filename)
|
263
|
-
else
|
264
|
-
prefix = 'download-'
|
265
|
-
end
|
266
|
-
prefix = prefix + '-' unless prefix.end_with?('-')
|
267
|
-
encoding = response.body.encoding
|
268
|
-
tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
|
269
|
-
@tempfile = tempfile
|
270
|
-
end
|
271
|
-
request.on_body do |chunk|
|
272
|
-
chunk.force_encoding(encoding)
|
273
|
-
tempfile.write(chunk)
|
274
|
-
end
|
275
|
-
request.on_complete do |response|
|
276
|
-
if tempfile
|
277
|
-
tempfile.close
|
278
|
-
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
279
|
-
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
280
|
-
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
281
|
-
"explicitly with `tempfile.delete`"
|
282
|
-
end
|
280
|
+
# models (e.g. Pet) or oneOf
|
281
|
+
klass = CityPayApiClient.const_get(return_type)
|
282
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data)
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
@@ -292,13 +292,13 @@ module CityPayApiClient
|
|
292
292
|
filename.gsub(/.*[\/\\]/, '')
|
293
293
|
end
|
294
294
|
|
295
|
-
def build_request_url(path)
|
295
|
+
def build_request_url(path, opts = {})
|
296
296
|
# Add leading and trailing slashes to path
|
297
297
|
path = "/#{path}".gsub(/\/+/, '/')
|
298
|
-
@config.base_url + path
|
298
|
+
@config.base_url(opts[:operation]) + path
|
299
299
|
end
|
300
300
|
|
301
|
-
# Update
|
301
|
+
# Update header and query params based on authentication settings.
|
302
302
|
#
|
303
303
|
# @param [Hash] header_params Header parameters
|
304
304
|
# @param [Hash] query_params Query parameters
|
@@ -310,7 +310,7 @@ module CityPayApiClient
|
|
310
310
|
case auth_setting[:in]
|
311
311
|
when 'header' then header_params[auth_setting[:key]] = auth_setting[:value]
|
312
312
|
when 'query' then query_params[auth_setting[:key]] = auth_setting[:value]
|
313
|
-
else fail ArgumentError, 'Authentication token must be in `query`
|
313
|
+
else fail ArgumentError, 'Authentication token must be in `query` or `header`'
|
314
314
|
end
|
315
315
|
end
|
316
316
|
end
|
@@ -337,8 +337,8 @@ module CityPayApiClient
|
|
337
337
|
# @param [Array] content_types array for Content-Type
|
338
338
|
# @return [String] the Content-Type header (e.g. application/json)
|
339
339
|
def select_header_content_type(content_types)
|
340
|
-
#
|
341
|
-
return
|
340
|
+
# return nil by default
|
341
|
+
return if content_types.nil? || content_types.empty?
|
342
342
|
# use JSON when present, otherwise use the first one
|
343
343
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
344
344
|
json_content_type || content_types.first
|
@@ -1,11 +1,11 @@
|
|
1
1
|
=begin
|
2
2
|
#CityPay Payment API
|
3
3
|
|
4
|
-
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security
|
4
|
+
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
5
|
|
6
6
|
Contact: support@citypay.com
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
|
-
OpenAPI Generator version:
|
8
|
+
OpenAPI Generator version: 6.2.1
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
@@ -1,11 +1,11 @@
|
|
1
1
|
=begin
|
2
2
|
#CityPay Payment API
|
3
3
|
|
4
|
-
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security
|
4
|
+
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
5
|
|
6
6
|
Contact: support@citypay.com
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
|
-
OpenAPI Generator version:
|
8
|
+
OpenAPI Generator version: 6.2.1
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
@@ -20,6 +20,18 @@ module CityPayApiClient
|
|
20
20
|
# Defines url base path
|
21
21
|
attr_accessor :base_path
|
22
22
|
|
23
|
+
# Define server configuration index
|
24
|
+
attr_accessor :server_index
|
25
|
+
|
26
|
+
# Define server operation configuration index
|
27
|
+
attr_accessor :server_operation_index
|
28
|
+
|
29
|
+
# Default server variables
|
30
|
+
attr_accessor :server_variables
|
31
|
+
|
32
|
+
# Default server operation variables
|
33
|
+
attr_accessor :server_operation_variables
|
34
|
+
|
23
35
|
# Defines API keys used with API Key authentications.
|
24
36
|
#
|
25
37
|
# @return [Hash] key: parameter name, value: parameter value (API key)
|
@@ -120,6 +132,7 @@ module CityPayApiClient
|
|
120
132
|
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
121
133
|
attr_accessor :params_encoding
|
122
134
|
|
135
|
+
|
123
136
|
attr_accessor :inject_format
|
124
137
|
|
125
138
|
attr_accessor :force_ending_format
|
@@ -127,16 +140,20 @@ module CityPayApiClient
|
|
127
140
|
def initialize
|
128
141
|
@scheme = 'https'
|
129
142
|
@host = 'api.citypay.com'
|
130
|
-
@base_path = '
|
143
|
+
@base_path = ''
|
144
|
+
@server_index = 0
|
145
|
+
@server_operation_index = {}
|
146
|
+
@server_variables = {}
|
147
|
+
@server_operation_variables = {}
|
131
148
|
@api_key = {}
|
132
149
|
@api_key_prefix = {}
|
133
|
-
@timeout = 0
|
134
150
|
@client_side_validation = true
|
135
151
|
@verify_ssl = true
|
136
152
|
@verify_ssl_host = true
|
137
|
-
@params_encoding = nil
|
138
153
|
@cert_file = nil
|
139
154
|
@key_file = nil
|
155
|
+
@timeout = 0
|
156
|
+
@params_encoding = nil
|
140
157
|
@debugging = false
|
141
158
|
@inject_format = false
|
142
159
|
@force_ending_format = false
|
@@ -170,17 +187,23 @@ module CityPayApiClient
|
|
170
187
|
@base_path = '' if @base_path == '/'
|
171
188
|
end
|
172
189
|
|
173
|
-
|
174
|
-
|
190
|
+
# Returns base URL for specified operation based on server settings
|
191
|
+
def base_url(operation = nil)
|
192
|
+
index = server_operation_index.fetch(operation, server_index)
|
193
|
+
return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil
|
194
|
+
|
195
|
+
server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation])
|
175
196
|
end
|
176
197
|
|
177
198
|
# Gets API key (with prefix if set).
|
178
199
|
# @param [String] param_name the parameter name of API key auth
|
179
|
-
def api_key_with_prefix(param_name)
|
200
|
+
def api_key_with_prefix(param_name, param_alias = nil)
|
201
|
+
key = @api_key[param_name]
|
202
|
+
key = @api_key.fetch(param_alias, key) unless param_alias.nil?
|
180
203
|
if @api_key_prefix[param_name]
|
181
|
-
"#{@api_key_prefix[param_name]} #{
|
204
|
+
"#{@api_key_prefix[param_name]} #{key}"
|
182
205
|
else
|
183
|
-
|
206
|
+
key
|
184
207
|
end
|
185
208
|
end
|
186
209
|
|
@@ -199,6 +222,13 @@ module CityPayApiClient
|
|
199
222
|
key: 'cp-api-key',
|
200
223
|
value: api_key_with_prefix('cp-api-key')
|
201
224
|
},
|
225
|
+
'cp-domain-key' =>
|
226
|
+
{
|
227
|
+
type: 'api_key',
|
228
|
+
in: 'query',
|
229
|
+
key: 'cp-domain-key',
|
230
|
+
value: api_key_with_prefix('cp-domain-key')
|
231
|
+
},
|
202
232
|
}
|
203
233
|
end
|
204
234
|
|
@@ -206,22 +236,27 @@ module CityPayApiClient
|
|
206
236
|
def server_settings
|
207
237
|
[
|
208
238
|
{
|
209
|
-
url: "https://api.citypay.com
|
239
|
+
url: "https://api.citypay.com",
|
210
240
|
description: "Production processing endpoint",
|
211
241
|
},
|
212
242
|
{
|
213
|
-
url: "https://sandbox.citypay.com
|
243
|
+
url: "https://sandbox.citypay.com",
|
214
244
|
description: "Testing service returning test results for all transactions",
|
215
245
|
}
|
216
246
|
]
|
217
247
|
end
|
218
248
|
|
249
|
+
def operation_server_settings
|
250
|
+
{
|
251
|
+
}
|
252
|
+
end
|
253
|
+
|
219
254
|
# Returns URL based on server settings
|
220
255
|
#
|
221
256
|
# @param index array index of the server settings
|
222
257
|
# @param variables hash of variable and the corresponding value
|
223
|
-
def server_url(index, variables = {})
|
224
|
-
servers = server_settings
|
258
|
+
def server_url(index, variables = {}, servers = nil)
|
259
|
+
servers = server_settings if servers == nil
|
225
260
|
|
226
261
|
# check array index out of bound
|
227
262
|
if (index < 0 || index >= servers.size)
|
@@ -231,10 +266,12 @@ module CityPayApiClient
|
|
231
266
|
server = servers[index]
|
232
267
|
url = server[:url]
|
233
268
|
|
269
|
+
return url unless server.key? :variables
|
270
|
+
|
234
271
|
# go through variable and assign a value
|
235
272
|
server[:variables].each do |name, variable|
|
236
273
|
if variables.key?(name)
|
237
|
-
if (server[:variables][name][:enum_values].include?
|
274
|
+
if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name]))
|
238
275
|
url.gsub! "{" + name.to_s + "}", variables[name]
|
239
276
|
else
|
240
277
|
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
@@ -247,5 +284,6 @@ module CityPayApiClient
|
|
247
284
|
|
248
285
|
url
|
249
286
|
end
|
287
|
+
|
250
288
|
end
|
251
289
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
=begin
|
2
2
|
#CityPay Payment API
|
3
3
|
|
4
|
-
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security
|
4
|
+
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
5
|
|
6
6
|
Contact: support@citypay.com
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
|
-
OpenAPI Generator version:
|
8
|
+
OpenAPI Generator version: 6.2.1
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'date'
|
13
|
+
require 'time'
|
13
14
|
|
14
15
|
module CityPayApiClient
|
15
16
|
class AccountCreate
|
@@ -26,6 +27,11 @@ module CityPayApiClient
|
|
26
27
|
}
|
27
28
|
end
|
28
29
|
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
29
35
|
# Attribute type mapping.
|
30
36
|
def self.openapi_types
|
31
37
|
{
|
@@ -143,8 +149,11 @@ module CityPayApiClient
|
|
143
149
|
# @return [Object] Returns the model itself
|
144
150
|
def build_from_hash(attributes)
|
145
151
|
return nil unless attributes.is_a?(Hash)
|
152
|
+
attributes = attributes.transform_keys(&:to_sym)
|
146
153
|
self.class.openapi_types.each_pair do |key, type|
|
147
|
-
if
|
154
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
155
|
+
self.send("#{key}=", nil)
|
156
|
+
elsif type =~ /\AArray<(.*)>/i
|
148
157
|
# check to ensure the input is an array given that the attribute
|
149
158
|
# is documented as an array but the input is not
|
150
159
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -152,7 +161,7 @@ module CityPayApiClient
|
|
152
161
|
end
|
153
162
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
154
163
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
155
|
-
end
|
164
|
+
end
|
156
165
|
end
|
157
166
|
|
158
167
|
self
|
@@ -164,8 +173,8 @@ module CityPayApiClient
|
|
164
173
|
# @return [Object] Deserialized data
|
165
174
|
def _deserialize(type, value)
|
166
175
|
case type.to_sym
|
167
|
-
when :
|
168
|
-
|
176
|
+
when :Time
|
177
|
+
Time.parse(value)
|
169
178
|
when :Date
|
170
179
|
Date.parse(value)
|
171
180
|
when :String
|
@@ -195,7 +204,9 @@ module CityPayApiClient
|
|
195
204
|
end
|
196
205
|
end
|
197
206
|
else # model
|
198
|
-
|
207
|
+
# models (e.g. Pet) or oneOf
|
208
|
+
klass = CityPayApiClient.const_get(type)
|
209
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
199
210
|
end
|
200
211
|
end
|
201
212
|
|
@@ -221,7 +232,7 @@ module CityPayApiClient
|
|
221
232
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
222
233
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
223
234
|
end
|
224
|
-
|
235
|
+
|
225
236
|
hash[param] = _to_hash(value)
|
226
237
|
end
|
227
238
|
hash
|
@@ -244,5 +255,7 @@ module CityPayApiClient
|
|
244
255
|
value
|
245
256
|
end
|
246
257
|
end
|
258
|
+
|
247
259
|
end
|
260
|
+
|
248
261
|
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
=begin
|
2
2
|
#CityPay Payment API
|
3
3
|
|
4
|
-
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security
|
4
|
+
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
5
|
|
6
6
|
Contact: support@citypay.com
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
|
-
OpenAPI Generator version:
|
8
|
+
OpenAPI Generator version: 6.2.1
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'date'
|
13
|
+
require 'time'
|
13
14
|
|
14
15
|
module CityPayApiClient
|
15
16
|
class AccountStatus
|
@@ -23,6 +24,11 @@ module CityPayApiClient
|
|
23
24
|
}
|
24
25
|
end
|
25
26
|
|
27
|
+
# Returns all the JSON keys this model knows about
|
28
|
+
def self.acceptable_attributes
|
29
|
+
attribute_map.values
|
30
|
+
end
|
31
|
+
|
26
32
|
# Attribute type mapping.
|
27
33
|
def self.openapi_types
|
28
34
|
{
|
@@ -101,8 +107,11 @@ module CityPayApiClient
|
|
101
107
|
# @return [Object] Returns the model itself
|
102
108
|
def build_from_hash(attributes)
|
103
109
|
return nil unless attributes.is_a?(Hash)
|
110
|
+
attributes = attributes.transform_keys(&:to_sym)
|
104
111
|
self.class.openapi_types.each_pair do |key, type|
|
105
|
-
if
|
112
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
113
|
+
self.send("#{key}=", nil)
|
114
|
+
elsif type =~ /\AArray<(.*)>/i
|
106
115
|
# check to ensure the input is an array given that the attribute
|
107
116
|
# is documented as an array but the input is not
|
108
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -110,7 +119,7 @@ module CityPayApiClient
|
|
110
119
|
end
|
111
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
-
end
|
122
|
+
end
|
114
123
|
end
|
115
124
|
|
116
125
|
self
|
@@ -122,8 +131,8 @@ module CityPayApiClient
|
|
122
131
|
# @return [Object] Deserialized data
|
123
132
|
def _deserialize(type, value)
|
124
133
|
case type.to_sym
|
125
|
-
when :
|
126
|
-
|
134
|
+
when :Time
|
135
|
+
Time.parse(value)
|
127
136
|
when :Date
|
128
137
|
Date.parse(value)
|
129
138
|
when :String
|
@@ -153,7 +162,9 @@ module CityPayApiClient
|
|
153
162
|
end
|
154
163
|
end
|
155
164
|
else # model
|
156
|
-
|
165
|
+
# models (e.g. Pet) or oneOf
|
166
|
+
klass = CityPayApiClient.const_get(type)
|
167
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
157
168
|
end
|
158
169
|
end
|
159
170
|
|
@@ -179,7 +190,7 @@ module CityPayApiClient
|
|
179
190
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
180
191
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
181
192
|
end
|
182
|
-
|
193
|
+
|
183
194
|
hash[param] = _to_hash(value)
|
184
195
|
end
|
185
196
|
hash
|
@@ -202,5 +213,7 @@ module CityPayApiClient
|
|
202
213
|
value
|
203
214
|
end
|
204
215
|
end
|
216
|
+
|
205
217
|
end
|
218
|
+
|
206
219
|
end
|