citypay_api_client 1.0.2 → 1.0.3
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 +1 -1
- data/README.md +4 -4
- data/lib/citypay_api_client/models/api_key.rb +16 -0
- data/lib/citypay_api_client/models/auth_request.rb +2 -0
- data/lib/citypay_api_client/models/capture_request.rb +2 -0
- data/lib/citypay_api_client/models/charge_request.rb +2 -0
- data/lib/citypay_api_client/models/void_request.rb +2 -0
- data/lib/citypay_api_client/test.rb +1 -1
- data/lib/citypay_api_client/version.rb +2 -1
- data/spec/it_api_sandbox_spec.rb +154 -0
- data/spec/models/acknowledgement_spec.rb +27 -14
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 353921c25e873f2f9265c87a6d7b0090bac363c9dc95907cf78d025a2b442c7a
|
4
|
+
data.tar.gz: 5c1155f422d3ac0b3655596b313fca732fe21b7f66a2a72aeae420fab7b8ee8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b593440b4d51f98c43860f07c579d8d4524034edf993ecf2fae11189d3d3e33c74e391ed677ba486a8b794cb8cfeb663949e59dde70ea02896baa16a0b9503f
|
7
|
+
data.tar.gz: 5750982411b91e4c30536a34693573a26f4de9aea88e479a98cdcec63b9cbfb960e4cd3dfdb420f5e724f8f483ed0dcfcded2f8e67a588f5e836f37a100105b9
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Completion processing. The API is also capable of tokinsed payments using Card H
|
|
34
34
|
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
35
35
|
|
36
36
|
- API version: 6.0.4
|
37
|
-
- Package version: 1.0.
|
37
|
+
- Package version: 1.0.3
|
38
38
|
- Build package: org.openapitools.codegen.languages.RubyClientCodegen
|
39
39
|
For more information, please visit [https://citypay.com/customer-centre/technical-support.html](https://citypay.com/customer-centre/technical-support.html)
|
40
40
|
|
@@ -51,16 +51,16 @@ gem build citypay_api_client.gemspec
|
|
51
51
|
Then either install the gem locally:
|
52
52
|
|
53
53
|
```shell
|
54
|
-
gem install ./citypay_api_client-1.0.
|
54
|
+
gem install ./citypay_api_client-1.0.3.gem
|
55
55
|
```
|
56
56
|
|
57
|
-
(for development, run `gem install --dev ./citypay_api_client-1.0.
|
57
|
+
(for development, run `gem install --dev ./citypay_api_client-1.0.3.gem` to install the development dependencies)
|
58
58
|
|
59
59
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
60
60
|
|
61
61
|
Finally add this to the Gemfile:
|
62
62
|
|
63
|
-
gem 'citypay_api_client', '~> 1.0.
|
63
|
+
gem 'citypay_api_client', '~> 1.0.3'
|
64
64
|
|
65
65
|
### Install from Git
|
66
66
|
|
@@ -34,6 +34,22 @@ module CityPayApiClient
|
|
34
34
|
|
35
35
|
def generate
|
36
36
|
|
37
|
+
if @client_id.nil?
|
38
|
+
raise 'ClientId is not defined'
|
39
|
+
end
|
40
|
+
|
41
|
+
if @licence_key.nil?
|
42
|
+
raise 'LicenceKey is not defined'
|
43
|
+
end
|
44
|
+
|
45
|
+
if @datetime.nil?
|
46
|
+
raise 'Datetime is not defined'
|
47
|
+
end
|
48
|
+
|
49
|
+
if @nonce.nil?
|
50
|
+
raise 'Nonce is not defined'
|
51
|
+
end
|
52
|
+
|
37
53
|
ds = @datetime.strftime("%Y%m%d%H%M")
|
38
54
|
message = []
|
39
55
|
message.push(*@client_id.bytes)
|
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
begin
|
13
13
|
card_holder_instance = CityPayApiClient::CardHolderAccountApi.new
|
14
|
-
resp = card_holder_instance.account_retrieve_request("
|
14
|
+
resp = card_holder_instance.account_retrieve_request("0021d9fc-12ce-4da1-9adf-7556a6427158")
|
15
15
|
p resp
|
16
16
|
p resp.account_id
|
17
17
|
p resp.date_created
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json'
|
3
|
+
require 'date'
|
4
|
+
require 'securerandom'
|
5
|
+
|
6
|
+
|
7
|
+
describe 'IntegrationTests' do
|
8
|
+
|
9
|
+
client_id = ENV['CP_CLIENT_ID']
|
10
|
+
licence_key = ENV['CP_LICENCE_KEY']
|
11
|
+
merchant_id = ENV['CP_MERCHANT_ID']
|
12
|
+
|
13
|
+
before do
|
14
|
+
|
15
|
+
# for each test
|
16
|
+
CityPayApiClient.configure do |config|
|
17
|
+
config.api_key['cp-api-key'] = CityPayApiClient::ApiKey.new(client_id: client_id, licence_key: licence_key).generate
|
18
|
+
config.debugging = true
|
19
|
+
config.host = "sandbox.citypay.com"
|
20
|
+
end
|
21
|
+
cha_api = CityPayApiClient::CardHolderAccountApi.new
|
22
|
+
end
|
23
|
+
|
24
|
+
after do
|
25
|
+
# eun after each test
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'Can run operational tests' do
|
29
|
+
api_instance = CityPayApiClient::OperationalApi.new
|
30
|
+
|
31
|
+
it 'should ping and ack' do
|
32
|
+
uuid = SecureRandom.uuid
|
33
|
+
result = api_instance.ping_request(CityPayApiClient::Ping.new(identifier: uuid))
|
34
|
+
expect(result.code == "044")
|
35
|
+
expect(result.identifier == uuid)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should list merchants' do
|
39
|
+
result = api_instance.list_merchants_request("default")
|
40
|
+
expect(result.clientid == client_id)
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'Run payment processing tests' do
|
46
|
+
api_instance = CityPayApiClient::PaymentProcessingApi.new
|
47
|
+
|
48
|
+
it 'should authorise' do
|
49
|
+
uuid = SecureRandom.uuid
|
50
|
+
result = api_instance.authorisation_request(CityPayApiClient::AuthRequest.new(
|
51
|
+
merchantid: merchant_id,
|
52
|
+
cardnumber: "4000000000000002",
|
53
|
+
csc: "012",
|
54
|
+
expmonth: 12,
|
55
|
+
expyear: 2030,
|
56
|
+
amount: 1395,
|
57
|
+
identifier: uuid
|
58
|
+
))
|
59
|
+
|
60
|
+
expect(result.auth_response).to_not be_nil
|
61
|
+
expect(result.authen_required).to be_nil
|
62
|
+
expect(result.request_challenged).to be_nil
|
63
|
+
|
64
|
+
response = result.auth_response
|
65
|
+
|
66
|
+
expect(response.identifier == uuid.to_str)
|
67
|
+
expect(response.authcode == "A12345")
|
68
|
+
expect(response.amount == 1395)
|
69
|
+
expect(response.result_code == "001")
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'Run card holder account actions' do
|
75
|
+
|
76
|
+
api_instance = CityPayApiClient::CardHolderAccountApi.new
|
77
|
+
cha_id = SecureRandom.hex(12)
|
78
|
+
|
79
|
+
it 'should create a new cha' do
|
80
|
+
|
81
|
+
result = api_instance.account_create(CityPayApiClient::AccountCreate.new(
|
82
|
+
account_id: cha_id,
|
83
|
+
contact: CityPayApiClient::ContactDetails.new(
|
84
|
+
address1: "7 Esplanade",
|
85
|
+
area: "St Helier",
|
86
|
+
company: "CityPay Limited",
|
87
|
+
country: "JE",
|
88
|
+
email: "dev@citypay.com",
|
89
|
+
firstname: "Integration",
|
90
|
+
lastname: "Test",
|
91
|
+
postcode: "JE2 3QA"
|
92
|
+
)
|
93
|
+
))
|
94
|
+
|
95
|
+
expect(result.account_id == cha_id)
|
96
|
+
expect(result.contact.address1 == "7 Esplanade")
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should add a card to the account' do
|
101
|
+
result = api_instance.account_card_register_request(cha_id, CityPayApiClient::RegisterCard.new(
|
102
|
+
cardnumber: "4000000000000002",
|
103
|
+
expmonth: 12,
|
104
|
+
expyear: 2030,
|
105
|
+
))
|
106
|
+
expect(result.account_id == cha_id)
|
107
|
+
expect(result.cards.length == 1)
|
108
|
+
expect(result.cards[0].expmonth == 12)
|
109
|
+
expect(result.cards[0].expyear == 2030)
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should retrieve the account and charge against it' do
|
114
|
+
result = api_instance.account_retrieve_request(cha_id)
|
115
|
+
expect(result.account_id == cha_id)
|
116
|
+
expect(result.contact.address1 == "7 Esplanade")
|
117
|
+
expect(result.cards.length == 1)
|
118
|
+
expect(result.cards[0].expmonth == 12)
|
119
|
+
expect(result.cards[0].expyear == 2030)
|
120
|
+
|
121
|
+
uuid = SecureRandom.uuid
|
122
|
+
result2 = api_instance.charge_request(CityPayApiClient::ChargeRequest.new(
|
123
|
+
amount: 7801,
|
124
|
+
csc: "012",
|
125
|
+
merchantid: merchant_id,
|
126
|
+
identifier: uuid,
|
127
|
+
token: result.cards[0].token
|
128
|
+
))
|
129
|
+
|
130
|
+
# decision object returned
|
131
|
+
expect(result2.auth_response).to_not be_nil
|
132
|
+
expect(result2.authen_required).to be_nil
|
133
|
+
expect(result2.request_challenged).to be_nil
|
134
|
+
|
135
|
+
response = result2.auth_response
|
136
|
+
|
137
|
+
expect(response.identifier == uuid.to_str)
|
138
|
+
expect(response.authcode == "A12345")
|
139
|
+
expect(response.amount == 1395)
|
140
|
+
expect(response.result_code == "001")
|
141
|
+
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
it 'should delete the cha' do
|
146
|
+
|
147
|
+
result = api_instance.account_delete_request(cha_id)
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
end
|
@@ -19,18 +19,26 @@ require 'date'
|
|
19
19
|
describe 'Acknowledgement' do
|
20
20
|
before do
|
21
21
|
# run before each test
|
22
|
-
|
22
|
+
json1 = '
|
23
23
|
{
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"message": "System: Accepted Transaction"
|
24
|
+
"code": "000",
|
25
|
+
"context": "1B12WmDZB3EYSbb",
|
26
|
+
"identifier": "testIdentifier",
|
27
|
+
"message": "System: Accepted Transaction"
|
29
28
|
}
|
30
|
-
}
|
31
29
|
'
|
32
|
-
|
33
|
-
|
30
|
+
|
31
|
+
json2 = '
|
32
|
+
{ "Acknowledgement": {
|
33
|
+
"code": "000",
|
34
|
+
"context": "1B12WmDZB3EYSbb",
|
35
|
+
"identifier": "testIdentifier",
|
36
|
+
"message": "System: Accepted Transaction"
|
37
|
+
}}
|
38
|
+
'
|
39
|
+
|
40
|
+
@instance1 = CityPayApiClient::ApiClient.new.convert_to_type(JSON.parse(json1, :symbolize_names => true), "Acknowledgement")
|
41
|
+
@instance2 = CityPayApiClient::ApiClient.new.convert_to_type(JSON.parse(json2, :symbolize_names => true), "Acknowledgement")
|
34
42
|
end
|
35
43
|
|
36
44
|
after do
|
@@ -39,30 +47,35 @@ describe 'Acknowledgement' do
|
|
39
47
|
|
40
48
|
describe 'test an instance of Acknowledgement' do
|
41
49
|
it 'should create an instance of Acknowledgement' do
|
42
|
-
expect(@
|
50
|
+
expect(@instance1).to be_instance_of(CityPayApiClient::Acknowledgement)
|
51
|
+
expect(@instance2).to be_instance_of(CityPayApiClient::Acknowledgement)
|
43
52
|
end
|
44
53
|
end
|
45
54
|
describe 'test attribute "code"' do
|
46
55
|
it 'should work' do
|
47
|
-
expect(@
|
56
|
+
expect(@instance1.code).to eq("000")
|
57
|
+
expect(@instance2.code).to eq("000")
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
51
61
|
describe 'test attribute "context"' do
|
52
62
|
it 'should work' do
|
53
|
-
expect(@
|
63
|
+
expect(@instance1.context).to eq("1B12WmDZB3EYSbb")
|
64
|
+
expect(@instance2.context).to eq("1B12WmDZB3EYSbb")
|
54
65
|
end
|
55
66
|
end
|
56
67
|
|
57
68
|
describe 'test attribute "identifier"' do
|
58
69
|
it 'should work' do
|
59
|
-
expect(@
|
70
|
+
expect(@instance1.identifier).to eq("testIdentifier")
|
71
|
+
expect(@instance2.identifier).to eq("testIdentifier")
|
60
72
|
end
|
61
73
|
end
|
62
74
|
|
63
75
|
describe 'test attribute "message"' do
|
64
76
|
it 'should work' do
|
65
|
-
expect(@
|
77
|
+
expect(@instance1.message).to eq("System: Accepted Transaction")
|
78
|
+
expect(@instance2.message).to eq("System: Accepted Transaction")
|
66
79
|
end
|
67
80
|
end
|
68
81
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- citypay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- spec/api/payment_processing_api_spec.rb
|
162
162
|
- spec/api_client_spec.rb
|
163
163
|
- spec/configuration_spec.rb
|
164
|
+
- spec/it_api_sandbox_spec.rb
|
164
165
|
- spec/models/account_create_spec.rb
|
165
166
|
- spec/models/account_status_spec.rb
|
166
167
|
- spec/models/acknowledgement_spec.rb
|
@@ -222,6 +223,7 @@ test_files:
|
|
222
223
|
- spec/api/card_holder_account_api_spec.rb
|
223
224
|
- spec/api_client_spec.rb
|
224
225
|
- spec/configuration_spec.rb
|
226
|
+
- spec/it_api_sandbox_spec.rb
|
225
227
|
- spec/models/error_spec.rb
|
226
228
|
- spec/models/capture_request_spec.rb
|
227
229
|
- spec/models/acknowledgement_spec.rb
|