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,239 @@
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 PaylinkStateEvent
17
+ # the date and time of the event.
18
+ attr_accessor :datetime
19
+
20
+ # a message associated with the event.
21
+ attr_accessor :message
22
+
23
+ # The name of the event that was actioned.
24
+ attr_accessor :state
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'datetime' => :'datetime',
30
+ :'message' => :'message',
31
+ :'state' => :'state'
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
+ :'datetime' => :'Time',
44
+ :'message' => :'String',
45
+ :'state' => :'Time'
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::PaylinkStateEvent` 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::PaylinkStateEvent`. 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?(:'datetime')
71
+ self.datetime = attributes[:'datetime']
72
+ end
73
+
74
+ if attributes.key?(:'message')
75
+ self.message = attributes[:'message']
76
+ end
77
+
78
+ if attributes.key?(:'state')
79
+ self.state = attributes[:'state']
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
+ invalid_properties
88
+ end
89
+
90
+ # Check to see if the all the properties in the model are valid
91
+ # @return true if the model is valid
92
+ def valid?
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ datetime == o.datetime &&
102
+ message == o.message &&
103
+ state == o.state
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Integer] Hash code
114
+ def hash
115
+ [datetime, message, state].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def self.build_from_hash(attributes)
122
+ new.build_from_hash(attributes)
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def build_from_hash(attributes)
129
+ return nil unless attributes.is_a?(Hash)
130
+ attributes = attributes.transform_keys(&:to_sym)
131
+ self.class.openapi_types.each_pair do |key, type|
132
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
133
+ self.send("#{key}=", nil)
134
+ elsif type =~ /\AArray<(.*)>/i
135
+ # check to ensure the input is an array given that the attribute
136
+ # is documented as an array but the input is not
137
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
138
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
+ end
140
+ elsif !attributes[self.class.attribute_map[key]].nil?
141
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
142
+ end
143
+ end
144
+
145
+ self
146
+ end
147
+
148
+ # Deserializes the data based on type
149
+ # @param string type Data type
150
+ # @param string value Value to be deserialized
151
+ # @return [Object] Deserialized data
152
+ def _deserialize(type, value)
153
+ case type.to_sym
154
+ when :Time
155
+ Time.parse(value)
156
+ when :Date
157
+ Date.parse(value)
158
+ when :String
159
+ value.to_s
160
+ when :Integer
161
+ value.to_i
162
+ when :Float
163
+ value.to_f
164
+ when :Boolean
165
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
+ true
167
+ else
168
+ false
169
+ end
170
+ when :Object
171
+ # generic object (usually a Hash), return directly
172
+ value
173
+ when /\AArray<(?<inner_type>.+)>\z/
174
+ inner_type = Regexp.last_match[:inner_type]
175
+ value.map { |v| _deserialize(inner_type, v) }
176
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
177
+ k_type = Regexp.last_match[:k_type]
178
+ v_type = Regexp.last_match[:v_type]
179
+ {}.tap do |hash|
180
+ value.each do |k, v|
181
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
182
+ end
183
+ end
184
+ else # model
185
+ # models (e.g. Pet) or oneOf
186
+ klass = CityPayApiClient.const_get(type)
187
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ if value.nil?
210
+ is_nullable = self.class.openapi_nullable.include?(attr)
211
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
212
+ end
213
+
214
+ hash[param] = _to_hash(value)
215
+ end
216
+ hash
217
+ end
218
+
219
+ # Outputs non-array value in the form of hash
220
+ # For object, use to_hash. Otherwise, just return the value
221
+ # @param [Object] value Any valid value
222
+ # @return [Hash] Returns the value in the form of hash
223
+ def _to_hash(value)
224
+ if value.is_a?(Array)
225
+ value.compact.map { |v| _to_hash(v) }
226
+ elsif value.is_a?(Hash)
227
+ {}.tap do |hash|
228
+ value.each { |k, v| hash[k] = _to_hash(v) }
229
+ end
230
+ elsif value.respond_to? :to_hash
231
+ value.to_hash
232
+ else
233
+ value
234
+ end
235
+ end
236
+
237
+ end
238
+
239
+ end
@@ -0,0 +1,364 @@
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 PaylinkTokenCreated
17
+ attr_accessor :attachments
18
+
19
+ # true if BPS has been enabled on this token.
20
+ attr_accessor :bps
21
+
22
+ # Date and time the token was generated.
23
+ attr_accessor :date_created
24
+
25
+ attr_accessor :errors
26
+
27
+ # A unique id of the request.
28
+ attr_accessor :id
29
+
30
+ # The identifier as presented in the TokenRequest.
31
+ attr_accessor :identifier
32
+
33
+ # Determines whether the token is `live` or `test`.
34
+ attr_accessor :mode
35
+
36
+ # A URL of a qrcode which can be used to refer to the token URL.
37
+ attr_accessor :qr_code
38
+
39
+ # The result field contains the result for the Paylink Token Request. 0 - indicates that an error was encountered while creating the token. 1 - which indicates that a Token was successfully created.
40
+ attr_accessor :result
41
+
42
+ # the version of the server performing the call.
43
+ attr_accessor :server_version
44
+
45
+ # The incoming IP address of the call.
46
+ attr_accessor :source
47
+
48
+ # A token generated for the request used to refer to the transaction in consequential calls.
49
+ attr_accessor :token
50
+
51
+ # The Paylink token URL used to checkout by the card holder.
52
+ attr_accessor :url
53
+
54
+ # A UrlShortCode (USC) used for short links.
55
+ attr_accessor :usc
56
+
57
+ # Attribute mapping from ruby-style variable name to JSON key.
58
+ def self.attribute_map
59
+ {
60
+ :'attachments' => :'attachments',
61
+ :'bps' => :'bps',
62
+ :'date_created' => :'date_created',
63
+ :'errors' => :'errors',
64
+ :'id' => :'id',
65
+ :'identifier' => :'identifier',
66
+ :'mode' => :'mode',
67
+ :'qr_code' => :'qr_code',
68
+ :'result' => :'result',
69
+ :'server_version' => :'server_version',
70
+ :'source' => :'source',
71
+ :'token' => :'token',
72
+ :'url' => :'url',
73
+ :'usc' => :'usc'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'attachments' => :'PaylinkAttachmentResult',
86
+ :'bps' => :'String',
87
+ :'date_created' => :'Time',
88
+ :'errors' => :'Array<PaylinkErrorCode>',
89
+ :'id' => :'String',
90
+ :'identifier' => :'String',
91
+ :'mode' => :'String',
92
+ :'qr_code' => :'String',
93
+ :'result' => :'Integer',
94
+ :'server_version' => :'String',
95
+ :'source' => :'String',
96
+ :'token' => :'String',
97
+ :'url' => :'String',
98
+ :'usc' => :'String'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ ])
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::PaylinkTokenCreated` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h|
117
+ if (!self.class.attribute_map.key?(k.to_sym))
118
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::PaylinkTokenCreated`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
119
+ end
120
+ h[k.to_sym] = v
121
+ }
122
+
123
+ if attributes.key?(:'attachments')
124
+ self.attachments = attributes[:'attachments']
125
+ end
126
+
127
+ if attributes.key?(:'bps')
128
+ self.bps = attributes[:'bps']
129
+ end
130
+
131
+ if attributes.key?(:'date_created')
132
+ self.date_created = attributes[:'date_created']
133
+ end
134
+
135
+ if attributes.key?(:'errors')
136
+ if (value = attributes[:'errors']).is_a?(Array)
137
+ self.errors = value
138
+ end
139
+ end
140
+
141
+ if attributes.key?(:'id')
142
+ self.id = attributes[:'id']
143
+ end
144
+
145
+ if attributes.key?(:'identifier')
146
+ self.identifier = attributes[:'identifier']
147
+ end
148
+
149
+ if attributes.key?(:'mode')
150
+ self.mode = attributes[:'mode']
151
+ end
152
+
153
+ if attributes.key?(:'qr_code')
154
+ self.qr_code = attributes[:'qr_code']
155
+ end
156
+
157
+ if attributes.key?(:'result')
158
+ self.result = attributes[:'result']
159
+ end
160
+
161
+ if attributes.key?(:'server_version')
162
+ self.server_version = attributes[:'server_version']
163
+ end
164
+
165
+ if attributes.key?(:'source')
166
+ self.source = attributes[:'source']
167
+ end
168
+
169
+ if attributes.key?(:'token')
170
+ self.token = attributes[:'token']
171
+ end
172
+
173
+ if attributes.key?(:'url')
174
+ self.url = attributes[:'url']
175
+ end
176
+
177
+ if attributes.key?(:'usc')
178
+ self.usc = attributes[:'usc']
179
+ end
180
+ end
181
+
182
+ # Show invalid properties with the reasons. Usually used together with valid?
183
+ # @return Array for valid properties with the reasons
184
+ def list_invalid_properties
185
+ invalid_properties = Array.new
186
+ if @id.nil?
187
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
188
+ end
189
+
190
+ if @result.nil?
191
+ invalid_properties.push('invalid value for "result", result cannot be nil.')
192
+ end
193
+
194
+ if @token.nil?
195
+ invalid_properties.push('invalid value for "token", token cannot be nil.')
196
+ end
197
+
198
+ invalid_properties
199
+ end
200
+
201
+ # Check to see if the all the properties in the model are valid
202
+ # @return true if the model is valid
203
+ def valid?
204
+ return false if @id.nil?
205
+ return false if @result.nil?
206
+ return false if @token.nil?
207
+ true
208
+ end
209
+
210
+ # Checks equality by comparing each attribute.
211
+ # @param [Object] Object to be compared
212
+ def ==(o)
213
+ return true if self.equal?(o)
214
+ self.class == o.class &&
215
+ attachments == o.attachments &&
216
+ bps == o.bps &&
217
+ date_created == o.date_created &&
218
+ errors == o.errors &&
219
+ id == o.id &&
220
+ identifier == o.identifier &&
221
+ mode == o.mode &&
222
+ qr_code == o.qr_code &&
223
+ result == o.result &&
224
+ server_version == o.server_version &&
225
+ source == o.source &&
226
+ token == o.token &&
227
+ url == o.url &&
228
+ usc == o.usc
229
+ end
230
+
231
+ # @see the `==` method
232
+ # @param [Object] Object to be compared
233
+ def eql?(o)
234
+ self == o
235
+ end
236
+
237
+ # Calculates hash code according to all attributes.
238
+ # @return [Integer] Hash code
239
+ def hash
240
+ [attachments, bps, date_created, errors, id, identifier, mode, qr_code, result, server_version, source, token, url, usc].hash
241
+ end
242
+
243
+ # Builds the object from hash
244
+ # @param [Hash] attributes Model attributes in the form of hash
245
+ # @return [Object] Returns the model itself
246
+ def self.build_from_hash(attributes)
247
+ new.build_from_hash(attributes)
248
+ end
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def build_from_hash(attributes)
254
+ return nil unless attributes.is_a?(Hash)
255
+ attributes = attributes.transform_keys(&:to_sym)
256
+ self.class.openapi_types.each_pair do |key, type|
257
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
258
+ self.send("#{key}=", nil)
259
+ elsif type =~ /\AArray<(.*)>/i
260
+ # check to ensure the input is an array given that the attribute
261
+ # is documented as an array but the input is not
262
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
263
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
264
+ end
265
+ elsif !attributes[self.class.attribute_map[key]].nil?
266
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
267
+ end
268
+ end
269
+
270
+ self
271
+ end
272
+
273
+ # Deserializes the data based on type
274
+ # @param string type Data type
275
+ # @param string value Value to be deserialized
276
+ # @return [Object] Deserialized data
277
+ def _deserialize(type, value)
278
+ case type.to_sym
279
+ when :Time
280
+ Time.parse(value)
281
+ when :Date
282
+ Date.parse(value)
283
+ when :String
284
+ value.to_s
285
+ when :Integer
286
+ value.to_i
287
+ when :Float
288
+ value.to_f
289
+ when :Boolean
290
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
291
+ true
292
+ else
293
+ false
294
+ end
295
+ when :Object
296
+ # generic object (usually a Hash), return directly
297
+ value
298
+ when /\AArray<(?<inner_type>.+)>\z/
299
+ inner_type = Regexp.last_match[:inner_type]
300
+ value.map { |v| _deserialize(inner_type, v) }
301
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
302
+ k_type = Regexp.last_match[:k_type]
303
+ v_type = Regexp.last_match[:v_type]
304
+ {}.tap do |hash|
305
+ value.each do |k, v|
306
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
307
+ end
308
+ end
309
+ else # model
310
+ # models (e.g. Pet) or oneOf
311
+ klass = CityPayApiClient.const_get(type)
312
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
313
+ end
314
+ end
315
+
316
+ # Returns the string representation of the object
317
+ # @return [String] String presentation of the object
318
+ def to_s
319
+ to_hash.to_s
320
+ end
321
+
322
+ # to_body is an alias to to_hash (backward compatibility)
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_body
325
+ to_hash
326
+ end
327
+
328
+ # Returns the object in the form of hash
329
+ # @return [Hash] Returns the object in the form of hash
330
+ def to_hash
331
+ hash = {}
332
+ self.class.attribute_map.each_pair do |attr, param|
333
+ value = self.send(attr)
334
+ if value.nil?
335
+ is_nullable = self.class.openapi_nullable.include?(attr)
336
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
337
+ end
338
+
339
+ hash[param] = _to_hash(value)
340
+ end
341
+ hash
342
+ end
343
+
344
+ # Outputs non-array value in the form of hash
345
+ # For object, use to_hash. Otherwise, just return the value
346
+ # @param [Object] value Any valid value
347
+ # @return [Hash] Returns the value in the form of hash
348
+ def _to_hash(value)
349
+ if value.is_a?(Array)
350
+ value.compact.map { |v| _to_hash(v) }
351
+ elsif value.is_a?(Hash)
352
+ {}.tap do |hash|
353
+ value.each { |k, v| hash[k] = _to_hash(v) }
354
+ end
355
+ elsif value.respond_to? :to_hash
356
+ value.to_hash
357
+ else
358
+ value
359
+ end
360
+ end
361
+
362
+ end
363
+
364
+ end