-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.es2015.js
63 lines (55 loc) · 1.67 KB
/
server.es2015.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// server dependencies
import { Server as InsecureServer } from 'http';
// framework dependencies
import Express from 'express';
const bodyParser = require('body-parser');
const PORTS = {
INSECURE: 2077
}
const app = Express();
app.use( Express.static('dist') );
app.use( bodyParser.json() );
const insecureServer = InsecureServer(app).listen(PORTS.INSECURE, () => {
const host = insecureServer.address().address || 'localhost';
const port = insecureServer.address().port || PORTS.INSECURE;
console.log('PRD app (insecure - HTTP) listening @ http://%s:%s', host, port);
});
app.post('/check-payment', (req, res) => {
if (typeof req.headers.fail != 'undefined') {
res.status(400).send({success:false});
} else {
res.status(200).send({success: true});
}
});
app.post('/get-payment-options', (req, res) => {
if (typeof req.headers.fail != 'undefined') {
res.status(200).send([]);
} else {
res.status(200).send([
{
id: 'standard',
label: 'Standard Shipping (3-5 Days)',
amount: {
currency: 'GBP',
value: 3.59
}
},
{
id: 'express',
label: 'Express Shipping (1 Day)',
amount: {
currency: 'GBP',
value: 5.59
}
},
{
id: 'saturday-1500-1700',
label: 'Saturday Fixed Timeslot (15:00 - 17:00 slot)',
amount: {
currency: 'GBP',
value: 7.59
}
}
]);
}
});