citypay_api_client 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +73 -0
  3. data/README.md +59 -32
  4. data/citypay_api_client.gemspec +1 -1
  5. data/docs/Acknowledgement.md +2 -2
  6. data/docs/AclCheckResponseModel.md +3 -3
  7. data/docs/AuthRequest.md +7 -7
  8. data/docs/AuthResponse.md +4 -4
  9. data/docs/AuthorisationAndPaymentApi.md +75 -231
  10. data/docs/Batch.md +1 -1
  11. data/docs/BatchProcessingApi.md +11 -11
  12. data/docs/BatchReportResponseModel.md +2 -2
  13. data/docs/BatchTransaction.md +1 -1
  14. data/docs/BatchTransactionReportRequest.md +22 -0
  15. data/docs/BatchTransactionReportResponse.md +24 -0
  16. data/docs/BatchTransactionResultModel.md +1 -1
  17. data/docs/Bin.md +2 -2
  18. data/docs/CaptureRequest.md +1 -1
  19. data/docs/Card.md +2 -2
  20. data/docs/CardHolderAccountApi.md +9 -5
  21. data/docs/ChargeRequest.md +7 -7
  22. data/docs/Decision.md +0 -2
  23. data/docs/DirectPostApi.md +2 -16
  24. data/docs/DirectPostRequest.md +7 -7
  25. data/docs/EventDataModel.md +2 -2
  26. data/docs/MerchantBatchReportRequest.md +28 -0
  27. data/docs/MerchantBatchReportResponse.md +24 -0
  28. data/docs/MerchantBatchResponse.md +30 -0
  29. data/docs/NetSummaryResponse.md +32 -0
  30. data/docs/PaylinkAdjustmentRequest.md +1 -1
  31. data/docs/PaylinkApi.md +141 -1
  32. data/docs/PaylinkBillPaymentTokenRequest.md +1 -1
  33. data/docs/PaylinkErrorCode.md +2 -2
  34. data/docs/PaylinkResendNotificationRequest.md +20 -0
  35. data/docs/PaylinkStateEvent.md +4 -4
  36. data/docs/PaylinkTokenCreated.md +11 -11
  37. data/docs/PaylinkTokenStatus.md +7 -7
  38. data/docs/PaylinkTokenStatusChangeRequest.md +7 -7
  39. data/docs/PaylinkTokenStatusChangeResponse.md +6 -2
  40. data/docs/PaymentIntent.md +42 -0
  41. data/docs/PaymentIntentReference.md +18 -0
  42. data/docs/RefundRequest.md +1 -1
  43. data/docs/RemittanceData.md +28 -0
  44. data/docs/RemittanceReportRequest.md +28 -0
  45. data/docs/RemittanceReportResponse.md +24 -0
  46. data/docs/RemittedClientData.md +44 -0
  47. data/docs/ReportingApi.md +378 -0
  48. data/docs/TokenisationResponseModel.md +1 -1
  49. data/lib/.DS_Store +0 -0
  50. data/lib/citypay_api_client/api/authorisation_and_payment_api__.rb +71 -3
  51. data/lib/citypay_api_client/api/batch_processing_api__.rb +7 -7
  52. data/lib/citypay_api_client/api/card_holder_account_api__.rb +4 -1
  53. data/lib/citypay_api_client/api/direct_post_api__.rb +5 -5
  54. data/lib/citypay_api_client/api/operational_functions_api__.rb +1 -1
  55. data/lib/citypay_api_client/api/paylink_api__.rb +138 -1
  56. data/lib/citypay_api_client/api/reporting_api__.rb +381 -0
  57. data/lib/citypay_api_client/api_client.rb +1 -1
  58. data/lib/citypay_api_client/api_error.rb +1 -1
  59. data/lib/citypay_api_client/configuration.rb +1 -1
  60. data/lib/citypay_api_client/models/account_create.rb +1 -1
  61. data/lib/citypay_api_client/models/account_status.rb +1 -1
  62. data/lib/citypay_api_client/models/acknowledgement.rb +1 -29
  63. data/lib/citypay_api_client/models/acl_check_request.rb +1 -1
  64. data/lib/citypay_api_client/models/acl_check_response_model.rb +2 -2
  65. data/lib/citypay_api_client/models/airline_advice.rb +1 -1
  66. data/lib/citypay_api_client/models/airline_segment.rb +1 -1
  67. data/lib/citypay_api_client/models/auth_reference.rb +1 -1
  68. data/lib/citypay_api_client/models/auth_references.rb +1 -1
  69. data/lib/citypay_api_client/models/auth_request.rb +10 -9
  70. data/lib/citypay_api_client/models/auth_response.rb +2 -2
  71. data/lib/citypay_api_client/models/batch.rb +2 -2
  72. data/lib/citypay_api_client/models/batch_report_request.rb +1 -1
  73. data/lib/citypay_api_client/models/batch_report_response_model.rb +2 -2
  74. data/lib/citypay_api_client/models/batch_transaction.rb +1 -1
  75. data/lib/citypay_api_client/models/batch_transaction_report_request.rb +234 -0
  76. data/lib/citypay_api_client/models/batch_transaction_report_response.rb +252 -0
  77. data/lib/citypay_api_client/models/batch_transaction_result_model.rb +1 -1
  78. data/lib/citypay_api_client/models/bin.rb +1 -1
  79. data/lib/citypay_api_client/models/bin_lookup.rb +1 -1
  80. data/lib/citypay_api_client/models/c_res_auth_request.rb +1 -1
  81. data/lib/citypay_api_client/models/capture_request.rb +1 -1
  82. data/lib/citypay_api_client/models/card.rb +1 -1
  83. data/lib/citypay_api_client/models/card_holder_account.rb +1 -1
  84. data/lib/citypay_api_client/models/card_status.rb +1 -1
  85. data/lib/citypay_api_client/models/charge_request.rb +10 -9
  86. data/lib/citypay_api_client/models/check_batch_status.rb +1 -1
  87. data/lib/citypay_api_client/models/check_batch_status_response.rb +1 -1
  88. data/lib/citypay_api_client/models/contact_details.rb +1 -1
  89. data/lib/citypay_api_client/models/decision.rb +2 -11
  90. data/lib/citypay_api_client/models/direct_post_request.rb +10 -9
  91. data/lib/citypay_api_client/models/direct_token_auth_request.rb +1 -1
  92. data/lib/citypay_api_client/models/domain_key_check_request.rb +1 -1
  93. data/lib/citypay_api_client/models/domain_key_request.rb +1 -1
  94. data/lib/citypay_api_client/models/domain_key_response.rb +1 -1
  95. data/lib/citypay_api_client/models/error.rb +1 -1
  96. data/lib/citypay_api_client/models/event_data_model.rb +1 -1
  97. data/lib/citypay_api_client/models/exists.rb +1 -1
  98. data/lib/citypay_api_client/models/external_mpi.rb +1 -1
  99. data/lib/citypay_api_client/models/list_merchants_response.rb +1 -1
  100. data/lib/citypay_api_client/models/mcc6012.rb +1 -1
  101. data/lib/citypay_api_client/models/merchant.rb +1 -1
  102. data/lib/citypay_api_client/models/merchant_batch_report_request.rb +265 -0
  103. data/lib/citypay_api_client/models/merchant_batch_report_response.rb +252 -0
  104. data/lib/citypay_api_client/models/merchant_batch_response.rb +301 -0
  105. data/lib/citypay_api_client/models/net_summary_response.rb +472 -0
  106. data/lib/citypay_api_client/models/pa_res_auth_request.rb +1 -1
  107. data/lib/citypay_api_client/models/paylink_address.rb +1 -1
  108. data/lib/citypay_api_client/models/paylink_adjustment_request.rb +1 -1
  109. data/lib/citypay_api_client/models/paylink_attachment_request.rb +1 -1
  110. data/lib/citypay_api_client/models/paylink_attachment_result.rb +1 -1
  111. data/lib/citypay_api_client/models/paylink_bill_payment_token_request.rb +1 -1
  112. data/lib/citypay_api_client/models/paylink_card_holder.rb +1 -1
  113. data/lib/citypay_api_client/models/paylink_cart.rb +1 -1
  114. data/lib/citypay_api_client/models/paylink_cart_item_model.rb +1 -1
  115. data/lib/citypay_api_client/models/paylink_config.rb +1 -1
  116. data/lib/citypay_api_client/models/paylink_custom_param.rb +1 -1
  117. data/lib/citypay_api_client/models/paylink_email_notification_path.rb +1 -1
  118. data/lib/citypay_api_client/models/paylink_error_code.rb +1 -1
  119. data/lib/citypay_api_client/models/paylink_field_guard_model.rb +1 -1
  120. data/lib/citypay_api_client/models/paylink_part_payments.rb +1 -1
  121. data/lib/citypay_api_client/models/paylink_resend_notification_request.rb +224 -0
  122. data/lib/citypay_api_client/models/paylink_sms_notification_path.rb +1 -1
  123. data/lib/citypay_api_client/models/paylink_state_event.rb +2 -2
  124. data/lib/citypay_api_client/models/paylink_token_created.rb +36 -8
  125. data/lib/citypay_api_client/models/paylink_token_request_model.rb +1 -1
  126. data/lib/citypay_api_client/models/paylink_token_status.rb +30 -2
  127. data/lib/citypay_api_client/models/paylink_token_status_change_request.rb +6 -7
  128. data/lib/citypay_api_client/models/paylink_token_status_change_response.rb +23 -3
  129. data/lib/citypay_api_client/models/paylink_ui.rb +1 -1
  130. data/lib/citypay_api_client/models/payment_intent.rb +479 -0
  131. data/lib/citypay_api_client/models/payment_intent_reference.rb +221 -0
  132. data/lib/citypay_api_client/models/ping.rb +1 -1
  133. data/lib/citypay_api_client/models/process_batch_request.rb +1 -1
  134. data/lib/citypay_api_client/models/process_batch_response.rb +1 -1
  135. data/lib/citypay_api_client/models/refund_request.rb +1 -1
  136. data/lib/citypay_api_client/models/register_card.rb +1 -1
  137. data/lib/citypay_api_client/models/remittance_data.rb +404 -0
  138. data/lib/citypay_api_client/models/remittance_report_request.rb +265 -0
  139. data/lib/citypay_api_client/models/remittance_report_response.rb +252 -0
  140. data/lib/citypay_api_client/models/remitted_client_data.rb +612 -0
  141. data/lib/citypay_api_client/models/request_challenged.rb +1 -1
  142. data/lib/citypay_api_client/models/retrieve_request.rb +1 -1
  143. data/lib/citypay_api_client/models/three_d_secure.rb +1 -1
  144. data/lib/citypay_api_client/models/tokenisation_response_model.rb +1 -1
  145. data/lib/citypay_api_client/models/void_request.rb +1 -1
  146. data/lib/citypay_api_client/version.rb +2 -2
  147. data/lib/citypay_api_client.rb +15 -2
  148. data/spec/.DS_Store +0 -0
  149. data/spec/api/reporting_api___spec.rb +99 -0
  150. data/spec/it_api_sandbox_spec.rb +0 -3
  151. data/spec/models/batch_transaction_report_request_spec.rb +47 -0
  152. data/spec/models/batch_transaction_report_response_spec.rb +53 -0
  153. data/spec/models/decision_spec.rb +0 -26
  154. data/spec/models/merchant_batch_report_request_spec.rb +65 -0
  155. data/spec/models/merchant_batch_report_response_spec.rb +53 -0
  156. data/spec/models/merchant_batch_response_spec.rb +71 -0
  157. data/spec/models/net_summary_response_spec.rb +77 -0
  158. data/spec/models/paylink_resend_notification_request_spec.rb +41 -0
  159. data/spec/models/payment_intent_reference_spec.rb +35 -0
  160. data/spec/models/payment_intent_spec.rb +107 -0
  161. data/spec/models/remittance_data_spec.rb +65 -0
  162. data/spec/models/remittance_report_request_spec.rb +65 -0
  163. data/spec/models/remittance_report_response_spec.rb +53 -0
  164. data/spec/models/remitted_client_data_spec.rb +113 -0
  165. data/spec/spec_helper.rb +1 -1
  166. metadata +124 -69
  167. data/spec/models/authen_required_spec.rb +0 -52
