Commit d829732c authored by Laurent's avatar Laurent

Symphony / Toulouse: fetch account label + add virtual card

parent 5344d14a
......@@ -23,6 +23,12 @@ export class Symphony extends PortalAdapter {
}
public updateCard(account: Account): Promise<any> {
account.setCardNumber(account.credentials['login']);
return Promise.resolve();
}
public request(account: Account, options: any): Promise<http.HttpResponse> {
if (!options.headers)
options.headers={};
......@@ -31,7 +37,7 @@ export class Symphony extends PortalAdapter {
}
public _signIn(account: Account): Promise<any> {
protected _signIn(account: Account): Promise<any> {
if (!(account.credentials['login'] && account.credentials['password']))
return Promise.reject(new WrongLoginPassword());
......@@ -46,7 +52,16 @@ export class Symphony extends PortalAdapter {
})
}
protected _fetchAccountLabel(account: Account): Promise<any> {
return this
._openSession(account)
.then( ($) => {
return $('table table td h2').text().trim();
});
}
protected _openSession(account: Account): Promise<any> {
let base_url = new UrlParse(account.getUrl()).origin;
......
......@@ -70,7 +70,7 @@ export class SymphonySignInWithSuccessfulLogin extends HTTPScenario {
<td class="defaultstyle">\
<table width="100%" cellspacing="0" cellpadding="0" border="0">\
<tbody><tr>\
<td> <h2>DUVAL, Claire</h2> </td>\
<td> <h2>POLO, Marco</h2> </td>\
</tr>\
</tbody></table>\
<table width="100%" cellspacing="0" cellpadding="2" border="0"></table>\
......
......@@ -33,5 +33,13 @@ describe('Account on Symphony', () => {
expect(loans[0].getDateDue()).to.equals('2018-07-02');
});
})
it('account label should be Marco POLO', () => {
let http = new SymphonySignInWithSuccessfulLogin('http://symphony.fr');
return adapter.setHTTP(http).signIn(account).then(() => {
expect(account.label).to.equals('POLO, Marco');
})
})
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment