citypay_api_client 1.0.0 → 1.0.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/Gemfile.lock +70 -0
- data/README.md +7 -5
- data/citypay_api-1.0.1.gem +0 -0
- data/citypay_api_client.gemspec +1 -1
- data/docs/CardHolderAccountApi.md +9 -36
- data/docs/OperationalApi.md +2 -8
- data/docs/PaymentProcessingApi.md +6 -24
- data/lib/citypay_api_client.rb +2 -1
- data/lib/citypay_api_client/models/api_key.rb +32 -29
- data/lib/citypay_api_client/version.rb +1 -1
- data/spec/models/api_key_spec.rb +78 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abee74941401eb70778cfb9a7413a2549c18490e1df25aa0f473ab8b532d89ff
|
4
|
+
data.tar.gz: 527d19c9d9e9601cfdb29c37bdb2fbc63fd127568e88d77d3b79c64fc5768d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 425f3616ef037ceef95fc1417710d105b7f96546e9a6b7742924512340a21a4d5808428e7d4504ddf55cf858c08711f30c089d5656825a066a946a2bc2e1f3ff
|
7
|
+
data.tar.gz: b50ec7b42bb64d7e7215b89d2e13eda64bf1f07551707856482d085454610a2e5957b9e3ea622342df8dc920ab79f162e596d813b605a5ec2066299af83c8309
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
citypay_api_client (1.0.1)
|
5
|
+
json (~> 2.1, >= 2.1.0)
|
6
|
+
typhoeus (~> 1.0, >= 1.0.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.1)
|
12
|
+
byebug (11.1.3)
|
13
|
+
coderay (1.1.3)
|
14
|
+
diff-lcs (1.4.4)
|
15
|
+
ethon (0.12.0)
|
16
|
+
ffi (>= 1.3.0)
|
17
|
+
ffi (1.13.1)
|
18
|
+
jaro_winkler (1.5.4)
|
19
|
+
json (2.3.1)
|
20
|
+
method_source (1.0.0)
|
21
|
+
parallel (1.19.2)
|
22
|
+
parser (2.7.1.4)
|
23
|
+
ast (~> 2.4.1)
|
24
|
+
pry (0.13.1)
|
25
|
+
coderay (~> 1.1)
|
26
|
+
method_source (~> 1.0)
|
27
|
+
pry-byebug (3.9.0)
|
28
|
+
byebug (~> 11.0)
|
29
|
+
pry (~> 0.13.0)
|
30
|
+
psych (3.2.0)
|
31
|
+
rainbow (3.0.0)
|
32
|
+
rake (13.0.1)
|
33
|
+
rspec (3.9.0)
|
34
|
+
rspec-core (~> 3.9.0)
|
35
|
+
rspec-expectations (~> 3.9.0)
|
36
|
+
rspec-mocks (~> 3.9.0)
|
37
|
+
rspec-core (3.9.2)
|
38
|
+
rspec-support (~> 3.9.3)
|
39
|
+
rspec-expectations (3.9.2)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.9.0)
|
42
|
+
rspec-mocks (3.9.1)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-support (3.9.3)
|
46
|
+
rubocop (0.66.0)
|
47
|
+
jaro_winkler (~> 1.5.1)
|
48
|
+
parallel (~> 1.10)
|
49
|
+
parser (>= 2.5, != 2.5.1.1)
|
50
|
+
psych (>= 3.1.0)
|
51
|
+
rainbow (>= 2.2.2, < 4.0)
|
52
|
+
ruby-progressbar (~> 1.7)
|
53
|
+
unicode-display_width (>= 1.4.0, < 1.6)
|
54
|
+
ruby-progressbar (1.10.1)
|
55
|
+
typhoeus (1.4.0)
|
56
|
+
ethon (>= 0.9.0)
|
57
|
+
unicode-display_width (1.5.0)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
citypay_api_client!
|
64
|
+
pry-byebug
|
65
|
+
rake (~> 13.0.1)
|
66
|
+
rspec (~> 3.6, >= 3.6.0)
|
67
|
+
rubocop (~> 0.66.0)
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# CityPay API Client for Ruby
|
2
2
|
|
3
3
|
CityPayApiClient - the Ruby gem for the CityPay Payment API
|
4
4
|
|
@@ -39,6 +39,11 @@ For more information, please visit [https://citypay.com/customer-centre/technica
|
|
39
39
|
|
40
40
|
## Installation
|
41
41
|
|
42
|
+
### Install from rubygems.org
|
43
|
+
```shell
|
44
|
+
gem install citypay_api_client
|
45
|
+
```
|
46
|
+
|
42
47
|
### Build a gem
|
43
48
|
|
44
49
|
To build the Ruby code into a gem:
|
@@ -85,10 +90,7 @@ require 'citypay_api_client'
|
|
85
90
|
|
86
91
|
# Setup authorization
|
87
92
|
CityPayApiClient.configure do |config|
|
88
|
-
|
89
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
90
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
91
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
93
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: "YourClientId", licence_key: "YourLicenceKey").generate
|
92
94
|
end
|
93
95
|
|
94
96
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
Binary file
|
data/citypay_api_client.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.homepage = "https://github.com/citypay/citypay-api-client-ruby"
|
25
25
|
s.summary = "A ruby wrapper for the CityPay API"
|
26
26
|
s.description = "CityPay API Client for Ruby"
|
27
|
-
s.license = "
|
27
|
+
s.license = "MIT"
|
28
28
|
s.required_ruby_version = ">= 1.9"
|
29
29
|
|
30
30
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
@@ -31,10 +31,7 @@ Deletes a card from the account. The card will be marked for deletion before a s
|
|
31
31
|
require 'citypay_api_client'
|
32
32
|
# setup authorization
|
33
33
|
CityPayApiClient.configure do |config|
|
34
|
-
|
35
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
36
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
37
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
34
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
38
35
|
end
|
39
36
|
|
40
37
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -87,10 +84,7 @@ Allows for a card to be registered for the account. The card will be added for f
|
|
87
84
|
require 'citypay_api_client'
|
88
85
|
# setup authorization
|
89
86
|
CityPayApiClient.configure do |config|
|
90
|
-
|
91
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
92
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
93
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
87
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
94
88
|
end
|
95
89
|
|
96
90
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -143,10 +137,7 @@ Updates the status of a card for processing. The following values are available
|
|
143
137
|
require 'citypay_api_client'
|
144
138
|
# setup authorization
|
145
139
|
CityPayApiClient.configure do |config|
|
146
|
-
|
147
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
148
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
149
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
140
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
150
141
|
end
|
151
142
|
|
152
143
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -201,10 +192,7 @@ Allows for the ability to change the contact details for an account.
|
|
201
192
|
require 'citypay_api_client'
|
202
193
|
# setup authorization
|
203
194
|
CityPayApiClient.configure do |config|
|
204
|
-
|
205
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
206
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
207
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
195
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
208
196
|
end
|
209
197
|
|
210
198
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -257,10 +245,7 @@ Creates a new card holder account and initialises the account ready for adding c
|
|
257
245
|
require 'citypay_api_client'
|
258
246
|
# setup authorization
|
259
247
|
CityPayApiClient.configure do |config|
|
260
|
-
|
261
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
262
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
263
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
248
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
264
249
|
end
|
265
250
|
|
266
251
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -311,10 +296,7 @@ Allows for the deletion of an account. The account will marked for deletion and
|
|
311
296
|
require 'citypay_api_client'
|
312
297
|
# setup authorization
|
313
298
|
CityPayApiClient.configure do |config|
|
314
|
-
|
315
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
316
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
317
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
299
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
318
300
|
end
|
319
301
|
|
320
302
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -365,10 +347,7 @@ Allows for the retrieval of a card holder account for the given `id`. Should dup
|
|
365
347
|
require 'citypay_api_client'
|
366
348
|
# setup authorization
|
367
349
|
CityPayApiClient.configure do |config|
|
368
|
-
|
369
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
370
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
371
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
350
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
372
351
|
end
|
373
352
|
|
374
353
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -419,10 +398,7 @@ Updates the status of an account. An account can have the following statuses app
|
|
419
398
|
require 'citypay_api_client'
|
420
399
|
# setup authorization
|
421
400
|
CityPayApiClient.configure do |config|
|
422
|
-
|
423
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
424
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
425
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
401
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
426
402
|
end
|
427
403
|
|
428
404
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
@@ -475,10 +451,7 @@ A charge process obtains an authorisation using a tokenised value which represen
|
|
475
451
|
require 'citypay_api_client'
|
476
452
|
# setup authorization
|
477
453
|
CityPayApiClient.configure do |config|
|
478
|
-
|
479
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
480
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
481
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
454
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
482
455
|
end
|
483
456
|
|
484
457
|
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
data/docs/OperationalApi.md
CHANGED
@@ -24,10 +24,7 @@ An operational request to list current merchants for a client. ### Sorting Sor
|
|
24
24
|
require 'citypay_api_client'
|
25
25
|
# setup authorization
|
26
26
|
CityPayApiClient.configure do |config|
|
27
|
-
|
28
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
29
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
30
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
27
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
31
28
|
end
|
32
29
|
|
33
30
|
api_instance = CityPayApiClient::OperationalApi.new
|
@@ -78,10 +75,7 @@ A ping request which performs a connection and authentication test to the CityPa
|
|
78
75
|
require 'citypay_api_client'
|
79
76
|
# setup authorization
|
80
77
|
CityPayApiClient.configure do |config|
|
81
|
-
|
82
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
83
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
84
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
78
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
85
79
|
end
|
86
80
|
|
87
81
|
api_instance = CityPayApiClient::OperationalApi.new
|
@@ -28,10 +28,7 @@ An authorisation process performs a standard transaction authorisation based on
|
|
28
28
|
require 'citypay_api_client'
|
29
29
|
# setup authorization
|
30
30
|
CityPayApiClient.configure do |config|
|
31
|
-
|
32
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
33
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
34
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
31
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
35
32
|
end
|
36
33
|
|
37
34
|
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
@@ -82,10 +79,7 @@ The CRes request performs authorisation processing once a challenge request has
|
|
82
79
|
require 'citypay_api_client'
|
83
80
|
# setup authorization
|
84
81
|
CityPayApiClient.configure do |config|
|
85
|
-
|
86
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
87
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
88
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
82
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
89
83
|
end
|
90
84
|
|
91
85
|
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
@@ -136,10 +130,7 @@ _The capture process only applies to transactions which have been pre-authorised
|
|
136
130
|
require 'citypay_api_client'
|
137
131
|
# setup authorization
|
138
132
|
CityPayApiClient.configure do |config|
|
139
|
-
|
140
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
141
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
142
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
133
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
143
134
|
end
|
144
135
|
|
145
136
|
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
@@ -190,10 +181,7 @@ The Payer Authentication Response (PaRes) is an operation after the result of au
|
|
190
181
|
require 'citypay_api_client'
|
191
182
|
# setup authorization
|
192
183
|
CityPayApiClient.configure do |config|
|
193
|
-
|
194
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
195
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
196
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
184
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
197
185
|
end
|
198
186
|
|
199
187
|
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
@@ -244,10 +232,7 @@ A retrieval request which allows an integration to obtain the result of a transa
|
|
244
232
|
require 'citypay_api_client'
|
245
233
|
# setup authorization
|
246
234
|
CityPayApiClient.configure do |config|
|
247
|
-
|
248
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
249
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
250
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
235
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
251
236
|
end
|
252
237
|
|
253
238
|
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
@@ -298,10 +283,7 @@ _The void process generally applies to transactions which have been pre-authoris
|
|
298
283
|
require 'citypay_api_client'
|
299
284
|
# setup authorization
|
300
285
|
CityPayApiClient.configure do |config|
|
301
|
-
|
302
|
-
config.api_key['cp-api-key'] = 'YOUR API KEY'
|
303
|
-
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
304
|
-
#config.api_key_prefix['cp-api-key'] = 'Bearer'
|
286
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: 'YourClientId', licence_key: 'YourLicenceKey').generate
|
305
287
|
end
|
306
288
|
|
307
289
|
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
data/lib/citypay_api_client.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
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 <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.
|
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
5
|
|
6
6
|
The version of the OpenAPI document: 6.0.0
|
7
7
|
Contact: support@citypay.com
|
@@ -22,6 +22,7 @@ require 'citypay_api_client/models/account_status'
|
|
22
22
|
require 'citypay_api_client/models/acknowledgement'
|
23
23
|
require 'citypay_api_client/models/airline_advice'
|
24
24
|
require 'citypay_api_client/models/airline_segment'
|
25
|
+
require 'citypay_api_client/models/api_key'
|
25
26
|
require 'citypay_api_client/models/auth_reference'
|
26
27
|
require 'citypay_api_client/models/auth_references'
|
27
28
|
require 'citypay_api_client/models/auth_request'
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'openssl'
|
3
|
-
require '
|
3
|
+
require 'base64'
|
4
4
|
|
5
5
|
module CityPayApiClient
|
6
|
-
class
|
6
|
+
class ApiKey
|
7
7
|
|
8
|
-
def initialize(client_id
|
8
|
+
def initialize(client_id:, licence_key:)
|
9
9
|
@client_id, @licence_key = client_id, licence_key
|
10
|
-
@nonce =
|
11
|
-
@datetime = DateTime.now()
|
10
|
+
@nonce = Random.new().bytes(16).bytes
|
11
|
+
@datetime = DateTime.now.new_offset(0)
|
12
12
|
end
|
13
13
|
|
14
14
|
def client_id
|
@@ -16,37 +16,40 @@ module CityPayApiClient
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def nonce=(nonce)
|
19
|
-
|
19
|
+
if nonce.is_a? String
|
20
|
+
@nonce = nonce.scan(/../).map { |x| x.hex.chr }.join.bytes
|
21
|
+
else
|
22
|
+
@nonce = nonce
|
23
|
+
end
|
24
|
+
|
20
25
|
end
|
21
26
|
|
22
27
|
def datetime=(datetime)
|
23
28
|
@datetime = datetime
|
24
29
|
end
|
25
30
|
|
31
|
+
private def hex_to_bytes(str)
|
32
|
+
str.scan(/../).map { |x| x.hex.chr }.join.bytes
|
33
|
+
end
|
34
|
+
|
26
35
|
def generate
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
# message
|
34
|
-
digest = OpenSSL::HMAC.digest(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# return base64.b64encode(dest).decode('utf-8')
|
45
|
-
|
46
|
-
# dt = datetime.strptime("2020-01-01 09:23:12", "%Y-%m-%d %H:%M:%S")
|
47
|
-
# key = api_key_generate_for("PC2", "7G79TG62BAJTK669", bytearray.fromhex("acb875aef083de292299bd69fcdeb5c5"), dt)
|
48
|
-
# self.assertEqual("UEMyOkFDQjg3NUFFRjA4M0RFMjkyMjk5QkQ2OUZDREVCNUM1Ol6Q3tCMPsYvqNhFelRD2zQHYlZquBGCY/6ZpZ0AngTF",key)
|
49
|
-
"not yet"
|
36
|
+
|
37
|
+
ds = @datetime.strftime("%Y%m%d%H%M")
|
38
|
+
message = []
|
39
|
+
message.push(*@client_id.bytes)
|
40
|
+
message.push(*@nonce)
|
41
|
+
message.push(*hex_to_bytes(ds))
|
42
|
+
# message = message.join
|
43
|
+
digest = OpenSSL::HMAC.digest('sha256', @licence_key, message.pack("c*"))
|
44
|
+
|
45
|
+
dest = []
|
46
|
+
dest.push(*@client_id.bytes)
|
47
|
+
dest.push(*"\x3A".bytes)
|
48
|
+
dest.push(*@nonce.each_entry.map { |b| '%02X' % (b & 0xFF) }.join.upcase.bytes)
|
49
|
+
dest.push(*"\x3A".bytes)
|
50
|
+
dest.push(*digest.bytes)
|
51
|
+
Base64.strict_encode64(dest.pack("c*"))
|
52
|
+
|
50
53
|
end
|
51
54
|
|
52
55
|
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'citypay_api_client/models/api_key'
|
3
|
+
|
4
|
+
describe 'ApiKey' do
|
5
|
+
before do
|
6
|
+
@instance = CityPayApiClient::ApiKey.new(client_id: "PC2", licence_key: "7G79TG62BAJTK669")
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'test generation' do
|
10
|
+
it 'should generate a new api key based on algorithm' do
|
11
|
+
expect(@instance).to be_instance_of(CityPayApiClient::ApiKey)
|
12
|
+
@instance.nonce = "acb875aef083de292299bd69fcdeb5c5"
|
13
|
+
@instance.datetime = DateTime.new(2020, 1, 1, 9, 23, 12, 0)
|
14
|
+
@instance.generate.should eq("UEMyOkFDQjg3NUFFRjA4M0RFMjkyMjk5QkQ2OUZDREVCNUM1Ol6Q3tCMPsYvqNhFelRD2zQHYlZquBGCY/6ZpZ0AngTF")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
describe 'generate from initialize' do
|
20
|
+
|
21
|
+
it 'should generate a new key' do
|
22
|
+
@instance.generate
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe('standard generation validation') do
|
28
|
+
|
29
|
+
#noinspection RubyLiteralArrayInspection
|
30
|
+
data = [
|
31
|
+
["aP","0FLSuYlRk5lLFK46","0172D48B3E020EB68CB177DC4BE537E6","2020-08-01T23:04:23","YVA6MDE3MkQ0OEIzRTAyMEVCNjhDQjE3N0RDNEJFNTM3RTY6mSUTOBc1Y4xSorAZUMtOZWD4vN0ZwAbn77+v+Z5Jbco="],
|
32
|
+
["6oh","IhitVGHjw8WIkafD","C50C8B11123AC2F9B04399EE02EDB7FA","2020-07-14T06:04:10","Nm9oOkM1MEM4QjExMTIzQUMyRjlCMDQzOTlFRTAyRURCN0ZBOo7kVI+jynP7HV1lxO6LopvJJaUVzTxeGu7PCOWvFLFw"],
|
33
|
+
["ZLM","qwHq9BS0vOW1ian5","E571174876229B467CCFCED5648DFB4B","2020-06-25T13:03:57","WkxNOkU1NzExNzQ4NzYyMjlCNDY3Q0NGQ0VENTY0OERGQjRCOsQAA3LtdHidGqrAEf39rLCSLBMB74uX+IWjKiSL/Fry"],
|
34
|
+
["JAnSB","CGqRnPns7rDuNyK7","F58B52303248328766B800021E3AAC32","2020-06-06T20:03:44","SkFuU0I6RjU4QjUyMzAzMjQ4MzI4NzY2QjgwMDAyMUUzQUFDMzI69S5jD67gT/aL8K/9mIH9ZvcznC91iVFK1i1QL/RSZGY="],
|
35
|
+
["9CYH","YIwtokm5HJX4HRyW","A149441E8633C07BBEA44E98064207F4","2020-05-19T03:03:31","OUNZSDpBMTQ5NDQxRTg2MzNDMDdCQkVBNDRFOTgwNjQyMDdGNDrbGQt+S7L28X4tzA5M5c8uuKDlE19po3s0KcT9U07+xA=="],
|
36
|
+
["ntF","QyNlLl5E0VI8yZFW","FBD4F6E51F021FD6FFB84B7A5394F1EE","2020-04-30T10:03:18","bnRGOkZCRDRGNkU1MUYwMjFGRDZGRkI4NEI3QTUzOTRGMUVFOlOnNTEul+L2da3PG6Do4JKuWy/14no8gdQ/Yn0O+Bgp"],
|
37
|
+
["5G","Ij2sltQQIxrX9JNh","B5230BAC144AF5DECBC7FF1DA5FBFD36","2020-04-11T17:03:05","NUc6QjUyMzBCQUMxNDRBRjVERUNCQzdGRjFEQTVGQkZEMzY6YGoTAbvDq8gpui9SgRwBxXkEGjRfP69WfozTBi+51pE="],
|
38
|
+
["kpGivRFGP","kAfYfNsW3g8RN3LE","DF2CC2B598AAABA7237166A0CD18695F","2020-03-24T00:02:52","a3BHaXZSRkdQOkRGMkNDMkI1OThBQUFCQTcyMzcxNjZBMENEMTg2OTVGOjUgfRSOU2IpTYmogi6M6NG4p2l3FKDZUrnLQx+bA1ag"],
|
39
|
+
["sw7Ue9gDC","D8cSOeuiVbLlKkAm","642FD45F8CFBC8CB8C340F96131B80E9","2020-03-05T07:02:39","c3c3VWU5Z0RDOjY0MkZENDVGOENGQkM4Q0I4QzM0MEY5NjEzMUI4MEU5Oj1yc6kNtdZWQrwAhIGgKg2+MfM1cy4LloYD39NWfOms"],
|
40
|
+
["mYCWPXSx8","eDsEdnL9Ic4AJKve","7129F032ABC0C0038A5DE2CD61DC0435","2020-02-15T14:02:26","bVlDV1BYU3g4OjcxMjlGMDMyQUJDMEMwMDM4QTVERTJDRDYxREMwNDM1Ovsnt3Dzh8e5n9CpiZX8PSJ4JqtajRGDZUIAxZxAoynr"],
|
41
|
+
["lmtv9HsWI","JOt5dH41lMrSUZJi","5BE9868B5F42C61B986BD3D654BF6613","2020-01-27T21:02:13","bG10djlIc1dJOjVCRTk4NjhCNUY0MkM2MUI5ODZCRDNENjU0QkY2NjEzOoUAiGITnda4EB2YHx/8zGP3FBgIHYkVU0d3PKYk3Paj"],
|
42
|
+
["ANWG7Vm0M","nCg3HeqhaDps6TZW","D3CF885E78D029AFFF6556B671EA5218","2020-01-09T04:02","QU5XRzdWbTBNOkQzQ0Y4ODVFNzhEMDI5QUZGRjY1NTZCNjcxRUE1MjE4OsBwvBUChvSNpwfUDhiojDldWGSi/X4/TyEIlWH7sf4m"],
|
43
|
+
["8M9drxQ8S","SfHLDlkF3ITHumKP","32948557E8846D6D50405510EB6361EF","2019-12-21T11:01:47","OE05ZHJ4UThTOjMyOTQ4NTU3RTg4NDZENkQ1MDQwNTUxMEVCNjM2MUVGOnGfxF1TmrtTGXr7wBlnhlvfcUCPHQnuvPsQNh+2iXt9"],
|
44
|
+
["PeA2oninT","xqs5MiXQMAq9vkO3","48D1E13E27C7CDA944465B53AF0215C2","2019-12-02T18:01:34","UGVBMm9uaW5UOjQ4RDFFMTNFMjdDN0NEQTk0NDQ2NUI1M0FGMDIxNUMyOugLjVkPR/iaRizSSFnAA01h8Ta7qlPf57K8wRx27FGC"],
|
45
|
+
["HDrdtwL2N","4WvdGVEj1d3eguPJ","0FD35319FEF366A019971715703122E1","2019-11-14T01:01:21","SERyZHR3TDJOOjBGRDM1MzE5RkVGMzY2QTAxOTk3MTcxNTcwMzEyMkUxOkgBNqCfcWnlSP1MtmULpRVm4RbVY+gAaIKx6wTNKwZS"],
|
46
|
+
["IvNuNrAns","KTodzmawZlql3lwt","6B315F760CF4F1503FCD697DE6F7707F","2019-10-26T08:01:08","SXZOdU5yQW5zOjZCMzE1Rjc2MENGNEYxNTAzRkNENjk3REU2Rjc3MDdGOlTnuUcLSpMVtK6a10hrQBeornjKy7KwPA/I3h20FsYt"],
|
47
|
+
["5e0V6iMOr","vsVvLLOTQcQWfuPe","1F3E63C31ADBDEB3F5C922CCA3895CD8","2019-10-07T15:00:55","NWUwVjZpTU9yOjFGM0U2M0MzMUFEQkRFQjNGNUM5MjJDQ0EzODk1Q0Q4Osl239n0tQLwq3MgzdqJmqqySMRYcx6rbG6vw2+I8B1h"],
|
48
|
+
["Zw6vcdEB6","MvjxOH6gDF8cByud","91B4FE721B9E39C5B078687541D01A8F","2019-09-18T22:00:42","Wnc2dmNkRUI2OjkxQjRGRTcyMUI5RTM5QzVCMDc4Njg3NTQxRDAxQThGOji6+2vTwoR8OjrMpbJ9VY+HrDlRk7BXe1zJAWZxoR3m"],
|
49
|
+
["v26Otxsyz","iUltF2cHM8kwBOxO","F33A3AAA272685E583E542C363D5FD96","2019-08-31T05:00:29","djI2T3R4c3l6OkYzM0EzQUFBMjcyNjg1RTU4M0U1NDJDMzYzRDVGRDk2Og1NJjSdJec/W0HdPkFPY8reYq3eK2ow3fEmPmwKKeJg"],
|
50
|
+
["SgnphnJP6","zgV5VlZL2zDGEHyG","FC08F615D14E4396DBB63EB87E6DBD91","2019-08-12T12:00:16","U2ducGhuSlA2OkZDMDhGNjE1RDE0RTQzOTZEQkI2M0VCODdFNkRCRDkxOnta4KFmRnx/yxxMSEYauBN8YwG/rDdJS7UOiLRY+n8t"],
|
51
|
+
["G7kd2YHP2","W5WP1tbKYu1o9dqS","3FAA3261E9EED86070F2C99BF3131847","2019-07-24T19:00:03","RzdrZDJZSFAyOjNGQUEzMjYxRTlFRUQ4NjA3MEYyQzk5QkYzMTMxODQ3OggmHx3ty1IlKr+IQnqakqVLYFcLO5wd5EYy0cxVjV/f"],
|
52
|
+
["6Q3WoEfYC","J5gI4aUpHVtA5Suf","EBB8C8905DDB2C4081FAFF20818A73F6","2019-07-06T01:59:50","NlEzV29FZllDOkVCQjhDODkwNUREQjJDNDA4MUZBRkYyMDgxOEE3M0Y2OnTpx4Gc8B6UHpRxxmZuLmCmWn1dbuPL6NeFV8pxN31v"],
|
53
|
+
["auijI3nyS","OU4Z7Svh7hKZImXX","6DE371427723FF6CE9D604925C610333","2019-06-17T08:59:37","YXVpakkzbnlTOjZERTM3MTQyNzcyM0ZGNkNFOUQ2MDQ5MjVDNjEwMzMzOiE83C7NO90jyE0Rpo9Kb0UuMoEcUuUZRtULazrvzBKP"],
|
54
|
+
["94JCLlSzp","fkKMaZlisNWEQzJ7","F9929A12E86121D75BD40B6F9D0A7783","2019-05-29T15:59:24","OTRKQ0xsU3pwOkY5OTI5QTEyRTg2MTIxRDc1QkQ0MEI2RjlEMEE3NzgzOoioe2F/SEDYMU1RRqAph8+xpOomlct3PtqT0GsZdEeO"],
|
55
|
+
["7y2nWixPc","Z4U3Ly0yls1Bygkd","213E32F0F98BF6AA9F5C201B3F1683C8","2019-05-10T22:59:11","N3kybldpeFBjOjIxM0UzMkYwRjk4QkY2QUE5RjVDMjAxQjNGMTY4M0M4OrWF87svGfZJdQyXuUQqrdS0+Y27qiHuub0eqg5J3IQ5"],
|
56
|
+
["IN4k12HJz","EmBqZaOktTC4vVJE","257FA0020CC89727D1996053EC48D427","2019-04-22T05:58:58","SU40azEySEp6OjI1N0ZBMDAyMENDODk3MjdEMTk5NjA1M0VDNDhENDI3OsO/hAllOkfhZOr7tZop8Z8FRFQeqL8eqJ2GGjs7M2qQ"],
|
57
|
+
["G60QusAjJ","VVazjlgrgGxqV1Np","EEA45C78A28B2849270EA1E67BC22BBF","2019-04-03T12:58:45","RzYwUXVzQWpKOkVFQTQ1Qzc4QTI4QjI4NDkyNzBFQTFFNjdCQzIyQkJGOi/RQgaWXQqYs9GHh5oSy+WkC3Pzwzgu0Ua+vlHxqLni"],
|
58
|
+
["pgM3vQwvZ","XcIF5R7tMbsOu3fs","5FFE3AD3D912F75CEFD5BBBDF51DA8FD","2019-03-15T19:58:32","cGdNM3ZRd3ZaOjVGRkUzQUQzRDkxMkY3NUNFRkQ1QkJCREY1MURBOEZEOhNlEQUDcGsIgQtObT5I/ZCuK9DrVjX4sytrn43JfefS"],
|
59
|
+
["gX1zl94d8","ycvUWcoU6FnWptVZ","3FBD83CDFDBC53B89F8E9C101DC52577","2019-02-25T02:58:19","Z1gxemw5NGQ4OjNGQkQ4M0NERkRCQzUzQjg5RjhFOUMxMDFEQzUyNTc3OkkeurytcvmHh6JlmPx1TxorZ4mka6XhJzgO91Wbx1q9"],
|
60
|
+
["ncicPapCa","ZpsDUzIZzAeLHgIJ","019B54A4AFC5E4C7187BC863871BA98C","2019-02-06T09:58:06","bmNpY1BhcENhOjAxOUI1NEE0QUZDNUU0QzcxODdCQzg2Mzg3MUJBOThDOmJIPoiFJj3rDuRyUoGu87DBqDpYWsMxNSbT1Z5PZ9Np"],
|
61
|
+
["2VCCeWYII","1NpLprJI4EXPr7lw","034931F44CFAD6072B5D69972E10E934","2019-01-18T16:57:53","MlZDQ2VXWUlJOjAzNDkzMUY0NENGQUQ2MDcyQjVENjk5NzJFMTBFOTM0OvrsfsZhD1VSxwlWKd43QsvuNi5KulQ5JbdCWbgaUL6Z"]
|
62
|
+
]
|
63
|
+
|
64
|
+
data.each_with_index do |item, index|
|
65
|
+
it "should test data for item #{index}" do
|
66
|
+
expect(item.size).to eq(5)
|
67
|
+
key = CityPayApiClient::ApiKey.new(client_id: item[0], licence_key: item[1])
|
68
|
+
key.nonce = item[2]
|
69
|
+
key.datetime = DateTime.parse(item[3], "%Y-%m-dT%H:%M:%S")
|
70
|
+
key.generate.should eq(item[4])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: citypay_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- citypay
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -78,8 +78,10 @@ extensions: []
|
|
78
78
|
extra_rdoc_files: []
|
79
79
|
files:
|
80
80
|
- Gemfile
|
81
|
+
- Gemfile.lock
|
81
82
|
- README.md
|
82
83
|
- Rakefile
|
84
|
+
- citypay_api-1.0.1.gem
|
83
85
|
- citypay_api_client.gemspec
|
84
86
|
- docs/AccountCreate.md
|
85
87
|
- docs/AccountStatus.md
|
@@ -164,6 +166,7 @@ files:
|
|
164
166
|
- spec/models/acknowledgement_spec.rb
|
165
167
|
- spec/models/airline_advice_spec.rb
|
166
168
|
- spec/models/airline_segment_spec.rb
|
169
|
+
- spec/models/api_key_spec.rb
|
167
170
|
- spec/models/auth_reference_spec.rb
|
168
171
|
- spec/models/auth_references_spec.rb
|
169
172
|
- spec/models/auth_request_spec.rb
|
@@ -192,9 +195,9 @@ files:
|
|
192
195
|
- spec/spec_helper.rb
|
193
196
|
homepage: https://github.com/citypay/citypay-api-client-ruby
|
194
197
|
licenses:
|
195
|
-
-
|
198
|
+
- MIT
|
196
199
|
metadata: {}
|
197
|
-
post_install_message:
|
200
|
+
post_install_message:
|
198
201
|
rdoc_options: []
|
199
202
|
require_paths:
|
200
203
|
- lib
|
@@ -210,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
213
|
version: '0'
|
211
214
|
requirements: []
|
212
215
|
rubygems_version: 3.0.3
|
213
|
-
signing_key:
|
216
|
+
signing_key:
|
214
217
|
specification_version: 4
|
215
218
|
summary: A ruby wrapper for the CityPay API
|
216
219
|
test_files:
|
@@ -231,6 +234,7 @@ test_files:
|
|
231
234
|
- spec/models/c_res_auth_request_spec.rb
|
232
235
|
- spec/models/airline_segment_spec.rb
|
233
236
|
- spec/models/card_spec.rb
|
237
|
+
- spec/models/api_key_spec.rb
|
234
238
|
- spec/models/auth_references_spec.rb
|
235
239
|
- spec/models/list_merchants_response_spec.rb
|
236
240
|
- spec/models/void_request_spec.rb
|