cloud_payments 0.0.3 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +12 -15
- data/Gemfile +2 -2
- data/README.md +74 -5
- data/Rakefile +1 -0
- data/cloud_payments.gemspec +7 -6
- data/config.ru +1 -0
- data/lib/cloud_payments.rb +1 -1
- data/lib/cloud_payments/client.rb +3 -2
- data/lib/cloud_payments/client/errors.rb +1 -0
- data/lib/cloud_payments/client/gateway_errors.rb +3 -1
- data/lib/cloud_payments/client/response.rb +2 -1
- data/lib/cloud_payments/client/serializer.rb +1 -0
- data/lib/cloud_payments/client/serializer/base.rb +9 -1
- data/lib/cloud_payments/client/serializer/multi_json.rb +1 -0
- data/lib/cloud_payments/config.rb +4 -0
- data/lib/cloud_payments/models.rb +2 -0
- data/lib/cloud_payments/models/like_subscription.rb +1 -0
- data/lib/cloud_payments/models/model.rb +1 -0
- data/lib/cloud_payments/models/on_fail.rb +2 -0
- data/lib/cloud_payments/models/on_kassa_receipt.rb +23 -0
- data/lib/cloud_payments/models/on_pay.rb +2 -0
- data/lib/cloud_payments/models/on_recurrent.rb +1 -0
- data/lib/cloud_payments/models/order.rb +1 -0
- data/lib/cloud_payments/models/secure3d.rb +1 -0
- data/lib/cloud_payments/models/subscription.rb +2 -1
- data/lib/cloud_payments/models/transaction.rb +9 -0
- data/lib/cloud_payments/namespaces.rb +12 -1
- data/lib/cloud_payments/namespaces/apple_pay.rb +18 -0
- data/lib/cloud_payments/namespaces/base.rb +2 -1
- data/lib/cloud_payments/namespaces/cards.rb +6 -0
- data/lib/cloud_payments/namespaces/kassa.rb +22 -0
- data/lib/cloud_payments/namespaces/orders.rb +5 -0
- data/lib/cloud_payments/namespaces/payments.rb +11 -0
- data/lib/cloud_payments/namespaces/subscriptions.rb +6 -0
- data/lib/cloud_payments/namespaces/tokens.rb +1 -0
- data/lib/cloud_payments/version.rb +2 -1
- data/lib/cloud_payments/webhooks.rb +7 -2
- data/spec/cloud_payments/client/response_spec.rb +3 -1
- data/spec/cloud_payments/client/serializer/multi_json_spec.rb +1 -0
- data/spec/cloud_payments/models/order_spec.rb +1 -0
- data/spec/cloud_payments/models/secure3d_spec.rb +1 -0
- data/spec/cloud_payments/models/subscription_spec.rb +1 -1
- data/spec/cloud_payments/models/transaction_spec.rb +25 -1
- data/spec/cloud_payments/namespaces/apple_pay_spec.rb +21 -0
- data/spec/cloud_payments/namespaces/base_spec.rb +10 -3
- data/spec/cloud_payments/namespaces/cards_spec.rb +42 -2
- data/spec/cloud_payments/namespaces/kassa_spec.rb +43 -0
- data/spec/cloud_payments/namespaces/orders_spec.rb +13 -0
- data/spec/cloud_payments/namespaces/payments_spec.rb +119 -0
- data/spec/cloud_payments/namespaces/subscriptions_spec.rb +21 -1
- data/spec/cloud_payments/namespaces/tokens_spec.rb +1 -0
- data/spec/cloud_payments/namespaces_spec.rb +2 -1
- data/spec/cloud_payments/webhooks_spec.rb +43 -0
- data/spec/cloud_payments_spec.rb +27 -4
- data/spec/fixtures/apis/cards/post3ds/failed.yml +45 -0
- data/spec/fixtures/apis/cards/post3ds/successful.yml +48 -0
- data/spec/fixtures/apis/orders/cancel/failed.yml +6 -0
- data/spec/fixtures/apis/orders/cancel/successful.yml +6 -0
- data/spec/fixtures/apis/payments/find/failed.yml +45 -0
- data/spec/fixtures/apis/payments/find/failed_with_message.yml +6 -0
- data/spec/fixtures/apis/payments/find/successful.yml +48 -0
- data/spec/fixtures/apis/payments/get/failed.yml +46 -0
- data/spec/fixtures/apis/payments/get/failed_with_message.yml +6 -0
- data/spec/fixtures/apis/payments/get/refunded.yml +49 -0
- data/spec/fixtures/apis/payments/get/successful.yml +49 -0
- data/spec/fixtures/apis/subscriptions/find/successful.yml +4 -4
- data/spec/fixtures/apis/subscriptions/get/successful.yml +31 -0
- data/spec/spec_helper.rb +13 -24
- data/spec/support/examples.rb +1 -0
- data/spec/support/helpers.rb +3 -2
- metadata +45 -15
- data/spec/cloud_payments/client_spec.rb +0 -5
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe CloudPayments::Namespaces::Kassa do
|
7
|
+
subject{ described_class.new(CloudPayments.client) }
|
8
|
+
|
9
|
+
describe '#receipt' do
|
10
|
+
let(:attributes) do
|
11
|
+
{
|
12
|
+
inn: '7708806666',
|
13
|
+
type: 'Income',
|
14
|
+
customer_receipt: {
|
15
|
+
items: [
|
16
|
+
{
|
17
|
+
amount: '13350.00',
|
18
|
+
label: 'Good Description',
|
19
|
+
price: '13350.00',
|
20
|
+
quantity: 1.0,
|
21
|
+
vat: 0
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
context do
|
29
|
+
before{ attributes.delete(:inn) }
|
30
|
+
specify{ expect{subject.receipt(attributes)}.to raise_error(described_class::InnNotProvided) }
|
31
|
+
end
|
32
|
+
|
33
|
+
context do
|
34
|
+
before{ attributes.delete(:type) }
|
35
|
+
specify{ expect{subject.receipt(attributes)}.to raise_error(described_class::TypeNotProvided) }
|
36
|
+
end
|
37
|
+
|
38
|
+
context do
|
39
|
+
before{ attributes.delete(:customer_receipt) }
|
40
|
+
specify{ expect{subject.receipt(attributes)}.to raise_error(described_class::CustomerReceiptNotProvided) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'spec_helper'
|
4
5
|
|
5
6
|
describe CloudPayments::Namespaces::Orders do
|
@@ -41,4 +42,16 @@ describe CloudPayments::Namespaces::Orders do
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
45
|
+
|
46
|
+
describe '#cancel' do
|
47
|
+
context do
|
48
|
+
before{ stub_api_request('orders/cancel/successful').perform }
|
49
|
+
specify{ expect(subject.cancel('12345')).to be_truthy }
|
50
|
+
end
|
51
|
+
|
52
|
+
context do
|
53
|
+
before{ stub_api_request('orders/cancel/failed').perform }
|
54
|
+
specify{ expect{ subject.cancel('12345') }.to raise_error(CloudPayments::Client::GatewayError, 'Error message') }
|
55
|
+
end
|
56
|
+
end
|
44
57
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe CloudPayments::Namespaces::Payments do
|
@@ -93,4 +94,122 @@ describe CloudPayments::Namespaces::Payments do
|
|
93
94
|
end
|
94
95
|
end
|
95
96
|
end
|
97
|
+
|
98
|
+
describe '#get' do
|
99
|
+
let(:transaction_id) { 12345 }
|
100
|
+
|
101
|
+
context 'config.raise_banking_errors = false' do
|
102
|
+
before { CloudPayments.config.raise_banking_errors = false }
|
103
|
+
|
104
|
+
context 'transaction not found' do
|
105
|
+
before{ stub_api_request('payments/get/failed_with_message').perform }
|
106
|
+
specify{ expect{subject.get(transaction_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
107
|
+
end
|
108
|
+
|
109
|
+
context 'transaction is failed' do
|
110
|
+
before{ stub_api_request('payments/get/failed').perform }
|
111
|
+
specify{ expect(subject.get(transaction_id)).to be_instance_of(CloudPayments::Transaction) }
|
112
|
+
specify{ expect(subject.get(transaction_id)).not_to be_required_secure3d }
|
113
|
+
specify{ expect(subject.get(transaction_id)).to be_declined }
|
114
|
+
specify{ expect(subject.get(transaction_id).id).to eq(transaction_id) }
|
115
|
+
specify{ expect(subject.get(transaction_id).reason).to eq('InsufficientFunds') }
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'transaction is successful' do
|
119
|
+
before{ stub_api_request('payments/get/successful').perform }
|
120
|
+
specify{ expect(subject.get(transaction_id)).to be_instance_of(CloudPayments::Transaction) }
|
121
|
+
specify{ expect(subject.get(transaction_id)).not_to be_required_secure3d }
|
122
|
+
specify{ expect(subject.get(transaction_id)).to be_completed }
|
123
|
+
specify{ expect(subject.get(transaction_id).id).to eq(transaction_id) }
|
124
|
+
specify{ expect(subject.get(transaction_id).reason).to eq('Approved') }
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'transaction is refunded' do
|
128
|
+
before{ stub_api_request('payments/get/refunded').perform }
|
129
|
+
specify{ expect(subject.get(transaction_id)).to be_completed }
|
130
|
+
specify{ expect(subject.get(transaction_id)).to be_refunded }
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context 'config.raise_banking_errors = true' do
|
135
|
+
before { CloudPayments.config.raise_banking_errors = true}
|
136
|
+
|
137
|
+
context 'transaction not found' do
|
138
|
+
before{ stub_api_request('payments/get/failed_with_message').perform }
|
139
|
+
specify{ expect{subject.get(transaction_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'transaction is failed' do
|
143
|
+
before{ stub_api_request('payments/get/failed').perform }
|
144
|
+
specify{ expect{subject.get(transaction_id)}.to raise_error(CloudPayments::Client::GatewayErrors::InsufficientFunds) }
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'transaction is successful' do
|
148
|
+
before{ stub_api_request('payments/get/successful').perform }
|
149
|
+
specify{ expect{subject.get(transaction_id)}.to_not raise_error }
|
150
|
+
specify{ expect(subject.get(transaction_id)).to be_instance_of(CloudPayments::Transaction) }
|
151
|
+
specify{ expect(subject.get(transaction_id)).not_to be_required_secure3d }
|
152
|
+
specify{ expect(subject.get(transaction_id)).to be_completed }
|
153
|
+
specify{ expect(subject.get(transaction_id).id).to eq(transaction_id) }
|
154
|
+
specify{ expect(subject.get(transaction_id).reason).to eq('Approved') }
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
describe '#find' do
|
160
|
+
let(:invoice_id) { '1234567' }
|
161
|
+
|
162
|
+
context 'config.raise_banking_errors = false' do
|
163
|
+
before { CloudPayments.config.raise_banking_errors = false }
|
164
|
+
|
165
|
+
context 'payment is not found' do
|
166
|
+
before{ stub_api_request('payments/find/failed_with_message').perform }
|
167
|
+
specify{ expect{subject.find(invoice_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
168
|
+
end
|
169
|
+
|
170
|
+
context 'payment is failed' do
|
171
|
+
before{ stub_api_request('payments/find/failed').perform }
|
172
|
+
specify{ expect(subject.find(invoice_id)).to be_instance_of(CloudPayments::Transaction) }
|
173
|
+
specify{ expect(subject.find(invoice_id)).not_to be_required_secure3d }
|
174
|
+
specify{ expect(subject.find(invoice_id)).to be_declined }
|
175
|
+
specify{ expect(subject.find(invoice_id).id).to eq(12345) }
|
176
|
+
specify{ expect(subject.find(invoice_id).invoice_id).to eq(invoice_id) }
|
177
|
+
specify{ expect(subject.find(invoice_id).reason).to eq('InsufficientFunds') }
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'transaction is successful' do
|
181
|
+
before{ stub_api_request('payments/find/successful').perform }
|
182
|
+
specify{ expect(subject.find(invoice_id)).to be_instance_of(CloudPayments::Transaction) }
|
183
|
+
specify{ expect(subject.find(invoice_id)).not_to be_required_secure3d }
|
184
|
+
specify{ expect(subject.find(invoice_id)).to be_completed }
|
185
|
+
specify{ expect(subject.find(invoice_id).id).to eq(12345) }
|
186
|
+
specify{ expect(subject.find(invoice_id).invoice_id).to eq(invoice_id) }
|
187
|
+
specify{ expect(subject.find(invoice_id).reason).to eq('Approved') }
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
context 'config.raise_banking_errors = true' do
|
192
|
+
before { CloudPayments.config.raise_banking_errors = true}
|
193
|
+
|
194
|
+
context 'payment is not found' do
|
195
|
+
before{ stub_api_request('payments/find/failed_with_message').perform }
|
196
|
+
specify{ expect{subject.find(invoice_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
197
|
+
end
|
198
|
+
|
199
|
+
context 'payment is failed' do
|
200
|
+
before{ stub_api_request('payments/find/failed').perform }
|
201
|
+
specify{ expect{subject.find(invoice_id)}.to raise_error(CloudPayments::Client::GatewayErrors::InsufficientFunds) }
|
202
|
+
end
|
203
|
+
|
204
|
+
context 'transaction is successful' do
|
205
|
+
before{ stub_api_request('payments/find/successful').perform }
|
206
|
+
specify{ expect(subject.find(invoice_id)).to be_instance_of(CloudPayments::Transaction) }
|
207
|
+
specify{ expect(subject.find(invoice_id)).not_to be_required_secure3d }
|
208
|
+
specify{ expect(subject.find(invoice_id)).to be_completed }
|
209
|
+
specify{ expect(subject.find(invoice_id).id).to eq(12345) }
|
210
|
+
specify{ expect(subject.find(invoice_id).invoice_id).to eq(invoice_id) }
|
211
|
+
specify{ expect(subject.find(invoice_id).reason).to eq('Approved') }
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
96
215
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe CloudPayments::Namespaces::Subscriptions do
|
@@ -5,7 +6,7 @@ describe CloudPayments::Namespaces::Subscriptions do
|
|
5
6
|
|
6
7
|
describe '#find' do
|
7
8
|
context do
|
8
|
-
before{ stub_api_request('subscriptions/
|
9
|
+
before{ stub_api_request('subscriptions/get/successful').perform }
|
9
10
|
|
10
11
|
specify{ expect(subject.find('sc_8cf8a9338fb')).to be_instance_of(CloudPayments::Subscription) }
|
11
12
|
|
@@ -21,6 +22,25 @@ describe CloudPayments::Namespaces::Subscriptions do
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
25
|
+
describe '#find_all' do
|
26
|
+
context do
|
27
|
+
before{ stub_api_request('subscriptions/find/successful').perform }
|
28
|
+
|
29
|
+
specify{ expect(subject.find_all("user@example.com")).to be_instance_of(Array) }
|
30
|
+
specify{ expect(subject.find_all("user@example.com").first).to be_instance_of(CloudPayments::Subscription) }
|
31
|
+
|
32
|
+
context do
|
33
|
+
let(:sub){ subject.find_all("user@example.com").first }
|
34
|
+
|
35
|
+
specify{ expect(sub.id).to eq('sc_8cf8a9338fb') }
|
36
|
+
specify{ expect(sub.account_id).to eq('user@example.com') }
|
37
|
+
specify{ expect(sub.description).to eq('Monthly subscription') }
|
38
|
+
specify{ expect(sub.started_at).to eq(DateTime.parse('2014-08-09T11:49:41')) }
|
39
|
+
specify{ expect(sub).to be_active }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
24
44
|
describe '#create' do
|
25
45
|
let(:attributes){ {
|
26
46
|
token: '477BBA133C182267F',
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe CloudPayments::Namespaces do
|
@@ -33,7 +34,7 @@ describe CloudPayments::Namespaces do
|
|
33
34
|
end
|
34
35
|
|
35
36
|
context 'when exception occurs while request' do
|
36
|
-
before{ stub_api_request('ping/failed').to_raise(::Faraday::
|
37
|
+
before{ stub_api_request('ping/failed').to_raise(::Faraday::ConnectionFailed) }
|
37
38
|
specify{ expect(subject.ping).to be_falsy }
|
38
39
|
end
|
39
40
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
3
4
|
require 'spec_helper'
|
4
5
|
|
5
6
|
describe CloudPayments::Webhooks do
|
@@ -226,4 +227,46 @@ describe CloudPayments::Webhooks do
|
|
226
227
|
specify { expect(subject.failed_transactions).to eq 22 }
|
227
228
|
specify { expect(subject.next_transaction_at).to eq DateTime.parse('2015-11-18 20:29:05') }
|
228
229
|
end
|
230
|
+
|
231
|
+
describe 'on_kassa_receipt' do
|
232
|
+
let(:raw_data) do
|
233
|
+
{"Id"=>"sc_a38ca02005d40db7d32b36a0097b0",
|
234
|
+
"DocumentNumber"=>"1234",
|
235
|
+
"SessionNumber"=>"12345",
|
236
|
+
"FiscalSign"=>"signsgin",
|
237
|
+
"DeviceNumber"=>"123465",
|
238
|
+
"RegNumber"=>"12345",
|
239
|
+
"Inn"=>"0",
|
240
|
+
"Type"=>"Type",
|
241
|
+
"Ofd"=>"Ofd",
|
242
|
+
"Url"=>"http://example.com/url/",
|
243
|
+
"QrCodeUrl"=>"http://example.com/url",
|
244
|
+
"Amount"=>"11.11",
|
245
|
+
"DateTime"=>"2015-11-18 20:29:05",
|
246
|
+
"Receipt"=>"{}",
|
247
|
+
"TransactionId" => "12321123",
|
248
|
+
"InvoiceId" => "123123",
|
249
|
+
"AccountId" => "3213213"}
|
250
|
+
end
|
251
|
+
|
252
|
+
subject { CloudPayments.webhooks.kassa_receipt(raw_data) }
|
253
|
+
|
254
|
+
specify { expect(subject.id).to eq "sc_a38ca02005d40db7d32b36a0097b0" }
|
255
|
+
specify { expect(subject.document_number).to eq '1234' }
|
256
|
+
specify { expect(subject.session_number).to eq '12345' }
|
257
|
+
specify { expect(subject.fiscal_sign).to eq 'signsgin' }
|
258
|
+
specify { expect(subject.device_number).to eq '123465' }
|
259
|
+
specify { expect(subject.reg_number).to eq '12345' }
|
260
|
+
specify { expect(subject.inn).to eq '0' }
|
261
|
+
specify { expect(subject.type).to eq 'Type' }
|
262
|
+
specify { expect(subject.ofd).to eq 'Ofd' }
|
263
|
+
specify { expect(subject.url).to eq 'http://example.com/url/' }
|
264
|
+
specify { expect(subject.qr_code_url).to eq 'http://example.com/url' }
|
265
|
+
specify { expect(subject.amount).to eq 11.11 }
|
266
|
+
specify { expect(subject.date_time).to eq DateTime.parse('2015-11-18 20:29:05') }
|
267
|
+
specify { expect(subject.receipt).to eq '{}' }
|
268
|
+
specify { expect(subject.transaction_id).to eq '12321123' }
|
269
|
+
specify { expect(subject.invoice_id).to eq '123123' }
|
270
|
+
specify { expect(subject.account_id).to eq '3213213' }
|
271
|
+
end
|
229
272
|
end
|
data/spec/cloud_payments_spec.rb
CHANGED
@@ -1,14 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe CloudPayments do
|
4
5
|
describe '#config=' do
|
5
|
-
before{ @old_config = CloudPayments.config }
|
6
|
-
after{ CloudPayments.config = @old_config }
|
6
|
+
before { @old_config = CloudPayments.config }
|
7
|
+
after { CloudPayments.config = @old_config }
|
7
8
|
|
8
9
|
specify{ expect{ CloudPayments.config = 'config' }.to change{ CloudPayments.config }.to('config') }
|
9
10
|
end
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
it 'supports global configuration' do
|
13
|
+
CloudPayments.config.secret_key = "OLD_KEY"
|
14
|
+
|
15
|
+
CloudPayments.configure do |c|
|
16
|
+
c.secret_key = "NEW_KEY"
|
17
|
+
end
|
18
|
+
|
19
|
+
expect(CloudPayments.config.secret_key).to eq "NEW_KEY"
|
20
|
+
expect(CloudPayments.client.config.secret_key).to eq "NEW_KEY"
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'supports local configuration' do
|
24
|
+
CloudPayments.config.secret_key = "OLD_KEY"
|
25
|
+
|
26
|
+
config = CloudPayments::Config.new do |c|
|
27
|
+
c.secret_key = "NEW_KEY"
|
28
|
+
end
|
29
|
+
client = CloudPayments::Client.new(config)
|
30
|
+
webhooks = CloudPayments::Webhooks.new(config)
|
31
|
+
|
32
|
+
expect(CloudPayments.config.secret_key).to eq "OLD_KEY"
|
33
|
+
expect(config.secret_key).to eq "NEW_KEY"
|
34
|
+
expect(client.config.secret_key).to eq "NEW_KEY"
|
35
|
+
expect(webhooks.config.secret_key).to eq "NEW_KEY"
|
13
36
|
end
|
14
37
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
:request:
|
3
|
+
:url: '/payments/cards/post3ds'
|
4
|
+
:body: '{"TransactionId":12345,"PaRes":"AQ=="}'
|
5
|
+
:response:
|
6
|
+
:body: >
|
7
|
+
{
|
8
|
+
"Model": {
|
9
|
+
"TransactionId": 12345,
|
10
|
+
"Amount": 10.0,
|
11
|
+
"Currency": "RUB",
|
12
|
+
"CurrencyCode": 0,
|
13
|
+
"PaymentAmount": 10.0,
|
14
|
+
"PaymentCurrency": "RUB",
|
15
|
+
"PaymentCurrencyCode": 0,
|
16
|
+
"InvoiceId": "1234567",
|
17
|
+
"AccountId": "user_x",
|
18
|
+
"Email": null,
|
19
|
+
"Description": "Payment for goods on example.com",
|
20
|
+
"JsonData": null,
|
21
|
+
"CreatedDate": "\/Date(1401718880000)\/",
|
22
|
+
"CreatedDateIso":"2014-08-09T11:49:41",
|
23
|
+
"TestMode": true,
|
24
|
+
"IpAddress": "195.91.194.13",
|
25
|
+
"IpCountry": "RU",
|
26
|
+
"IpCity": "Ufa",
|
27
|
+
"IpRegion": "Bashkortostan Republic",
|
28
|
+
"IpDistrict": "Volga Federal District",
|
29
|
+
"IpLatitude": 54.7355,
|
30
|
+
"IpLongitude": 55.991982,
|
31
|
+
"CardFirstSix": "411111",
|
32
|
+
"CardLastFour": "1111",
|
33
|
+
"CardType": "Visa",
|
34
|
+
"CardTypeCode": 0,
|
35
|
+
"IssuerBankCountry": "RU",
|
36
|
+
"Status": "Declined",
|
37
|
+
"StatusCode": 5,
|
38
|
+
"Reason": "InsufficientFunds",
|
39
|
+
"ReasonCode": 5051,
|
40
|
+
"CardHolderMessage": "Insufficient funds on account",
|
41
|
+
"Name": "CARDHOLDER NAME"
|
42
|
+
},
|
43
|
+
"Success": false,
|
44
|
+
"Message": null
|
45
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
:request:
|
3
|
+
:url: '/payments/cards/post3ds'
|
4
|
+
:body: '{"TransactionId":12345,"PaRes":"AQ=="}'
|
5
|
+
:response:
|
6
|
+
:body: >
|
7
|
+
{
|
8
|
+
"Model":{
|
9
|
+
"TransactionId":12345,
|
10
|
+
"Amount":10.0,
|
11
|
+
"Currency":"RUB",
|
12
|
+
"CurrencyCode":0,
|
13
|
+
"InvoiceId":"1234567",
|
14
|
+
"AccountId":"user_x",
|
15
|
+
"Email":null,
|
16
|
+
"Description":"Payment for goods on example.com",
|
17
|
+
"JsonData":null,
|
18
|
+
"CreatedDate":"\/Date(1401718880000)\/",
|
19
|
+
"CreatedDateIso":"2014-08-09T11:49:41",
|
20
|
+
"AuthDate":"\/Date(1401733880523)\/",
|
21
|
+
"AuthDateIso":"2014-08-09T11:49:42",
|
22
|
+
"ConfirmDate":"\/Date(1401733880523)\/",
|
23
|
+
"ConfirmDateIso":"2014-08-09T11:49:42",
|
24
|
+
"AuthCode":"123456",
|
25
|
+
"TestMode":true,
|
26
|
+
"IpAddress":"195.91.194.13",
|
27
|
+
"IpCountry":"RU",
|
28
|
+
"IpCity":"Ufa",
|
29
|
+
"IpRegion":"Bashkortostan Republic",
|
30
|
+
"IpDistrict":"Volga Federal District",
|
31
|
+
"IpLatitude":54.7355,
|
32
|
+
"IpLongitude":55.991982,
|
33
|
+
"CardFirstSix":"411111",
|
34
|
+
"CardLastFour":"1111",
|
35
|
+
"CardType":"Visa",
|
36
|
+
"CardTypeCode":0,
|
37
|
+
"IssuerBankCountry":"RU",
|
38
|
+
"Status":"Completed",
|
39
|
+
"StatusCode":3,
|
40
|
+
"Reason":"Approved",
|
41
|
+
"ReasonCode":0,
|
42
|
+
"CardHolderMessage":"Payment successful",
|
43
|
+
"Name":"CARDHOLDER NAME",
|
44
|
+
"Token":"a4e67841-abb0-42de-a364-d1d8f9f4b3c0"
|
45
|
+
},
|
46
|
+
"Success":true,
|
47
|
+
"Message": null
|
48
|
+
}
|