citypay_api_client 1.0.2 → 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.
Files changed (243) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +105 -34
  3. data/citypay_api_client.gemspec +4 -5
  4. data/docs/AccountCreate.md +10 -9
  5. data/docs/AccountStatus.md +8 -7
  6. data/docs/Acknowledgement.md +14 -13
  7. data/docs/AclCheckRequest.md +18 -0
  8. data/docs/AclCheckResponseModel.md +24 -0
  9. data/docs/AirlineAdvice.md +38 -37
  10. data/docs/AirlineSegment.md +22 -21
  11. data/docs/AuthReference.md +34 -33
  12. data/docs/AuthReferences.md +8 -7
  13. data/docs/AuthRequest.md +50 -49
  14. data/docs/AuthResponse.md +60 -59
  15. data/docs/AuthenRequired.md +12 -11
  16. data/docs/AuthorisationAndPaymentApi.md +559 -0
  17. data/docs/Batch.md +22 -0
  18. data/docs/BatchProcessingApi.md +214 -0
  19. data/docs/BatchReportRequest.md +20 -0
  20. data/docs/BatchReportResponseModel.md +28 -0
  21. data/docs/BatchTransaction.md +24 -0
  22. data/docs/BatchTransactionResultModel.md +40 -0
  23. data/docs/Bin.md +34 -0
  24. data/docs/BinLookup.md +18 -0
  25. data/docs/CResAuthRequest.md +8 -7
  26. data/docs/CaptureRequest.md +18 -17
  27. data/docs/Card.md +46 -41
  28. data/docs/CardHolderAccount.md +24 -21
  29. data/docs/CardHolderAccountApi.md +326 -105
  30. data/docs/CardStatus.md +10 -9
  31. data/docs/ChargeRequest.md +36 -31
  32. data/docs/CheckBatchStatus.md +20 -0
  33. data/docs/CheckBatchStatusResponse.md +18 -0
  34. data/docs/ContactDetails.md +32 -31
  35. data/docs/Decision.md +12 -11
  36. data/docs/DirectPostApi.md +365 -0
  37. data/docs/DirectPostRequest.md +58 -0
  38. data/docs/DirectTokenAuthRequest.md +24 -0
  39. data/docs/DomainKeyCheckRequest.md +18 -0
  40. data/docs/DomainKeyRequest.md +22 -0
  41. data/docs/DomainKeyResponse.md +26 -0
  42. data/docs/Error.md +16 -13
  43. data/docs/EventDataModel.md +26 -0
  44. data/docs/Exists.md +22 -0
  45. data/docs/ExternalMPI.md +16 -15
  46. data/docs/ListMerchantsResponse.md +12 -11
  47. data/docs/MCC6012.md +14 -13
  48. data/docs/Merchant.md +16 -15
  49. data/docs/OperationalApi.md +124 -22
  50. data/docs/OperationalFunctionsApi.md +355 -0
  51. data/docs/PaResAuthRequest.md +10 -9
  52. data/docs/PaylinkAddress.md +30 -0
  53. data/docs/PaylinkAdjustmentRequest.md +22 -0
  54. data/docs/PaylinkApi.md +630 -0
  55. data/docs/PaylinkAttachmentRequest.md +26 -0
  56. data/docs/PaylinkAttachmentResult.md +22 -0
  57. data/docs/PaylinkBillPaymentTokenRequest.md +32 -0
  58. data/docs/PaylinkCardHolder.md +36 -0
  59. data/docs/PaylinkCart.md +30 -0
  60. data/docs/PaylinkCartItemModel.md +32 -0
  61. data/docs/PaylinkConfig.md +60 -0
  62. data/docs/PaylinkCustomParam.md +36 -0
  63. data/docs/PaylinkEmailNotificationPath.md +26 -0
  64. data/docs/PaylinkErrorCode.md +20 -0
  65. data/docs/PaylinkFieldGuardModel.md +30 -0
  66. data/docs/PaylinkPartPayments.md +28 -0
  67. data/docs/PaylinkSMSNotificationPath.md +20 -0
  68. data/docs/PaylinkStateEvent.md +22 -0
  69. data/docs/PaylinkTokenCreated.md +44 -0
  70. data/docs/PaylinkTokenRequestModel.md +38 -0
  71. data/docs/PaylinkTokenStatus.md +72 -0
  72. data/docs/PaylinkTokenStatusChangeRequest.md +26 -0
  73. data/docs/PaylinkTokenStatusChangeResponse.md +20 -0
  74. data/docs/PaylinkUI.md +24 -0
  75. data/docs/PaymentProcessingApi.md +307 -68
  76. data/docs/Ping.md +8 -7
  77. data/docs/ProcessBatchRequest.md +24 -0
  78. data/docs/ProcessBatchResponse.md +20 -0
  79. data/docs/RefundRequest.md +26 -0
  80. data/docs/RegisterCard.md +16 -13
  81. data/docs/RequestChallenged.md +16 -15
  82. data/docs/RetrieveRequest.md +12 -11
  83. data/docs/ThreeDSecure.md +32 -15
  84. data/docs/TokenisationResponseModel.md +36 -0
  85. data/docs/VoidRequest.md +12 -13
  86. data/lib/.DS_Store +0 -0
  87. data/lib/citypay_api_client/api/authorisation_and_payment_api__.rb +565 -0
  88. data/lib/citypay_api_client/api/batch_processing_api__.rb +225 -0
  89. data/lib/citypay_api_client/api/{card_holder_account_api.rb → card_holder_account_api__.rb} +136 -46
  90. data/lib/citypay_api_client/api/direct_post_api__.rb +373 -0
  91. data/lib/citypay_api_client/api/operational_functions_api__.rb +356 -0
  92. data/lib/citypay_api_client/api/paylink_api__.rb +614 -0
  93. data/lib/citypay_api_client/api_client.rb +59 -59
  94. data/lib/citypay_api_client/api_error.rb +2 -2
  95. data/lib/citypay_api_client/configuration.rb +53 -15
  96. data/lib/citypay_api_client/models/account_create.rb +21 -8
  97. data/lib/citypay_api_client/models/account_status.rb +21 -8
  98. data/lib/citypay_api_client/models/acknowledgement.rb +21 -8
  99. data/lib/citypay_api_client/models/acl_check_request.rb +224 -0
  100. data/lib/citypay_api_client/models/acl_check_response_model.rb +249 -0
  101. data/lib/citypay_api_client/models/airline_advice.rb +23 -10
  102. data/lib/citypay_api_client/models/airline_segment.rb +21 -8
  103. data/lib/citypay_api_client/models/api_key.rb +16 -0
  104. data/lib/citypay_api_client/models/auth_reference.rb +45 -11
  105. data/lib/citypay_api_client/models/auth_references.rb +21 -8
  106. data/lib/citypay_api_client/models/auth_request.rb +79 -33
  107. data/lib/citypay_api_client/models/auth_response.rb +43 -106
  108. data/lib/citypay_api_client/models/authen_required.rb +21 -8
  109. data/lib/citypay_api_client/models/batch.rb +264 -0
  110. data/lib/citypay_api_client/models/batch_report_request.rb +277 -0
  111. data/lib/citypay_api_client/models/batch_report_response_model.rb +357 -0
  112. data/lib/citypay_api_client/models/batch_transaction.rb +321 -0
  113. data/lib/citypay_api_client/models/batch_transaction_result_model.rb +421 -0
  114. data/lib/citypay_api_client/models/bin.rb +299 -0
  115. data/lib/citypay_api_client/models/bin_lookup.rb +234 -0
  116. data/lib/citypay_api_client/models/c_res_auth_request.rb +21 -8
  117. data/lib/citypay_api_client/models/capture_request.rb +38 -20
  118. data/lib/citypay_api_client/models/card.rb +67 -10
  119. data/lib/citypay_api_client/models/card_holder_account.rb +35 -12
  120. data/lib/citypay_api_client/models/card_status.rb +21 -8
  121. data/lib/citypay_api_client/models/charge_request.rb +96 -24
  122. data/lib/citypay_api_client/models/check_batch_status.rb +259 -0
  123. data/lib/citypay_api_client/models/check_batch_status_response.rb +220 -0
  124. data/lib/citypay_api_client/models/contact_details.rb +87 -44
  125. data/lib/citypay_api_client/models/decision.rb +21 -8
  126. data/lib/citypay_api_client/models/direct_post_request.rb +670 -0
  127. data/lib/citypay_api_client/models/direct_token_auth_request.rb +249 -0
  128. data/lib/citypay_api_client/models/domain_key_check_request.rb +252 -0
  129. data/lib/citypay_api_client/models/domain_key_request.rb +250 -0
  130. data/lib/citypay_api_client/models/domain_key_response.rb +294 -0
  131. data/lib/citypay_api_client/models/error.rb +35 -12
  132. data/lib/citypay_api_client/models/event_data_model.rb +259 -0
  133. data/lib/citypay_api_client/models/exists.rb +244 -0
  134. data/lib/citypay_api_client/models/external_mpi.rb +27 -8
  135. data/lib/citypay_api_client/models/list_merchants_response.rb +21 -8
  136. data/lib/citypay_api_client/models/mcc6012.rb +21 -8
  137. data/lib/citypay_api_client/models/merchant.rb +21 -8
  138. data/lib/citypay_api_client/models/pa_res_auth_request.rb +22 -9
  139. data/lib/citypay_api_client/models/paylink_address.rb +402 -0
  140. data/lib/citypay_api_client/models/paylink_adjustment_request.rb +269 -0
  141. data/lib/citypay_api_client/models/paylink_attachment_request.rb +269 -0
  142. data/lib/citypay_api_client/models/paylink_attachment_result.rb +249 -0
  143. data/lib/citypay_api_client/models/paylink_bill_payment_token_request.rb +292 -0
  144. data/lib/citypay_api_client/models/paylink_card_holder.rb +353 -0
  145. data/lib/citypay_api_client/models/paylink_cart.rb +280 -0
  146. data/lib/citypay_api_client/models/paylink_cart_item_model.rb +289 -0
  147. data/lib/citypay_api_client/models/paylink_config.rb +433 -0
  148. data/lib/citypay_api_client/models/paylink_custom_param.rb +314 -0
  149. data/lib/citypay_api_client/models/paylink_email_notification_path.rb +268 -0
  150. data/lib/citypay_api_client/models/paylink_error_code.rb +239 -0
  151. data/lib/citypay_api_client/models/paylink_field_guard_model.rb +279 -0
  152. data/lib/citypay_api_client/models/paylink_part_payments.rb +269 -0
  153. data/lib/citypay_api_client/models/paylink_sms_notification_path.rb +234 -0
  154. data/lib/citypay_api_client/models/paylink_state_event.rb +239 -0
  155. data/lib/citypay_api_client/models/paylink_token_created.rb +364 -0
  156. data/lib/citypay_api_client/models/paylink_token_request_model.rb +374 -0
  157. data/lib/citypay_api_client/models/paylink_token_status.rb +490 -0
  158. data/lib/citypay_api_client/models/paylink_token_status_change_request.rb +270 -0
  159. data/lib/citypay_api_client/models/paylink_token_status_change_response.rb +235 -0
  160. data/lib/citypay_api_client/models/paylink_ui.rb +249 -0
  161. data/lib/citypay_api_client/models/ping.rb +21 -8
  162. data/lib/citypay_api_client/models/process_batch_request.rb +308 -0
  163. data/lib/citypay_api_client/models/process_batch_response.rb +234 -0
  164. data/lib/citypay_api_client/models/refund_request.rb +332 -0
  165. data/lib/citypay_api_client/models/register_card.rb +59 -12
  166. data/lib/citypay_api_client/models/request_challenged.rb +29 -16
  167. data/lib/citypay_api_client/models/retrieve_request.rb +21 -8
  168. data/lib/citypay_api_client/models/three_d_secure.rb +106 -13
  169. data/lib/citypay_api_client/models/tokenisation_response_model.rb +333 -0
  170. data/lib/citypay_api_client/models/void_request.rb +22 -19
  171. data/lib/citypay_api_client/utils/digest_utils.rb +18 -0
  172. data/lib/citypay_api_client/utils/direct_post_mac.rb +22 -0
  173. data/lib/citypay_api_client/version.rb +3 -3
  174. data/lib/citypay_api_client.rb +53 -6
  175. data/spec/.DS_Store +0 -0
  176. data/spec/api/authorisation_and_payment_api___spec.rb +130 -0
  177. data/spec/api/batch_processing_api___spec.rb +70 -0
  178. data/spec/api/{card_holder_account_api_spec.rb → card_holder_account_api___spec.rb} +15 -3
  179. data/spec/api/direct_post_api___spec.rb +98 -0
  180. data/spec/api/operational_functions_api___spec.rb +94 -0
  181. data/spec/api/paylink_api___spec.rb +131 -0
  182. data/spec/api_client_spec.rb +4 -4
  183. data/spec/configuration_spec.rb +5 -5
  184. data/spec/it_api_sandbox_spec.rb +222 -0
  185. data/spec/models/acknowledgement_spec.rb +6 -8
  186. data/spec/models/acl_check_request_spec.rb +33 -0
  187. data/spec/models/acl_check_response_model_spec.rb +51 -0
  188. data/spec/models/auth_references_spec.rb +7 -8
  189. data/spec/models/auth_response_spec.rb +29 -30
  190. data/spec/models/batch_report_request_spec.rb +39 -0
  191. data/spec/models/batch_report_response_model_spec.rb +63 -0
  192. data/spec/models/batch_spec.rb +45 -0
  193. data/spec/models/batch_transaction_result_model_spec.rb +87 -0
  194. data/spec/models/batch_transaction_spec.rb +51 -0
  195. data/spec/models/bin_lookup_spec.rb +33 -0
  196. data/spec/models/bin_spec.rb +81 -0
  197. data/spec/models/card_holder_account_spec.rb +8 -5
  198. data/spec/models/check_batch_status_response_spec.rb +45 -0
  199. data/spec/models/check_batch_status_spec.rb +39 -0
  200. data/spec/models/decision_spec.rb +1 -1
  201. data/spec/models/direct_post_request_spec.rb +153 -0
  202. data/spec/models/direct_token_auth_request_spec.rb +51 -0
  203. data/spec/models/domain_key_check_request_spec.rb +33 -0
  204. data/spec/models/domain_key_request_spec.rb +45 -0
  205. data/spec/models/domain_key_response_spec.rb +57 -0
  206. data/spec/models/event_data_model_spec.rb +57 -0
  207. data/spec/{api/operational_api_spec.rb → models/exists_spec.rb} +14 -20
  208. data/spec/models/list_merchants_response_spec.rb +2 -2
  209. data/spec/models/paylink_address_spec.rb +69 -0
  210. data/spec/models/paylink_adjustment_request_spec.rb +45 -0
  211. data/spec/models/paylink_attachment_request_spec.rb +45 -0
  212. data/spec/models/paylink_attachment_result_spec.rb +45 -0
  213. data/spec/models/paylink_bill_payment_token_request_spec.rb +63 -0
  214. data/spec/models/paylink_card_holder_spec.rb +87 -0
  215. data/spec/models/paylink_cart_item_model_spec.rb +75 -0
  216. data/spec/models/paylink_cart_spec.rb +69 -0
  217. data/spec/models/paylink_config_spec.rb +159 -0
  218. data/spec/models/paylink_custom_param_spec.rb +87 -0
  219. data/spec/models/paylink_email_notification_path_spec.rb +57 -0
  220. data/spec/models/paylink_error_code_spec.rb +39 -0
  221. data/spec/models/paylink_field_guard_model_spec.rb +45 -0
  222. data/spec/models/paylink_part_payments_spec.rb +63 -0
  223. data/spec/models/paylink_sms_notification_path_spec.rb +39 -0
  224. data/spec/models/paylink_state_event_spec.rb +45 -0
  225. data/spec/models/paylink_token_created_spec.rb +111 -0
  226. data/spec/models/paylink_token_request_model_spec.rb +93 -0
  227. data/spec/models/paylink_token_status_change_request_spec.rb +57 -0
  228. data/spec/models/paylink_token_status_change_response_spec.rb +39 -0
  229. data/spec/models/paylink_token_status_spec.rb +195 -0
  230. data/spec/models/paylink_ui_spec.rb +51 -0
  231. data/spec/models/process_batch_request_spec.rb +51 -0
  232. data/spec/models/process_batch_response_spec.rb +39 -0
  233. data/spec/models/refund_request_spec.rb +64 -0
  234. data/spec/models/tokenisation_response_model_spec.rb +87 -0
  235. data/spec/spec_helper.rb +2 -2
  236. data/spec/utils/direct_post_mac_spec.rb +13 -0
  237. metadata +212 -37
  238. data/Gemfile.lock +0 -70
  239. data/git_push.sh +0 -58
  240. data/lib/citypay_api_client/api/operational_api.rb +0 -147
  241. data/lib/citypay_api_client/api/payment_processing_api.rb +0 -405
  242. data/lib/citypay_api_client/test.rb +0 -20
  243. 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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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.
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: 5.0.0-SNAPSHOT
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 DateTime).include?(return_type)
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 'DateTime'
260
+ when 'Time'
219
261
  # parse date time (expecting ISO 8601 format)
