citypay_api_client 1.0.0
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 +7 -0
- data/Gemfile +9 -0
- data/README.md +176 -0
- data/Rakefile +10 -0
- data/citypay_api_client.gemspec +39 -0
- data/docs/AccountCreate.md +19 -0
- data/docs/AccountStatus.md +17 -0
- data/docs/Acknowledgement.md +23 -0
- data/docs/AirlineAdvice.md +47 -0
- data/docs/AirlineSegment.md +31 -0
- data/docs/AuthReference.md +43 -0
- data/docs/AuthReferences.md +17 -0
- data/docs/AuthRequest.md +59 -0
- data/docs/AuthResponse.md +69 -0
- data/docs/AuthenRequired.md +21 -0
- data/docs/CResAuthRequest.md +17 -0
- data/docs/CaptureRequest.md +27 -0
- data/docs/Card.md +51 -0
- data/docs/CardHolderAccount.md +31 -0
- data/docs/CardHolderAccountApi.md +515 -0
- data/docs/CardStatus.md +19 -0
- data/docs/ChargeRequest.md +41 -0
- data/docs/ContactDetails.md +41 -0
- data/docs/Decision.md +21 -0
- data/docs/Error.md +23 -0
- data/docs/ExternalMPI.md +25 -0
- data/docs/ListMerchantsResponse.md +21 -0
- data/docs/MCC6012.md +23 -0
- data/docs/Merchant.md +25 -0
- data/docs/OperationalApi.md +118 -0
- data/docs/PaResAuthRequest.md +19 -0
- data/docs/PaymentProcessingApi.md +338 -0
- data/docs/Ping.md +17 -0
- data/docs/RegisterCard.md +23 -0
- data/docs/RequestChallenged.md +25 -0
- data/docs/RetrieveRequest.md +21 -0
- data/docs/ThreeDSecure.md +25 -0
- data/docs/VoidRequest.md +23 -0
- data/git_push.sh +58 -0
- data/lib/citypay_api_client.rb +72 -0
- data/lib/citypay_api_client/api/card_holder_account_api.rb +628 -0
- data/lib/citypay_api_client/api/operational_api.rb +148 -0
- data/lib/citypay_api_client/api/payment_processing_api.rb +406 -0
- data/lib/citypay_api_client/api_client.rb +388 -0
- data/lib/citypay_api_client/api_error.rb +57 -0
- data/lib/citypay_api_client/configuration.rb +252 -0
- data/lib/citypay_api_client/models/account_create.rb +249 -0
- data/lib/citypay_api_client/models/account_status.rb +207 -0
- data/lib/citypay_api_client/models/acknowledgement.rb +285 -0
- data/lib/citypay_api_client/models/airline_advice.rb +551 -0
- data/lib/citypay_api_client/models/airline_segment.rb +408 -0
- data/lib/citypay_api_client/models/api_key.rb +53 -0
- data/lib/citypay_api_client/models/auth_reference.rb +400 -0
- data/lib/citypay_api_client/models/auth_references.rb +208 -0
- data/lib/citypay_api_client/models/auth_request.rb +631 -0
- data/lib/citypay_api_client/models/auth_response.rb +563 -0
- data/lib/citypay_api_client/models/authen_required.rb +227 -0
- data/lib/citypay_api_client/models/c_res_auth_request.rb +207 -0
- data/lib/citypay_api_client/models/capture_request.rb +285 -0
- data/lib/citypay_api_client/models/card.rb +425 -0
- data/lib/citypay_api_client/models/card_holder_account.rb +315 -0
- data/lib/citypay_api_client/models/card_status.rb +217 -0
- data/lib/citypay_api_client/models/charge_request.rb +453 -0
- data/lib/citypay_api_client/models/contact_details.rb +456 -0
- data/lib/citypay_api_client/models/decision.rb +224 -0
- data/lib/citypay_api_client/models/error.rb +285 -0
- data/lib/citypay_api_client/models/external_mpi.rb +307 -0
- data/lib/citypay_api_client/models/list_merchants_response.rb +252 -0
- data/lib/citypay_api_client/models/mcc6012.rb +237 -0
- data/lib/citypay_api_client/models/merchant.rb +247 -0
- data/lib/citypay_api_client/models/pa_res_auth_request.rb +227 -0
- data/lib/citypay_api_client/models/ping.rb +231 -0
- data/lib/citypay_api_client/models/register_card.rb +336 -0
- data/lib/citypay_api_client/models/request_challenged.rb +247 -0
- data/lib/citypay_api_client/models/retrieve_request.rb +256 -0
- data/lib/citypay_api_client/models/three_d_secure.rb +247 -0
- data/lib/citypay_api_client/models/void_request.rb +266 -0
- data/lib/citypay_api_client/version.rb +15 -0
- data/spec/api/card_holder_account_api_spec.rb +149 -0
- data/spec/api/operational_api_spec.rb +59 -0
- data/spec/api/payment_processing_api_spec.rb +107 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/account_create_spec.rb +47 -0
- data/spec/models/account_status_spec.rb +41 -0
- data/spec/models/acknowledgement_spec.rb +59 -0
- data/spec/models/airline_advice_spec.rb +131 -0
- data/spec/models/airline_segment_spec.rb +83 -0
- data/spec/models/auth_reference_spec.rb +119 -0
- data/spec/models/auth_references_spec.rb +41 -0
- data/spec/models/auth_request_spec.rb +167 -0
- data/spec/models/auth_response_spec.rb +197 -0
- data/spec/models/authen_required_spec.rb +53 -0
- data/spec/models/c_res_auth_request_spec.rb +41 -0
- data/spec/models/capture_request_spec.rb +71 -0
- data/spec/models/card_holder_account_spec.rb +83 -0
- data/spec/models/card_spec.rb +143 -0
- data/spec/models/card_status_spec.rb +47 -0
- data/spec/models/charge_request_spec.rb +113 -0
- data/spec/models/contact_details_spec.rb +113 -0
- data/spec/models/decision_spec.rb +53 -0
- data/spec/models/error_spec.rb +59 -0
- data/spec/models/external_mpi_spec.rb +65 -0
- data/spec/models/list_merchants_response_spec.rb +53 -0
- data/spec/models/mcc6012_spec.rb +59 -0
- data/spec/models/merchant_spec.rb +65 -0
- data/spec/models/pa_res_auth_request_spec.rb +47 -0
- data/spec/models/ping_spec.rb +41 -0
- data/spec/models/register_card_spec.rb +59 -0
- data/spec/models/request_challenged_spec.rb +65 -0
- data/spec/models/retrieve_request_spec.rb +53 -0
- data/spec/models/three_d_secure_spec.rb +65 -0
- data/spec/models/void_request_spec.rb +59 -0
- data/spec/spec_helper.rb +111 -0
- metadata +252 -0
@@ -0,0 +1,217 @@
|
|
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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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
|
+
The version of the OpenAPI document: 6.0.0
|
7
|
+
Contact: support@citypay.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CityPayApiClient
|
16
|
+
class CardStatus
|
17
|
+
# The status of the card to set, valid values are ACTIVE or INACTIVE.
|
18
|
+
attr_accessor :card_status
|
19
|
+
|
20
|
+
# Defines if the card is set as the default.
|
21
|
+
attr_accessor :default
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'card_status' => :'card_status',
|
27
|
+
:'default' => :'default'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.openapi_types
|
33
|
+
{
|
34
|
+
:'card_status' => :'String',
|
35
|
+
:'default' => :'Boolean'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::CardStatus` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::CardStatus`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'card_status')
|
61
|
+
self.card_status = attributes[:'card_status']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'default')
|
65
|
+
self.default = attributes[:'default']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
card_status == o.card_status &&
|
88
|
+
default == o.default
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[card_status, default].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if type =~ /\AArray<(.*)>/i
|
117
|
+
# check to ensure the input is an array given that the attribute
|
118
|
+
# is documented as an array but the input is not
|
119
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
120
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
121
|
+
end
|
122
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
123
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
124
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
125
|
+
end
|
126
|
+
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def _deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :DateTime
|
137
|
+
DateTime.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
CityPayApiClient.const_get(type).build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,453 @@
|
|
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 <aside class=\"notice\"> Before we begin a reminder that 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 including: </aside> * 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
|
+
The version of the OpenAPI document: 6.0.0
|
7
|
+
Contact: support@citypay.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CityPayApiClient
|
16
|
+
class ChargeRequest
|
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
|
+
# 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.
|
24
|
+
attr_accessor :csc
|
25
|
+
|
26
|
+
# 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.
|
27
|
+
attr_accessor :csc_policy
|
28
|
+
|
29
|
+
# The processing currency for the transaction. Will default to the merchant account currency.
|
30
|
+
attr_accessor :currency
|
31
|
+
|
32
|
+
# 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.
|
33
|
+
attr_accessor :duplicate_policy
|
34
|
+
|
35
|
+
# 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 32 to 127. 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.
|
36
|
+
attr_accessor :identifier
|
37
|
+
|
38
|
+
# 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.
|
39
|
+
attr_accessor :match_avsa
|
40
|
+
|
41
|
+
# Identifies the merchant account to perform processing for.
|
42
|
+
attr_accessor :merchantid
|
43
|
+
|
44
|
+
# An optional reference value for the calling client such as a version number i.e.
|
45
|
+
attr_accessor :sdk
|
46
|
+
|
47
|
+
# 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.
|
48
|
+
attr_accessor :token
|
49
|
+
|
50
|
+
# Further information that can be added to the transaction will display in reporting. Can be used for flexible values such as operator id.
|
51
|
+
attr_accessor :trans_info
|
52
|
+
|
53
|
+
# The type of transaction being submitted. Normally this value is not required and your account manager may request that you set this field.
|
54
|
+
attr_accessor :trans_type
|
55
|
+
|
56
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
57
|
+
def self.attribute_map
|
58
|
+
{
|
59
|
+
:'amount' => :'amount',
|
60
|
+
:'avs_postcode_policy' => :'avs_postcode_policy',
|
61
|
+
:'csc' => :'csc',
|
62
|
+
:'csc_policy' => :'csc_policy',
|
63
|
+
:'currency' => :'currency',
|
64
|
+
:'duplicate_policy' => :'duplicate_policy',
|
65
|
+
:'identifier' => :'identifier',
|
66
|
+
:'match_avsa' => :'match_avsa',
|
67
|
+
:'merchantid' => :'merchantid',
|
68
|
+
:'sdk' => :'sdk',
|
69
|
+
:'token' => :'token',
|
70
|
+
:'trans_info' => :'trans_info',
|
71
|
+
:'trans_type' => :'trans_type'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Attribute type mapping.
|
76
|
+
def self.openapi_types
|
77
|
+
{
|
78
|
+
:'amount' => :'Integer',
|
79
|
+
:'avs_postcode_policy' => :'String',
|
80
|
+
:'csc' => :'String',
|
81
|
+
:'csc_policy' => :'String',
|
82
|
+
:'currency' => :'String',
|
83
|
+
:'duplicate_policy' => :'String',
|
84
|
+
:'identifier' => :'String',
|
85
|
+
:'match_avsa' => :'String',
|
86
|
+
:'merchantid' => :'Integer',
|
87
|
+
:'sdk' => :'String',
|
88
|
+
:'token' => :'String',
|
89
|
+
:'trans_info' => :'String',
|
90
|
+
:'trans_type' => :'String'
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
# List of attributes with nullable: true
|
95
|
+
def self.openapi_nullable
|
96
|
+
Set.new([
|
97
|
+
])
|
98
|
+
end
|
99
|
+
|
100
|
+
# Initializes the object
|
101
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
102
|
+
def initialize(attributes = {})
|
103
|
+
if (!attributes.is_a?(Hash))
|
104
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::ChargeRequest` initialize method"
|
105
|
+
end
|
106
|
+
|
107
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
108
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
109
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
110
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::ChargeRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
111
|
+
end
|
112
|
+
h[k.to_sym] = v
|
113
|
+
}
|
114
|
+
|
115
|
+
if attributes.key?(:'amount')
|
116
|
+
self.amount = attributes[:'amount']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'avs_postcode_policy')
|
120
|
+
self.avs_postcode_policy = attributes[:'avs_postcode_policy']
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'csc')
|
124
|
+
self.csc = attributes[:'csc']
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.key?(:'csc_policy')
|
128
|
+
self.csc_policy = attributes[:'csc_policy']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.key?(:'currency')
|
132
|
+
self.currency = attributes[:'currency']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.key?(:'duplicate_policy')
|
136
|
+
self.duplicate_policy = attributes[:'duplicate_policy']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.key?(:'identifier')
|
140
|
+
self.identifier = attributes[:'identifier']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.key?(:'match_avsa')
|
144
|
+
self.match_avsa = attributes[:'match_avsa']
|
145
|
+
end
|
146
|
+
|
147
|
+
if attributes.key?(:'merchantid')
|
148
|
+
self.merchantid = attributes[:'merchantid']
|
149
|
+
end
|
150
|
+
|
151
|
+
if attributes.key?(:'sdk')
|
152
|
+
self.sdk = attributes[:'sdk']
|
153
|
+
end
|
154
|
+
|
155
|
+
if attributes.key?(:'token')
|
156
|
+
self.token = attributes[:'token']
|
157
|
+
end
|
158
|
+
|
159
|
+
if attributes.key?(:'trans_info')
|
160
|
+
self.trans_info = attributes[:'trans_info']
|
161
|
+
end
|
162
|
+
|
163
|
+
if attributes.key?(:'trans_type')
|
164
|
+
self.trans_type = attributes[:'trans_type']
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
169
|
+
# @return Array for valid properties with the reasons
|
170
|
+
def list_invalid_properties
|
171
|
+
invalid_properties = Array.new
|
172
|
+
if @amount.nil?
|
173
|
+
invalid_properties.push('invalid value for "amount", amount cannot be nil.')
|
174
|
+
end
|
175
|
+
|
176
|
+
if !@csc.nil? && @csc.to_s.length > 4
|
177
|
+
invalid_properties.push('invalid value for "csc", the character length must be smaller than or equal to 4.')
|
178
|
+
end
|
179
|
+
|
180
|
+
if !@csc.nil? && @csc.to_s.length < 3
|
181
|
+
invalid_properties.push('invalid value for "csc", the character length must be great than or equal to 3.')
|
182
|
+
end
|
183
|
+
|
184
|
+
if !@currency.nil? && @currency.to_s.length > 3
|
185
|
+
invalid_properties.push('invalid value for "currency", the character length must be smaller than or equal to 3.')
|
186
|
+
end
|
187
|
+
|
188
|
+
if !@currency.nil? && @currency.to_s.length < 3
|
189
|
+
invalid_properties.push('invalid value for "currency", the character length must be great than or equal to 3.')
|
190
|
+
end
|
191
|
+
|
192
|
+
if @identifier.nil?
|
193
|
+
invalid_properties.push('invalid value for "identifier", identifier cannot be nil.')
|
194
|
+
end
|
195
|
+
|
196
|
+
if @identifier.to_s.length > 50
|
197
|
+
invalid_properties.push('invalid value for "identifier", the character length must be smaller than or equal to 50.')
|
198
|
+
end
|
199
|
+
|
200
|
+
if @identifier.to_s.length < 4
|
201
|
+
invalid_properties.push('invalid value for "identifier", the character length must be great than or equal to 4.')
|
202
|
+
end
|
203
|
+
|
204
|
+
if @merchantid.nil?
|
205
|
+
invalid_properties.push('invalid value for "merchantid", merchantid cannot be nil.')
|
206
|
+
end
|
207
|
+
|
208
|
+
if @token.nil?
|
209
|
+
invalid_properties.push('invalid value for "token", token cannot be nil.')
|
210
|
+
end
|
211
|
+
|
212
|
+
if !@trans_info.nil? && @trans_info.to_s.length > 50
|
213
|
+
invalid_properties.push('invalid value for "trans_info", the character length must be smaller than or equal to 50.')
|
214
|
+
end
|
215
|
+
|
216
|
+
if !@trans_type.nil? && @trans_type.to_s.length > 1
|
217
|
+
invalid_properties.push('invalid value for "trans_type", the character length must be smaller than or equal to 1.')
|
218
|
+
end
|
219
|
+
|
220
|
+
invalid_properties
|
221
|
+
end
|
222
|
+
|
223
|
+
# Check to see if the all the properties in the model are valid
|
224
|
+
# @return true if the model is valid
|
225
|
+
def valid?
|
226
|
+
return false if @amount.nil?
|
227
|
+
return false if !@csc.nil? && @csc.to_s.length > 4
|
228
|
+
return false if !@csc.nil? && @csc.to_s.length < 3
|
229
|
+
return false if !@currency.nil? && @currency.to_s.length > 3
|
230
|
+
return false if !@currency.nil? && @currency.to_s.length < 3
|
231
|
+
return false if @identifier.nil?
|
232
|
+
return false if @identifier.to_s.length > 50
|
233
|
+
return false if @identifier.to_s.length < 4
|
234
|
+
return false if @merchantid.nil?
|
235
|
+
return false if @token.nil?
|
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] csc Value to be assigned
|
243
|
+
def csc=(csc)
|
244
|
+
if !csc.nil? && csc.to_s.length > 4
|
245
|
+
fail ArgumentError, 'invalid value for "csc", the character length must be smaller than or equal to 4.'
|
246
|
+
end
|
247
|
+
|
248
|
+
if !csc.nil? && csc.to_s.length < 3
|
249
|
+
fail ArgumentError, 'invalid value for "csc", the character length must be great than or equal to 3.'
|
250
|
+
end
|
251
|
+
|
252
|
+
@csc = csc
|
253
|
+
end
|
254
|
+
|
255
|
+
# Custom attribute writer method with validation
|
256
|
+
# @param [Object] currency Value to be assigned
|
257
|
+
def currency=(currency)
|
258
|
+
if !currency.nil? && currency.to_s.length > 3
|
259
|
+
fail ArgumentError, 'invalid value for "currency", the character length must be smaller than or equal to 3.'
|
260
|
+
end
|
261
|
+
|
262
|
+
if !currency.nil? && currency.to_s.length < 3
|
263
|
+
fail ArgumentError, 'invalid value for "currency", the character length must be great than or equal to 3.'
|
264
|
+
end
|
265
|
+
|
266
|
+
@currency = currency
|
267
|
+
end
|
268
|
+
|
269
|
+
# Custom attribute writer method with validation
|
270
|
+
# @param [Object] identifier Value to be assigned
|
271
|
+
def identifier=(identifier)
|
272
|
+
if identifier.nil?
|
273
|
+
fail ArgumentError, 'identifier cannot be nil'
|
274
|
+
end
|
275
|
+
|
276
|
+
if identifier.to_s.length > 50
|
277
|
+
fail ArgumentError, 'invalid value for "identifier", the character length must be smaller than or equal to 50.'
|
278
|
+
end
|
279
|
+
|
280
|
+
if identifier.to_s.length < 4
|
281
|
+
fail ArgumentError, 'invalid value for "identifier", the character length must be great than or equal to 4.'
|
282
|
+
end
|
283
|
+
|
284
|
+
@identifier = identifier
|
285
|
+
end
|
286
|
+
|
287
|
+
# Custom attribute writer method with validation
|
288
|
+
# @param [Object] trans_info Value to be assigned
|
289
|
+
def trans_info=(trans_info)
|
290
|
+
if !trans_info.nil? && trans_info.to_s.length > 50
|
291
|
+
fail ArgumentError, 'invalid value for "trans_info", the character length must be smaller than or equal to 50.'
|
292
|
+
end
|
293
|
+
|
294
|
+
@trans_info = trans_info
|
295
|
+
end
|
296
|
+
|
297
|
+
# Custom attribute writer method with validation
|
298
|
+
# @param [Object] trans_type Value to be assigned
|
299
|
+
def trans_type=(trans_type)
|
300
|
+
if !trans_type.nil? && trans_type.to_s.length > 1
|
301
|
+
fail ArgumentError, 'invalid value for "trans_type", the character length must be smaller than or equal to 1.'
|
302
|
+
end
|
303
|
+
|
304
|
+
@trans_type = trans_type
|
305
|
+
end
|
306
|
+
|
307
|
+
# Checks equality by comparing each attribute.
|
308
|
+
# @param [Object] Object to be compared
|
309
|
+
def ==(o)
|
310
|
+
return true if self.equal?(o)
|
311
|
+
self.class == o.class &&
|
312
|
+
amount == o.amount &&
|
313
|
+
avs_postcode_policy == o.avs_postcode_policy &&
|
314
|
+
csc == o.csc &&
|
315
|
+
csc_policy == o.csc_policy &&
|
316
|
+
currency == o.currency &&
|
317
|
+
duplicate_policy == o.duplicate_policy &&
|
318
|
+
identifier == o.identifier &&
|
319
|
+
match_avsa == o.match_avsa &&
|
320
|
+
merchantid == o.merchantid &&
|
321
|
+
sdk == o.sdk &&
|
322
|
+
token == o.token &&
|
323
|
+
trans_info == o.trans_info &&
|
324
|
+
trans_type == o.trans_type
|
325
|
+
end
|
326
|
+
|
327
|
+
# @see the `==` method
|
328
|
+
# @param [Object] Object to be compared
|
329
|
+
def eql?(o)
|
330
|
+
self == o
|
331
|
+
end
|
332
|
+
|
333
|
+
# Calculates hash code according to all attributes.
|
334
|
+
# @return [Integer] Hash code
|
335
|
+
def hash
|
336
|
+
[amount, avs_postcode_policy, csc, csc_policy, currency, duplicate_policy, identifier, match_avsa, merchantid, sdk, token, trans_info, trans_type].hash
|
337
|
+
end
|
338
|
+
|
339
|
+
# Builds the object from hash
|
340
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
341
|
+
# @return [Object] Returns the model itself
|
342
|
+
def self.build_from_hash(attributes)
|
343
|
+
new.build_from_hash(attributes)
|
344
|
+
end
|
345
|
+
|
346
|
+
# Builds the object from hash
|
347
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
348
|
+
# @return [Object] Returns the model itself
|
349
|
+
def build_from_hash(attributes)
|
350
|
+
return nil unless attributes.is_a?(Hash)
|
351
|
+
self.class.openapi_types.each_pair do |key, type|
|
352
|
+
if type =~ /\AArray<(.*)>/i
|
353
|
+
# check to ensure the input is an array given that the attribute
|
354
|
+
# is documented as an array but the input is not
|
355
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
356
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
357
|
+
end
|
358
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
359
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
360
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
361
|
+
end
|
362
|
+
|
363
|
+
self
|
364
|
+
end
|
365
|
+
|
366
|
+
# Deserializes the data based on type
|
367
|
+
# @param string type Data type
|
368
|
+
# @param string value Value to be deserialized
|
369
|
+
# @return [Object] Deserialized data
|
370
|
+
def _deserialize(type, value)
|
371
|
+
case type.to_sym
|
372
|
+
when :DateTime
|
373
|
+
DateTime.parse(value)
|
374
|
+
when :Date
|
375
|
+
Date.parse(value)
|
376
|
+
when :String
|
377
|
+
value.to_s
|
378
|
+
when :Integer
|
379
|
+
value.to_i
|
380
|
+
when :Float
|
381
|
+
value.to_f
|
382
|
+
when :Boolean
|
383
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
384
|
+
true
|
385
|
+
else
|
386
|
+
false
|
387
|
+
end
|
388
|
+
when :Object
|
389
|
+
# generic object (usually a Hash), return directly
|
390
|
+
value
|
391
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
392
|
+
inner_type = Regexp.last_match[:inner_type]
|
393
|
+
value.map { |v| _deserialize(inner_type, v) }
|
394
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
395
|
+
k_type = Regexp.last_match[:k_type]
|
396
|
+
v_type = Regexp.last_match[:v_type]
|
397
|
+
{}.tap do |hash|
|
398
|
+
value.each do |k, v|
|
399
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
400
|
+
end
|
401
|
+
end
|
402
|
+
else # model
|
403
|
+
CityPayApiClient.const_get(type).build_from_hash(value)
|
404
|
+
end
|
405
|
+
end
|
406
|
+
|
407
|
+
# Returns the string representation of the object
|
408
|
+
# @return [String] String presentation of the object
|
409
|
+
def to_s
|
410
|
+
to_hash.to_s
|
411
|
+
end
|
412
|
+
|
413
|
+
# to_body is an alias to to_hash (backward compatibility)
|
414
|
+
# @return [Hash] Returns the object in the form of hash
|
415
|
+
def to_body
|
416
|
+
to_hash
|
417
|
+
end
|
418
|
+
|
419
|
+
# Returns the object in the form of hash
|
420
|
+
# @return [Hash] Returns the object in the form of hash
|
421
|
+
def to_hash
|
422
|
+
hash = {}
|
423
|
+
self.class.attribute_map.each_pair do |attr, param|
|
424
|
+
value = self.send(attr)
|
425
|
+
if value.nil?
|
426
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
427
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
428
|
+
end
|
429
|
+
|
430
|
+
hash[param] = _to_hash(value)
|
431
|
+
end
|
432
|
+
hash
|
433
|
+
end
|
434
|
+
|
435
|
+
# Outputs non-array value in the form of hash
|
436
|
+
# For object, use to_hash. Otherwise, just return the value
|
437
|
+
# @param [Object] value Any valid value
|
438
|
+
# @return [Hash] Returns the value in the form of hash
|
439
|
+
def _to_hash(value)
|
440
|
+
if value.is_a?(Array)
|
441
|
+
value.compact.map { |v| _to_hash(v) }
|
442
|
+
elsif value.is_a?(Hash)
|
443
|
+
{}.tap do |hash|
|
444
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
445
|
+
end
|
446
|
+
elsif value.respond_to? :to_hash
|
447
|
+
value.to_hash
|
448
|
+
else
|
449
|
+
value
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
end
|