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
@@ -0,0 +1,670 @@
1
+ =begin
2
+ #CityPay Payment API
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 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
+
6
+ Contact: support@citypay.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 6.2.1
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module CityPayApiClient
16
+ class DirectPostRequest
17
+ # The amount to authorise in the lowest unit of currency with a variable length to a maximum of 12 digits. No decimal points are to be included and no divisional characters such as 1,024. The amount should be the total amount required for the transaction. For example with GBP £1,021.95 the amount value is 102195.
18
+ attr_accessor :amount
19
+
20
+ # A policy value which determines whether an AVS postcode policy is enforced or bypassed. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the AVS postcode numeric value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the postcode did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send postcode details for authorisation.
21
+ attr_accessor :avs_postcode_policy
22
+
23
+ attr_accessor :bill_to
24
+
25
+ # The card number (PAN) with a variable length to a maximum of 21 digits in numerical form. Any non numeric characters will be stripped out of the card number, this includes whitespace or separators internal of the provided value. The card number must be treated as sensitive data. We only provide an obfuscated value in logging and reporting. The plaintext value is encrypted in our database using AES 256 GMC bit encryption for settlement or refund purposes. When providing the card number to our gateway through the authorisation API you will be handling the card data on your application. This will require further PCI controls to be in place and this value must never be stored.
26
+ attr_accessor :cardnumber
27
+
28
+ # The Card Security Code (CSC) (also known as CV2/CVV2) is normally found on the back of the card (American Express has it on the front). The value helps to identify posession of the card as it is not available within the chip or magnetic swipe. When forwarding the CSC, please ensure the value is a string as some values start with 0 and this will be stripped out by any integer parsing. The CSC number aids fraud prevention in Mail Order and Internet payments. Business rules are available on your account to identify whether to accept or decline transactions based on mismatched results of the CSC. The Payment Card Industry (PCI) requires that at no stage of a transaction should the CSC be stored. This applies to all entities handling card data. It should also not be used in any hashing process. CityPay do not store the value and have no method of retrieving the value once the transaction has been processed. For this reason, duplicate checking is unable to determine the CSC in its duplication check algorithm.
29
+ attr_accessor :csc
30
+
31
+ # A policy value which determines whether a CSC policy is enforced or bypassed. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the CSC value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the CSC did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send the CSC details for authorisation.
32
+ attr_accessor :csc_policy
33
+
34
+ # The processing currency for the transaction. Will default to the merchant account currency.
35
+ attr_accessor :currency
36
+
37
+ # A policy value which determines whether a duplication policy is enforced or bypassed. A duplication check has a window of time set against your account within which it can action. If a previous transaction with matching values occurred within the window, any subsequent transaction will result in a T001 result. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be checked for duplication within the duplication window. `2` to bypass. Transactions that are bypassed will not be checked for duplication within the duplication window. `3` to ignore. Transactions that are ignored will have the same affect as bypass.
38
+ attr_accessor :duplicate_policy
39
+
40
+ # The month of expiry of the card. The month value should be a numerical value between 1 and 12.
41
+ attr_accessor :expmonth
42
+
43
+ # The year of expiry of the card.
44
+ attr_accessor :expyear
45
+
46
+ # The identifier of the transaction to process. The value should be a valid reference and may be used to perform post processing actions and to aid in reconciliation of transactions. The value should be a valid printable string with ASCII character ranges from 0x32 to 0x127. The identifier is recommended to be distinct for each transaction such as a [random unique identifier](https://en.wikipedia.org/wiki/Universally_unique_identifier) this will aid in ensuring each transaction is identifiable. When transactions are processed they are also checked for duplicate requests. Changing the identifier on a subsequent request will ensure that a transaction is considered as different.
47
+ attr_accessor :identifier
48
+
49
+ # A message authentication code ensures the data is authentic and that the intended amount has not been tampered with. The mac value is generated using a hash-based mac value. The following algorithm is used. - A key (k) is derived from your licence key - A value (v) is produced by concatenating the nonce, amount value and identifier, such as a purchase with nonce `0123456789ABCDEF` an amount of £275.95 and an identifier of OD-12345678 would become `0123456789ABCDEF27595OD-12345678` and extracting the UTF-8 byte values - The result from HMAC_SHA256(k, v) is hex-encoded (upper-case) - For instance, a licence key of `LK123456789`, a nonce of `0123456789ABCDEF`, an amount of `27595` and an identifier of `OD-12345678` would generate a MAC of `163DBAB194D743866A9BCC7FC9C8A88FCD99C6BBBF08D619291212D1B91EE12E`.
50
+ attr_accessor :mac
51
+
52
+ # A policy value which determines whether an AVS address policy is enforced, bypassed or ignored. Values are `0` for the default policy (default value if not supplied). Your default values are determined by your account manager on setup of the account. `1` for an enforced policy. Transactions that are enforced will be rejected if the AVS address numeric value does not match. `2` to bypass. Transactions that are bypassed will be allowed through even if the address did not match. `3` to ignore. Transactions that are ignored will bypass the result and not send address numeric details for authorisation.
53
+ attr_accessor :match_avsa
54
+
55
+ # The card holder name as appears on the card such as MR N E BODY. Required for some acquirers.
56
+ attr_accessor :name_on_card
57
+
58
+ # A random value Hex string (uppercase) which is provided to the API to perform a digest. The value will be used in any digest function.
59
+ attr_accessor :nonce
60
+
61
+ # The URL used to redirect back to your site when a transaction has been rejected or declined. Required if a url-encoded request.
62
+ attr_accessor :redirect_failure
63
+
64
+ # The URL used to redirect back to your site when a transaction has been tokenised or authorised. Required if a url-encoded request.
65
+ attr_accessor :redirect_success
66
+
67
+ attr_accessor :ship_to
68
+
69
+ attr_accessor :threedsecure
70
+
71
+ # Further information that can be added to the transaction will display in reporting. Can be used for flexible values such as operator id.
72
+ attr_accessor :trans_info
73
+
74
+ # The type of transaction being submitted. Normally this value is not required and your account manager may request that you set this field.
75
+ attr_accessor :trans_type
76
+
77
+ # Attribute mapping from ruby-style variable name to JSON key.
78
+ def self.attribute_map
79
+ {
80
+ :'amount' => :'amount',
81
+ :'avs_postcode_policy' => :'avs_postcode_policy',
82
+ :'bill_to' => :'bill_to',
83
+ :'cardnumber' => :'cardnumber',
84
+ :'csc' => :'csc',
85
+ :'csc_policy' => :'csc_policy',
86
+ :'currency' => :'currency',
87
+ :'duplicate_policy' => :'duplicate_policy',
88
+ :'expmonth' => :'expmonth',
89
+ :'expyear' => :'expyear',
90
+ :'identifier' => :'identifier',
91
+ :'mac' => :'mac',
92
+ :'match_avsa' => :'match_avsa',
93
+ :'name_on_card' => :'name_on_card',
94
+ :'nonce' => :'nonce',
95
+ :'redirect_failure' => :'redirect_failure',
96
+ :'redirect_success' => :'redirect_success',
97
+ :'ship_to' => :'ship_to',
98
+ :'threedsecure' => :'threedsecure',
99
+ :'trans_info' => :'trans_info',
100
+ :'trans_type' => :'trans_type'
101
+ }
102
+ end
103
+
104
+ # Returns all the JSON keys this model knows about
105
+ def self.acceptable_attributes
106
+ attribute_map.values
107
+ end
108
+
109
+ # Attribute type mapping.
110
+ def self.openapi_types
111
+ {
112
+ :'amount' => :'Integer',
113
+ :'avs_postcode_policy' => :'String',
114
+ :'bill_to' => :'ContactDetails',
115
+ :'cardnumber' => :'String',
116
+ :'csc' => :'String',
117
+ :'csc_policy' => :'String',
118
+ :'currency' => :'String',
119
+ :'duplicate_policy' => :'String',
120
+ :'expmonth' => :'Integer',
121
+ :'expyear' => :'Integer',
122
+ :'identifier' => :'String',
123
+ :'mac' => :'String',
124
+ :'match_avsa' => :'String',
125
+ :'name_on_card' => :'String',
126
+ :'nonce' => :'String',
127
+ :'redirect_failure' => :'String',
128
+ :'redirect_success' => :'String',
129
+ :'ship_to' => :'ContactDetails',
130
+ :'threedsecure' => :'ThreeDSecure',
131
+ :'trans_info' => :'String',
132
+ :'trans_type' => :'String'
133
+ }
134
+ end
135
+
136
+ # List of attributes with nullable: true
137
+ def self.openapi_nullable
138
+ Set.new([
139
+ ])
140
+ end
141
+
142
+ # Initializes the object
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ def initialize(attributes = {})
145
+ if (!attributes.is_a?(Hash))
146
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::DirectPostRequest` initialize method"
147
+ end
148
+
149
+ # check to see if the attribute exists and convert string to symbol for hash key
150
+ attributes = attributes.each_with_object({}) { |(k, v), h|
151
+ if (!self.class.attribute_map.key?(k.to_sym))
152
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::DirectPostRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
153
+ end
154
+ h[k.to_sym] = v
155
+ }
156
+
157
+ if attributes.key?(:'amount')
158
+ self.amount = attributes[:'amount']
159
+ end
160
+
161
+ if attributes.key?(:'avs_postcode_policy')
162
+ self.avs_postcode_policy = attributes[:'avs_postcode_policy']
163
+ end
164
+
165
+ if attributes.key?(:'bill_to')
166
+ self.bill_to = attributes[:'bill_to']
167
+ end
168
+
169
+ if attributes.key?(:'cardnumber')
170
+ self.cardnumber = attributes[:'cardnumber']
171
+ end
172
+
173
+ if attributes.key?(:'csc')
174
+ self.csc = attributes[:'csc']
175
+ end
176
+
177
+ if attributes.key?(:'csc_policy')
178
+ self.csc_policy = attributes[:'csc_policy']
179
+ end
180
+
181
+ if attributes.key?(:'currency')
182
+ self.currency = attributes[:'currency']
183
+ end
184
+
185
+ if attributes.key?(:'duplicate_policy')
186
+ self.duplicate_policy = attributes[:'duplicate_policy']
187
+ end
188
+
189
+ if attributes.key?(:'expmonth')
190
+ self.expmonth = attributes[:'expmonth']
191
+ end
192
+
193
+ if attributes.key?(:'expyear')
194
+ self.expyear = attributes[:'expyear']
195
+ end
196
+
197
+ if attributes.key?(:'identifier')
198
+ self.identifier = attributes[:'identifier']
199
+ end
200
+
201
+ if attributes.key?(:'mac')
202
+ self.mac = attributes[:'mac']
203
+ end
204
+
205
+ if attributes.key?(:'match_avsa')
206
+ self.match_avsa = attributes[:'match_avsa']
207
+ end
208
+
209
+ if attributes.key?(:'name_on_card')
210
+ self.name_on_card = attributes[:'name_on_card']
211
+ end
212
+
213
+ if attributes.key?(:'nonce')
214
+ self.nonce = attributes[:'nonce']
215
+ end
216
+
217
+ if attributes.key?(:'redirect_failure')
218
+ self.redirect_failure = attributes[:'redirect_failure']
219
+ end
220
+
221
+ if attributes.key?(:'redirect_success')
222
+ self.redirect_success = attributes[:'redirect_success']
223
+ end
224
+
225
+ if attributes.key?(:'ship_to')
226
+ self.ship_to = attributes[:'ship_to']
227
+ end
228
+
229
+ if attributes.key?(:'threedsecure')
230
+ self.threedsecure = attributes[:'threedsecure']
231
+ end
232
+
233
+ if attributes.key?(:'trans_info')
234
+ self.trans_info = attributes[:'trans_info']
235
+ end
236
+
237
+ if attributes.key?(:'trans_type')
238
+ self.trans_type = attributes[:'trans_type']
239
+ end
240
+ end
241
+
242
+ # Show invalid properties with the reasons. Usually used together with valid?
243
+ # @return Array for valid properties with the reasons
244
+ def list_invalid_properties
245
+ invalid_properties = Array.new
246
+ if @amount.nil?
247
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
248
+ end
249
+
250
+ if @cardnumber.nil?
251
+ invalid_properties.push('invalid value for "cardnumber", cardnumber cannot be nil.')
252
+ end
253
+
254
+ if @cardnumber.to_s.length > 22
255
+ invalid_properties.push('invalid value for "cardnumber", the character length must be smaller than or equal to 22.')
256
+ end
257
+
258
+ if @cardnumber.to_s.length < 12
259
+ invalid_properties.push('invalid value for "cardnumber", the character length must be great than or equal to 12.')
260
+ end
261
+
262
+ if !@csc.nil? && @csc.to_s.length > 4
263
+ invalid_properties.push('invalid value for "csc", the character length must be smaller than or equal to 4.')
264
+ end
265
+
266
+ if !@csc.nil? && @csc.to_s.length < 3
267
+ invalid_properties.push('invalid value for "csc", the character length must be great than or equal to 3.')
268
+ end
269
+
270
+ if !@currency.nil? && @currency.to_s.length > 3
271
+ invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
272
+ end
273
+
274
+ if !@currency.nil? && @currency.to_s.length < 3
275
+ invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 3.')
276
+ end
277
+
278
+ if @expmonth.nil?
279
+ invalid_properties.push('invalid value for "expmonth", expmonth cannot be nil.')
280
+ end
281
+
282
+ if @expmonth > 12
283
+ invalid_properties.push('invalid value for "expmonth", must be smaller than or equal to 12.')
284
+ end
285
+
286
+ if @expmonth < 1
287
+ invalid_properties.push('invalid value for "expmonth", must be greater than or equal to 1.')
288
+ end
289
+
290
+ if @expyear.nil?
291
+ invalid_properties.push('invalid value for "expyear", expyear cannot be nil.')
292
+ end
293
+
294
+ if @expyear > 2100
295
+ invalid_properties.push('invalid value for "expyear", must be smaller than or equal to 2100.')
296
+ end
297
+
298
+ if @expyear < 2000
299
+ invalid_properties.push('invalid value for "expyear", must be greater than or equal to 2000.')
300
+ end
301
+
302
+ if @identifier.nil?
303
+ invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
304
+ end
305
+
306
+ if @identifier.to_s.length > 50
307
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
308
+ end
309
+
310
+ if @identifier.to_s.length < 4
311
+ invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
312
+ end
313
+
314
+ if @mac.nil?
315
+ invalid_properties.push('invalid value for "mac", mac cannot be nil.')
316
+ end
317
+
318
+ if !@name_on_card.nil? && @name_on_card.to_s.length > 45
319
+ invalid_properties.push('invalid value for "name_on_card", the character length must be smaller than or equal to 45.')
320
+ end
321
+
322
+ if !@name_on_card.nil? && @name_on_card.to_s.length < 2
323
+ invalid_properties.push('invalid value for "name_on_card", the character length must be great than or equal to 2.')
324
+ end
325
+
326
+ if !@trans_info.nil? && @trans_info.to_s.length > 50
327
+ invalid_properties.push('invalid value for "trans_info", the character length must be smaller than or equal to 50.')
328
+ end
329
+
330
+ if !@trans_type.nil? && @trans_type.to_s.length > 1
331
+ invalid_properties.push('invalid value for "trans_type", the character length must be smaller than or equal to 1.')
332
+ end
333
+
334
+ invalid_properties
335
+ end
336
+
337
+ # Check to see if the all the properties in the model are valid
338
+ # @return true if the model is valid
339
+ def valid?
340
+ return false if @amount.nil?
341
+ return false if @cardnumber.nil?
342
+ return false if @cardnumber.to_s.length > 22
343
+ return false if @cardnumber.to_s.length < 12
344
+ return false if !@csc.nil? && @csc.to_s.length > 4
345
+ return false if !@csc.nil? && @csc.to_s.length < 3
346
+ return false if !@currency.nil? && @currency.to_s.length > 3
347
+ return false if !@currency.nil? && @currency.to_s.length < 3
348
+ return false if @expmonth.nil?
349
+ return false if @expmonth > 12
350
+ return false if @expmonth < 1
351
+ return false if @expyear.nil?
352
+ return false if @expyear > 2100
353
+ return false if @expyear < 2000
354
+ return false if @identifier.nil?
355
+ return false if @identifier.to_s.length > 50
356
+ return false if @identifier.to_s.length < 4
357
+ return false if @mac.nil?
358
+ return false if !@name_on_card.nil? && @name_on_card.to_s.length > 45
359
+ return false if !@name_on_card.nil? && @name_on_card.to_s.length < 2
360
+ return false if !@trans_info.nil? && @trans_info.to_s.length > 50
361
+ return false if !@trans_type.nil? && @trans_type.to_s.length > 1
362
+ true
363
+ end
364
+
365
+ # Custom attribute writer method with validation
366
+ # @param [Object] amount Value to be assigned
367
+ def amount=(amount)
368
+ if amount.nil?
369
+ fail ArgumentError, 'amount cannot be nil'
370
+ end
371
+
372
+ @amount = amount
373
+ end
374
+
375
+ # Custom attribute writer method with validation
376
+ # @param [Object] cardnumber Value to be assigned
377
+ def cardnumber=(cardnumber)
378
+ if cardnumber.nil?
379
+ fail ArgumentError, 'cardnumber cannot be nil'
380
+ end
381
+
382
+ if cardnumber.to_s.length > 22
383
+ fail ArgumentError, 'invalid value for "cardnumber", the character length must be smaller than or equal to 22.'
384
+ end
385
+
386
+ if cardnumber.to_s.length < 12
387
+ fail ArgumentError, 'invalid value for "cardnumber", the character length must be great than or equal to 12.'
388
+ end
389
+
390
+ @cardnumber = cardnumber
391
+ end
392
+
393
+ # Custom attribute writer method with validation
394
+ # @param [Object] csc Value to be assigned
395
+ def csc=(csc)
396
+ if !csc.nil? && csc.to_s.length > 4
397
+ fail ArgumentError, 'invalid value for "csc", the character length must be smaller than or equal to 4.'
398
+ end
399
+
400
+ if !csc.nil? && csc.to_s.length < 3
401
+ fail ArgumentError, 'invalid value for "csc", the character length must be great than or equal to 3.'
402
+ end
403
+
404
+ @csc = csc
405
+ end
406
+
407
+ # Custom attribute writer method with validation
408
+ # @param [Object] currency Value to be assigned
409
+ def currency=(currency)
410
+ if !currency.nil? && currency.to_s.length > 3
411
+ fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
412
+ end
413
+
414
+ if !currency.nil? && currency.to_s.length < 3
415
+ fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 3.'
416
+ end
417
+
418
+ @currency = currency
419
+ end
420
+
421
+ # Custom attribute writer method with validation
422
+ # @param [Object] expmonth Value to be assigned
423
+ def expmonth=(expmonth)
424
+ if expmonth.nil?
425
+ fail ArgumentError, 'expmonth cannot be nil'
426
+ end
427
+
428
+ if expmonth > 12
429
+ fail ArgumentError, 'invalid value for "expmonth", must be smaller than or equal to 12.'
430
+ end
431
+
432
+ if expmonth < 1
433
+ fail ArgumentError, 'invalid value for "expmonth", must be greater than or equal to 1.'
434
+ end
435
+
436
+ @expmonth = expmonth
437
+ end
438
+
439
+ # Custom attribute writer method with validation
440
+ # @param [Object] expyear Value to be assigned
441
+ def expyear=(expyear)
442
+ if expyear.nil?
443
+ fail ArgumentError, 'expyear cannot be nil'
444
+ end
445
+
446
+ if expyear > 2100
447
+ fail ArgumentError, 'invalid value for "expyear", must be smaller than or equal to 2100.'
448
+ end
449
+
450
+ if expyear < 2000
451
+ fail ArgumentError, 'invalid value for "expyear", must be greater than or equal to 2000.'
452
+ end
453
+
454
+ @expyear = expyear
455
+ end
456
+
457
+ # Custom attribute writer method with validation
458
+ # @param [Object] identifier Value to be assigned
459
+ def identifier=(identifier)
460
+ if identifier.nil?
461
+ fail ArgumentError, 'identifier cannot be nil'
462
+ end
463
+
464
+ if identifier.to_s.length > 50
465
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
466
+ end
467
+
468
+ if identifier.to_s.length < 4
469
+ fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
470
+ end
471
+
472
+ @identifier = identifier
473
+ end
474
+
475
+ # Custom attribute writer method with validation
476
+ # @param [Object] name_on_card Value to be assigned
477
+ def name_on_card=(name_on_card)
478
+ if !name_on_card.nil? && name_on_card.to_s.length > 45
479
+ fail ArgumentError, 'invalid value for "name_on_card", the character length must be smaller than or equal to 45.'
480
+ end
481
+
482
+ if !name_on_card.nil? && name_on_card.to_s.length < 2
483
+ fail ArgumentError, 'invalid value for "name_on_card", the character length must be great than or equal to 2.'
484
+ end
485
+
486
+ @name_on_card = name_on_card
487
+ end
488
+
489
+ # Custom attribute writer method with validation
490
+ # @param [Object] trans_info Value to be assigned
491
+ def trans_info=(trans_info)
492
+ if !trans_info.nil? && trans_info.to_s.length > 50
493
+ fail ArgumentError, 'invalid value for "trans_info", the character length must be smaller than or equal to 50.'
494
+ end
495
+
496
+ @trans_info = trans_info
497
+ end
498
+
499
+ # Custom attribute writer method with validation
500
+ # @param [Object] trans_type Value to be assigned
501
+ def trans_type=(trans_type)
502
+ if !trans_type.nil? && trans_type.to_s.length > 1
503
+ fail ArgumentError, 'invalid value for "trans_type", the character length must be smaller than or equal to 1.'
504
+ end
505
+
506
+ @trans_type = trans_type
507
+ end
508
+
509
+ # Checks equality by comparing each attribute.
510
+ # @param [Object] Object to be compared
511
+ def ==(o)
512
+ return true if self.equal?(o)
513
+ self.class == o.class &&
514
+ amount == o.amount &&
515
+ avs_postcode_policy == o.avs_postcode_policy &&
516
+ bill_to == o.bill_to &&
517
+ cardnumber == o.cardnumber &&
518
+ csc == o.csc &&
519
+ csc_policy == o.csc_policy &&
520
+ currency == o.currency &&
521
+ duplicate_policy == o.duplicate_policy &&
522
+ expmonth == o.expmonth &&
523
+ expyear == o.expyear &&
524
+ identifier == o.identifier &&
525
+ mac == o.mac &&
526
+ match_avsa == o.match_avsa &&
527
+ name_on_card == o.name_on_card &&
528
+ nonce == o.nonce &&
529
+ redirect_failure == o.redirect_failure &&
530
+ redirect_success == o.redirect_success &&
531
+ ship_to == o.ship_to &&
532
+ threedsecure == o.threedsecure &&
533
+ trans_info == o.trans_info &&
534
+ trans_type == o.trans_type
535
+ end
536
+
537
+ # @see the `==` method
538
+ # @param [Object] Object to be compared
539
+ def eql?(o)
540
+ self == o
541
+ end
542
+
543
+ # Calculates hash code according to all attributes.
544
+ # @return [Integer] Hash code
545
+ def hash
546
+ [amount, avs_postcode_policy, bill_to, cardnumber, csc, csc_policy, currency, duplicate_policy, expmonth, expyear, identifier, mac, match_avsa, name_on_card, nonce, redirect_failure, redirect_success, ship_to, threedsecure, trans_info, trans_type].hash
547
+ end
548
+
549
+ # Builds the object from hash
550
+ # @param [Hash] attributes Model attributes in the form of hash
551
+ # @return [Object] Returns the model itself
552
+ def self.build_from_hash(attributes)
553
+ new.build_from_hash(attributes)
554
+ end
555
+
556
+ # Builds the object from hash
557
+ # @param [Hash] attributes Model attributes in the form of hash
558
+ # @return [Object] Returns the model itself
559
+ def build_from_hash(attributes)
560
+ return nil unless attributes.is_a?(Hash)
561
+ attributes = attributes.transform_keys(&:to_sym)
562
+ self.class.openapi_types.each_pair do |key, type|
563
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
564
+ self.send("#{key}=", nil)
565
+ elsif type =~ /\AArray<(.*)>/i
566
+ # check to ensure the input is an array given that the attribute
567
+ # is documented as an array but the input is not
568
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
569
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
570
+ end
571
+ elsif !attributes[self.class.attribute_map[key]].nil?
572
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
573
+ end
574
+ end
575
+
576
+ self
577
+ end
578
+
579
+ # Deserializes the data based on type
580
+ # @param string type Data type
581
+ # @param string value Value to be deserialized
582
+ # @return [Object] Deserialized data
583
+ def _deserialize(type, value)
584
+ case type.to_sym
585
+ when :Time
586
+ Time.parse(value)
587
+ when :Date
588
+ Date.parse(value)
589
+ when :String
590
+ value.to_s
591
+ when :Integer
592
+ value.to_i
593
+ when :Float
594
+ value.to_f
595
+ when :Boolean
596
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
597
+ true
598
+ else
599
+ false
600
+ end
601
+ when :Object
602
+ # generic object (usually a Hash), return directly
603
+ value
604
+ when /\AArray<(?<inner_type>.+)>\z/
605
+ inner_type = Regexp.last_match[:inner_type]
606
+ value.map { |v| _deserialize(inner_type, v) }
607
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
608
+ k_type = Regexp.last_match[:k_type]
609
+ v_type = Regexp.last_match[:v_type]
610
+ {}.tap do |hash|
611
+ value.each do |k, v|
612
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
613
+ end
614
+ end
615
+ else # model
616
+ # models (e.g. Pet) or oneOf
617
+ klass = CityPayApiClient.const_get(type)
618
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
619
+ end
620
+ end
621
+
622
+ # Returns the string representation of the object
623
+ # @return [String] String presentation of the object
624
+ def to_s
625
+ to_hash.to_s
626
+ end
627
+
628
+ # to_body is an alias to to_hash (backward compatibility)
629
+ # @return [Hash] Returns the object in the form of hash
630
+ def to_body
631
+ to_hash
632
+ end
633
+
634
+ # Returns the object in the form of hash
635
+ # @return [Hash] Returns the object in the form of hash
636
+ def to_hash
637
+ hash = {}
638
+ self.class.attribute_map.each_pair do |attr, param|
639
+ value = self.send(attr)
640
+ if value.nil?
641
+ is_nullable = self.class.openapi_nullable.include?(attr)
642
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
643
+ end
644
+
645
+ hash[param] = _to_hash(value)
646
+ end
647
+ hash
648
+ end
649
+
650
+ # Outputs non-array value in the form of hash
651
+ # For object, use to_hash. Otherwise, just return the value
652
+ # @param [Object] value Any valid value
653
+ # @return [Hash] Returns the value in the form of hash
654
+ def _to_hash(value)
655
+ if value.is_a?(Array)
656
+ value.compact.map { |v| _to_hash(v) }
657
+ elsif value.is_a?(Hash)
658
+ {}.tap do |hash|
659
+ value.each { |k, v| hash[k] = _to_hash(v) }
660
+ end
661
+ elsif value.respond_to? :to_hash
662
+ value.to_hash
663
+ else
664
+ value
665
+ end
666
+ end
667
+
668
+ end
669
+
670
+ end