-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Modifier l’API permettant d’accepter les CGU afin de foncti…
- Loading branch information
Showing
15 changed files
with
99 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...rc/identity-access-management/domain/usecases/accept-pix-orga-terms-of-service.usecase.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
/** | ||
* @param {{ | ||
* userId: string, | ||
* userRepository: UserRepository | ||
* legalDocumentApiRepository: legalDocumentApiRepository | ||
* }} params | ||
* @return {Promise<User>} | ||
* @return {Promise<void>} | ||
*/ | ||
export const acceptPixOrgaTermsOfService = function ({ userId, userRepository }) { | ||
return userRepository.updatePixOrgaTermsOfServiceAcceptedToTrue(userId); | ||
export const acceptPixOrgaTermsOfService = function ({ userId, legalDocumentApiRepository }) { | ||
return legalDocumentApiRepository.acceptPixOrgaTos({ userId }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...c/identity-access-management/infrastructure/repositories/legal-document-api.repository.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import * as legalDocumentApi from '../../../legal-documents/application/api/legal-documents-api.js'; | ||
|
||
const acceptPixOrgaTos = async ({ userId, dependencies = { legalDocumentApi } }) => { | ||
return dependencies.legalDocumentApi.acceptLegalDocumentByUserId({ userId, service: 'pix-orga', type: 'TOS' }); | ||
}; | ||
|
||
const legalDocumentApiRepository = { acceptPixOrgaTos }; | ||
|
||
export { legalDocumentApiRepository }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...-access-management/unit/infrastructure/repositories/legal-document-api.repository.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { legalDocumentApiRepository } from '../../../../../src/identity-access-management/infrastructure/repositories/legal-document-api.repository.js'; | ||
import { expect, sinon } from '../../../../test-helper.js'; | ||
|
||
describe('Unit | Identity Access Management | Infrastructure | Repositories | legal-document-api', function () { | ||
describe('#acceptPixOrgaTos', function () { | ||
it('accepts terms of service', async function () { | ||
// given | ||
const dependencies = { | ||
legalDocumentApi: { | ||
acceptLegalDocumentByUserId: sinon.stub().resolves(), | ||
}, | ||
}; | ||
|
||
const userId = Symbol('userId'); | ||
|
||
// when | ||
await legalDocumentApiRepository.acceptPixOrgaTos({ userId, dependencies }); | ||
|
||
// then | ||
expect(dependencies.legalDocumentApi.acceptLegalDocumentByUserId).to.have.been.calledWithExactly({ | ||
userId, | ||
service: 'pix-orga', | ||
type: 'TOS', | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters