Skip to content

Commit 19dc244

Browse files
2.1.0
1 parent a757bce commit 19dc244

File tree

12 files changed

+125
-115
lines changed

12 files changed

+125
-115
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fintecture-client",
3-
"version": "2.0.2",
3+
"version": "2.1.0",
44
"description": "Fintecture Open Banking API Gateway enabling secure bank connections and payments",
55
"main": "lib/fintecture-client.js",
66
"types": "lib/fintecture-client.d.ts",

src/Ais.ts

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,37 @@ export class AIS {
4343
state?: string,
4444
model?: string,
4545
psuId?: string,
46-
psuIpAddress?: string
46+
psuIpAddress?: string,
4747
): Promise<object> {
4848
if (accessToken) {
49-
return await this._authorizeWithAccessToken(accessToken, providerId, redirectUri, state, model, psuId, psuIpAddress);
49+
return await this._authorizeWithAccessToken(
50+
accessToken,
51+
providerId,
52+
redirectUri,
53+
state,
54+
model,
55+
psuId,
56+
psuIpAddress,
57+
);
5058
} else {
5159
return await this._authorizeWithAppId(providerId, redirectUri, state, model, psuId, psuIpAddress);
5260
}
5361
}
5462

55-
5663
/**
57-
* This API is used to poll the authentication status within
64+
* This API is used to poll the authentication status within
5865
* the decoupled model. Once the decoupled authentication flow
59-
* as initiated, the status is "PENDING". Once the PSU has
60-
* successfully authenticated, the status becomes "COMPLETED".
61-
* If the authentication times out, is cancelled or failed,
66+
* as initiated, the status is "PENDING". Once the PSU has
67+
* successfully authenticated, the status becomes "COMPLETED".
68+
* If the authentication times out, is cancelled or failed,
6269
* the status becomes "FAILED".
6370
*
6471
* @param {string} accessToken
6572
* @param {string} providerId
6673
* @param {string} pollingId
6774
* @returns {Promise<object>}
6875
*/
69-
public async decoupled(
70-
accessToken: string,
71-
providerId: string,
72-
pollingId: string
73-
): Promise<object> {
76+
public async decoupled(accessToken: string, providerId: string, pollingId: string): Promise<object> {
7477
if (accessToken) {
7578
return await this._decoupledWithAccesToken(accessToken, providerId, pollingId);
7679
} else {
@@ -86,16 +89,21 @@ export class AIS {
8689
* @param {object} queryParameters (optional)
8790
* @returns {Promise<object>}
8891
*/
89-
public async getAccounts(accessToken: string, customerId: string, queryParameters?: object, headerParameters?: object): Promise<object> {
90-
const url = `${Endpoints.AISCUSTOMER}/${customerId}/accounts${queryParameters ? '?' + qs.stringify(queryParameters) : ''}`;
92+
public async getAccounts(
93+
accessToken: string,
94+
customerId: string,
95+
queryParameters?: object,
96+
headerParameters?: object,
97+
): Promise<object> {
98+
const url = `${Endpoints.AISCUSTOMER}/${customerId}/accounts${
99+
queryParameters ? '?' + qs.stringify(queryParameters) : ''
100+
}`;
91101

92102
const headers = apiService.getHeaders('get', url, accessToken, this.config, null, headerParameters);
93103

94-
return await this.axiosInstance
95-
.get(url, { headers })
96-
.then(response => {
97-
return response.data;
98-
});
104+
return await this.axiosInstance.get(url, { headers }).then(response => {
105+
return response.data;
106+
});
99107
}
100108

101109
/**
@@ -109,21 +117,27 @@ export class AIS {
109117
* @param {string} paginationUrl (optional)
110118
* @returns {Promise<object>}
111119
*/
112-
public async getTransactions(accessToken: string, customerId: string, accountId: string, queryParameters?: object, headerParameters?: object, paginationUrl?: string): Promise<object> {
113-
120+
public async getTransactions(
121+
accessToken: string,
122+
customerId: string,
123+
accountId: string,
124+
queryParameters?: object,
125+
headerParameters?: object,
126+
paginationUrl?: string,
127+
): Promise<object> {
114128
let url = paginationUrl;
115129

116130
if (!url) {
117-
url = `${Endpoints.AISCUSTOMER}/${customerId}/accounts/${accountId}/transactions${queryParameters ? '?' + qs.stringify(queryParameters) : ''}` ;
131+
url = `${Endpoints.AISCUSTOMER}/${customerId}/accounts/${accountId}/transactions${
132+
queryParameters ? '?' + qs.stringify(queryParameters) : ''
133+
}`;
118134
}
119135

120136
const headers = apiService.getHeaders('get', url, accessToken, this.config, null, headerParameters);
121137

122-
return await this.axiosInstance
123-
.get(url, { headers })
124-
.then(response => {
125-
return response.data;
126-
});
138+
return await this.axiosInstance.get(url, { headers }).then(response => {
139+
return response.data;
140+
});
127141
}
128142

129143
/**
@@ -135,16 +149,21 @@ export class AIS {
135149
* @param {object} queryParameters (optional)
136150
* @returns {Promise<object>}
137151
*/
138-
public async getAccountHolders(accessToken: string, customerId: string, queryParameters: object, headerParameters?: object): Promise<object> {
139-
const url = `${Endpoints.AISCUSTOMER}/${customerId}/accountholders${queryParameters ? '?' + qs.stringify(queryParameters) : ''}`;
152+
public async getAccountHolders(
153+
accessToken: string,
154+
customerId: string,
155+
queryParameters: object,
156+
headerParameters?: object,
157+
): Promise<object> {
158+
const url = `${Endpoints.AISCUSTOMER}/${customerId}/accountholders${
159+
queryParameters ? '?' + qs.stringify(queryParameters) : ''
160+
}`;
140161

141162
const headers = apiService.getHeaders('get', url, accessToken, this.config, null, headerParameters);
142163

143-
return await this.axiosInstance
144-
.get(url, { headers },)
145-
.then(response => {
146-
return response.data;
147-
});
164+
return await this.axiosInstance.get(url, { headers }).then(response => {
165+
return response.data;
166+
});
148167
}
149168

150169
/**
@@ -159,9 +178,7 @@ export class AIS {
159178

160179
const headers = apiService.getHeaders('delete', url, accessToken, this.config);
161180

162-
return await this.axiosInstance
163-
.delete(url, { headers })
164-
.then(response => response.data);
181+
return await this.axiosInstance.delete(url, { headers }).then(response => response.data);
165182
}
166183

167184
/**
@@ -181,11 +198,10 @@ export class AIS {
181198
providerId: string,
182199
redirectUri: string,
183200
state?: string,
184-
model?: string,
185-
psuId?: string,
186-
psuIpAddress?: string
201+
model?: string,
202+
psuId?: string,
203+
psuIpAddress?: string,
187204
): Promise<object> {
188-
189205
const queryParameters = {
190206
redirect_uri: redirectUri,
191207
};
@@ -203,12 +219,10 @@ export class AIS {
203219
const headers = apiService.getHeaders('get', url, accessToken, this.config);
204220

205221
if (model === Constants.DECOUPLEDMODEL) {
206-
headers["x-psu-id"] = psuId;
207-
headers["x-psu-ip-address"] = psuIpAddress
222+
headers['x-psu-id'] = psuId;
223+
headers['x-psu-ip-address'] = psuIpAddress;
208224
}
209225

210-
211-
212226
const response = await this.axiosInstance.get(url, { headers });
213227
return response.data;
214228
}
@@ -218,10 +232,9 @@ export class AIS {
218232
redirectUri: string,
219233
state?: string,
220234
model?: string,
221-
psuId?: string,
222-
psuIpAddress?: string
235+
psuId?: string,
236+
psuIpAddress?: string,
223237
): Promise<object> {
224-
225238
const queryParameters = {
226239
response_type: 'code',
227240
redirect_uri: redirectUri,
@@ -240,19 +253,15 @@ export class AIS {
240253
const headers = apiService.getHeaders('get', url, null, this.config);
241254

242255
if (model === Constants.DECOUPLEDMODEL) {
243-
headers["x-psu-id"] = psuId;
244-
headers["x-psu-ip-address"] = psuIpAddress
256+
headers['x-psu-id'] = psuId;
257+
headers['x-psu-ip-address'] = psuIpAddress;
245258
}
246259

247260
const response = await this.axiosInstance.get(url, { headers });
248261
return response.data;
249262
}
250263

251-
private async _decoupledWithAccesToken(
252-
accessToken: string,
253-
providerId: string,
254-
pollingId: string
255-
): Promise<object> {
264+
private async _decoupledWithAccesToken(accessToken: string, providerId: string, pollingId: string): Promise<object> {
256265
const url = `${Endpoints.AISPROVIDER}/${providerId}/authorize/decoupled/${pollingId}`;
257266

258267
const headers = apiService.getHeaders('get', url, accessToken, this.config);
@@ -261,10 +270,7 @@ export class AIS {
261270
return response.data;
262271
}
263272

264-
private async _decoupledWithAppId(
265-
providerId: string,
266-
pollingId: string
267-
): Promise<object> {
273+
private async _decoupledWithAppId(providerId: string, pollingId: string): Promise<object> {
268274
const url = `${Endpoints.AISPROVIDER}/${providerId}/authorize/decoupled/${pollingId}`;
269275

270276
const headers = apiService.getHeaders('get', url, null, this.config);

src/Authentication.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ export class Authentication {
7474
code: authCode,
7575
grant_type: 'authorization_code',
7676
};
77-
}
78-
else {
77+
} else {
7978
data = {
8079
scope: 'PIS',
8180
app_id: this.appId,
@@ -84,9 +83,9 @@ export class Authentication {
8483
}
8584

8685
if (scopes) {
87-
data["scope"] = scopes;
86+
data['scope'] = scopes;
8887
}
89-
88+
9089
return qs.stringify(data);
9190
}
9291

src/Connect.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class Connect {
3030

3131
const queryParameters = qs.stringify({
3232
redirect_uri: connectConfig.redirect_uri,
33-
state: connectConfig.state
33+
state: connectConfig.state,
3434
});
3535
const url = `${Endpoints.AISCONNECT}?${queryParameters}`;
3636

@@ -47,7 +47,7 @@ export class Connect {
4747
const { data } = await this.axiosInstance.get(url, { headers });
4848

4949
return {
50-
url: data.meta.url
50+
url: data.meta.url,
5151
};
5252
}
5353

@@ -66,7 +66,7 @@ export class Connect {
6666
const queryParameters = qs.stringify({
6767
origin_uri: connectConfig.origin_uri,
6868
redirect_uri: connectConfig.redirect_uri,
69-
state: connectConfig.state
69+
state: connectConfig.state,
7070
});
7171
const url = `${Endpoints.PISCONNECT}?${queryParameters}`;
7272

@@ -137,7 +137,7 @@ export class Connect {
137137
psu_email: payment.customer_email,
138138
psu_ip: payment.customer_ip,
139139
psu_phone: payment.customer_phone,
140-
psu_address: payment.customer_address
140+
psu_address: payment.customer_address,
141141
};
142142

143143
const data: IData = {

src/Pis.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ export class PIS {
3232
* @param {object} payload
3333
* @returns {Promise<object>}
3434
*/
35-
public async prepare(
36-
accessToken: string,
37-
payload: object,
38-
): Promise<object> {
35+
public async prepare(accessToken: string, payload: object): Promise<object> {
3936
const url = `${Endpoints.PIS}/prepare`;
4037

4138
const headers = apiService.getHeaders('post', url, accessToken, this.config, payload);
@@ -61,7 +58,9 @@ export class PIS {
6158
redirectUri: string,
6259
state?: string,
6360
): Promise<object> {
64-
const url = `${Endpoints.PISPROVIDER}/${providerId}/initiate?redirect_uri=${redirectUri}${state ? '&state=' + state : ''}`;
61+
const url = `${Endpoints.PISPROVIDER}/${providerId}/initiate?redirect_uri=${redirectUri}${
62+
state ? '&state=' + state : ''
63+
}`;
6564

6665
const headers = apiService.getHeaders('post', url, accessToken, this.config, payload);
6766

@@ -105,8 +104,8 @@ export class PIS {
105104
if (amount) {
106105
payload.data = {
107106
attributes: {
108-
amount
109-
}
107+
amount,
108+
},
110109
};
111110
}
112111

@@ -126,12 +125,14 @@ export class PIS {
126125
* @returns {Promise<object>}
127126
*/
128127
public async getPayments(accessToken: string, sessionId: string, queryParameters?: object): Promise<object> {
129-
130-
const url = `${Endpoints.PIS}/payments` + (sessionId?('/'+sessionId):'') + (queryParameters ? ('?' + qs.stringify(queryParameters)) : '')
128+
const url =
129+
`${Endpoints.PIS}/payments` +
130+
(sessionId ? '/' + sessionId : '') +
131+
(queryParameters ? '?' + qs.stringify(queryParameters) : '');
131132

132133
const headers = apiService.getHeaders('get', url, accessToken, this.config);
133134

134-
const response = await this.axiosInstance.get(url, {headers});
135+
const response = await this.axiosInstance.get(url, { headers });
135136

136137
return response.data;
137138
}

src/interfaces/ConfigInterface.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* @interface IFintectureConfig
55
*/
66

7-
import { environment } from "../utils/Constants";
8-
7+
import { environment } from '../utils/Constants';
98

109
export interface IFintectureConfig {
1110
app_id: string;

0 commit comments

Comments
 (0)