220
- DateTime.parse data
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, e.g. Pet
239
- # for models which present the model name with nested data
240
- if !data[return_type.to_sym].nil?
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 hearder and query params based on authentication settings.
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` of `header`'
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
- # use application/json by default
341
- return 'application/json' if content_types.nil? || content_types.empty?
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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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.
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: 5.0.0-SNAPSHOT
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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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.
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: 5.0.0-SNAPSHOT
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 = '/v6'
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
- def base_url
174
- "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
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]} #{@api_key[param_name]}"
204
+ "#{@api_key_prefix[param_name]} #{key}"
182
205
  else
183
- @api_key[param_name]
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/v6",
239
+ url: "https://api.citypay.com",
210
240
  description: "Production processing endpoint",
211
241
  },
212
242
  {
213
- url: "https://sandbox.citypay.com/v6",
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? variables[name])
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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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.
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: 5.0.0-SNAPSHOT
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 type =~ /\AArray<(.*)>/i
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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
168
- DateTime.parse(value)
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
- CityPayApiClient.const_get(type).build_from_hash(value)
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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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.
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: 5.0.0-SNAPSHOT
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 type =~ /\AArray<(.*)>/i
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 # or else data not found in attributes(hash), not an issue as the data can be optional
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 :DateTime
126
- DateTime.parse(value)
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
- CityPayApiClient.const_get(type).build_from_hash(value)
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