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.
- checksums.yaml +4 -4
- data/README.md +105 -34
- data/citypay_api_client.gemspec +4 -5
- data/docs/AccountCreate.md +10 -9
- data/docs/AccountStatus.md +8 -7
- data/docs/Acknowledgement.md +14 -13
- data/docs/AclCheckRequest.md +18 -0
- data/docs/AclCheckResponseModel.md +24 -0
- data/docs/AirlineAdvice.md +38 -37
- data/docs/AirlineSegment.md +22 -21
- data/docs/AuthReference.md +34 -33
- data/docs/AuthReferences.md +8 -7
- data/docs/AuthRequest.md +50 -49
- data/docs/AuthResponse.md +60 -59
- data/docs/AuthenRequired.md +12 -11
- data/docs/AuthorisationAndPaymentApi.md +559 -0
- data/docs/Batch.md +22 -0
- data/docs/BatchProcessingApi.md +214 -0
- data/docs/BatchReportRequest.md +20 -0
- data/docs/BatchReportResponseModel.md +28 -0
- data/docs/BatchTransaction.md +24 -0
- data/docs/BatchTransactionResultModel.md +40 -0
- data/docs/Bin.md +34 -0
- data/docs/BinLookup.md +18 -0
- data/docs/CResAuthRequest.md +8 -7
- data/docs/CaptureRequest.md +18 -17
- data/docs/Card.md +46 -41
- data/docs/CardHolderAccount.md +24 -21
- data/docs/CardHolderAccountApi.md +326 -105
- data/docs/CardStatus.md +10 -9
- data/docs/ChargeRequest.md +36 -31
- data/docs/CheckBatchStatus.md +20 -0
- data/docs/CheckBatchStatusResponse.md +18 -0
- data/docs/ContactDetails.md +32 -31
- data/docs/Decision.md +12 -11
- data/docs/DirectPostApi.md +365 -0
- data/docs/DirectPostRequest.md +58 -0
- data/docs/DirectTokenAuthRequest.md +24 -0
- data/docs/DomainKeyCheckRequest.md +18 -0
- data/docs/DomainKeyRequest.md +22 -0
- data/docs/DomainKeyResponse.md +26 -0
- data/docs/Error.md +16 -13
- data/docs/EventDataModel.md +26 -0
- data/docs/Exists.md +22 -0
- data/docs/ExternalMPI.md +16 -15
- data/docs/ListMerchantsResponse.md +12 -11
- data/docs/MCC6012.md +14 -13
- data/docs/Merchant.md +16 -15
- data/docs/OperationalApi.md +124 -22
- data/docs/OperationalFunctionsApi.md +355 -0
- data/docs/PaResAuthRequest.md +10 -9
- data/docs/PaylinkAddress.md +30 -0
- data/docs/PaylinkAdjustmentRequest.md +22 -0
- data/docs/PaylinkApi.md +630 -0
- data/docs/PaylinkAttachmentRequest.md +26 -0
- data/docs/PaylinkAttachmentResult.md +22 -0
- data/docs/PaylinkBillPaymentTokenRequest.md +32 -0
- data/docs/PaylinkCardHolder.md +36 -0
- data/docs/PaylinkCart.md +30 -0
- data/docs/PaylinkCartItemModel.md +32 -0
- data/docs/PaylinkConfig.md +60 -0
- data/docs/PaylinkCustomParam.md +36 -0
- data/docs/PaylinkEmailNotificationPath.md +26 -0
- data/docs/PaylinkErrorCode.md +20 -0
- data/docs/PaylinkFieldGuardModel.md +30 -0
- data/docs/PaylinkPartPayments.md +28 -0
- data/docs/PaylinkSMSNotificationPath.md +20 -0
- data/docs/PaylinkStateEvent.md +22 -0
- data/docs/PaylinkTokenCreated.md +44 -0
- data/docs/PaylinkTokenRequestModel.md +38 -0
- data/docs/PaylinkTokenStatus.md +72 -0
- data/docs/PaylinkTokenStatusChangeRequest.md +26 -0
- data/docs/PaylinkTokenStatusChangeResponse.md +20 -0
- data/docs/PaylinkUI.md +24 -0
- data/docs/PaymentProcessingApi.md +307 -68
- data/docs/Ping.md +8 -7
- data/docs/ProcessBatchRequest.md +24 -0
- data/docs/ProcessBatchResponse.md +20 -0
- data/docs/RefundRequest.md +26 -0
- data/docs/RegisterCard.md +16 -13
- data/docs/RequestChallenged.md +16 -15
- data/docs/RetrieveRequest.md +12 -11
- data/docs/ThreeDSecure.md +32 -15
- data/docs/TokenisationResponseModel.md +36 -0
- data/docs/VoidRequest.md +12 -13
- data/lib/.DS_Store +0 -0
- data/lib/citypay_api_client/api/authorisation_and_payment_api__.rb +565 -0
- data/lib/citypay_api_client/api/batch_processing_api__.rb +225 -0
- data/lib/citypay_api_client/api/{card_holder_account_api.rb → card_holder_account_api__.rb} +136 -46
- data/lib/citypay_api_client/api/direct_post_api__.rb +373 -0
- data/lib/citypay_api_client/api/operational_functions_api__.rb +356 -0
- data/lib/citypay_api_client/api/paylink_api__.rb +614 -0
- data/lib/citypay_api_client/api_client.rb +59 -59
- data/lib/citypay_api_client/api_error.rb +2 -2
- data/lib/citypay_api_client/configuration.rb +53 -15
- data/lib/citypay_api_client/models/account_create.rb +21 -8
- data/lib/citypay_api_client/models/account_status.rb +21 -8
- data/lib/citypay_api_client/models/acknowledgement.rb +21 -8
- data/lib/citypay_api_client/models/acl_check_request.rb +224 -0
- data/lib/citypay_api_client/models/acl_check_response_model.rb +249 -0
- data/lib/citypay_api_client/models/airline_advice.rb +23 -10
- data/lib/citypay_api_client/models/airline_segment.rb +21 -8
- data/lib/citypay_api_client/models/auth_reference.rb +45 -11
- data/lib/citypay_api_client/models/auth_references.rb +21 -8
- data/lib/citypay_api_client/models/auth_request.rb +79 -35
- data/lib/citypay_api_client/models/auth_response.rb +43 -106
- data/lib/citypay_api_client/models/authen_required.rb +21 -8
- data/lib/citypay_api_client/models/batch.rb +264 -0
- data/lib/citypay_api_client/models/batch_report_request.rb +277 -0
- data/lib/citypay_api_client/models/batch_report_response_model.rb +357 -0
- data/lib/citypay_api_client/models/batch_transaction.rb +321 -0
- data/lib/citypay_api_client/models/batch_transaction_result_model.rb +421 -0
- data/lib/citypay_api_client/models/bin.rb +299 -0
- data/lib/citypay_api_client/models/bin_lookup.rb +234 -0
- data/lib/citypay_api_client/models/c_res_auth_request.rb +21 -8
- data/lib/citypay_api_client/models/capture_request.rb +38 -22
- data/lib/citypay_api_client/models/card.rb +67 -10
- data/lib/citypay_api_client/models/card_holder_account.rb +35 -12
- data/lib/citypay_api_client/models/card_status.rb +21 -8
- data/lib/citypay_api_client/models/charge_request.rb +96 -26
- data/lib/citypay_api_client/models/check_batch_status.rb +259 -0
- data/lib/citypay_api_client/models/check_batch_status_response.rb +220 -0
- data/lib/citypay_api_client/models/contact_details.rb +87 -44
- data/lib/citypay_api_client/models/decision.rb +21 -8
- data/lib/citypay_api_client/models/direct_post_request.rb +670 -0
- data/lib/citypay_api_client/models/direct_token_auth_request.rb +249 -0
- data/lib/citypay_api_client/models/domain_key_check_request.rb +252 -0
- data/lib/citypay_api_client/models/domain_key_request.rb +250 -0
- data/lib/citypay_api_client/models/domain_key_response.rb +294 -0
- data/lib/citypay_api_client/models/error.rb +35 -12
- data/lib/citypay_api_client/models/event_data_model.rb +259 -0
- data/lib/citypay_api_client/models/exists.rb +244 -0
- data/lib/citypay_api_client/models/external_mpi.rb +27 -8
- data/lib/citypay_api_client/models/list_merchants_response.rb +21 -8
- data/lib/citypay_api_client/models/mcc6012.rb +21 -8
- data/lib/citypay_api_client/models/merchant.rb +21 -8
- data/lib/citypay_api_client/models/pa_res_auth_request.rb +22 -9
- data/lib/citypay_api_client/models/paylink_address.rb +402 -0
- data/lib/citypay_api_client/models/paylink_adjustment_request.rb +269 -0
- data/lib/citypay_api_client/models/paylink_attachment_request.rb +269 -0
- data/lib/citypay_api_client/models/paylink_attachment_result.rb +249 -0
- data/lib/citypay_api_client/models/paylink_bill_payment_token_request.rb +292 -0
- data/lib/citypay_api_client/models/paylink_card_holder.rb +353 -0
- data/lib/citypay_api_client/models/paylink_cart.rb +280 -0
- data/lib/citypay_api_client/models/paylink_cart_item_model.rb +289 -0
- data/lib/citypay_api_client/models/paylink_config.rb +433 -0
- data/lib/citypay_api_client/models/paylink_custom_param.rb +314 -0
- data/lib/citypay_api_client/models/paylink_email_notification_path.rb +268 -0
- data/lib/citypay_api_client/models/paylink_error_code.rb +239 -0
- data/lib/citypay_api_client/models/paylink_field_guard_model.rb +279 -0
- data/lib/citypay_api_client/models/paylink_part_payments.rb +269 -0
- data/lib/citypay_api_client/models/paylink_sms_notification_path.rb +234 -0
- data/lib/citypay_api_client/models/paylink_state_event.rb +239 -0
- data/lib/citypay_api_client/models/paylink_token_created.rb +364 -0
- data/lib/citypay_api_client/models/paylink_token_request_model.rb +374 -0
- data/lib/citypay_api_client/models/paylink_token_status.rb +490 -0
- data/lib/citypay_api_client/models/paylink_token_status_change_request.rb +270 -0
- data/lib/citypay_api_client/models/paylink_token_status_change_response.rb +235 -0
- data/lib/citypay_api_client/models/paylink_ui.rb +249 -0
- data/lib/citypay_api_client/models/ping.rb +21 -8
- data/lib/citypay_api_client/models/process_batch_request.rb +308 -0
- data/lib/citypay_api_client/models/process_batch_response.rb +234 -0
- data/lib/citypay_api_client/models/refund_request.rb +332 -0
- data/lib/citypay_api_client/models/register_card.rb +59 -12
- data/lib/citypay_api_client/models/request_challenged.rb +29 -16
- data/lib/citypay_api_client/models/retrieve_request.rb +21 -8
- data/lib/citypay_api_client/models/three_d_secure.rb +106 -13
- data/lib/citypay_api_client/models/tokenisation_response_model.rb +333 -0
- data/lib/citypay_api_client/models/void_request.rb +22 -21
- data/lib/citypay_api_client/utils/digest_utils.rb +18 -0
- data/lib/citypay_api_client/utils/direct_post_mac.rb +22 -0
- data/lib/citypay_api_client/version.rb +3 -4
- data/lib/citypay_api_client.rb +53 -6
- data/spec/.DS_Store +0 -0
- data/spec/api/authorisation_and_payment_api___spec.rb +130 -0
- data/spec/api/batch_processing_api___spec.rb +70 -0
- data/spec/api/{card_holder_account_api_spec.rb → card_holder_account_api___spec.rb} +15 -3
- data/spec/api/direct_post_api___spec.rb +98 -0
- data/spec/api/operational_functions_api___spec.rb +94 -0
- data/spec/api/paylink_api___spec.rb +131 -0
- data/spec/api_client_spec.rb +4 -4
- data/spec/configuration_spec.rb +5 -5
- data/spec/it_api_sandbox_spec.rb +126 -58
- data/spec/models/acknowledgement_spec.rb +7 -22
- data/spec/models/acl_check_request_spec.rb +33 -0
- data/spec/models/acl_check_response_model_spec.rb +51 -0
- data/spec/models/auth_references_spec.rb +7 -8
- data/spec/models/auth_response_spec.rb +29 -30
- data/spec/models/batch_report_request_spec.rb +39 -0
- data/spec/models/batch_report_response_model_spec.rb +63 -0
- data/spec/models/batch_spec.rb +45 -0
- data/spec/models/batch_transaction_result_model_spec.rb +87 -0
- data/spec/models/batch_transaction_spec.rb +51 -0
- data/spec/models/bin_lookup_spec.rb +33 -0
- data/spec/models/bin_spec.rb +81 -0
- data/spec/models/card_holder_account_spec.rb +8 -5
- data/spec/models/check_batch_status_response_spec.rb +45 -0
- data/spec/models/check_batch_status_spec.rb +39 -0
- data/spec/models/decision_spec.rb +1 -1
- data/spec/models/direct_post_request_spec.rb +153 -0
- data/spec/models/direct_token_auth_request_spec.rb +51 -0
- data/spec/models/domain_key_check_request_spec.rb +33 -0
- data/spec/models/domain_key_request_spec.rb +45 -0
- data/spec/models/domain_key_response_spec.rb +57 -0
- data/spec/models/event_data_model_spec.rb +57 -0
- data/spec/{api/operational_api_spec.rb → models/exists_spec.rb} +14 -20
- data/spec/models/list_merchants_response_spec.rb +2 -2
- data/spec/models/paylink_address_spec.rb +69 -0
- data/spec/models/paylink_adjustment_request_spec.rb +45 -0
- data/spec/models/paylink_attachment_request_spec.rb +45 -0
- data/spec/models/paylink_attachment_result_spec.rb +45 -0
- data/spec/models/paylink_bill_payment_token_request_spec.rb +63 -0
- data/spec/models/paylink_card_holder_spec.rb +87 -0
- data/spec/models/paylink_cart_item_model_spec.rb +75 -0
- data/spec/models/paylink_cart_spec.rb +69 -0
- data/spec/models/paylink_config_spec.rb +159 -0
- data/spec/models/paylink_custom_param_spec.rb +87 -0
- data/spec/models/paylink_email_notification_path_spec.rb +57 -0
- data/spec/models/paylink_error_code_spec.rb +39 -0
- data/spec/models/paylink_field_guard_model_spec.rb +45 -0
- data/spec/models/paylink_part_payments_spec.rb +63 -0
- data/spec/models/paylink_sms_notification_path_spec.rb +39 -0
- data/spec/models/paylink_state_event_spec.rb +45 -0
- data/spec/models/paylink_token_created_spec.rb +111 -0
- data/spec/models/paylink_token_request_model_spec.rb +93 -0
- data/spec/models/paylink_token_status_change_request_spec.rb +57 -0
- data/spec/models/paylink_token_status_change_response_spec.rb +39 -0
- data/spec/models/paylink_token_status_spec.rb +195 -0
- data/spec/models/paylink_ui_spec.rb +51 -0
- data/spec/models/process_batch_request_spec.rb +51 -0
- data/spec/models/process_batch_response_spec.rb +39 -0
- data/spec/models/refund_request_spec.rb +64 -0
- data/spec/models/tokenisation_response_model_spec.rb +87 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/utils/direct_post_mac_spec.rb +13 -0
- metadata +210 -37
- data/Gemfile.lock +0 -70
- data/git_push.sh +0 -58
- data/lib/citypay_api_client/api/operational_api.rb +0 -147
- data/lib/citypay_api_client/api/payment_processing_api.rb +0 -405
- data/lib/citypay_api_client/test.rb +0 -20
- data/spec/api/payment_processing_api_spec.rb +0 -106
@@ -1,49 +1,55 @@
|
|
1
1
|
=begin
|
2
2
|
#CityPay Payment API
|
3
3
|
|
4
|
-
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security
|
4
|
+
# This CityPay API is a HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokinsed payments using Card Holder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive card holder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
5
|
|
6
6
|
Contact: support@citypay.com
|
7
7
|
Generated by: https://openapi-generator.tech
|
8
|
-
OpenAPI Generator version:
|
8
|
+
OpenAPI Generator version: 6.2.1
|
9
9
|
|
10
10
|
=end
|
11
11
|
|
12
12
|
require 'date'
|
13
|
+
require 'time'
|
13
14
|
|
14
15
|
module CityPayApiClient
|
15
16
|
class ChargeRequest
|
16
|
-
# The amount to authorise in the lowest unit of currency with a variable length to a maximum of 12 digits.
|
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.
|
17
18
|
attr_accessor :amount
|
18
19
|
|
19
|
-
# 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.
|
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.
|
20
21
|
attr_accessor :avs_postcode_policy
|
21
22
|
|
22
|
-
#
|
23
|
+
# Merchant-initiated transactions (MITs) are payments you trigger, where the cardholder has previously consented to you carrying out such payments. These may be scheduled (such as recurring payments and installments) or unscheduled (like account top-ups triggered by balance thresholds and no-show charges). Scheduled --- These are regular payments using stored card details, like installments or a monthly subscription fee. - `I` Instalment - A single purchase of goods or services billed to a cardholder in multiple transactions, over a period of time agreed by the cardholder and you. - `R` Recurring - Transactions processed at fixed, regular intervals not to exceed one year between transactions, representing an agreement between a cardholder and you to purchase goods or services provided over a period of time. Unscheduled --- These are payments using stored card details that do not occur on a regular schedule, like top-ups for a digital wallet triggered by the balance falling below a certain threshold. - `A` Reauthorisation - a purchase made after the original purchase. A common scenario is delayed/split shipments. - `C` Unscheduled Payment - A transaction using a stored credential for a fixed or variable amount that does not occur on a scheduled or regularly occurring transaction date. This includes account top-ups triggered by balance thresholds. - `D` Delayed Charge - A delayed charge is typically used in hotel, cruise lines and vehicle rental environments to perform a supplemental account charge after original services are rendered. - `L` Incremental - An incremental authorisation is typically found in hotel and car rental environments, where the cardholder has agreed to pay for any service incurred during the duration of the contract. An incremental authorisation is where you need to seek authorisation of further funds in addition to what you have originally requested. A common scenario is additional services charged to the contract, such as extending a stay in a hotel. - `S` Resubmission - When the original purchase occurred, but you were not able to get authorisation at the time the goods or services were provided. It should be only used where the goods or services have already been provided, but the authorisation request is declined for insufficient funds. - `X` No-show - A no-show is a transaction where you are enabled to charge for services which the cardholder entered into an agreement to purchase, but the cardholder did not meet the terms of the agreement.
|
24
|
+
attr_accessor :cardholder_agreement
|
25
|
+
|
26
|
+
# The Card Security Code (CSC) (also known as CV2/CVV2) is normally found on the back of the card (American Express has it on the front). The value helps to identify posession of the card as it is not available within the chip or magnetic swipe. When forwarding the CSC, please ensure the value is a string as some values start with 0 and this will be stripped out by any integer parsing. The CSC number aids fraud prevention in Mail Order and Internet payments. Business rules are available on your account to identify whether to accept or decline transactions based on mismatched results of the CSC. The Payment Card Industry (PCI) requires that at no stage of a transaction should the CSC be stored. This applies to all entities handling card data. It should also not be used in any hashing process. CityPay do not store the value and have no method of retrieving the value once the transaction has been processed. For this reason, duplicate checking is unable to determine the CSC in its duplication check algorithm.
|
23
27
|
attr_accessor :csc
|
24
28
|
|
25
|
-
# 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.
|
29
|
+
# 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.
|
26
30
|
attr_accessor :csc_policy
|
27
31
|
|
28
32
|
# The processing currency for the transaction. Will default to the merchant account currency.
|
29
33
|
attr_accessor :currency
|
30
34
|
|
31
|
-
# 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.
|
35
|
+
# 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.
|
32
36
|
attr_accessor :duplicate_policy
|
33
37
|
|
34
|
-
# 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
|
38
|
+
# 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.
|
35
39
|
attr_accessor :identifier
|
36
40
|
|
37
|
-
#
|
41
|
+
# Transactions charged using the API are defined as: **Cardholder Initiated**: A _cardholder initiated transaction_ (CIT) is where the cardholder selects the card for use for a purchase using previously stored details. An example would be a customer buying an item from your website after being present with their saved card details at checkout. **Merchant Intiated**: A _merchant initiated transaction_ (MIT) is an authorisation initiated where you as the merchant submit a cardholders previously stored details without the cardholder's participation. An example would be a subscription to a membership scheme to debit their card monthly. MITs have different reasons such as reauthorisation, delayed, unscheduled, incremental, recurring, instalment, no-show or resubmission. The following values apply - `M` - specifies that the transaction is initiated by the merchant - `C` - specifies that the transaction is initiated by the cardholder Where transactions are merchant initiated, a valid cardholder agreement must be defined.
|
42
|
+
attr_accessor :initiation
|
43
|
+
|
44
|
+
# 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.
|
38
45
|
attr_accessor :match_avsa
|
39
46
|
|
40
47
|
# Identifies the merchant account to perform processing for.
|
41
48
|
attr_accessor :merchantid
|
42
49
|
|
43
|
-
|
44
|
-
attr_accessor :sdk
|
50
|
+
attr_accessor :threedsecure
|
45
51
|
|
46
|
-
# A tokenised form of a card that belongs to a card holder's account and that has been previously registered. The token is time based and will only be active for a short duration. The value is therefore designed not to be stored remotely for future
|
52
|
+
# A tokenised form of a card that belongs to a card holder's account and that has been previously registered. The token is time based and will only be active for a short duration. The value is therefore designed not to be stored remotely for future use. Tokens will start with ct and are resiliently tamper proof using HMacSHA-256. No sensitive card data is stored internally within the token. Each card will contain a different token and the value may be different on any retrieval call. The value can be presented for payment as a selection value to an end user in a web application.
|
47
53
|
attr_accessor :token
|
48
54
|
|
49
55
|
# Further information that can be added to the transaction will display in reporting. Can be used for flexible values such as operator id.
|
@@ -57,33 +63,42 @@ module CityPayApiClient
|
|
57
63
|
{
|
58
64
|
:'amount' => :'amount',
|
59
65
|
:'avs_postcode_policy' => :'avs_postcode_policy',
|
66
|
+
:'cardholder_agreement' => :'cardholder_agreement',
|
60
67
|
:'csc' => :'csc',
|
61
68
|
:'csc_policy' => :'csc_policy',
|
62
69
|
:'currency' => :'currency',
|
63
70
|
:'duplicate_policy' => :'duplicate_policy',
|
64
71
|
:'identifier' => :'identifier',
|
72
|
+
:'initiation' => :'initiation',
|
65
73
|
:'match_avsa' => :'match_avsa',
|
66
74
|
:'merchantid' => :'merchantid',
|
67
|
-
:'
|
75
|
+
:'threedsecure' => :'threedsecure',
|
68
76
|
:'token' => :'token',
|
69
77
|
:'trans_info' => :'trans_info',
|
70
78
|
:'trans_type' => :'trans_type'
|
71
79
|
}
|
72
80
|
end
|
73
81
|
|
82
|
+
# Returns all the JSON keys this model knows about
|
83
|
+
def self.acceptable_attributes
|
84
|
+
attribute_map.values
|
85
|
+
end
|
86
|
+
|
74
87
|
# Attribute type mapping.
|
75
88
|
def self.openapi_types
|
76
89
|
{
|
77
90
|
:'amount' => :'Integer',
|
78
91
|
:'avs_postcode_policy' => :'String',
|
92
|
+
:'cardholder_agreement' => :'String',
|
79
93
|
:'csc' => :'String',
|
80
94
|
:'csc_policy' => :'String',
|
81
95
|
:'currency' => :'String',
|
82
96
|
:'duplicate_policy' => :'String',
|
83
97
|
:'identifier' => :'String',
|
98
|
+
:'initiation' => :'String',
|
84
99
|
:'match_avsa' => :'String',
|
85
100
|
:'merchantid' => :'Integer',
|
86
|
-
:'
|
101
|
+
:'threedsecure' => :'ThreeDSecure',
|
87
102
|
:'token' => :'String',
|
88
103
|
:'trans_info' => :'String',
|
89
104
|
:'trans_type' => :'String'
|
@@ -119,6 +134,10 @@ module CityPayApiClient
|
|
119
134
|
self.avs_postcode_policy = attributes[:'avs_postcode_policy']
|
120
135
|
end
|
121
136
|
|
137
|
+
if attributes.key?(:'cardholder_agreement')
|
138
|
+
self.cardholder_agreement = attributes[:'cardholder_agreement']
|
139
|
+
end
|
140
|
+
|
122
141
|
if attributes.key?(:'csc')
|
123
142
|
self.csc = attributes[:'csc']
|
124
143
|
end
|
@@ -139,6 +158,10 @@ module CityPayApiClient
|
|
139
158
|
self.identifier = attributes[:'identifier']
|
140
159
|
end
|
141
160
|
|
161
|
+
if attributes.key?(:'initiation')
|
162
|
+
self.initiation = attributes[:'initiation']
|
163
|
+
end
|
164
|
+
|
142
165
|
if attributes.key?(:'match_avsa')
|
143
166
|
self.match_avsa = attributes[:'match_avsa']
|
144
167
|
end
|
@@ -147,10 +170,8 @@ module CityPayApiClient
|
|
147
170
|
self.merchantid = attributes[:'merchantid']
|
148
171
|
end
|
149
172
|
|
150
|
-
if attributes.key?(:'
|
151
|
-
self.
|
152
|
-
else
|
153
|
-
self.sdk = CityPayApiClient::FULL_VERSION
|
173
|
+
if attributes.key?(:'threedsecure')
|
174
|
+
self.threedsecure = attributes[:'threedsecure']
|
154
175
|
end
|
155
176
|
|
156
177
|
if attributes.key?(:'token')
|
@@ -174,6 +195,10 @@ module CityPayApiClient
|
|
174
195
|
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
175
196
|
end
|
176
197
|
|
198
|
+
if !@cardholder_agreement.nil? && @cardholder_agreement.to_s.length > 1
|
199
|
+
invalid_properties.push('invalid value for "cardholder_agreement", the character length must be smaller than or equal to 1.')
|
200
|
+
end
|
201
|
+
|
177
202
|
if !@csc.nil? && @csc.to_s.length > 4
|
178
203
|
invalid_properties.push('invalid value for "csc", the character length must be smaller than or equal to 4.')
|
179
204
|
end
|
@@ -202,6 +227,10 @@ module CityPayApiClient
|
|
202
227
|
invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
|
203
228
|
end
|
204
229
|
|
230
|
+
if !@initiation.nil? && @initiation.to_s.length > 1
|
231
|
+
invalid_properties.push('invalid value for "initiation", the character length must be smaller than or equal to 1.')
|
232
|
+
end
|
233
|
+
|
205
234
|
if @merchantid.nil?
|
206
235
|
invalid_properties.push('invalid value for "merchantid", merchantid cannot be nil.')
|
207
236
|
end
|
@@ -225,6 +254,7 @@ module CityPayApiClient
|
|
225
254
|
# @return true if the model is valid
|
226
255
|
def valid?
|
227
256
|
return false if @amount.nil?
|
257
|
+
return false if !@cardholder_agreement.nil? && @cardholder_agreement.to_s.length > 1
|
228
258
|
return false if !@csc.nil? && @csc.to_s.length > 4
|
229
259
|
return false if !@csc.nil? && @csc.to_s.length < 3
|
230
260
|
return false if !@currency.nil? && @currency.to_s.length > 3
|
@@ -232,6 +262,7 @@ module CityPayApiClient
|
|
232
262
|
return false if @identifier.nil?
|
233
263
|
return false if @identifier.to_s.length > 50
|
234
264
|
return false if @identifier.to_s.length < 4
|
265
|
+
return false if !@initiation.nil? && @initiation.to_s.length > 1
|
235
266
|
return false if @merchantid.nil?
|
236
267
|
return false if @token.nil?
|
237
268
|
return false if !@trans_info.nil? && @trans_info.to_s.length > 50
|
@@ -239,6 +270,26 @@ module CityPayApiClient
|
|
239
270
|
true
|
240
271
|
end
|
241
272
|
|
273
|
+
# Custom attribute writer method with validation
|
274
|
+
# @param [Object] amount Value to be assigned
|
275
|
+
def amount=(amount)
|
276
|
+
if amount.nil?
|
277
|
+
fail ArgumentError, 'amount cannot be nil'
|
278
|
+
end
|
279
|
+
|
280
|
+
@amount = amount
|
281
|
+
end
|
282
|
+
|
283
|
+
# Custom attribute writer method with validation
|
284
|
+
# @param [Object] cardholder_agreement Value to be assigned
|
285
|
+
def cardholder_agreement=(cardholder_agreement)
|
286
|
+
if !cardholder_agreement.nil? && cardholder_agreement.to_s.length > 1
|
287
|
+
fail ArgumentError, 'invalid value for "cardholder_agreement", the character length must be smaller than or equal to 1.'
|
288
|
+
end
|
289
|
+
|
290
|
+
@cardholder_agreement = cardholder_agreement
|
291
|
+
end
|
292
|
+
|
242
293
|
# Custom attribute writer method with validation
|
243
294
|
# @param [Object] csc Value to be assigned
|
244
295
|
def csc=(csc)
|
@@ -285,6 +336,16 @@ module CityPayApiClient
|
|
285
336
|
@identifier = identifier
|
286
337
|
end
|
287
338
|
|
339
|
+
# Custom attribute writer method with validation
|
340
|
+
# @param [Object] initiation Value to be assigned
|
341
|
+
def initiation=(initiation)
|
342
|
+
if !initiation.nil? && initiation.to_s.length > 1
|
343
|
+
fail ArgumentError, 'invalid value for "initiation", the character length must be smaller than or equal to 1.'
|
344
|
+
end
|
345
|
+
|
346
|
+
@initiation = initiation
|
347
|
+
end
|
348
|
+
|
288
349
|
# Custom attribute writer method with validation
|
289
350
|
# @param [Object] trans_info Value to be assigned
|
290
351
|
def trans_info=(trans_info)
|
@@ -312,14 +373,16 @@ module CityPayApiClient
|
|
312
373
|
self.class == o.class &&
|
313
374
|
amount == o.amount &&
|
314
375
|
avs_postcode_policy == o.avs_postcode_policy &&
|
376
|
+
cardholder_agreement == o.cardholder_agreement &&
|
315
377
|
csc == o.csc &&
|
316
378
|
csc_policy == o.csc_policy &&
|
317
379
|
currency == o.currency &&
|
318
380
|
duplicate_policy == o.duplicate_policy &&
|
319
381
|
identifier == o.identifier &&
|
382
|
+
initiation == o.initiation &&
|
320
383
|
match_avsa == o.match_avsa &&
|
321
384
|
merchantid == o.merchantid &&
|
322
|
-
|
385
|
+
threedsecure == o.threedsecure &&
|
323
386
|
token == o.token &&
|
324
387
|
trans_info == o.trans_info &&
|
325
388
|
trans_type == o.trans_type
|
@@ -334,7 +397,7 @@ module CityPayApiClient
|
|
334
397
|
# Calculates hash code according to all attributes.
|
335
398
|
# @return [Integer] Hash code
|
336
399
|
def hash
|
337
|
-
[amount, avs_postcode_policy, csc, csc_policy, currency, duplicate_policy, identifier, match_avsa, merchantid,
|
400
|
+
[amount, avs_postcode_policy, cardholder_agreement, csc, csc_policy, currency, duplicate_policy, identifier, initiation, match_avsa, merchantid, threedsecure, token, trans_info, trans_type].hash
|
338
401
|
end
|
339
402
|
|
340
403
|
# Builds the object from hash
|
@@ -349,8 +412,11 @@ module CityPayApiClient
|
|
349
412
|
# @return [Object] Returns the model itself
|
350
413
|
def build_from_hash(attributes)
|
351
414
|
return nil unless attributes.is_a?(Hash)
|
415
|
+
attributes = attributes.transform_keys(&:to_sym)
|
352
416
|
self.class.openapi_types.each_pair do |key, type|
|
353
|
-
if
|
417
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
418
|
+
self.send("#{key}=", nil)
|
419
|
+
elsif type =~ /\AArray<(.*)>/i
|
354
420
|
# check to ensure the input is an array given that the attribute
|
355
421
|
# is documented as an array but the input is not
|
356
422
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
@@ -358,7 +424,7 @@ module CityPayApiClient
|
|
358
424
|
end
|
359
425
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
360
426
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
361
|
-
end
|
427
|
+
end
|
362
428
|
end
|
363
429
|
|
364
430
|
self
|
@@ -370,8 +436,8 @@ module CityPayApiClient
|
|
370
436
|
# @return [Object] Deserialized data
|
371
437
|
def _deserialize(type, value)
|
372
438
|
case type.to_sym
|
373
|
-
when :
|
374
|
-
|
439
|
+
when :Time
|
440
|
+
Time.parse(value)
|
375
441
|
when :Date
|
376
442
|
Date.parse(value)
|
377
443
|
when :String
|
@@ -401,7 +467,9 @@ module CityPayApiClient
|
|
401
467
|
end
|
402
468
|
end
|
403
469
|
else # model
|
404
|
-
|
470
|
+
# models (e.g. Pet) or oneOf
|
471
|
+
klass = CityPayApiClient.const_get(type)
|
472
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
405
473
|
end
|
406
474
|
end
|
407
475
|
|
@@ -427,7 +495,7 @@ module CityPayApiClient
|
|
427
495
|
is_nullable = self.class.openapi_nullable.include?(attr)
|
428
496
|
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
429
497
|
end
|
430
|
-
|
498
|
+
|
431
499
|
hash[param] = _to_hash(value)
|
432
500
|
end
|
433
501
|
hash
|
@@ -450,5 +518,7 @@ module CityPayApiClient
|
|
450
518
|
value
|
451
519
|
end
|
452
520
|
end
|
521
|
+
|
453
522
|
end
|
523
|
+
|
454
524
|
end
|
@@ -0,0 +1,259 @@
|
|
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 CheckBatchStatus
|
17
|
+
attr_accessor :batch_id
|
18
|
+
|
19
|
+
# The batch account id to obtain the batch for. Defaults to your client id if not provided.
|
20
|
+
attr_accessor :client_account_id
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'batch_id' => :'batch_id',
|
26
|
+
:'client_account_id' => :'client_account_id'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'batch_id' => :'Array<Integer>',
|
39
|
+
:'client_account_id' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::CheckBatchStatus` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::CheckBatchStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'batch_id')
|
65
|
+
if (value = attributes[:'batch_id']).is_a?(Array)
|
66
|
+
self.batch_id = value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.key?(:'client_account_id')
|
71
|
+
self.client_account_id = attributes[:'client_account_id']
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
if @batch_id.nil?
|
80
|
+
invalid_properties.push('invalid value for "batch_id", batch_id cannot be nil.')
|
81
|
+
end
|
82
|
+
|
83
|
+
if !@client_account_id.nil? && @client_account_id.to_s.length > 20
|
84
|
+
invalid_properties.push('invalid value for "client_account_id", the character length must be smaller than or equal to 20.')
|
85
|
+
end
|
86
|
+
|
87
|
+
if !@client_account_id.nil? && @client_account_id.to_s.length < 3
|
88
|
+
invalid_properties.push('invalid value for "client_account_id", the character length must be great than or equal to 3.')
|
89
|
+
end
|
90
|
+
|
91
|
+
invalid_properties
|
92
|
+
end
|
93
|
+
|
94
|
+
# Check to see if the all the properties in the model are valid
|
95
|
+
# @return true if the model is valid
|
96
|
+
def valid?
|
97
|
+
return false if @batch_id.nil?
|
98
|
+
return false if !@client_account_id.nil? && @client_account_id.to_s.length > 20
|
99
|
+
return false if !@client_account_id.nil? && @client_account_id.to_s.length < 3
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
# Custom attribute writer method with validation
|
104
|
+
# @param [Object] client_account_id Value to be assigned
|
105
|
+
def client_account_id=(client_account_id)
|
106
|
+
if !client_account_id.nil? && client_account_id.to_s.length > 20
|
107
|
+
fail ArgumentError, 'invalid value for "client_account_id", the character length must be smaller than or equal to 20.'
|
108
|
+
end
|
109
|
+
|
110
|
+
if !client_account_id.nil? && client_account_id.to_s.length < 3
|
111
|
+
fail ArgumentError, 'invalid value for "client_account_id", the character length must be great than or equal to 3.'
|
112
|
+
end
|
113
|
+
|
114
|
+
@client_account_id = client_account_id
|
115
|
+
end
|
116
|
+
|
117
|
+
# Checks equality by comparing each attribute.
|
118
|
+
# @param [Object] Object to be compared
|
119
|
+
def ==(o)
|
120
|
+
return true if self.equal?(o)
|
121
|
+
self.class == o.class &&
|
122
|
+
batch_id == o.batch_id &&
|
123
|
+
client_account_id == o.client_account_id
|
124
|
+
end
|
125
|
+
|
126
|
+
# @see the `==` method
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def eql?(o)
|
129
|
+
self == o
|
130
|
+
end
|
131
|
+
|
132
|
+
# Calculates hash code according to all attributes.
|
133
|
+
# @return [Integer] Hash code
|
134
|
+
def hash
|
135
|
+
[batch_id, client_account_id].hash
|
136
|
+
end
|
137
|
+
|
138
|
+
# Builds the object from hash
|
139
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
140
|
+
# @return [Object] Returns the model itself
|
141
|
+
def self.build_from_hash(attributes)
|
142
|
+
new.build_from_hash(attributes)
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
attributes = attributes.transform_keys(&:to_sym)
|
151
|
+
self.class.openapi_types.each_pair do |key, type|
|
152
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
153
|
+
self.send("#{key}=", nil)
|
154
|
+
elsif type =~ /\AArray<(.*)>/i
|
155
|
+
# check to ensure the input is an array given that the attribute
|
156
|
+
# is documented as an array but the input is not
|
157
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
158
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
159
|
+
end
|
160
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
161
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
self
|
166
|
+
end
|
167
|
+
|
168
|
+
# Deserializes the data based on type
|
169
|
+
# @param string type Data type
|
170
|
+
# @param string value Value to be deserialized
|
171
|
+
# @return [Object] Deserialized data
|
172
|
+
def _deserialize(type, value)
|
173
|
+
case type.to_sym
|
174
|
+
when :Time
|
175
|
+
Time.parse(value)
|
176
|
+
when :Date
|
177
|
+
Date.parse(value)
|
178
|
+
when :String
|
179
|
+
value.to_s
|
180
|
+
when :Integer
|
181
|
+
value.to_i
|
182
|
+
when :Float
|
183
|
+
value.to_f
|
184
|
+
when :Boolean
|
185
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
186
|
+
true
|
187
|
+
else
|
188
|
+
false
|
189
|
+
end
|
190
|
+
when :Object
|
191
|
+
# generic object (usually a Hash), return directly
|
192
|
+
value
|
193
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
194
|
+
inner_type = Regexp.last_match[:inner_type]
|
195
|
+
value.map { |v| _deserialize(inner_type, v) }
|
196
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
197
|
+
k_type = Regexp.last_match[:k_type]
|
198
|
+
v_type = Regexp.last_match[:v_type]
|
199
|
+
{}.tap do |hash|
|
200
|
+
value.each do |k, v|
|
201
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
else # model
|
205
|
+
# models (e.g. Pet) or oneOf
|
206
|
+
klass = CityPayApiClient.const_get(type)
|
207
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
# Returns the string representation of the object
|
212
|
+
# @return [String] String presentation of the object
|
213
|
+
def to_s
|
214
|
+
to_hash.to_s
|
215
|
+
end
|
216
|
+
|
217
|
+
# to_body is an alias to to_hash (backward compatibility)
|
218
|
+
# @return [Hash] Returns the object in the form of hash
|
219
|
+
def to_body
|
220
|
+
to_hash
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns the object in the form of hash
|
224
|
+
# @return [Hash] Returns the object in the form of hash
|
225
|
+
def to_hash
|
226
|
+
hash = {}
|
227
|
+
self.class.attribute_map.each_pair do |attr, param|
|
228
|
+
value = self.send(attr)
|
229
|
+
if value.nil?
|
230
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
231
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
232
|
+
end
|
233
|
+
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
|
+
end
|