cloud_payments 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/Gemfile +1 -1
- data/README.md +0 -2
- data/Rakefile +1 -0
- data/cloud_payments.gemspec +1 -0
- data/config.ru +1 -0
- data/lib/cloud_payments.rb +1 -0
- data/lib/cloud_payments/client.rb +1 -0
- data/lib/cloud_payments/client/errors.rb +1 -0
- data/lib/cloud_payments/client/gateway_errors.rb +1 -0
- 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 +1 -0
- data/lib/cloud_payments/client/serializer/multi_json.rb +1 -0
- data/lib/cloud_payments/config.rb +1 -0
- data/lib/cloud_payments/models.rb +1 -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 +1 -0
- data/lib/cloud_payments/models/on_pay.rb +1 -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 +1 -0
- data/lib/cloud_payments/models/transaction.rb +1 -0
- data/lib/cloud_payments/namespaces.rb +1 -0
- data/lib/cloud_payments/namespaces/base.rb +1 -0
- data/lib/cloud_payments/namespaces/cards.rb +1 -0
- data/lib/cloud_payments/namespaces/orders.rb +1 -0
- data/lib/cloud_payments/namespaces/payments.rb +11 -0
- data/lib/cloud_payments/namespaces/subscriptions.rb +1 -0
- data/lib/cloud_payments/namespaces/tokens.rb +1 -0
- data/lib/cloud_payments/version.rb +2 -1
- data/lib/cloud_payments/webhooks.rb +1 -0
- 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/client_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 -0
- data/spec/cloud_payments/models/transaction_spec.rb +1 -0
- data/spec/cloud_payments/namespaces/base_spec.rb +1 -0
- data/spec/cloud_payments/namespaces/cards_spec.rb +1 -0
- data/spec/cloud_payments/namespaces/orders_spec.rb +1 -0
- data/spec/cloud_payments/namespaces/payments_spec.rb +113 -0
- data/spec/cloud_payments/namespaces/subscriptions_spec.rb +1 -0
- data/spec/cloud_payments/namespaces/tokens_spec.rb +1 -0
- data/spec/cloud_payments/namespaces_spec.rb +1 -0
- data/spec/cloud_payments/webhooks_spec.rb +1 -0
- data/spec/cloud_payments_spec.rb +1 -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 +45 -0
- data/spec/fixtures/apis/payments/get/failed_with_message.yml +6 -0
- data/spec/fixtures/apis/payments/get/successful.yml +48 -0
- data/spec/spec_helper.rb +1 -7
- data/spec/support/examples.rb +1 -0
- data/spec/support/helpers.rb +1 -0
- metadata +15 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed4e88a861a6e0f61c9758ae8db253faf5479e74
|
4
|
+
data.tar.gz: 26b8c758021f249079c5b00d88e62cdf7bc80327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1556658db7e02a39c840876f9017218182a853b92fe590fb7ed0ca793a20784b81c917ca959e72b565d8df616ed1354cd91e21f921ac5a82b4cd32be64f76dc2
|
7
|
+
data.tar.gz: 4a1c1a70e208bc95d3c3bfaf07219309c8e0171912ca0267a18e47667112c8cadf67ae4809ab723348fb1351029d3fd9a8c9bca53e7271b3eb5eaa1cf862abe1
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,8 +3,6 @@
|
|
3
3
|
CloudPayments ruby client (http://cloudpayments.eu/Docs/Integration)
|
4
4
|
|
5
5
|
[![Build Status](https://travis-ci.org/undr/cloud_payments.svg)](https://travis-ci.org/undr/cloud_payments)
|
6
|
-
[![Code Climate](https://codeclimate.com/github/undr/cloud_payments/badges/gpa.svg)](https://codeclimate.com/github/undr/cloud_payments)
|
7
|
-
[![Test Coverage](https://codeclimate.com/github/undr/cloud_payments/badges/coverage.svg)](https://codeclimate.com/github/undr/cloud_payments)
|
8
6
|
|
9
7
|
## Installation
|
10
8
|
|
data/Rakefile
CHANGED
data/cloud_payments.gemspec
CHANGED
data/config.ru
CHANGED
data/lib/cloud_payments.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module CloudPayments
|
2
3
|
class Client
|
3
4
|
class Response
|
@@ -5,7 +6,7 @@ module CloudPayments
|
|
5
6
|
|
6
7
|
def initialize(status, body, headers = {})
|
7
8
|
@status, @origin_body, @headers = status, body, headers
|
8
|
-
@origin_body = body.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
|
9
|
+
@origin_body = body.dup.force_encoding('UTF-8') if body.respond_to?(:force_encoding)
|
9
10
|
end
|
10
11
|
|
11
12
|
def body
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module CloudPayments
|
2
3
|
module Namespaces
|
3
4
|
class Payments < Base
|
@@ -27,6 +28,16 @@ module CloudPayments
|
|
27
28
|
response = request(:post3ds, transaction_id: id, pa_res: pa_res)
|
28
29
|
Transaction.new(response[:model])
|
29
30
|
end
|
31
|
+
|
32
|
+
def get(id)
|
33
|
+
response = request(:get, transaction_id: id)
|
34
|
+
Transaction.new(response[:model])
|
35
|
+
end
|
36
|
+
|
37
|
+
def find(invoice_id)
|
38
|
+
response = request(:find, invoice_id: invoice_id)
|
39
|
+
Transaction.new(response[:model])
|
40
|
+
end
|
30
41
|
end
|
31
42
|
end
|
32
43
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
describe CloudPayments::Client::Response do
|
4
5
|
let(:status){ 200 }
|
5
|
-
let(:body){ '{"Model":{"Id":123,"CurrencyCode":"RUB","Amount":120},"Success":true}' }
|
6
|
+
let(:body){ '{"Model":{"Id":123,"CurrencyCode":"RUB","Amount":120},"Success":true}'.dup.force_encoding('CP1251').freeze }
|
6
7
|
let(:headers){ { 'content-type' => 'application/json' } }
|
7
8
|
|
8
9
|
subject{ CloudPayments::Client::Response.new(status, body, headers) }
|
@@ -13,6 +14,7 @@ describe CloudPayments::Client::Response do
|
|
13
14
|
context 'wnen content type does not match /json/' do
|
14
15
|
let(:headers){ { 'content-type' => 'text/plain' } }
|
15
16
|
specify{ expect(subject.body).to eq(body) }
|
17
|
+
specify{ expect(subject.body.encoding.name).to eq('UTF-8') }
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -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,116 @@ 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
|
+
end
|
127
|
+
|
128
|
+
context 'config.raise_banking_errors = true' do
|
129
|
+
before { CloudPayments.config.raise_banking_errors = true}
|
130
|
+
|
131
|
+
context 'transaction not found' do
|
132
|
+
before{ stub_api_request('payments/get/failed_with_message').perform }
|
133
|
+
specify{ expect{subject.get(transaction_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
134
|
+
end
|
135
|
+
|
136
|
+
context 'transaction is failed' do
|
137
|
+
before{ stub_api_request('payments/get/failed').perform }
|
138
|
+
specify{ expect{subject.get(transaction_id)}.to raise_error(CloudPayments::Client::GatewayErrors::InsufficientFunds) }
|
139
|
+
end
|
140
|
+
|
141
|
+
context 'transaction is successful' do
|
142
|
+
before{ stub_api_request('payments/get/successful').perform }
|
143
|
+
specify{ expect{subject.get(transaction_id)}.to_not raise_error }
|
144
|
+
specify{ expect(subject.get(transaction_id)).to be_instance_of(CloudPayments::Transaction) }
|
145
|
+
specify{ expect(subject.get(transaction_id)).not_to be_required_secure3d }
|
146
|
+
specify{ expect(subject.get(transaction_id)).to be_completed }
|
147
|
+
specify{ expect(subject.get(transaction_id).id).to eq(transaction_id) }
|
148
|
+
specify{ expect(subject.get(transaction_id).reason).to eq('Approved') }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe '#find' do
|
154
|
+
let(:invoice_id) { '1234567' }
|
155
|
+
|
156
|
+
context 'config.raise_banking_errors = false' do
|
157
|
+
before { CloudPayments.config.raise_banking_errors = false }
|
158
|
+
|
159
|
+
context 'payment is not found' do
|
160
|
+
before{ stub_api_request('payments/find/failed_with_message').perform }
|
161
|
+
specify{ expect{subject.find(invoice_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'payment is failed' do
|
165
|
+
before{ stub_api_request('payments/find/failed').perform }
|
166
|
+
specify{ expect(subject.find(invoice_id)).to be_instance_of(CloudPayments::Transaction) }
|
167
|
+
specify{ expect(subject.find(invoice_id)).not_to be_required_secure3d }
|
168
|
+
specify{ expect(subject.find(invoice_id)).to be_declined }
|
169
|
+
specify{ expect(subject.find(invoice_id).id).to eq(12345) }
|
170
|
+
specify{ expect(subject.find(invoice_id).invoice_id).to eq(invoice_id) }
|
171
|
+
specify{ expect(subject.find(invoice_id).reason).to eq('InsufficientFunds') }
|
172
|
+
end
|
173
|
+
|
174
|
+
context 'transaction is successful' do
|
175
|
+
before{ stub_api_request('payments/find/successful').perform }
|
176
|
+
specify{ expect(subject.find(invoice_id)).to be_instance_of(CloudPayments::Transaction) }
|
177
|
+
specify{ expect(subject.find(invoice_id)).not_to be_required_secure3d }
|
178
|
+
specify{ expect(subject.find(invoice_id)).to be_completed }
|
179
|
+
specify{ expect(subject.find(invoice_id).id).to eq(12345) }
|
180
|
+
specify{ expect(subject.find(invoice_id).invoice_id).to eq(invoice_id) }
|
181
|
+
specify{ expect(subject.find(invoice_id).reason).to eq('Approved') }
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
context 'config.raise_banking_errors = true' do
|
186
|
+
before { CloudPayments.config.raise_banking_errors = true}
|
187
|
+
|
188
|
+
context 'payment is not found' do
|
189
|
+
before{ stub_api_request('payments/find/failed_with_message').perform }
|
190
|
+
specify{ expect{subject.find(invoice_id)}.to raise_error(CloudPayments::Client::GatewayError, 'Not found') }
|
191
|
+
end
|
192
|
+
|
193
|
+
context 'payment is failed' do
|
194
|
+
before{ stub_api_request('payments/find/failed').perform }
|
195
|
+
specify{ expect{subject.find(invoice_id)}.to raise_error(CloudPayments::Client::GatewayErrors::InsufficientFunds) }
|
196
|
+
end
|
197
|
+
|
198
|
+
context 'transaction is successful' do
|
199
|
+
before{ stub_api_request('payments/find/successful').perform }
|
200
|
+
specify{ expect(subject.find(invoice_id)).to be_instance_of(CloudPayments::Transaction) }
|
201
|
+
specify{ expect(subject.find(invoice_id)).not_to be_required_secure3d }
|
202
|
+
specify{ expect(subject.find(invoice_id)).to be_completed }
|
203
|
+
specify{ expect(subject.find(invoice_id).id).to eq(12345) }
|
204
|
+
specify{ expect(subject.find(invoice_id).invoice_id).to eq(invoice_id) }
|
205
|
+
specify{ expect(subject.find(invoice_id).reason).to eq('Approved') }
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
96
209
|
end
|
data/spec/cloud_payments_spec.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
:request:
|
3
|
+
:url: '/payments/find'
|
4
|
+
:body: '{"InvoiceId":"1234567"}'
|
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/find'
|
4
|
+
:body: '{"InvoiceId":"1234567"}'
|
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
|
+
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
:request:
|
3
|
+
:url: '/payments/get'
|
4
|
+
:body: '{"TransactionId":12345}'
|
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/get'
|
4
|
+
:body: '{"TransactionId":12345}'
|
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
|
+
}
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
3
|
|
3
|
-
if ENV['CODECLIMATE_REPO_TOKEN']
|
4
|
-
require "codeclimate-test-reporter"
|
5
|
-
CodeClimate::TestReporter.start
|
6
|
-
end
|
7
|
-
|
8
4
|
require 'bundler'
|
9
5
|
Bundler.require(:default, :test)
|
10
6
|
|
@@ -26,6 +22,4 @@ end
|
|
26
22
|
RSpec.configure do |config|
|
27
23
|
config.mock_with :rspec
|
28
24
|
config.include CloudPayments::RSpec::Helpers
|
29
|
-
|
30
|
-
config.after(:suite){ WebMock.allow_net_connect! }
|
31
25
|
end
|
data/spec/support/examples.rb
CHANGED
data/spec/support/helpers.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_payments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- undr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -150,6 +150,12 @@ files:
|
|
150
150
|
- spec/fixtures/apis/payments/confirm/failed.yml
|
151
151
|
- spec/fixtures/apis/payments/confirm/failed_with_message.yml
|
152
152
|
- spec/fixtures/apis/payments/confirm/successful.yml
|
153
|
+
- spec/fixtures/apis/payments/find/failed.yml
|
154
|
+
- spec/fixtures/apis/payments/find/failed_with_message.yml
|
155
|
+
- spec/fixtures/apis/payments/find/successful.yml
|
156
|
+
- spec/fixtures/apis/payments/get/failed.yml
|
157
|
+
- spec/fixtures/apis/payments/get/failed_with_message.yml
|
158
|
+
- spec/fixtures/apis/payments/get/successful.yml
|
153
159
|
- spec/fixtures/apis/payments/post3ds/failed.yml
|
154
160
|
- spec/fixtures/apis/payments/post3ds/successful.yml
|
155
161
|
- spec/fixtures/apis/payments/refund/failed.yml
|
@@ -192,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
198
|
version: '0'
|
193
199
|
requirements: []
|
194
200
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.6.11
|
196
202
|
signing_key:
|
197
203
|
specification_version: 4
|
198
204
|
summary: CloudPayments ruby client
|
@@ -223,6 +229,12 @@ test_files:
|
|
223
229
|
- spec/fixtures/apis/payments/confirm/failed.yml
|
224
230
|
- spec/fixtures/apis/payments/confirm/failed_with_message.yml
|
225
231
|
- spec/fixtures/apis/payments/confirm/successful.yml
|
232
|
+
- spec/fixtures/apis/payments/find/failed.yml
|
233
|
+
- spec/fixtures/apis/payments/find/failed_with_message.yml
|
234
|
+
- spec/fixtures/apis/payments/find/successful.yml
|
235
|
+
- spec/fixtures/apis/payments/get/failed.yml
|
236
|
+
- spec/fixtures/apis/payments/get/failed_with_message.yml
|
237
|
+
- spec/fixtures/apis/payments/get/successful.yml
|
226
238
|
- spec/fixtures/apis/payments/post3ds/failed.yml
|
227
239
|
- spec/fixtures/apis/payments/post3ds/successful.yml
|
228
240
|
- spec/fixtures/apis/payments/refund/failed.yml
|