Skip to content
Snippets Groups Projects
Commit a449ac9e authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix: onDelete

parent aa1d8d13
No related branches found
No related tags found
1 merge request!12Feat/donnes tech debut contrat
Pipeline #40040 failed
......@@ -38,7 +38,7 @@
* @property {string} postalCode
* @property {string} inseeCode
* @property {string} endDate
* @property {number} [serviceId]
* @property {number} [serviceID]
* @property {number} [ID]
*/
......
......@@ -235,14 +235,14 @@ async function deleteConsent(
boToken
) {
log('error', `Invalid or not found consent for user`)
if (userConsent.serviceId) {
if (userConsent.serviceID) {
await terminateContract(
baseUrl,
apiAuthKey,
sgeLogin,
contractId,
pointId,
userConsent.serviceId
userConsent.serviceID
)
await deleteBoConsent(
boBaseUrl,
......
// @ts-check
const { log, errors } = require('cozy-konnector-libs')
const { getAccountRev, getAccountSecret } = require('./helpers/account')
const { getBoConsent, deleteBoConsent } = require('./requests/bo')
......@@ -26,21 +27,21 @@ async function onDeleteAccount() {
accountData.data.consentId
)
if (userConsent.pointId && userConsent.pointId) {
log('error', `Consent found for user`)
if (userConsent.serviceId) {
if (userConsent.ID && userConsent.pointID && userConsent.pointID) {
log('log', `Consent ${userConsent.ID} found for user`)
if (userConsent.serviceID) {
await deleteBoConsent(
secrets.boBaseUrl,
secrets.boToken,
userConsent.id
userConsent.ID
)
await terminateContract(
secrets.baseUrl,
secrets.apiAuthKey,
secrets.sgeLogin,
secrets.contractId,
userConsent.pointId,
userConsent.serviceId
userConsent.pointID,
userConsent.serviceID
)
} else {
log('error', `No service id retrieved from BO`)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment