citypay_api_client 1.0.3 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) 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/auth_reference.rb +45 -11
  104. data/lib/citypay_api_client/models/auth_references.rb +21 -8
  105. data/lib/citypay_api_client/models/auth_request.rb +79 -35
  106. data/lib/citypay_api_client/models/auth_response.rb +43 -106
  107. data/lib/citypay_api_client/models/authen_required.rb +21 -8
  108. data/lib/citypay_api_client/models/batch.rb +264 -0
  109. data/lib/citypay_api_client/models/batch_report_request.rb +277 -0
  110. data/lib/citypay_api_client/models/batch_report_response_model.rb +357 -0
  111. data/lib/citypay_api_client/models/batch_transaction.rb +321 -0
  112. data/lib/citypay_api_client/models/batch_transaction_result_model.rb +421 -0
  113. data/lib/citypay_api_client/models/bin.rb +299 -0
  114. data/lib/citypay_api_client/models/bin_lookup.rb +234 -0
  115. data/lib/citypay_api_client/models/c_res_auth_request.rb +21 -8
  116. data/lib/citypay_api_client/models/capture_request.rb +38 -22
  117. data/lib/citypay_api_client/models/card.rb +67 -10
  118. data/lib/citypay_api_client/models/card_holder_account.rb +35 -12
  119. data/lib/citypay_api_client/models/card_status.rb +21 -8
  120. data/lib/citypay_api_client/models/charge_request.rb +96 -26
  121. data/lib/citypay_api_client/models/check_batch_status.rb +259 -0
  122. data/lib/citypay_api_client/models/check_batch_status_response.rb +220 -0
  123. data/lib/citypay_api_client/models/contact_details.rb +87 -44
  124. data/lib/citypay_api_client/models/decision.rb +21 -8
  125. data/lib/citypay_api_client/models/direct_post_request.rb +670 -0
  126. data/lib/citypay_api_client/models/direct_token_auth_request.rb +249 -0
  127. data/lib/citypay_api_client/models/domain_key_check_request.rb +252 -0
  128. data/lib/citypay_api_client/models/domain_key_request.rb +250 -0
  129. data/lib/citypay_api_client/models/domain_key_response.rb +294 -0
  130. data/lib/citypay_api_client/models/error.rb +35 -12
  131. data/lib/citypay_api_client/models/event_data_model.rb +259 -0
  132. data/lib/citypay_api_client/models/exists.rb +244 -0
  133. data/lib/citypay_api_client/models/external_mpi.rb +27 -8
  134. data/lib/citypay_api_client/models/list_merchants_response.rb +21 -8
  135. data/lib/citypay_api_client/models/mcc6012.rb +21 -8
  136. data/lib/citypay_api_client/models/merchant.rb +21 -8
  137. data/lib/citypay_api_client/models/pa_res_auth_request.rb +22 -9
  138. data/lib/citypay_api_client/models/paylink_address.rb +402 -0
  139. data/lib/citypay_api_client/models/paylink_adjustment_request.rb +269 -0
  140. data/lib/citypay_api_client/models/paylink_attachment_request.rb +269 -0
  141. data/lib/citypay_api_client/models/paylink_attachment_result.rb +249 -0
  142. data/lib/citypay_api_client/models/paylink_bill_payment_token_request.rb +292 -0
  143. data/lib/citypay_api_client/models/paylink_card_holder.rb +353 -0
  144. data/lib/citypay_api_client/models/paylink_cart.rb +280 -0
  145. data/lib/citypay_api_client/models/paylink_cart_item_model.rb +289 -0
  146. data/lib/citypay_api_client/models/paylink_config.rb +433 -0
  147. data/lib/citypay_api_client/models/paylink_custom_param.rb +314 -0
  148. data/lib/citypay_api_client/models/paylink_email_notification_path.rb +268 -0
  149. data/lib/citypay_api_client/models/paylink_error_code.rb +239 -0
  150. data/lib/citypay_api_client/models/paylink_field_guard_model.rb +279 -0
  151. data/lib/citypay_api_client/models/paylink_part_payments.rb +269 -0
  152. data/lib/citypay_api_client/models/paylink_sms_notification_path.rb +234 -0
  153. data/lib/citypay_api_client/models/paylink_state_event.rb +239 -0
  154. data/lib/citypay_api_client/models/paylink_token_created.rb +364 -0
  155. data/lib/citypay_api_client/models/paylink_token_request_model.rb +374 -0
  156. data/lib/citypay_api_client/models/paylink_token_status.rb +490 -0
  157. data/lib/citypay_api_client/models/paylink_token_status_change_request.rb +270 -0
  158. data/lib/citypay_api_client/models/paylink_token_status_change_response.rb +235 -0
  159. data/lib/citypay_api_client/models/paylink_ui.rb +249 -0
  160. data/lib/citypay_api_client/models/ping.rb +21 -8
  161. data/lib/citypay_api_client/models/process_batch_request.rb +308 -0
  162. data/lib/citypay_api_client/models/process_batch_response.rb +234 -0
  163. data/lib/citypay_api_client/models/refund_request.rb +332 -0
  164. data/lib/citypay_api_client/models/register_card.rb +59 -12
  165. data/lib/citypay_api_client/models/request_challenged.rb +29 -16
  166. data/lib/citypay_api_client/models/retrieve_request.rb +21 -8
  167. data/lib/citypay_api_client/models/three_d_secure.rb +106 -13
  168. data/lib/citypay_api_client/models/tokenisation_response_model.rb +333 -0
  169. data/lib/citypay_api_client/models/void_request.rb +22 -21
  170. data/lib/citypay_api_client/utils/digest_utils.rb +18 -0
  171. data/lib/citypay_api_client/utils/direct_post_mac.rb +22 -0
  172. data/lib/citypay_api_client/version.rb +3 -4
  173. data/lib/citypay_api_client.rb +53 -6
  174. data/spec/.DS_Store +0 -0
  175. data/spec/api/authorisation_and_payment_api___spec.rb +130 -0
  176. data/spec/api/batch_processing_api___spec.rb +70 -0
  177. data/spec/api/{card_holder_account_api_spec.rb → card_holder_account_api___spec.rb} +15 -3
  178. data/spec/api/direct_post_api___spec.rb +98 -0
  179. data/spec/api/operational_functions_api___spec.rb +94 -0
  180. data/spec/api/paylink_api___spec.rb +131 -0
  181. data/spec/api_client_spec.rb +4 -4
  182. data/spec/configuration_spec.rb +5 -5
  183. data/spec/it_api_sandbox_spec.rb +126 -58
  184. data/spec/models/acknowledgement_spec.rb +7 -22
  185. data/spec/models/acl_check_request_spec.rb +33 -0
  186. data/spec/models/acl_check_response_model_spec.rb +51 -0
  187. data/spec/models/auth_references_spec.rb +7 -8
  188. data/spec/models/auth_response_spec.rb +29 -30
  189. data/spec/models/batch_report_request_spec.rb +39 -0
  190. data/spec/models/batch_report_response_model_spec.rb +63 -0
  191. data/spec/models/batch_spec.rb +45 -0
  192. data/spec/models/batch_transaction_result_model_spec.rb +87 -0
  193. data/spec/models/batch_transaction_spec.rb +51 -0
  194. data/spec/models/bin_lookup_spec.rb +33 -0
  195. data/spec/models/bin_spec.rb +81 -0
  196. data/spec/models/card_holder_account_spec.rb +8 -5
  197. data/spec/models/check_batch_status_response_spec.rb +45 -0
  198. data/spec/models/check_batch_status_spec.rb +39 -0
  199. data/spec/models/decision_spec.rb +1 -1
  200. data/spec/models/direct_post_request_spec.rb +153 -0
  201. data/spec/models/direct_token_auth_request_spec.rb +51 -0
  202. data/spec/models/domain_key_check_request_spec.rb +33 -0
  203. data/spec/models/domain_key_request_spec.rb +45 -0
  204. data/spec/models/domain_key_response_spec.rb +57 -0
  205. data/spec/models/event_data_model_spec.rb +57 -0
  206. data/spec/{api/operational_api_spec.rb → models/exists_spec.rb} +14 -20
  207. data/spec/models/list_merchants_response_spec.rb +2 -2
  208. data/spec/models/paylink_address_spec.rb +69 -0
  209. data/spec/models/paylink_adjustment_request_spec.rb +45 -0
  210. data/spec/models/paylink_attachment_request_spec.rb +45 -0
  211. data/spec/models/paylink_attachment_result_spec.rb +45 -0
  212. data/spec/models/paylink_bill_payment_token_request_spec.rb +63 -0
  213. data/spec/models/paylink_card_holder_spec.rb +87 -0
  214. data/spec/models/paylink_cart_item_model_spec.rb +75 -0
  215. data/spec/models/paylink_cart_spec.rb +69 -0
  216. data/spec/models/paylink_config_spec.rb +159 -0
  217. data/spec/models/paylink_custom_param_spec.rb +87 -0
  218. data/spec/models/paylink_email_notification_path_spec.rb +57 -0
  219. data/spec/models/paylink_error_code_spec.rb +39 -0
  220. data/spec/models/paylink_field_guard_model_spec.rb +45 -0
  221. data/spec/models/paylink_part_payments_spec.rb +63 -0
  222. data/spec/models/paylink_sms_notification_path_spec.rb +39 -0
  223. data/spec/models/paylink_state_event_spec.rb +45 -0
  224. data/spec/models/paylink_token_created_spec.rb +111 -0
  225. data/spec/models/paylink_token_request_model_spec.rb +93 -0
  226. data/spec/models/paylink_token_status_change_request_spec.rb +57 -0
  227. data/spec/models/paylink_token_status_change_response_spec.rb +39 -0
  228. data/spec/models/paylink_token_status_spec.rb +195 -0
  229. data/spec/models/paylink_ui_spec.rb +51 -0
  230. data/spec/models/process_batch_request_spec.rb +51 -0
  231. data/spec/models/process_batch_response_spec.rb +39 -0
  232. data/spec/models/refund_request_spec.rb +64 -0
  233. data/spec/models/tokenisation_response_model_spec.rb +87 -0
  234. data/spec/spec_helper.rb +2 -2
  235. data/spec/utils/direct_post_mac_spec.rb +13 -0
  236. metadata +210 -37
  237. data/Gemfile.lock +0 -70
  238. data/git_push.sh +0 -58
  239. data/lib/citypay_api_client/api/operational_api.rb +0 -147
  240. data/lib/citypay_api_client/api/payment_processing_api.rb +0 -405
  241. data/lib/citypay_api_client/test.rb +0 -20
  242. data/spec/api/payment_processing_api_spec.rb +0 -106
@@ -0,0 +1,264 @@
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 Batch
17
+ # The date that the file was created in ISO-8601 format.
18
+ attr_accessor :batch_date
19
+
20
+ # The batch id requested.
21
+ attr_accessor :batch_id
22
+
23
+ # The status of the batch. Possible values are - CANCELLED. The file has been cancelled by an administrator or server process. - COMPLETE. The file has passed through the processing cycle and is determined as being complete further information should be obtained on the results of the processing - ERROR_IN_PROCESSING. Errors have occurred in the processing that has deemed that processing can not continue. - INITIALISED. The file has been initialised and no action has yet been performed - LOCKED. The file has been locked for processing - QUEUED. The file has been queued for processing yet no processing has yet been performed - UNKNOWN. The file is of an unknown status, that is the file can either not be determined by the information requested of the file has not yet been received.
24
+ attr_accessor :batch_status
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'batch_date' => :'batch_date',
30
+ :'batch_id' => :'batch_id',
31
+ :'batch_status' => :'batch_status'
32
+ }
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'batch_date' => :'Date',
44
+ :'batch_id' => :'Integer',
45
+ :'batch_status' => :'String'
46
+ }
47
+ end
48
+
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::Batch` initialize method"
60
+ end
61
+
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::Batch`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
69
+
70
+ if attributes.key?(:'batch_date')
71
+ self.batch_date = attributes[:'batch_date']
72
+ end
73
+
74
+ if attributes.key?(:'batch_id')
75
+ self.batch_id = attributes[:'batch_id']
76
+ end
77
+
78
+ if attributes.key?(:'batch_status')
79
+ self.batch_status = attributes[:'batch_status']
80
+ end
81
+ end
82
+
83
+ # Show invalid properties with the reasons. Usually used together with valid?
84
+ # @return Array for valid properties with the reasons
85
+ def list_invalid_properties
86
+ invalid_properties = Array.new
87
+ if @batch_date.nil?
88
+ invalid_properties.push('invalid value for "batch_date", batch_date cannot be nil.')
89
+ end
90
+
91
+ if !@batch_id.nil? && @batch_id < 1
92
+ invalid_properties.push('invalid value for "batch_id", must be greater than or equal to 1.')
93
+ end
94
+
95
+ if @batch_status.nil?
96
+ invalid_properties.push('invalid value for "batch_status", batch_status cannot be nil.')
97
+ end
98
+
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ return false if @batch_date.nil?
106
+ return false if !@batch_id.nil? && @batch_id < 1
107
+ return false if @batch_status.nil?
108
+ true
109
+ end
110
+
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] batch_id Value to be assigned
113
+ def batch_id=(batch_id)
114
+ if !batch_id.nil? && batch_id < 1
115
+ fail ArgumentError, 'invalid value for "batch_id", must be greater than or equal to 1.'
116
+ end
117
+
118
+ @batch_id = batch_id
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ batch_date == o.batch_date &&
127
+ batch_id == o.batch_id &&
128
+ batch_status == o.batch_status
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [batch_date, batch_id, batch_status].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ new.build_from_hash(attributes)
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def build_from_hash(attributes)
154
+ return nil unless attributes.is_a?(Hash)
155
+ attributes = attributes.transform_keys(&:to_sym)
156
+ self.class.openapi_types.each_pair do |key, type|
157
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
158
+ self.send("#{key}=", nil)
159
+ elsif type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ end
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :Time
180
+ Time.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :Boolean
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ # models (e.g. Pet) or oneOf
211
+ klass = CityPayApiClient.const_get(type)
212
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
213
+ end
214
+ end
215
+
216
+ # Returns the string representation of the object
217
+ # @return [String] String presentation of the object
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_hash (backward compatibility)
223
+ # @return [Hash] Returns the object in the form of hash
224
+ def to_body
225
+ to_hash
226
+ end
227
+
228
+ # Returns the object in the form of hash
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_hash
231
+ hash = {}
232
+ self.class.attribute_map.each_pair do |attr, param|
233
+ value = self.send(attr)
234
+ if value.nil?
235
+ is_nullable = self.class.openapi_nullable.include?(attr)
236
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
237
+ end
238
+
239
+ hash[param] = _to_hash(value)
240
+ end
241
+ hash
242
+ end
243
+
244
+ # Outputs non-array value in the form of hash
245
+ # For object, use to_hash. Otherwise, just return the value
246
+ # @param [Object] value Any valid value
247
+ # @return [Hash] Returns the value in the form of hash
248
+ def _to_hash(value)
249
+ if value.is_a?(Array)
250
+ value.compact.map { |v| _to_hash(v) }
251
+ elsif value.is_a?(Hash)
252
+ {}.tap do |hash|
253
+ value.each { |k, v| hash[k] = _to_hash(v) }
254
+ end
255
+ elsif value.respond_to? :to_hash
256
+ value.to_hash
257
+ else
258
+ value
259
+ end
260
+ end
261
+
262
+ end
263
+
264
+ end
@@ -0,0 +1,277 @@
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 BatchReportRequest
17
+ # The batch id specified in the batch processing request.
18
+ attr_accessor :batch_id
19
+
20
+ # The batch account id that the batch was processed for. Defaults to your client id if not provided.
21
+ attr_accessor :client_account_id
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'batch_id' => :'batch_id',
27
+ :'client_account_id' => :'client_account_id'
28
+ }
29
+ end
30
+
31
+ # Returns all the JSON keys this model knows about
32
+ def self.acceptable_attributes
33
+ attribute_map.values
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.openapi_types
38
+ {
39
+ :'batch_id' => :'Integer',
40
+ :'client_account_id' => :'String'
41
+ }
42
+ end
43
+
44
+ # List of attributes with nullable: true
45
+ def self.openapi_nullable
46
+ Set.new([
47
+ ])
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ if (!attributes.is_a?(Hash))
54
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::BatchReportRequest` initialize method"
55
+ end
56
+
57
+ # check to see if the attribute exists and convert string to symbol for hash key
58
+ attributes = attributes.each_with_object({}) { |(k, v), h|
59
+ if (!self.class.attribute_map.key?(k.to_sym))
60
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::BatchReportRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
61
+ end
62
+ h[k.to_sym] = v
63
+ }
64
+
65
+ if attributes.key?(:'batch_id')
66
+ self.batch_id = attributes[:'batch_id']
67
+ end
68
+
69
+ if attributes.key?(:'client_account_id')
70
+ self.client_account_id = attributes[:'client_account_id']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ if @batch_id.nil?
79
+ invalid_properties.push('invalid value for "batch_id", batch_id cannot be nil.')
80
+ end
81
+
82
+ if @batch_id < 1
83
+ invalid_properties.push('invalid value for "batch_id", must be greater than or equal to 1.')
84
+ end
85
+
86
+ if !@client_account_id.nil? && @client_account_id.to_s.length > 20
87
+ invalid_properties.push('invalid value for "client_account_id", the character length must be smaller than or equal to 20.')
88
+ end
89
+
90
+ if !@client_account_id.nil? && @client_account_id.to_s.length < 3
91
+ invalid_properties.push('invalid value for "client_account_id", the character length must be great than or equal to 3.')
92
+ end
93
+
94
+ invalid_properties
95
+ end
96
+
97
+ # Check to see if the all the properties in the model are valid
98
+ # @return true if the model is valid
99
+ def valid?
100
+ return false if @batch_id.nil?
101
+ return false if @batch_id < 1
102
+ return false if !@client_account_id.nil? && @client_account_id.to_s.length > 20
103
+ return false if !@client_account_id.nil? && @client_account_id.to_s.length < 3
104
+ true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] batch_id Value to be assigned
109
+ def batch_id=(batch_id)
110
+ if batch_id.nil?
111
+ fail ArgumentError, 'batch_id cannot be nil'
112
+ end
113
+
114
+ if batch_id < 1
115
+ fail ArgumentError, 'invalid value for "batch_id", must be greater than or equal to 1.'
116
+ end
117
+
118
+ @batch_id = batch_id
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] client_account_id Value to be assigned
123
+ def client_account_id=(client_account_id)
124
+ if !client_account_id.nil? && client_account_id.to_s.length > 20
125
+ fail ArgumentError, 'invalid value for "client_account_id", the character length must be smaller than or equal to 20.'
126
+ end
127
+
128
+ if !client_account_id.nil? && client_account_id.to_s.length < 3
129
+ fail ArgumentError, 'invalid value for "client_account_id", the character length must be great than or equal to 3.'
130
+ end
131
+
132
+ @client_account_id = client_account_id
133
+ end
134
+
135
+ # Checks equality by comparing each attribute.
136
+ # @param [Object] Object to be compared
137
+ def ==(o)
138
+ return true if self.equal?(o)
139
+ self.class == o.class &&
140
+ batch_id == o.batch_id &&
141
+ client_account_id == o.client_account_id
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [batch_id, client_account_id].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
171
+ self.send("#{key}=", nil)
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :Time
193
+ Time.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ # models (e.g. Pet) or oneOf
224
+ klass = CityPayApiClient.const_get(type)
225
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end