powercash21 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -0
- data/Gemfile.lock +42 -0
- data/README.md +4 -3
- data/lib/powercash21/client.rb +35 -0
- data/lib/powercash21/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dbe2d1ebd784e210b1e6997a9ef1c4eec673801ef523419cd1f1301f20b18df
|
4
|
+
data.tar.gz: 9c44deffa1ee4b357c6f1544b1ee58e5de2d6b63f657956bb01e8985c3560f43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71a4fa5b615e648a9ce60928741ebd07ba20d451147cb302f467500d9bad41af82e42c31dede4a5a42cf94b2ec606425136da9170ed41fa9fdec9472babc6863
|
7
|
+
data.tar.gz: 2878ad1c9500ee2a8c04f9ad0dd48591e4912052c6cec96c98a8c4f721d042b5b22a674d8cbd933228a79d825730c108793c218638b99e00f6fc6636e3c8236f
|
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
powercash21 (0.0.3)
|
5
|
+
faraday (~> 0.15.3)
|
6
|
+
faraday_middleware (~> 0.12.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.3)
|
12
|
+
faraday (0.15.4)
|
13
|
+
multipart-post (>= 1.2, < 3)
|
14
|
+
faraday_middleware (0.12.2)
|
15
|
+
faraday (>= 0.7.4, < 1.0)
|
16
|
+
multipart-post (2.0.0)
|
17
|
+
rake (10.5.0)
|
18
|
+
rspec (3.8.0)
|
19
|
+
rspec-core (~> 3.8.0)
|
20
|
+
rspec-expectations (~> 3.8.0)
|
21
|
+
rspec-mocks (~> 3.8.0)
|
22
|
+
rspec-core (3.8.0)
|
23
|
+
rspec-support (~> 3.8.0)
|
24
|
+
rspec-expectations (3.8.2)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.8.0)
|
27
|
+
rspec-mocks (3.8.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.8.0)
|
30
|
+
rspec-support (3.8.0)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
ruby
|
34
|
+
|
35
|
+
DEPENDENCIES
|
36
|
+
bundler (~> 1.17)
|
37
|
+
powercash21!
|
38
|
+
rake (~> 10.0)
|
39
|
+
rspec (~> 3.0)
|
40
|
+
|
41
|
+
BUNDLED WITH
|
42
|
+
1.17.1
|
data/README.md
CHANGED
@@ -30,6 +30,7 @@ Or create ENV variable POWERCASH21_SECRET_KEY ( ENV['POWERCASH21_SECRET_KEY'] )
|
|
30
30
|
|
31
31
|
## Usage
|
32
32
|
|
33
|
+
```ruby
|
33
34
|
powercash_client = Powercash21::Client.new
|
34
35
|
|
35
36
|
url = 'pay/backoffice/tx_diagnose'
|
@@ -43,11 +44,11 @@ params = {
|
|
43
44
|
|
44
45
|
response = powercash_client.post(url, params)
|
45
46
|
response.body
|
46
|
-
|
47
|
+
```
|
47
48
|
|
48
49
|
## Contributing
|
49
50
|
|
50
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/zinggg/powercash21. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
51
52
|
|
52
53
|
## License
|
53
54
|
|
@@ -55,4 +56,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
55
56
|
|
56
57
|
## Code of Conduct
|
57
58
|
|
58
|
-
Everyone interacting in the Powercash21 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
59
|
+
Everyone interacting in the Powercash21 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/zinggg/powercash21/blob/master/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Powercash21
|
2
|
+
class Client
|
3
|
+
require 'digest'
|
4
|
+
attr_accessor :secret_key
|
5
|
+
|
6
|
+
def initialize(secret_key: nil)
|
7
|
+
@secret_key = secret_key || Powercash21.secret_key
|
8
|
+
end
|
9
|
+
|
10
|
+
def connection
|
11
|
+
@connection ||= begin
|
12
|
+
Faraday.new(:url => 'https://sandbox.powerpay21.com') do |faraday|
|
13
|
+
faraday.request :url_encoded
|
14
|
+
faraday.adapter Faraday.default_adapter
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def post(url, data = {})
|
20
|
+
connection.post(url, data)
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(url, data = {})
|
24
|
+
connection.get(url, data)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def format_data(data)
|
30
|
+
sorted_hash = Hash[data.map{|k, v| [k.to_s.downcase, v]}.sort]
|
31
|
+
signature = sorted_hash.map {|kay,val| val}.join("").to_s + @secret_key
|
32
|
+
sorted_hash['signature'] = Digest::SHA1.hexdigest(signature)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/powercash21/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: powercash21
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugeniu Tambur
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,14 +90,17 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
92
|
- ".travis.yml"
|
93
|
+
- CHANGELOG.md
|
93
94
|
- CODE_OF_CONDUCT.md
|
94
95
|
- Gemfile
|
96
|
+
- Gemfile.lock
|
95
97
|
- LICENSE.txt
|
96
98
|
- README.md
|
97
99
|
- Rakefile
|
98
100
|
- bin/console
|
99
101
|
- bin/setup
|
100
102
|
- lib/powercash21.rb
|
103
|
+
- lib/powercash21/client.rb
|
101
104
|
- lib/powercash21/version.rb
|
102
105
|
- powercash21.gemspec
|
103
106
|
homepage: https://github.com/zinggg/powercash21
|