redsys-ruby 0.1.1 → 0.1.2
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/README.md +13 -0
- data/app/models/redsys_ruby/configuration.rb +17 -5
- data/doc/img/config_cred.png +0 -0
- data/doc/img/redsys_payment.png +0 -0
- data/lib/redsys-ruby/tpv.rb +1 -0
- data/lib/redsys-ruby/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f2f92fd3e151ccd653ed86948905c9b2fd975e8f421f1090412ebb8cd998fc7
|
|
4
|
+
data.tar.gz: 653e16462dbaa3e0df0ee3a69aaf1521a85a4ad72da9999bdb906b475e9aceca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17fdfa8e5622f5f58f74903b6b8f16f30728a8eb36bb3dd8e1a6666c8ef64fa79ff71f221c63520682806147c88b6fe5540714db80acdd4368b1f9af73daff22
|
|
7
|
+
data.tar.gz: b53b40548f40019a1f4e64c6ec69bbd5649d5c92943fcbe2185a7e2bede93a3bc2c102e87674e064b0d1a5a43e7a09e9e6ee43dd144598ca6abc56f7b4d76b67
|
data/README.md
CHANGED
|
@@ -32,6 +32,17 @@ Add the following to your `config/routes.rb`:
|
|
|
32
32
|
mount RedsysRuby::Engine => "/redsys_ruby"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
Once mounted, the engine provides the following routes (assuming it is mounted at `"/redsys_ruby"`):
|
|
36
|
+
|
|
37
|
+
| Route Helper | HTTP Method | Path | Description |
|
|
38
|
+
|---|---|---|---|
|
|
39
|
+
| `redsys_ruby.root_path` | `GET` | `/redsys_ruby` | Payment testing and index page. |
|
|
40
|
+
| `redsys_ruby.payments_path` | `GET` | `/redsys_ruby/payments` | Payment testing and index page. |
|
|
41
|
+
| `redsys_ruby.ok_payments_path` | `GET` | `/redsys_ruby/payments/ok` | Premium success page (UrlOK). |
|
|
42
|
+
| `redsys_ruby.ko_payments_path` | `GET` | `/redsys_ruby/payments/ko` | Premium failure page (UrlKO). |
|
|
43
|
+
| `redsys_ruby.edit_configuration_path` | `GET` | `/redsys_ruby/configuration/edit` | Configuration UI. |
|
|
44
|
+
| `redsys_ruby.configuration_path` | `PATCH`/`PUT` | `/redsys_ruby/configuration` | Update configuration. |
|
|
45
|
+
|
|
35
46
|
#### 2. Configuration
|
|
36
47
|
|
|
37
48
|
For security, it is highly recommended to manage your secrets (like `merchant_key`) using **environment variables** or **Rails encrypted credentials**.
|
|
@@ -103,6 +114,8 @@ The gem provides beautifully designed `Ok` and `KO` pages that match modern aest
|
|
|
103
114
|
- Responsive design.
|
|
104
115
|
- Backdrop blur effects.
|
|
105
116
|
|
|
117
|
+

|
|
118
|
+
|
|
106
119
|
---
|
|
107
120
|
|
|
108
121
|
### Low-level Ruby Usage (Non-Rails)
|
|
@@ -20,13 +20,25 @@ module RedsysRuby
|
|
|
20
20
|
config = (YAML.safe_load_file(CONFIG_PATH, aliases: true) || {})[Rails.env] || {}
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
creds = Rails.application.credentials.redsys rescue {}
|
|
23
|
+
creds = (Rails.application.credentials.redsys rescue {}) || {}
|
|
24
|
+
|
|
25
|
+
env = ENV["REDSYS_ENVIRONMENT"] || creds[:environment] || config["environment"] || "test"
|
|
26
|
+
|
|
27
|
+
key = ENV["REDSYS_MERCHANT_KEY"] || creds[:merchant_key] || config["merchant_key"]
|
|
28
|
+
code = ENV["REDSYS_MERCHANT_CODE"] || creds[:merchant_code] || config["merchant_code"]
|
|
29
|
+
term = ENV["REDSYS_TERMINAL"] || creds[:terminal] || config["terminal"]
|
|
30
|
+
|
|
31
|
+
if env == "test"
|
|
32
|
+
key ||= "sq7HjmUOBfKmC576ILgskD5srU870gJ7"
|
|
33
|
+
code ||= "999008881"
|
|
34
|
+
term ||= "001"
|
|
35
|
+
end
|
|
24
36
|
|
|
25
37
|
new(
|
|
26
|
-
merchant_key:
|
|
27
|
-
merchant_code:
|
|
28
|
-
terminal:
|
|
29
|
-
environment:
|
|
38
|
+
merchant_key: key,
|
|
39
|
+
merchant_code: code,
|
|
40
|
+
terminal: term,
|
|
41
|
+
environment: env
|
|
30
42
|
)
|
|
31
43
|
end
|
|
32
44
|
|
|
Binary file
|
|
Binary file
|
data/lib/redsys-ruby/tpv.rb
CHANGED
data/lib/redsys-ruby/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redsys-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- smallPush
|
|
@@ -14,14 +14,14 @@ dependencies:
|
|
|
14
14
|
name: railties
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '7.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '7.0'
|
|
27
27
|
description: Implement Redsys HMAC SHA256 signature and payment parameters handling.
|
|
@@ -46,6 +46,8 @@ files:
|
|
|
46
46
|
- app/views/redsys_ruby/payments/ko.html.erb
|
|
47
47
|
- app/views/redsys_ruby/payments/ok.html.erb
|
|
48
48
|
- config/routes.rb
|
|
49
|
+
- doc/img/config_cred.png
|
|
50
|
+
- doc/img/redsys_payment.png
|
|
49
51
|
- lib/redsys-ruby.rb
|
|
50
52
|
- lib/redsys-ruby/engine.rb
|
|
51
53
|
- lib/redsys-ruby/tpv.rb
|