cloud_payments 1.0.2 → 1.2.0
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/bin/release +17 -0
- data/cloud_payments.gemspec +1 -1
- data/lib/cloud_payments/client.rb +12 -2
- data/lib/cloud_payments/models/transaction.rb +1 -0
- data/lib/cloud_payments/version.rb +1 -2
- data/spec/cloud_payments/models/transaction_spec.rb +3 -1
- data/spec/cloud_payments_spec.rb +0 -3
- 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 +11 -2
- data/spec/support/helpers.rb +1 -1
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c4990b4c0e90d444b09179475ce9c3e2ff4c50d8a2af87bd25d676f18ed399e
|
4
|
+
data.tar.gz: 8702f0a17b461fb582d79cf79382fb72af93ac86429bcc9ef26f1979cb4ab619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e860f4b88400e9f8eeb97c380448a7fa45f37bf7cee3304dbb44b3f09204e32c503a98f31fe629f891f7777c036df23f41de7b532e3078c77f6562be2267540e
|
7
|
+
data.tar.gz: 3b70dedae8ce944c98a68cdfa80fd4aaa3ef3c8e766a30237b138ff4af73ce9a146a363f6eabbcfb86c66f4786650388dc342ae2edc70b338b14b278517e183e
|
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
@@ -19,7 +19,7 @@ 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', '< 3.0'
|
23
23
|
spec.add_dependency 'multi_json', '~> 1.11'
|
24
24
|
spec.add_dependency 'hashie', '~> 3.4'
|
25
25
|
|
@@ -16,7 +16,6 @@ module CloudPayments
|
|
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,18 @@ 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
|
+
|
49
|
+
# https://github.com/lostisland/faraday/blob/main/UPGRADING.md#authentication-helper-methods-in-connection-have-been-removed
|
50
|
+
# https://lostisland.github.io/faraday/#/middleware/included/authentication?id=faraday-1x-usage
|
51
|
+
if Faraday::VERSION.start_with?("1.")
|
52
|
+
conn.request :basic_auth, config.public_key, config.secret_key
|
53
|
+
else
|
54
|
+
conn.request :authorization, :basic, config.public_key, config.secret_key
|
55
|
+
end
|
56
|
+
|
57
|
+
config.connection_block.call(conn) if config.connection_block
|
58
|
+
end
|
49
59
|
end
|
50
60
|
end
|
51
61
|
end
|
@@ -43,7 +43,8 @@ describe CloudPayments::Transaction do
|
|
43
43
|
refunded: false,
|
44
44
|
card_holder_message: 'Payment successful',
|
45
45
|
name: 'CARDHOLDER NAME',
|
46
|
-
token: 'a4e67841-abb0-42de-a364-d1d8f9f4b3c0'
|
46
|
+
token: 'a4e67841-abb0-42de-a364-d1d8f9f4b3c0',
|
47
|
+
escrow_accumulation_id: '119d1f05-4fa8-4f35-85b6-09216a5a4fb6'
|
47
48
|
} }
|
48
49
|
|
49
50
|
specify{ expect(subject.id).to eq(504) }
|
@@ -82,6 +83,7 @@ describe CloudPayments::Transaction do
|
|
82
83
|
specify{ expect(subject.name).to eq('CARDHOLDER NAME') }
|
83
84
|
specify{ expect(subject.token).to eq('a4e67841-abb0-42de-a364-d1d8f9f4b3c0') }
|
84
85
|
specify{ expect(subject.refunded).to eq(false) }
|
86
|
+
specify{ expect(subject.escrow_accumulation_id).to eq('119d1f05-4fa8-4f35-85b6-09216a5a4fb6') }
|
85
87
|
|
86
88
|
context 'without any attributes' do
|
87
89
|
let(:attributes){ {} }
|
data/spec/cloud_payments_spec.rb
CHANGED
@@ -3,9 +3,6 @@ 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
|
|
@@ -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
@@ -15,8 +15,10 @@ RSpec.configure do |config|
|
|
15
15
|
config.mock_with :rspec
|
16
16
|
config.include CloudPayments::RSpec::Helpers
|
17
17
|
|
18
|
-
|
19
|
-
|
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|
|
20
22
|
c.public_key = 'user'
|
21
23
|
c.secret_key = 'pass'
|
22
24
|
c.host = 'http://localhost:9292'
|
@@ -24,4 +26,11 @@ RSpec.configure do |config|
|
|
24
26
|
# c.raise_banking_errors = true
|
25
27
|
end
|
26
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
|
27
36
|
end
|
data/spec/support/helpers.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_payments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- undr
|
8
8
|
- kirillplatonov
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-04-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: faraday
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
16
|
requirements:
|
18
|
-
- - "
|
17
|
+
- - "<"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
19
|
+
version: '3.0'
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
|
-
- - "
|
24
|
+
- - "<"
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
26
|
+
version: '3.0'
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
28
|
name: multi_json
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -85,7 +84,8 @@ description: CloudPayments ruby client
|
|
85
84
|
email:
|
86
85
|
- undr@yandex.ru
|
87
86
|
- mail@kirillplatonov.com
|
88
|
-
executables:
|
87
|
+
executables:
|
88
|
+
- release
|
89
89
|
extensions: []
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- LICENSE.txt
|
97
97
|
- README.md
|
98
98
|
- Rakefile
|
99
|
+
- bin/release
|
99
100
|
- cloud_payments.gemspec
|
100
101
|
- config.ru
|
101
102
|
- lib/cloud_payments.rb
|
@@ -193,7 +194,6 @@ homepage: https://github.com/platmart/cloud_payments
|
|
193
194
|
licenses:
|
194
195
|
- MIT
|
195
196
|
metadata: {}
|
196
|
-
post_install_message:
|
197
197
|
rdoc_options: []
|
198
198
|
require_paths:
|
199
199
|
- lib
|
@@ -208,8 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
|
-
rubygems_version: 3.
|
212
|
-
signing_key:
|
211
|
+
rubygems_version: 3.6.2
|
213
212
|
specification_version: 4
|
214
213
|
summary: CloudPayments ruby client
|
215
214
|
test_files:
|