File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ const vhost = require('vhost')
1515const EmailService = require ( './services/email-service' )
1616const TokenService = require ( './services/token-service' )
1717const capabilityDiscovery = require ( './capability-discovery' )
18+ const paymentPointerDiscovery = require ( './payment-pointer-discovery' )
1819const API = require ( './api' )
1920const errorPages = require ( './handlers/error-pages' )
2021const config = require ( './server-config' )
@@ -166,6 +167,7 @@ function initHeaders (app) {
166167 } )
167168
168169 app . use ( '/' , capabilityDiscovery ( ) )
170+ app . use ( '/' , paymentPointerDiscovery ( ) )
169171}
170172
171173/**
Original file line number Diff line number Diff line change 1+ 'use strict'
2+ /**
3+ * @module payment-pointer-discovery
4+ */
5+ const express = require ( 'express' )
6+
7+ module . exports = paymentPointerDiscovery
8+
9+ /**
10+ * Returns a set of routes to deal with server payment pointer discovery
11+ * @method paymentPointerDiscovery
12+ * @return {Router } Express router
13+ */
14+ function paymentPointerDiscovery ( ) {
15+ const router = express . Router ( '/' )
16+
17+ // Advertise the server payment pointer discover endpoint
18+ router . get ( '/.well-known/pay' , paymentPointerDocument ( ) )
19+ return router
20+ }
21+
22+ /**
23+ * Serves the service payment pointer document (containing server root URL, including
24+ * any base path the user specified in config, server API endpoints, etc).
25+ * @method paymentPointerDocument
26+ * @param req
27+ * @param res
28+ * @param next
29+ */
30+ function paymentPointerDocument ( ) {
31+ return ( req , res ) => {
32+ res . json ( {
33+ hello : 'world'
34+ } )
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments