cloud_payments 0.0.6 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +11 -8
- data/README.md +74 -3
- data/bin/release +17 -0
- data/cloud_payments.gemspec +6 -6
- data/lib/cloud_payments/client.rb +6 -4
- data/lib/cloud_payments/config.rb +3 -0
- data/lib/cloud_payments/models/on_fail.rb +1 -0
- data/lib/cloud_payments/models/on_kassa_receipt.rb +23 -0
- data/lib/cloud_payments/models/on_pay.rb +1 -0
- data/lib/cloud_payments/models/subscription.rb +1 -1
- data/lib/cloud_payments/models/transaction.rb +9 -0
- data/lib/cloud_payments/models.rb +1 -0
- data/lib/cloud_payments/namespaces/apple_pay.rb +18 -0
- data/lib/cloud_payments/namespaces/base.rb +1 -1
- data/lib/cloud_payments/namespaces/cards.rb +5 -0
- data/lib/cloud_payments/namespaces/kassa.rb +22 -0
- data/lib/cloud_payments/namespaces/orders.rb +4 -0
- data/lib/cloud_payments/namespaces.rb +11 -1
- data/lib/cloud_payments/version.rb +1 -2
- data/lib/cloud_payments/webhooks.rb +6 -2
- data/lib/cloud_payments.rb +0 -1
- data/spec/cloud_payments/models/subscription_spec.rb +0 -1
- data/spec/cloud_payments/models/transaction_spec.rb +26 -1
- data/spec/cloud_payments/namespaces/apple_pay_spec.rb +21 -0
- data/spec/cloud_payments/namespaces/cards_spec.rb +41 -2
- data/spec/cloud_payments/namespaces/kassa_spec.rb +43 -0
- data/spec/cloud_payments/namespaces/orders_spec.rb +12 -0
- data/spec/cloud_payments/namespaces/payments_spec.rb +6 -0
- data/spec/cloud_payments/namespaces_spec.rb +1 -1
- data/spec/cloud_payments/webhooks_spec.rb +42 -0
- data/spec/cloud_payments_spec.rb +24 -5
- 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/get/failed.yml +1 -0
- data/spec/fixtures/apis/payments/get/refunded.yml +49 -0
- data/spec/fixtures/apis/payments/get/successful.yml +1 -0
- data/spec/fixtures/apis/tokens/auth/successful.yml +2 -1
- data/spec/fixtures/apis/tokens/charge/successful.yml +2 -1
- data/spec/spec_helper.rb +19 -8
- metadata +37 -19
- data/spec/cloud_payments/client_spec.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 18a3af691a696388ee8c524b24e8de18be07b14d45935ed2ddfe7ac66c2f5e04
|
4
|
+
data.tar.gz: 9640d2ef9dae3d7ec7048be44c80123ce4ff735059fa0209891d7482affe2131
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 433286122b1d5dd9ed981ed9314f0dbdb21ccc4ccb7db1a3487201211543377ad4441e953125c810bf285a035c8cadac0d17143e141c381ed4a0589cd8b1d823
|
7
|
+
data.tar.gz: bd01fc125ddd8606b8570bffb804d72964f1442cb934140c75a39ac2e92861be925b5b997638ff433375af8ff7c71624c9fba1f6de33ffe0c379e6c8e7866956
|
data/.travis.yml
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.3
|
5
|
+
- 2.4
|
6
|
+
- 2.5
|
7
|
+
- 2.6
|
8
|
+
- 2.7
|
9
|
+
|
2
10
|
cache: bundler
|
3
|
-
|
11
|
+
|
4
12
|
before_install: gem install bundler
|
5
|
-
|
6
|
-
|
7
|
-
- '2.3'
|
8
|
-
- ruby-head
|
9
|
-
matrix:
|
10
|
-
allow_failures:
|
11
|
-
- rvm: ruby-head
|
13
|
+
|
14
|
+
script: bundle exec rspec
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# CloudPayments
|
2
2
|
|
3
|
-
CloudPayments ruby client (
|
3
|
+
CloudPayments ruby client (https://developers.cloudpayments.ru/en/)
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.org/
|
5
|
+
[![Build Status](https://travis-ci.org/platmart/cloud_payments.svg)](https://travis-ci.org/platmart/cloud_payments)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -28,6 +28,8 @@ $ gem install cloud_payments
|
|
28
28
|
|
29
29
|
### Configuration
|
30
30
|
|
31
|
+
#### Global configuration
|
32
|
+
|
31
33
|
```ruby
|
32
34
|
CloudPayments.configure do |c|
|
33
35
|
c.host = 'http://localhost:3000' # By default, it is https://api.cloudpayments.ru
|
@@ -37,6 +39,28 @@ CloudPayments.configure do |c|
|
|
37
39
|
c.logger = Logger.new('/dev/null') # By default, it writes logs to stdout
|
38
40
|
c.raise_banking_errors = true # By default, it is not raising banking errors
|
39
41
|
end
|
42
|
+
|
43
|
+
# API client
|
44
|
+
CloudPayments.client.payments.cards.charge(...)
|
45
|
+
|
46
|
+
# Webhooks
|
47
|
+
CloudPayments.webhooks.on_pay(...)
|
48
|
+
```
|
49
|
+
|
50
|
+
#### Local configuration
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
config = CloudPayments::Config.new do |c|
|
54
|
+
# ...
|
55
|
+
end
|
56
|
+
|
57
|
+
# API client
|
58
|
+
client = CloudPayments::Client.new(config)
|
59
|
+
client.payments.cards.charge(...)
|
60
|
+
|
61
|
+
# Webhooks
|
62
|
+
webhooks = CloudPayments::Webhooks.new(config)
|
63
|
+
webhooks.on_pay(...)
|
40
64
|
```
|
41
65
|
|
42
66
|
### Test method
|
@@ -81,6 +105,7 @@ transaction = CloudPayments.client.payments.cards.charge(
|
|
81
105
|
# :card_last_four=>"1111",
|
82
106
|
# :card_type=>"Visa",
|
83
107
|
# :card_type_code=>0,
|
108
|
+
# :issuer=>"Sberbank of Russia",
|
84
109
|
# :issuer_bank_country=>"RU",
|
85
110
|
# :status=>"Completed",
|
86
111
|
# :status_code=>3,
|
@@ -95,6 +120,52 @@ transaction.token
|
|
95
120
|
# => "a4e67841-abb0-42de-a364-d1d8f9f4b3c0"
|
96
121
|
```
|
97
122
|
|
123
|
+
## Kassa Receipt
|
124
|
+
|
125
|
+
CloudPayments Kassa API (https://cloudpayments.ru/docs/api/kassa)
|
126
|
+
|
127
|
+
```ruby
|
128
|
+
CloudPayments.client.kassa.receipt({
|
129
|
+
account_id: "user@example.com",
|
130
|
+
customer_receipt: {
|
131
|
+
items: [
|
132
|
+
{
|
133
|
+
amount: "13350.00",
|
134
|
+
ean13: nil,
|
135
|
+
label: "Good Description",
|
136
|
+
price: "13350.00",
|
137
|
+
quantity: 1.0,
|
138
|
+
vat: nil
|
139
|
+
}
|
140
|
+
]
|
141
|
+
},
|
142
|
+
inn: "7708806666",
|
143
|
+
invoice_id: "231312312",
|
144
|
+
type: "Income"
|
145
|
+
})
|
146
|
+
```
|
147
|
+
|
148
|
+
## Apple Pay Start Session
|
149
|
+
[Start Apple Pay session](https://developers.cloudpayments.ru/#zapusk-sessii-dlya-oplaty-cherez-apple-pay)
|
150
|
+
```ruby
|
151
|
+
CloudPayments.client.apple_pay.start_session({validation_url: "https://apple-pay-gateway-pr-pod2.apple.com/paymentservices/startSession"})
|
152
|
+
# => {
|
153
|
+
# :message => nil,
|
154
|
+
# :model => {
|
155
|
+
# :display_name => "example.com,
|
156
|
+
# :domain_name => "example.com",
|
157
|
+
# :epoch_timestamp => 1594072416294,
|
158
|
+
# :expires_at => 1594076016294,
|
159
|
+
# :merchant_identifier => "5DCCE3A52CFC3FAF9F4EA8421472E47BC503E03051B04D2ED67A3834386B52F2",
|
160
|
+
# :merchant_session_identifier => "SSHDA3C703BD69B45EDB8934E6BFCC159B2B83AAFC02DB625F1F1E3997CCC2FE2CFD11F636558",
|
161
|
+
# :nonce => "51c77142",
|
162
|
+
# :signature => "30800.....0"
|
163
|
+
# },
|
164
|
+
# :success => true
|
165
|
+
# }
|
166
|
+
|
167
|
+
```
|
168
|
+
|
98
169
|
## Webhooks
|
99
170
|
|
100
171
|
```ruby
|
@@ -132,7 +203,7 @@ end
|
|
132
203
|
|
133
204
|
## Contributing
|
134
205
|
|
135
|
-
1. Fork it ( https://github.com/
|
206
|
+
1. Fork it ( https://github.com/platmart/cloud_payments/fork )
|
136
207
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
137
208
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
138
209
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/bin/release
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
VERSION=$1
|
4
|
+
|
5
|
+
if [ -z $1 ] ; then
|
6
|
+
echo "Please provide version number: bin/release 1.0.0" && exit 1;
|
7
|
+
fi
|
8
|
+
|
9
|
+
printf "module CloudPayments\n VERSION = \"$VERSION\"\nend\n" > ./lib/cloud_payments/version.rb
|
10
|
+
bundle
|
11
|
+
git add Gemfile.lock lib/cloud_payments/version.rb
|
12
|
+
git commit -m "Bump version for $VERSION"
|
13
|
+
git push
|
14
|
+
git tag v$VERSION
|
15
|
+
git push --tags
|
16
|
+
gem build cloud_payments.gemspec
|
17
|
+
gem push "cloud_payments-$VERSION.gem"
|
data/cloud_payments.gemspec
CHANGED
@@ -7,11 +7,11 @@ require 'cloud_payments/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'cloud_payments'
|
9
9
|
spec.version = CloudPayments::VERSION
|
10
|
-
spec.authors = ['undr']
|
11
|
-
spec.email = ['undr@yandex.ru']
|
10
|
+
spec.authors = ['undr', 'kirillplatonov']
|
11
|
+
spec.email = ['undr@yandex.ru', 'mail@kirillplatonov.com']
|
12
12
|
spec.summary = %q{CloudPayments ruby client}
|
13
13
|
spec.description = %q{CloudPayments ruby client}
|
14
|
-
spec.homepage = ''
|
14
|
+
spec.homepage = 'https://github.com/platmart/cloud_payments'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -19,10 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_dependency 'faraday', '
|
22
|
+
spec.add_dependency 'faraday', '< 2.0'
|
23
23
|
spec.add_dependency 'multi_json', '~> 1.11'
|
24
24
|
spec.add_dependency 'hashie', '~> 3.4'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
-
spec.add_development_dependency 'rspec', '~> 3.
|
26
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
28
28
|
end
|
@@ -10,13 +10,12 @@ module CloudPayments
|
|
10
10
|
|
11
11
|
attr_reader :config, :connection
|
12
12
|
|
13
|
-
def initialize
|
14
|
-
@config = CloudPayments.config
|
13
|
+
def initialize(config = nil)
|
14
|
+
@config = config || CloudPayments.config
|
15
15
|
@connection = build_connection
|
16
16
|
end
|
17
17
|
|
18
18
|
def perform_request(path, params = nil)
|
19
|
-
connection.basic_auth(config.public_key, config.secret_key)
|
20
19
|
response = connection.post(path, (params ? convert_to_json(params) : nil), headers)
|
21
20
|
|
22
21
|
Response.new(response.status, response.body, response.headers).tap do |response|
|
@@ -45,7 +44,10 @@ module CloudPayments
|
|
45
44
|
end
|
46
45
|
|
47
46
|
def build_connection
|
48
|
-
Faraday::Connection.new(config.host, config.connection_options
|
47
|
+
Faraday::Connection.new(config.host, config.connection_options) do |conn|
|
48
|
+
conn.request :basic_auth, config.public_key, config.secret_key
|
49
|
+
config.connection_block.call(conn) if config.connection_block
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module CloudPayments
|
3
|
+
# @see https://cloudpayments.ru/Docs/Notifications#receipt CloudPayments API
|
4
|
+
class OnKassaReceipt < Model
|
5
|
+
property :id, required: true
|
6
|
+
property :document_number, required: true
|
7
|
+
property :session_number, required: true
|
8
|
+
property :fiscal_sign, required: true
|
9
|
+
property :device_number, required: true
|
10
|
+
property :reg_number, required: true
|
11
|
+
property :inn, required: true
|
12
|
+
property :type, required: true
|
13
|
+
property :ofd, required: true
|
14
|
+
property :url, required: true
|
15
|
+
property :qr_code_url, required: true
|
16
|
+
property :amount, transform_with: DecimalTransform, required: true
|
17
|
+
property :date_time, transform_with: DateTimeTransform
|
18
|
+
property :receipt
|
19
|
+
property :invoice_id
|
20
|
+
property :transaction_id
|
21
|
+
property :account_id
|
22
|
+
end
|
23
|
+
end
|
@@ -5,7 +5,7 @@ module CloudPayments
|
|
5
5
|
|
6
6
|
property :id, required: true
|
7
7
|
property :account_id, required: true
|
8
|
-
property :description
|
8
|
+
property :description
|
9
9
|
property :email, required: true
|
10
10
|
property :amount, transform_with: DecimalTransform, required: true
|
11
11
|
property :currency, required: true
|
@@ -36,13 +36,18 @@ module CloudPayments
|
|
36
36
|
property :card_type_code
|
37
37
|
property :card_exp_date
|
38
38
|
property :name
|
39
|
+
property :issuer
|
39
40
|
property :issuer_bank_country
|
40
41
|
property :status, required: true
|
41
42
|
property :status_code
|
42
43
|
property :reason
|
43
44
|
property :reason_code
|
45
|
+
property :refunded
|
44
46
|
property :card_holder_message
|
45
47
|
property :token
|
48
|
+
property :apple_pay
|
49
|
+
property :android_pay
|
50
|
+
property :escrow_accumulation_id
|
46
51
|
|
47
52
|
def required_secure3d?
|
48
53
|
false
|
@@ -79,5 +84,9 @@ module CloudPayments
|
|
79
84
|
def declined?
|
80
85
|
status == DECLINED
|
81
86
|
end
|
87
|
+
|
88
|
+
def refunded?
|
89
|
+
refunded
|
90
|
+
end
|
82
91
|
end
|
83
92
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module CloudPayments
|
3
|
+
module Namespaces
|
4
|
+
class ApplePay < Base
|
5
|
+
ValidationUrlMissing = Class.new(StandardError)
|
6
|
+
|
7
|
+
def self.resource_name
|
8
|
+
'applepay'
|
9
|
+
end
|
10
|
+
|
11
|
+
def start_session(attributes)
|
12
|
+
validation_url = attributes.fetch(:validation_url) { raise ValidationUrlMissing.new('validation_url is required') }
|
13
|
+
|
14
|
+
request(:startsession, { "ValidationUrl" => validation_url })
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -24,7 +24,7 @@ module CloudPayments
|
|
24
24
|
protected
|
25
25
|
|
26
26
|
def api_exceptions
|
27
|
-
[::Faraday::
|
27
|
+
[::Faraday::ConnectionFailed, ::Faraday::TimeoutError, Client::ServerError, Client::GatewayError]
|
28
28
|
end
|
29
29
|
|
30
30
|
def resource_path(path = nil)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module CloudPayments
|
3
|
+
module Namespaces
|
4
|
+
class Kassa < Base
|
5
|
+
InnNotProvided = Class.new(StandardError)
|
6
|
+
TypeNotProvided = Class.new(StandardError)
|
7
|
+
CustomerReceiptNotProvided = Class.new(StandardError)
|
8
|
+
|
9
|
+
def self.resource_name
|
10
|
+
'kkt'
|
11
|
+
end
|
12
|
+
|
13
|
+
def receipt(attributes)
|
14
|
+
attributes.fetch(:inn) { raise InnNotProvided.new('inn attribute is required') }
|
15
|
+
attributes.fetch(:type) { raise TypeNotProvided.new('type attribute is required') }
|
16
|
+
attributes.fetch(:customer_receipt) { raise CustomerReceiptNotProvided.new('customer_receipt is required') }
|
17
|
+
|
18
|
+
request(:receipt, attributes)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -5,6 +5,8 @@ require 'cloud_payments/namespaces/tokens'
|
|
5
5
|
require 'cloud_payments/namespaces/payments'
|
6
6
|
require 'cloud_payments/namespaces/subscriptions'
|
7
7
|
require 'cloud_payments/namespaces/orders'
|
8
|
+
require 'cloud_payments/namespaces/kassa'
|
9
|
+
require 'cloud_payments/namespaces/apple_pay'
|
8
10
|
|
9
11
|
module CloudPayments
|
10
12
|
module Namespaces
|
@@ -12,6 +14,10 @@ module CloudPayments
|
|
12
14
|
Payments.new(self)
|
13
15
|
end
|
14
16
|
|
17
|
+
def kassa
|
18
|
+
Kassa.new(self)
|
19
|
+
end
|
20
|
+
|
15
21
|
def subscriptions
|
16
22
|
Subscriptions.new(self)
|
17
23
|
end
|
@@ -20,9 +26,13 @@ module CloudPayments
|
|
20
26
|
Orders.new(self)
|
21
27
|
end
|
22
28
|
|
29
|
+
def apple_pay
|
30
|
+
ApplePay.new(self)
|
31
|
+
end
|
32
|
+
|
23
33
|
def ping
|
24
34
|
!!(perform_request('/test').body || {})[:success]
|
25
|
-
rescue ::Faraday::
|
35
|
+
rescue ::Faraday::ConnectionFailed, ::Faraday::TimeoutError, CloudPayments::Client::ServerError => e
|
26
36
|
false
|
27
37
|
end
|
28
38
|
end
|
@@ -8,8 +8,8 @@ module CloudPayments
|
|
8
8
|
|
9
9
|
attr_reader :config
|
10
10
|
|
11
|
-
def initialize
|
12
|
-
@config = CloudPayments.config
|
11
|
+
def initialize(config = nil)
|
12
|
+
@config = config || CloudPayments.config
|
13
13
|
@digest = OpenSSL::Digest.new('sha256')
|
14
14
|
@serializer = Client::Serializer::Base.new(config)
|
15
15
|
end
|
@@ -23,6 +23,10 @@ module CloudPayments
|
|
23
23
|
true
|
24
24
|
end
|
25
25
|
|
26
|
+
def kassa_receipt(data)
|
27
|
+
OnKassaReceipt.new(@serializer.load(data))
|
28
|
+
end
|
29
|
+
|
26
30
|
def on_recurrent(data)
|
27
31
|
OnRecurrent.new(@serializer.load(data))
|
28
32
|
end
|
data/lib/cloud_payments.rb
CHANGED
@@ -54,7 +54,6 @@ describe CloudPayments::Subscription do
|
|
54
54
|
|
55
55
|
it_behaves_like :raise_without_attribute, :id
|
56
56
|
it_behaves_like :raise_without_attribute, :account_id
|
57
|
-
it_behaves_like :raise_without_attribute, :description
|
58
57
|
it_behaves_like :raise_without_attribute, :email
|
59
58
|
it_behaves_like :raise_without_attribute, :amount
|
60
59
|
it_behaves_like :raise_without_attribute, :currency_code
|
@@ -34,14 +34,17 @@ describe CloudPayments::Transaction do
|
|
34
34
|
card_type: 'Visa',
|
35
35
|
card_type_code: 0,
|
36
36
|
card_exp_date: '10/17',
|
37
|
+
issuer: 'Sberbank of Russia',
|
37
38
|
issuer_bank_country: 'RU',
|
38
39
|
status: 'Completed',
|
39
40
|
status_code: 3,
|
40
41
|
reason: 'Approved',
|
41
42
|
reason_code: 0,
|
43
|
+
refunded: false,
|
42
44
|
card_holder_message: 'Payment successful',
|
43
45
|
name: 'CARDHOLDER NAME',
|
44
|
-
token: 'a4e67841-abb0-42de-a364-d1d8f9f4b3c0'
|
46
|
+
token: 'a4e67841-abb0-42de-a364-d1d8f9f4b3c0',
|
47
|
+
escrow_accumulation_id: '119d1f05-4fa8-4f35-85b6-09216a5a4fb6'
|
45
48
|
} }
|
46
49
|
|
47
50
|
specify{ expect(subject.id).to eq(504) }
|
@@ -72,12 +75,15 @@ describe CloudPayments::Transaction do
|
|
72
75
|
specify{ expect(subject.card_type).to eq('Visa') }
|
73
76
|
specify{ expect(subject.card_type_code).to eq(0) }
|
74
77
|
specify{ expect(subject.card_exp_date).to eq('10/17') }
|
78
|
+
specify{ expect(subject.issuer).to eq('Sberbank of Russia') }
|
75
79
|
specify{ expect(subject.issuer_bank_country).to eq('RU') }
|
76
80
|
specify{ expect(subject.reason).to eq('Approved') }
|
77
81
|
specify{ expect(subject.reason_code).to eq(0) }
|
78
82
|
specify{ expect(subject.card_holder_message).to eq('Payment successful') }
|
79
83
|
specify{ expect(subject.name).to eq('CARDHOLDER NAME') }
|
80
84
|
specify{ expect(subject.token).to eq('a4e67841-abb0-42de-a364-d1d8f9f4b3c0') }
|
85
|
+
specify{ expect(subject.refunded).to eq(false) }
|
86
|
+
specify{ expect(subject.escrow_accumulation_id).to eq('119d1f05-4fa8-4f35-85b6-09216a5a4fb6') }
|
81
87
|
|
82
88
|
context 'without any attributes' do
|
83
89
|
let(:attributes){ {} }
|
@@ -111,9 +117,11 @@ describe CloudPayments::Transaction do
|
|
111
117
|
it_behaves_like :not_raise_without_attribute, :ip_longitude, :ip_lng
|
112
118
|
it_behaves_like :not_raise_without_attribute, :card_type_code
|
113
119
|
it_behaves_like :not_raise_without_attribute, :card_exp_date
|
120
|
+
it_behaves_like :not_raise_without_attribute, :issuer
|
114
121
|
it_behaves_like :not_raise_without_attribute, :issuer_bank_country
|
115
122
|
it_behaves_like :not_raise_without_attribute, :reason
|
116
123
|
it_behaves_like :not_raise_without_attribute, :reason_code
|
124
|
+
it_behaves_like :not_raise_without_attribute, :refunded
|
117
125
|
it_behaves_like :not_raise_without_attribute, :card_holder_message
|
118
126
|
it_behaves_like :not_raise_without_attribute, :name
|
119
127
|
it_behaves_like :not_raise_without_attribute, :token
|
@@ -251,5 +259,22 @@ describe CloudPayments::Transaction do
|
|
251
259
|
specify{ expect(subject.ip_location).to be_nil }
|
252
260
|
end
|
253
261
|
end
|
262
|
+
|
263
|
+
describe '#refunded?' do
|
264
|
+
context do
|
265
|
+
let(:attributes) { { refunded: false } }
|
266
|
+
specify { expect(subject.refunded?).to be_falsey }
|
267
|
+
end
|
268
|
+
|
269
|
+
context do
|
270
|
+
let(:attributes) { { refunded: true } }
|
271
|
+
specify { expect(subject.refunded?).to be_truthy }
|
272
|
+
end
|
273
|
+
|
274
|
+
context do
|
275
|
+
let(:attributes) { { refunded: nil } }
|
276
|
+
specify { expect(subject.refunded?).to be_falsey }
|
277
|
+
end
|
278
|
+
end
|
254
279
|
end
|
255
280
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
require 'spec_helper'
|
5
|
+
|
6
|
+
describe CloudPayments::Namespaces::ApplePay do
|
7
|
+
subject{ described_class.new(CloudPayments.client) }
|
8
|
+
|
9
|
+
describe '#receipt' do
|
10
|
+
let(:attributes) do
|
11
|
+
{
|
12
|
+
validation_url: ''
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
context do
|
17
|
+
before{ attributes.delete(:validation_url) }
|
18
|
+
specify{ expect{subject.start_session(attributes)}.to raise_error(described_class::ValidationUrlMissing) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -14,11 +14,11 @@ describe CloudPayments::Namespaces::Cards do
|
|
14
14
|
card_cryptogram_packet: '01492500008719030128SM'
|
15
15
|
} }
|
16
16
|
|
17
|
-
|
17
|
+
describe '#charge' do
|
18
18
|
context 'config.raise_banking_errors = false' do
|
19
19
|
before { CloudPayments.config.raise_banking_errors = false }
|
20
20
|
|
21
|
-
|
21
|
+
context do
|
22
22
|
before{ stub_api_request('cards/charge/successful').perform }
|
23
23
|
specify{ expect(subject.charge(attributes)).to be_instance_of(CloudPayments::Transaction) }
|
24
24
|
specify{ expect(subject.charge(attributes)).not_to be_required_secure3d }
|
@@ -117,4 +117,43 @@ describe CloudPayments::Namespaces::Cards do
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
120
|
+
|
121
|
+
describe '#post3ds' do
|
122
|
+
let(:attributes){ { transaction_id: 12345, pa_res: 'AQ==' } }
|
123
|
+
|
124
|
+
context 'config.raise_banking_errors = false' do
|
125
|
+
before { CloudPayments.config.raise_banking_errors = false }
|
126
|
+
|
127
|
+
context do
|
128
|
+
before{ stub_api_request('cards/post3ds/successful').perform }
|
129
|
+
specify{ expect(subject.post3ds(attributes)).to be_instance_of(CloudPayments::Transaction) }
|
130
|
+
specify{ expect(subject.post3ds(attributes)).not_to be_required_secure3d }
|
131
|
+
specify{ expect(subject.post3ds(attributes)).to be_completed }
|
132
|
+
specify{ expect(subject.post3ds(attributes).id).to eq(12345) }
|
133
|
+
end
|
134
|
+
|
135
|
+
context do
|
136
|
+
before{ stub_api_request('cards/post3ds/failed').perform }
|
137
|
+
specify{ expect(subject.post3ds(attributes)).to be_instance_of(CloudPayments::Transaction) }
|
138
|
+
specify{ expect(subject.post3ds(attributes)).not_to be_required_secure3d }
|
139
|
+
specify{ expect(subject.post3ds(attributes)).to be_declined }
|
140
|
+
specify{ expect(subject.post3ds(attributes).id).to eq(12345) }
|
141
|
+
specify{ expect(subject.post3ds(attributes).reason).to eq('InsufficientFunds') }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context 'config.raise_banking_errors = true' do
|
146
|
+
before { CloudPayments.config.raise_banking_errors = true }
|
147
|
+
|
148
|
+
context do
|
149
|
+
before{ stub_api_request('cards/post3ds/successful').perform }
|
150
|
+
specify{ expect{ subject.post3ds(attributes) }.not_to raise_error }
|
151
|
+
end
|
152
|
+
|
153
|
+
context do
|
154
|
+
before{ stub_api_request('cards/post3ds/failed').perform }
|
155
|
+
specify{ expect{ subject.post3ds(attributes) }.to raise_error(CloudPayments::Client::GatewayErrors::InsufficientFunds) }
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
120
159
|
end
|
@@ -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
|
@@ -42,4 +42,16 @@ describe CloudPayments::Namespaces::Orders do
|
|
42
42
|
end
|
43
43
|
end
|
44
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
|
45
57
|
end
|
@@ -123,6 +123,12 @@ describe CloudPayments::Namespaces::Payments do
|
|
123
123
|
specify{ expect(subject.get(transaction_id).id).to eq(transaction_id) }
|
124
124
|
specify{ expect(subject.get(transaction_id).reason).to eq('Approved') }
|
125
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
|
126
132
|
end
|
127
133
|
|
128
134
|
context 'config.raise_banking_errors = true' do
|
@@ -34,7 +34,7 @@ describe CloudPayments::Namespaces do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'when exception occurs while request' do
|
37
|
-
before{ stub_api_request('ping/failed').to_raise(::Faraday::
|
37
|
+
before{ stub_api_request('ping/failed').to_raise(::Faraday::ConnectionFailed) }
|
38
38
|
specify{ expect(subject.ping).to be_falsy }
|
39
39
|
end
|
40
40
|
|
@@ -227,4 +227,46 @@ describe CloudPayments::Webhooks do
|
|
227
227
|
specify { expect(subject.failed_transactions).to eq 22 }
|
228
228
|
specify { expect(subject.next_transaction_at).to eq DateTime.parse('2015-11-18 20:29:05') }
|
229
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
|
230
272
|
end
|
data/spec/cloud_payments_spec.rb
CHANGED
@@ -3,13 +3,32 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe CloudPayments do
|
5
5
|
describe '#config=' do
|
6
|
-
before{ @old_config = CloudPayments.config }
|
7
|
-
after{ CloudPayments.config = @old_config }
|
8
|
-
|
9
6
|
specify{ expect{ CloudPayments.config = 'config' }.to change{ CloudPayments.config }.to('config') }
|
10
7
|
end
|
11
8
|
|
12
|
-
|
13
|
-
|
9
|
+
it 'supports global configuration' do
|
10
|
+
CloudPayments.config.secret_key = "OLD_KEY"
|
11
|
+
|
12
|
+
CloudPayments.configure do |c|
|
13
|
+
c.secret_key = "NEW_KEY"
|
14
|
+
end
|
15
|
+
|
16
|
+
expect(CloudPayments.config.secret_key).to eq "NEW_KEY"
|
17
|
+
expect(CloudPayments.client.config.secret_key).to eq "NEW_KEY"
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'supports local configuration' do
|
21
|
+
CloudPayments.config.secret_key = "OLD_KEY"
|
22
|
+
|
23
|
+
config = CloudPayments::Config.new do |c|
|
24
|
+
c.secret_key = "NEW_KEY"
|
25
|
+
end
|
26
|
+
client = CloudPayments::Client.new(config)
|
27
|
+
webhooks = CloudPayments::Webhooks.new(config)
|
28
|
+
|
29
|
+
expect(CloudPayments.config.secret_key).to eq "OLD_KEY"
|
30
|
+
expect(config.secret_key).to eq "NEW_KEY"
|
31
|
+
expect(client.config.secret_key).to eq "NEW_KEY"
|
32
|
+
expect(webhooks.config.secret_key).to eq "NEW_KEY"
|
14
33
|
end
|
15
34
|
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
|
+
}
|
@@ -0,0 +1,49 @@
|
|
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
|
+
"Refunded": true,
|
43
|
+
"CardHolderMessage":"Payment successful",
|
44
|
+
"Name":"CARDHOLDER NAME",
|
45
|
+
"Token":"a4e67841-abb0-42de-a364-d1d8f9f4b3c0"
|
46
|
+
},
|
47
|
+
"Success":true,
|
48
|
+
"Message": null
|
49
|
+
}
|
@@ -41,7 +41,8 @@
|
|
41
41
|
"ReasonCode":0,
|
42
42
|
"CardHolderMessage":"Payment successful",
|
43
43
|
"Name":"CARDHOLDER NAME",
|
44
|
-
"Token":"a4e67841-abb0-42de-a364-d1d8f9f4b3c0"
|
44
|
+
"Token":"a4e67841-abb0-42de-a364-d1d8f9f4b3c0",
|
45
|
+
"EscrowAccumulationId": "119d1f05-4fa8-4f35-85b6-09216a5a4fb6"
|
45
46
|
},
|
46
47
|
"Success":true,
|
47
48
|
"Message": null
|
@@ -41,7 +41,8 @@
|
|
41
41
|
"ReasonCode":0,
|
42
42
|
"CardHolderMessage":"Payment successful",
|
43
43
|
"Name":"CARDHOLDER NAME",
|
44
|
-
"Token":"a4e67841-abb0-42de-a364-d1d8f9f4b3c0"
|
44
|
+
"Token":"a4e67841-abb0-42de-a364-d1d8f9f4b3c0",
|
45
|
+
"EscrowAccumulationId": "119d1f05-4fa8-4f35-85b6-09216a5a4fb6"
|
45
46
|
},
|
46
47
|
"Success":true,
|
47
48
|
"Message": null
|
data/spec/spec_helper.rb
CHANGED
@@ -11,15 +11,26 @@ WebMock.disable_net_connect!
|
|
11
11
|
|
12
12
|
Dir["./spec/support/**/*.rb"].each { |f| require f }
|
13
13
|
|
14
|
-
CloudPayments.configure do |c|
|
15
|
-
c.public_key = 'user'
|
16
|
-
c.secret_key = 'pass'
|
17
|
-
c.host = 'http://localhost:9292'
|
18
|
-
c.log = false
|
19
|
-
# c.raise_banking_errors = true
|
20
|
-
end
|
21
|
-
|
22
14
|
RSpec.configure do |config|
|
23
15
|
config.mock_with :rspec
|
24
16
|
config.include CloudPayments::RSpec::Helpers
|
17
|
+
|
18
|
+
# these params are used in stubs, in basic auth
|
19
|
+
# see webmock_stub in spec/support/helpers.rb
|
20
|
+
def default_config
|
21
|
+
CloudPayments::Config.new do |c|
|
22
|
+
c.public_key = 'user'
|
23
|
+
c.secret_key = 'pass'
|
24
|
+
c.host = 'http://localhost:9292'
|
25
|
+
c.log = false
|
26
|
+
# c.raise_banking_errors = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
CloudPayments.config = default_config
|
31
|
+
|
32
|
+
config.after :each do
|
33
|
+
CloudPayments.config = default_config
|
34
|
+
CloudPayments.client = CloudPayments::Client.new
|
35
|
+
end
|
25
36
|
end
|
metadata
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_payments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- undr
|
8
|
-
|
8
|
+
- kirillplatonov
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-12-05 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: faraday
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- - "
|
18
|
+
- - "<"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0
|
20
|
+
version: '2.0'
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- - "
|
25
|
+
- - "<"
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0
|
27
|
+
version: '2.0'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: multi_json
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,32 +59,34 @@ dependencies:
|
|
58
59
|
requirements:
|
59
60
|
- - "~>"
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
+
version: '13.0'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
67
|
- - "~>"
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
+
version: '13.0'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
name: rspec
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
74
|
- - "~>"
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: '3.
|
76
|
+
version: '3.9'
|
76
77
|
type: :development
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
81
|
- - "~>"
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: '3.
|
83
|
+
version: '3.9'
|
83
84
|
description: CloudPayments ruby client
|
84
85
|
email:
|
85
86
|
- undr@yandex.ru
|
86
|
-
|
87
|
+
- mail@kirillplatonov.com
|
88
|
+
executables:
|
89
|
+
- release
|
87
90
|
extensions: []
|
88
91
|
extra_rdoc_files: []
|
89
92
|
files:
|
@@ -94,6 +97,7 @@ files:
|
|
94
97
|
- LICENSE.txt
|
95
98
|
- README.md
|
96
99
|
- Rakefile
|
100
|
+
- bin/release
|
97
101
|
- cloud_payments.gemspec
|
98
102
|
- config.ru
|
99
103
|
- lib/cloud_payments.rb
|
@@ -109,6 +113,7 @@ files:
|
|
109
113
|
- lib/cloud_payments/models/like_subscription.rb
|
110
114
|
- lib/cloud_payments/models/model.rb
|
111
115
|
- lib/cloud_payments/models/on_fail.rb
|
116
|
+
- lib/cloud_payments/models/on_kassa_receipt.rb
|
112
117
|
- lib/cloud_payments/models/on_pay.rb
|
113
118
|
- lib/cloud_payments/models/on_recurrent.rb
|
114
119
|
- lib/cloud_payments/models/order.rb
|
@@ -116,8 +121,10 @@ files:
|
|
116
121
|
- lib/cloud_payments/models/subscription.rb
|
117
122
|
- lib/cloud_payments/models/transaction.rb
|
118
123
|
- lib/cloud_payments/namespaces.rb
|
124
|
+
- lib/cloud_payments/namespaces/apple_pay.rb
|
119
125
|
- lib/cloud_payments/namespaces/base.rb
|
120
126
|
- lib/cloud_payments/namespaces/cards.rb
|
127
|
+
- lib/cloud_payments/namespaces/kassa.rb
|
121
128
|
- lib/cloud_payments/namespaces/orders.rb
|
122
129
|
- lib/cloud_payments/namespaces/payments.rb
|
123
130
|
- lib/cloud_payments/namespaces/subscriptions.rb
|
@@ -126,13 +133,14 @@ files:
|
|
126
133
|
- lib/cloud_payments/webhooks.rb
|
127
134
|
- spec/cloud_payments/client/response_spec.rb
|
128
135
|
- spec/cloud_payments/client/serializer/multi_json_spec.rb
|
129
|
-
- spec/cloud_payments/client_spec.rb
|
130
136
|
- spec/cloud_payments/models/order_spec.rb
|
131
137
|
- spec/cloud_payments/models/secure3d_spec.rb
|
132
138
|
- spec/cloud_payments/models/subscription_spec.rb
|
133
139
|
- spec/cloud_payments/models/transaction_spec.rb
|
140
|
+
- spec/cloud_payments/namespaces/apple_pay_spec.rb
|
134
141
|
- spec/cloud_payments/namespaces/base_spec.rb
|
135
142
|
- spec/cloud_payments/namespaces/cards_spec.rb
|
143
|
+
- spec/cloud_payments/namespaces/kassa_spec.rb
|
136
144
|
- spec/cloud_payments/namespaces/orders_spec.rb
|
137
145
|
- spec/cloud_payments/namespaces/payments_spec.rb
|
138
146
|
- spec/cloud_payments/namespaces/subscriptions_spec.rb
|
@@ -146,6 +154,10 @@ files:
|
|
146
154
|
- spec/fixtures/apis/cards/charge/failed.yml
|
147
155
|
- spec/fixtures/apis/cards/charge/secure3d.yml
|
148
156
|
- spec/fixtures/apis/cards/charge/successful.yml
|
157
|
+
- spec/fixtures/apis/cards/post3ds/failed.yml
|
158
|
+
- spec/fixtures/apis/cards/post3ds/successful.yml
|
159
|
+
- spec/fixtures/apis/orders/cancel/failed.yml
|
160
|
+
- spec/fixtures/apis/orders/cancel/successful.yml
|
149
161
|
- spec/fixtures/apis/orders/create/successful.yml
|
150
162
|
- spec/fixtures/apis/payments/confirm/failed.yml
|
151
163
|
- spec/fixtures/apis/payments/confirm/failed_with_message.yml
|
@@ -155,6 +167,7 @@ files:
|
|
155
167
|
- spec/fixtures/apis/payments/find/successful.yml
|
156
168
|
- spec/fixtures/apis/payments/get/failed.yml
|
157
169
|
- spec/fixtures/apis/payments/get/failed_with_message.yml
|
170
|
+
- spec/fixtures/apis/payments/get/refunded.yml
|
158
171
|
- spec/fixtures/apis/payments/get/successful.yml
|
159
172
|
- spec/fixtures/apis/payments/post3ds/failed.yml
|
160
173
|
- spec/fixtures/apis/payments/post3ds/successful.yml
|
@@ -178,11 +191,11 @@ files:
|
|
178
191
|
- spec/spec_helper.rb
|
179
192
|
- spec/support/examples.rb
|
180
193
|
- spec/support/helpers.rb
|
181
|
-
homepage:
|
194
|
+
homepage: https://github.com/platmart/cloud_payments
|
182
195
|
licenses:
|
183
196
|
- MIT
|
184
197
|
metadata: {}
|
185
|
-
post_install_message:
|
198
|
+
post_install_message:
|
186
199
|
rdoc_options: []
|
187
200
|
require_paths:
|
188
201
|
- lib
|
@@ -197,21 +210,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
210
|
- !ruby/object:Gem::Version
|
198
211
|
version: '0'
|
199
212
|
requirements: []
|
200
|
-
|
201
|
-
|
202
|
-
signing_key:
|
213
|
+
rubygems_version: 3.2.22
|
214
|
+
signing_key:
|
203
215
|
specification_version: 4
|
204
216
|
summary: CloudPayments ruby client
|
205
217
|
test_files:
|
206
218
|
- spec/cloud_payments/client/response_spec.rb
|
207
219
|
- spec/cloud_payments/client/serializer/multi_json_spec.rb
|
208
|
-
- spec/cloud_payments/client_spec.rb
|
209
220
|
- spec/cloud_payments/models/order_spec.rb
|
210
221
|
- spec/cloud_payments/models/secure3d_spec.rb
|
211
222
|
- spec/cloud_payments/models/subscription_spec.rb
|
212
223
|
- spec/cloud_payments/models/transaction_spec.rb
|
224
|
+
- spec/cloud_payments/namespaces/apple_pay_spec.rb
|
213
225
|
- spec/cloud_payments/namespaces/base_spec.rb
|
214
226
|
- spec/cloud_payments/namespaces/cards_spec.rb
|
227
|
+
- spec/cloud_payments/namespaces/kassa_spec.rb
|
215
228
|
- spec/cloud_payments/namespaces/orders_spec.rb
|
216
229
|
- spec/cloud_payments/namespaces/payments_spec.rb
|
217
230
|
- spec/cloud_payments/namespaces/subscriptions_spec.rb
|
@@ -225,6 +238,10 @@ test_files:
|
|
225
238
|
- spec/fixtures/apis/cards/charge/failed.yml
|
226
239
|
- spec/fixtures/apis/cards/charge/secure3d.yml
|
227
240
|
- spec/fixtures/apis/cards/charge/successful.yml
|
241
|
+
- spec/fixtures/apis/cards/post3ds/failed.yml
|
242
|
+
- spec/fixtures/apis/cards/post3ds/successful.yml
|
243
|
+
- spec/fixtures/apis/orders/cancel/failed.yml
|
244
|
+
- spec/fixtures/apis/orders/cancel/successful.yml
|
228
245
|
- spec/fixtures/apis/orders/create/successful.yml
|
229
246
|
- spec/fixtures/apis/payments/confirm/failed.yml
|
230
247
|
- spec/fixtures/apis/payments/confirm/failed_with_message.yml
|
@@ -234,6 +251,7 @@ test_files:
|
|
234
251
|
- spec/fixtures/apis/payments/find/successful.yml
|
235
252
|
- spec/fixtures/apis/payments/get/failed.yml
|
236
253
|
- spec/fixtures/apis/payments/get/failed_with_message.yml
|
254
|
+
- spec/fixtures/apis/payments/get/refunded.yml
|
237
255
|
- spec/fixtures/apis/payments/get/successful.yml
|
238
256
|
- spec/fixtures/apis/payments/post3ds/failed.yml
|
239
257
|
- spec/fixtures/apis/payments/post3ds/successful.yml
|