@@ -0,0 +1,479 @@
1
+ =begin
2
+ #CityPay Payment API
3
+
4
+ # Welcome to the CityPay API, a robust HTTP API payment solution designed for seamless server-to-server transactional processing. Our API facilitates a wide array of payment operations, catering to diverse business needs. Whether you're integrating Internet payments, handling Mail Order/Telephone Order (MOTO) transactions, managing Subscriptions with Recurring and Continuous Authority payments, or navigating the complexities of 3-D Secure authentication, our API is equipped to support your requirements. Additionally, we offer functionalities for Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids, and Completion processing, alongside the capability for tokenised payments. ## Compliance and Security Overview <aside class=\"notice\"> Ensuring the security of payment transactions and compliance with industry standards is paramount. Our API is designed with stringent security measures and compliance protocols to safeguard sensitive information and meet the rigorous requirements of Visa, MasterCard, and the PCI Security Standards Council. </aside> ### Key Compliance and Security Measures * **TLS Encryption**: All data transmissions must utilise TLS version 1.2 or higher, employing [strong cryptography](#enabled-tls-ciphers). Our infrastructure strictly enforces this requirement to maintain the integrity and confidentiality of data in transit. We conduct regular scans and assessments of our TLS endpoints to identify and mitigate vulnerabilities. * **Data Storage Prohibitions**: Storing sensitive cardholder data (CHD), such as the card security code (CSC) or primary account number (PAN), is strictly prohibited. Our API is designed to minimize your exposure to sensitive data, thereby reducing your compliance burden. * **Data Masking**: For consumer protection and compliance, full card numbers must not be displayed on receipts or any customer-facing materials. Our API automatically masks PANs, displaying only the last four digits to facilitate safe receipt generation. * **Network Scans**: If your application is web-based, regular scans of your hosting environment are mandatory to identify and rectify potential vulnerabilities. This proactive measure is crucial for maintaining a secure and compliant online presence. * **PCI Compliance**: Adherence to PCI DSS standards is not optional; it's a requirement for operating securely and legally in the payments ecosystem. For detailed information on compliance requirements and resources, please visit the PCI Security Standards Council website [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/). * **Request Validation**: Our API includes mechanisms to verify the legitimacy of each request, ensuring it pertains to a valid account and originates from a trusted source. We leverage remote IP address verification alongside sophisticated application firewall technologies to thwart a wide array of common security threats. ## Getting Started Before integrating with the CityPay API, ensure your application and development practices align with the outlined compliance and security measures. This preparatory step is crucial for a smooth integration process and the long-term success of your payment processing operations. For further details on API endpoints, request/response formats, and code examples, proceed to the subsequent sections of our documentation. Our aim is to provide you with all the necessary tools and information to integrate our payment processing capabilities seamlessly into your application. Thank you for choosing CityPay API. We look forward to supporting your payment processing needs with our secure, compliant, and versatile API solution.
5
+
6
+ Contact: support@citypay.com
7
+ Generated by: https://openapi-generator.tech
8
+ OpenAPI Generator version: 7.2.0
9
+
10
+ =end
11
+
12
+ require 'date'
13
+ require 'time'
14
+
15
+ module CityPayApiClient
16
+ class PaymentIntent
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 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 possession 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.
26
+ attr_accessor :csc
27
+
28
+ # 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.
29
+ attr_accessor :csc_policy
30
+
31
+ # The processing currency for the transaction. Will default to the merchant account currency.
32
+ attr_accessor :currency
33
+
34
+ # 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.
35
+ attr_accessor :duplicate_policy
36
+
37
+ # 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.
38
+ attr_accessor :identifier
39
+
40
+ # 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.
41
+ attr_accessor :match_avsa
42
+
43
+ attr_accessor :ship_to
44
+
45
+ attr_accessor :tag
46
+
47
+ # Further information that can be added to the transaction will display in reporting. Can be used for flexible values such as operator id.
48
+ attr_accessor :trans_info
49
+
50
+ # The type of transaction being submitted. Normally this value is not required and your account manager may request that you set this field.
51
+ attr_accessor :trans_type
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'amount' => :'amount',
57
+ :'avs_postcode_policy' => :'avs_postcode_policy',
58
+ :'bill_to' => :'bill_to',
59
+ :'csc' => :'csc',
60
+ :'csc_policy' => :'csc_policy',
61
+ :'currency' => :'currency',
62
+ :'duplicate_policy' => :'duplicate_policy',
63
+ :'identifier' => :'identifier',
64
+ :'match_avsa' => :'match_avsa',
65
+ :'ship_to' => :'ship_to',
66
+ :'tag' => :'tag',
67
+ :'trans_info' => :'trans_info',
68
+ :'trans_type' => :'trans_type'
69
+ }
70
+ end
71
+
72
+ # Returns all the JSON keys this model knows about
73
+ def self.acceptable_attributes
74
+ attribute_map.values
75
+ end
76
+
77
+ # Attribute type mapping.
78
+ def self.openapi_types
79
+ {
80
+ :'amount' => :'Integer',
81
+ :'avs_postcode_policy' => :'String',
82
+ :'bill_to' => :'ContactDetails',
83
+ :'csc' => :'String',
84
+ :'csc_policy' => :'String',
85
+ :'currency' => :'String',
86
+ :'duplicate_policy' => :'String',
87
+ :'identifier' => :'String',
88
+ :'match_avsa' => :'String',
89
+ :'ship_to' => :'ContactDetails',
90
+ :'tag' => :'Array<String>',
91
+ :'trans_info' => :'String',
92
+ :'trans_type' => :'String'
93
+ }
94
+ end
95
+
96
+ # List of attributes with nullable: true
97
+ def self.openapi_nullable
98
+ Set.new([
99
+ ])
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::PaymentIntent` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ attributes = attributes.each_with_object({}) { |(k, v), h|
111
+ if (!self.class.attribute_map.key?(k.to_sym))
112
+ fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::PaymentIntent`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
113
+ end
114
+ h[k.to_sym] = v
115
+ }
116
+
117
+ if attributes.key?(:'amount')
118
+ self.amount = attributes[:'amount']
119
+ else
120
+ self.amount = nil
121
+ end
122
+
123
+ if attributes.key?(:'avs_postcode_policy')
124
+ self.avs_postcode_policy = attributes[:'avs_postcode_policy']
125
+ end
126
+
127
+ if attributes.key?(:'bill_to')
128
+ self.bill_to = attributes[:'bill_to']
129
+ end
130
+
131
+ if attributes.key?(:'csc')
132
+ self.csc = attributes[:'csc']
133
+ end
134
+
135
+ if attributes.key?(:'csc_policy')
136
+ self.csc_policy = attributes[:'csc_policy']
137
+ end
138
+
139
+ if attributes.key?(:'currency')
140
+ self.currency = attributes[:'currency']
141
+ end
142
+
143
+ if attributes.key?(:'duplicate_policy')
144
+ self.duplicate_policy = attributes[:'duplicate_policy']
145
+ end
146
+
147
+ if attributes.key?(:'identifier')
148
+ self.identifier = attributes[:'identifier']
149
+ else
150
+ self.identifier = nil
151
+ end
152
+
153
+ if attributes.key?(:'match_avsa')
154
+ self.match_avsa = attributes[:'match_avsa']
155
+ end
156
+
157
+ if attributes.key?(:'ship_to')
158
+ self.ship_to = attributes[:'ship_to']
159
+ end
160
+
161
+ if attributes.key?(:'tag')
162
+ if (value = attributes[:'tag']).is_a?(Array)
163
+ self.tag = value
164
+ end
165
+ end
166
+
167
+ if attributes.key?(:'trans_info')
168
+ self.trans_info = attributes[:'trans_info']
169
+ end
170
+
171
+ if attributes.key?(:'trans_type')
172
+ self.trans_type = attributes[:'trans_type']
173
+ end
174
+ end
175
+
176
+ # Show invalid properties with the reasons. Usually used together with valid?
177
+ # @return Array for valid properties with the reasons
178
+ def list_invalid_properties
179
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
180
+ invalid_properties = Array.new
181
+ if @amount.nil?
182
+ invalid_properties.push('invalid value for "amount", amount cannot be nil.')
183
+ end
184
+
185
+ if !@csc.nil? && @csc.to_s.length > 4
186
+ invalid_properties.push('invalid value for "csc", the character length must be smaller than or equal to 4.')
187
+ end
188
+
189
+ if !@csc.nil? && @csc.to_s.length < 3
190
+ invalid_properties.push('invalid value for "csc", the character length must be great than or equal to 3.')
191
+ end
192
+
193
+ if !@currency.nil? && @currency.to_s.length > 3
194
+ invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
195
+ end
196
+
197
+ if !@currency.nil? && @currency.to_s.length < 3
198
+ invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 3.')
199
+ end
200
+
201
+ if @identifier.nil?
202
+ invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
203
+ end
204
+
205
+ if @identifier.to_s.length > 50
206
+ invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
207
+ end
208
+
209
+ if @identifier.to_s.length < 4
210
+ invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
211
+ end
212
+
213
+ if !@trans_info.nil? && @trans_info.to_s.length > 50
214
+ invalid_properties.push('invalid value for "trans_info", the character length must be smaller than or equal to 50.')
215
+ end
216
+
217
+ if !@trans_type.nil? && @trans_type.to_s.length > 1
218
+ invalid_properties.push('invalid value for "trans_type", the character length must be smaller than or equal to 1.')
219
+ end
220
+
221
+ invalid_properties
222
+ end
223
+
224
+ # Check to see if the all the properties in the model are valid
225
+ # @return true if the model is valid
226
+ def valid?
227
+ warn '[DEPRECATED] the `valid?` method is obsolete'
228
+ return false if @amount.nil?
229
+ return false if !@csc.nil? && @csc.to_s.length > 4
230
+ return false if !@csc.nil? && @csc.to_s.length < 3
231
+ return false if !@currency.nil? && @currency.to_s.length > 3
232
+ return false if !@currency.nil? && @currency.to_s.length < 3
233
+ return false if @identifier.nil?
234
+ return false if @identifier.to_s.length > 50
235
+ return false if @identifier.to_s.length < 4
236
+ return false if !@trans_info.nil? && @trans_info.to_s.length > 50
237
+ return false if !@trans_type.nil? && @trans_type.to_s.length > 1
238
+ true
239
+ end
240
+
241
+ # Custom attribute writer method with validation
242
+ # @param [Object] amount Value to be assigned
243
+ def amount=(amount)
244
+ if amount.nil?
245
+ fail ArgumentError, 'amount cannot be nil'
246
+ end
247
+
248
+ @amount = amount
249
+ end
250
+
251
+ # Custom attribute writer method with validation
252
+ # @param [Object] csc Value to be assigned
253
+ def csc=(csc)
254
+ if csc.nil?
255
+ fail ArgumentError, 'csc cannot be nil'
256
+ end
257
+
258
+ if csc.to_s.length > 4
259
+ fail ArgumentError, 'invalid value for "csc", the character length must be smaller than or equal to 4.'
260
+ end
261
+
262
+ if csc.to_s.length < 3
263
+ fail ArgumentError, 'invalid value for "csc", the character length must be great than or equal to 3.'
264
+ end
265
+
266
+ @csc = csc
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] currency Value to be assigned
271
+ def currency=(currency)
272
+ if currency.nil?
273
+ fail ArgumentError, 'currency cannot be nil'
274
+ end
275
+
276
+ if currency.to_s.length > 3
277
+ fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
278
+ end
279
+
280
+ if currency.to_s.length < 3
281
+ fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 3.'
282
+ end
283
+
284
+ @currency = currency
285
+ end
286
+
287
+ # Custom attribute writer method with validation
288
+ # @param [Object] identifier Value to be assigned
289
+ def identifier=(identifier)
290
+ if identifier.nil?
291
+ fail ArgumentError, 'identifier cannot be nil'
292
+ end
293
+
294
+ if identifier.to_s.length > 50
295
+ fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
296
+ end
297
+
298
+ if identifier.to_s.length < 4
299
+ fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
300
+ end
301
+
302
+ @identifier = identifier
303
+ end
304
+
305
+ # Custom attribute writer method with validation
306
+ # @param [Object] trans_info Value to be assigned
307
+ def trans_info=(trans_info)
308
+ if trans_info.nil?
309
+ fail ArgumentError, 'trans_info cannot be nil'
310
+ end
311
+
312
+ if trans_info.to_s.length > 50
313
+ fail ArgumentError, 'invalid value for "trans_info", the character length must be smaller than or equal to 50.'
314
+ end
315
+
316
+ @trans_info = trans_info
317
+ end
318
+
319
+ # Custom attribute writer method with validation
320
+ # @param [Object] trans_type Value to be assigned
321
+ def trans_type=(trans_type)
322
+ if trans_type.nil?
323
+ fail ArgumentError, 'trans_type cannot be nil'
324
+ end
325
+
326
+ if trans_type.to_s.length > 1
327
+ fail ArgumentError, 'invalid value for "trans_type", the character length must be smaller than or equal to 1.'
328
+ end
329
+
330
+ @trans_type = trans_type
331
+ end
332
+
333
+ # Checks equality by comparing each attribute.
334
+ # @param [Object] Object to be compared
335
+ def ==(o)
336
+ return true if self.equal?(o)
337
+ self.class == o.class &&
338
+ amount == o.amount &&
339
+ avs_postcode_policy == o.avs_postcode_policy &&
340
+ bill_to == o.bill_to &&
341
+ csc == o.csc &&
342
+ csc_policy == o.csc_policy &&
343
+ currency == o.currency &&
344
+ duplicate_policy == o.duplicate_policy &&
345
+ identifier == o.identifier &&
346
+ match_avsa == o.match_avsa &&
347
+ ship_to == o.ship_to &&
348
+ tag == o.tag &&
349
+ trans_info == o.trans_info &&
350
+ trans_type == o.trans_type
351
+ end
352
+
353
+ # @see the `==` method
354
+ # @param [Object] Object to be compared
355
+ def eql?(o)
356
+ self == o
357
+ end
358
+
359
+ # Calculates hash code according to all attributes.
360
+ # @return [Integer] Hash code
361
+ def hash
362
+ [amount, avs_postcode_policy, bill_to, csc, csc_policy, currency, duplicate_policy, identifier, match_avsa, ship_to, tag, trans_info, trans_type].hash
363
+ end
364
+
365
+ # Builds the object from hash
366
+ # @param [Hash] attributes Model attributes in the form of hash
367
+ # @return [Object] Returns the model itself
368
+ def self.build_from_hash(attributes)
369
+ return nil unless attributes.is_a?(Hash)
370
+ attributes = attributes.transform_keys(&:to_sym)
371
+ transformed_hash = {}
372
+ openapi_types.each_pair do |key, type|
373
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
374
+ transformed_hash["#{key}"] = nil
375
+ elsif type =~ /\AArray<(.*)>/i
376
+ # check to ensure the input is an array given that the attribute
377
+ # is documented as an array but the input is not
378
+ if attributes[attribute_map[key]].is_a?(Array)
379
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
380
+ end
381
+ elsif !attributes[attribute_map[key]].nil?
382
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
383
+ end
384
+ end
385
+ new(transformed_hash)
386
+ end
387
+
388
+ # Deserializes the data based on type
389
+ # @param string type Data type
390
+ # @param string value Value to be deserialized
391
+ # @return [Object] Deserialized data
392
+ def self._deserialize(type, value)
393
+ case type.to_sym
394
+ when :Time
395
+ Time.parse(value)
396
+ when :Date
397
+ Date.parse(value)
398
+ when :String
399
+ value.to_s
400
+ when :Integer
401
+ value.to_i
402
+ when :Float
403
+ value.to_f
404
+ when :Boolean
405
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
406
+ true
407
+ else
408
+ false
409
+ end
410
+ when :Object
411
+ # generic object (usually a Hash), return directly
412
+ value
413
+ when /\AArray<(?<inner_type>.+)>\z/
414
+ inner_type = Regexp.last_match[:inner_type]
415
+ value.map { |v| _deserialize(inner_type, v) }
416
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
417
+ k_type = Regexp.last_match[:k_type]
418
+ v_type = Regexp.last_match[:v_type]
419
+ {}.tap do |hash|
420
+ value.each do |k, v|
421
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
422
+ end
423
+ end
424
+ else # model
425
+ # models (e.g. Pet) or oneOf
426
+ klass = CityPayApiClient.const_get(type)
427
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
428
+ end
429
+ end
430
+
431
+ # Returns the string representation of the object
432
+ # @return [String] String presentation of the object
433
+ def to_s
434
+ to_hash.to_s
435
+ end
436
+
437
+ # to_body is an alias to to_hash (backward compatibility)
438
+ # @return [Hash] Returns the object in the form of hash
439
+ def to_body
440
+ to_hash
441
+ end
442
+
443
+ # Returns the object in the form of hash
444
+ # @return [Hash] Returns the object in the form of hash
445
+ def to_hash
446
+ hash = {}
447
+ self.class.attribute_map.each_pair do |attr, param|
448
+ value = self.send(attr)
449
+ if value.nil?
450
+ is_nullable = self.class.openapi_nullable.include?(attr)
451
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
452
+ end
453
+
454
+ hash[param] = _to_hash(value)
455
+ end
456
+ hash
457
+ end
458
+
459
+ # Outputs non-array value in the form of hash
460
+ # For object, use to_hash. Otherwise, just return the value
461
+ # @param [Object] value Any valid value
462
+ # @return [Hash] Returns the value in the form of hash
463
+ def _to_hash(value)
464
+ if value.is_a?(Array)
465
+ value.compact.map { |v| _to_hash(v) }
466
+ elsif value.is_a?(Hash)
467
+ {}.tap do |hash|
468
+ value.each { |k, v| hash[k] = _to_hash(v) }
469
+ end
470
+ elsif value.respond_to? :to_hash
471
+ value.to_hash
472
+ else
473
+ value
474
+ end
475
+ end
476
+
477
+ end
478
+
479
+ end