Skip to content

Commit 53feb90

Browse files
Merge pull request #3 from tlgman/feat-change-pis-and-ais-forms
Feat change pis and ais forms
2 parents 908e38b + cb41310 commit 53feb90

6 files changed

Lines changed: 53 additions & 16 deletions

File tree

ais-connect.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dotenv.config({ path: path.join(__dirname, '.env') });
1212

1313
require('dotenv').config();
1414

15+
1516
// Create the fintecture client instance
1617
let client = new FintectureClient({ app_id: process.env.APP_ID, app_secret: process.env.APP_SECRET, private_key: process.env.APP_PRIV_KEY, env: process.env.FINTECTURE_ENV });
1718

@@ -22,29 +23,35 @@ let customerId;
2223

2324
// initial screen
2425
app.get("/", async (_req, res) => {
25-
res.render("index", {});
26+
res.render('index', {
27+
country: 'fr'
28+
});
2629
});
2730

2831

2932
// Redirect to connect
30-
app.get("/connect", async (req, res) => {
33+
app.get("/connect", async (req, res, next) => {
3134
const psuType = req.query.psu_type || 'all';
3235
const country = req.query.country || 'fr';
3336

34-
let config = {
37+
const config = {
3538
redirect_uri: process.env.APP_REDIRECT_URI,
3639
state: "bob",
3740
psu_type: psuType,
3841
country: country
39-
}
40-
41-
const connect = await client.getAisConnect(null, config)
42+
};
4243

43-
res.writeHead(
44-
301,
45-
{ Location: connect.url }
46-
);
47-
res.end();
44+
try {
45+
const connect = await client.getAisConnect(null, config);
46+
47+
res.writeHead(
48+
301,
49+
{ Location: connect.url }
50+
);
51+
res.end();
52+
} catch(err) {
53+
next(err);
54+
}
4855
});
4956

5057
app.get("/error_page", async (req, res) => {

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"description": "",
55
"main": "sample.js",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"start:ais-connect": "node ais-connect",
8+
"start:ais-decoupled": "node ais-decoupled",
9+
"start:ais-redirect": "node ais-redirect",
10+
"start:pis-connect": "node pis-connect"
811
},
912
"author": "",
1013
"license": "ISC",

pis-connect.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ app.get("/", async (_req, res) => {
3838
customer_address_country: '',
3939
production: process.env.FINTECTURE_ENV === "production",
4040
scheme: 'auto',
41-
country: 'fr'
41+
country: 'fr',
42+
expiry: undefined
4243
});
4344
});
4445

@@ -68,6 +69,8 @@ app.post("/connect", async (req, res) => {
6869
psu_type: req.body.psu_type || 'retail',
6970
country: req.body.country || 'fr',
7071
scheme: (req.body.scheme == "auto")?'':req.body.scheme,
72+
expiry: req.body.expiry,
73+
scheduled_expiration_policy: req.body.scheduled_expiration_policy
7174
};
7275

7376
try {

views/ais-connect/index.ejs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
<html>
22
<body>
33
<form name="form1" method="GET" action="/connect">
4+
<div class="form-group">
5+
<label for="country">Country</label>
6+
<input type="text" name="country" value="<%= country %>">
7+
</div>
48
<input type="hidden" name="psu_type" value="all" />
59
<button type="submit">Connect ALL</button>
610
</form>
711
<form name="form1" method="GET" action="/connect">
12+
<div class="form-group">
13+
<label for="country">Country</label>
14+
<input type="text" name="country" value="<%= country %>">
15+
</div>
816
<input type="hidden" name="psu_type" value="retail" />
917
<button type="submit">Connect RETAIL</button>
1018
</form>
1119
<form name="form1" method="GET" action="/connect">
20+
<div class="form-group">
21+
<label for="country">Country</label>
22+
<input type="text" name="country" value="<%= country %>">
23+
</div>
1224
<input type="hidden" name="psu_type" value="corporate" />
1325
<button type="submit">Connect CORPO</button>
1426
</form>

views/pis-connect-qr/index.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<input type="text" id="communication" name="communication" value="<%= communication %>">
2424
</div>
2525
<div class="form-group">
26-
<label for="psu_type">* Type</label>
26+
<label for="psu_type">* Psu Type</label>
2727
<select name="psu_type">
2828
<option value="retail">Retail</option>
2929
<option value="corporate">Corporate</option>

views/pis-connect/index.ejs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
<input type="text" id="execution_date" name="execution_date" value="<%= execution_date %>">
2929
</div>
3030
<div class="form-group">
31-
<label for="psu_type">* Type</label>
31+
<label for="psu_type">* Psu Type</label>
3232
<select name="psu_type">
3333
<option value="all">All</option>
3434
<option value="retail">Retail</option>
3535
<option value="corporate">Corporate</option>
3636
</select>
3737
</div>
3838
<div class="form-group">
39-
<label for="Scheme">* Type</label>
39+
<label for="Scheme">* Scheme</label>
4040
<select name="scheme">
4141
<option value="auto">Auto</option>
4242
<option value="SEPA">SEPA</option>
@@ -87,6 +87,18 @@
8787
<label for="customer_address_country">Customer Address Country</label>
8888
<input type="email" id="customer_address_country" name="customer_address_country" value="<%= customer_address_country %>">
8989
</div>
90+
<div class="form-group">
91+
<label for="expiry">Expiry</label>
92+
<input type="number" id="expiry" name="expiry" value="<%= expiry %>" min="0" step="1000">
93+
</div>
94+
<div class="form-group">
95+
<label for="scheduled_expiration_policy">Scheduled Expiration Policy</label>
96+
<select id="scheduled_expiration_policy" name="scheduled_expiration_policy">
97+
<option disabled selected value>No value</option>
98+
<option value="immediate">immediate</option>
99+
<option value="expire">expire</option>
100+
</select>
101+
</div>
90102

91103
<button type="submit">Pay by bank</button>
92104
</form>

0 commit comments

Comments
 (0)