dps 0.0.5 → 0.0.7
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 +2 -2
- data/app/controllers/dps/application_controller.rb +5 -0
- data/app/controllers/dps/info_controller.rb +15 -0
- data/app/controllers/dps/payments_controller.rb +35 -0
- data/app/views/layouts/dps/application.html.erb +16 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20190319025700_create_dps_engine_articles.rb +9 -0
- data/db/migrate/20190319034641_create_dps_engine_admin_users_articles.rb +9 -0
- data/db/migrate/20190319041143_create_dps_engine_admin_users_nodes.rb +9 -0
- data/lib/dps.rb +28 -2
- data/lib/dps/dns.rb +1 -1
- data/lib/dps/engine.rb +5 -0
- data/lib/dps/version.rb +2 -2
- metadata +53 -6
- data/.gitignore +0 -14
- data/Gemfile +0 -6
- data/LICENSE.txt +0 -21
- data/dps.gemspec +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f44694279c28ea0625208f237acd9447d82a2cc1c470a850184759415b68e434
|
4
|
+
data.tar.gz: 62fa3342cefcf8f019c548cf3191bea4576d4d3efc494bcecd1288bd5e1b591c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d55c84067b0f512c47c7d5ca8e66bdf9bd0303f398000eb1439a430602a88e94a8a22829a0f95a8bb3287377ffbbbfc925b8f0d84675a219bafc421004abaa94
|
7
|
+
data.tar.gz: 007afa21d7158259787ead1c8824b53f7d1c81d60e174854c0f5743337454ebfccad4947ba1994f3e39163d07c2639350e4e2acc26db5a1568ac220f9588d5a1
|
data/README.md
CHANGED
@@ -26,10 +26,10 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
|
29
|
+
Dps::DNS.get_endpoint('example.com')
|
30
30
|
|
31
31
|
# if `tworgy.com` has a DNS TXT record with the value 'dps:endpoint url=https://tworgy.com/dps'
|
32
32
|
|
33
|
-
|
33
|
+
Dps::DNS.get_endpoint('tworgy.com') # returns 'https://tworgy.com/dps'
|
34
34
|
```
|
35
35
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_dependency "dps/application_controller"
|
2
|
+
|
3
|
+
module Dps
|
4
|
+
class InfoController < ApplicationController
|
5
|
+
|
6
|
+
def show
|
7
|
+
if Dps.endpoints.present?
|
8
|
+
render json: "Endpoints are: #{Dps.endpoints}"
|
9
|
+
else
|
10
|
+
render json: "No endpoints specified", status: 501
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_dependency "dps/application_controller"
|
2
|
+
|
3
|
+
module Dps
|
4
|
+
class PaymentsController < ApplicationController
|
5
|
+
before_action :load_endpoint
|
6
|
+
|
7
|
+
def new
|
8
|
+
if @endpoint_renderer.present?
|
9
|
+
@endpoint_renderer.instance_method(:render_new_payment).bind(self).call
|
10
|
+
else
|
11
|
+
render json: "Could not process endpoint '#{@endpoint}'", status: 501
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def load_endpoint
|
18
|
+
@endpoint = params[:endpoint]
|
19
|
+
@endpoint_renderer = Dps.get_new_payment_renderer(@endpoint)
|
20
|
+
end
|
21
|
+
|
22
|
+
def payment_params
|
23
|
+
params.require(:payment).permit(
|
24
|
+
:payer,
|
25
|
+
:recipient,
|
26
|
+
|
27
|
+
transaction: [
|
28
|
+
:type,
|
29
|
+
:ref
|
30
|
+
]
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>DPS engine</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<%= stylesheet_link_tag "dps/engine/application", media: "all" %>
|
9
|
+
<%= javascript_include_tag "dps/engine/application" %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
|
13
|
+
<%= yield %>
|
14
|
+
|
15
|
+
</body>
|
16
|
+
</html>
|
data/config/routes.rb
ADDED
data/lib/dps.rb
CHANGED
@@ -1,7 +1,33 @@
|
|
1
|
+
require 'dbc'
|
1
2
|
require "dps/dns"
|
3
|
+
require "dps/engine"
|
2
4
|
require "dps/version"
|
3
5
|
|
4
|
-
module
|
6
|
+
module Dps
|
5
7
|
class Error < StandardError; end
|
6
|
-
|
8
|
+
class ProcNotSetError < StandardError; end
|
9
|
+
|
10
|
+
mattr_accessor :endpoints
|
11
|
+
mattr_accessor :new_payment_endpoints_renderers
|
12
|
+
self.new_payment_endpoints_renderers = {}
|
13
|
+
|
14
|
+
def self.setup
|
15
|
+
yield(self)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get_new_payment_renderer(endpoint)
|
19
|
+
begin
|
20
|
+
new_payment_endpoints_renderers.fetch(endpoint.to_sym)
|
21
|
+
rescue KeyError
|
22
|
+
ProcNotSetError.new("Endpoint proc not set: '#{endpoint}'")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.new_payment_renderer(endpoint, renderer)
|
27
|
+
DBC.require(!renderer.is_a?(Class), "Renderer '#{renderer}' must not be a Class for delegation to work.")
|
28
|
+
DBC.require(renderer.is_a?(Module), "Renderer '#{renderer}' must be a Module for delegation to work.")
|
29
|
+
|
30
|
+
new_payment_endpoints_renderers[endpoint.to_sym] = renderer
|
31
|
+
end
|
32
|
+
|
7
33
|
end
|
data/lib/dps/dns.rb
CHANGED
data/lib/dps/engine.rb
ADDED
data/lib/dps/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.0.
|
1
|
+
module Dps
|
2
|
+
VERSION = "0.0.7"
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Holroyd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dnsruby
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.61'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: matholroyd-dbc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,34 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '3.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: sqlite3
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.3.6
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.6
|
69
111
|
description: Direct Payment Standard (DPS) specifies a common way for entities to
|
70
112
|
advertise payment options as well as facilitate payments directly between 2 parties.
|
71
113
|
This library contains tools to interact with or implement a DPS server.
|
@@ -75,14 +117,19 @@ executables: []
|
|
75
117
|
extensions: []
|
76
118
|
extra_rdoc_files: []
|
77
119
|
files:
|
78
|
-
- ".gitignore"
|
79
|
-
- Gemfile
|
80
|
-
- LICENSE.txt
|
81
120
|
- README.md
|
82
121
|
- Rakefile
|
83
|
-
- dps.
|
122
|
+
- app/controllers/dps/application_controller.rb
|
123
|
+
- app/controllers/dps/info_controller.rb
|
124
|
+
- app/controllers/dps/payments_controller.rb
|
125
|
+
- app/views/layouts/dps/application.html.erb
|
126
|
+
- config/routes.rb
|
127
|
+
- db/migrate/20190319025700_create_dps_engine_articles.rb
|
128
|
+
- db/migrate/20190319034641_create_dps_engine_admin_users_articles.rb
|
129
|
+
- db/migrate/20190319041143_create_dps_engine_admin_users_nodes.rb
|
84
130
|
- lib/dps.rb
|
85
131
|
- lib/dps/dns.rb
|
132
|
+
- lib/dps/engine.rb
|
86
133
|
- lib/dps/version.rb
|
87
134
|
homepage: https://github.com/matholroyd/dps-ruby
|
88
135
|
licenses:
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2019 Mat Holroyd
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/dps.gemspec
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "dps/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "dps"
|
7
|
-
spec.version = DPS::VERSION
|
8
|
-
spec.authors = ["Mat Holroyd"]
|
9
|
-
spec.email = ['dps@matholroyd.com']
|
10
|
-
|
11
|
-
spec.summary = %q{DPS is a collection of tools to help interact with or implement a DPS server}
|
12
|
-
spec.description = %q{Direct Payment Standard (DPS) specifies a common way for entities to advertise payment options as well as facilitate payments directly between 2 parties. This library contains tools to interact with or implement a DPS server.}
|
13
|
-
spec.homepage = "https://github.com/matholroyd/dps-ruby"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
if spec.respond_to?(:metadata)
|
19
|
-
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
20
|
-
else
|
21
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
22
|
-
"public gem pushes."
|
23
|
-
end
|
24
|
-
|
25
|
-
# Specify which files should be added to the gem when it is released.
|
26
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
28
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
29
|
-
end
|
30
|
-
spec.bindir = "exe"
|
31
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = ["lib"]
|
33
|
-
|
34
|
-
spec.add_dependency "dnsruby", "~> 1.61"
|
35
|
-
|
36
|
-
spec.add_development_dependency "bundler", "~> 1.17.a"
|
37
|
-
spec.add_development_dependency "rake", "~> 12.3"
|
38
|
-
spec.add_development_dependency "rspec", "~> 3.8"
|
39
|
-
end
|