Skip to content

Commit

Permalink
Don't revoke device on enedis fail get contract (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Jun 6, 2024
1 parent 874f726 commit 69892c1
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions core/enedis/enedis.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,7 @@ module.exports = function EnedisModel(logger, db, redisClient) {
const data = {
usage_point_id: usagePointId,
};
let response;
try {
response = await makeRequest('/customers_upc/v5/usage_points/contracts', data, accessToken);
} catch (e) {
// if status is 403, error is "No consent can be found for this customer and this usage point"
// Revoke device to avoid re-hitting this error
if (get(e, 'response.status') === 403) {
await db.t_device.update(devices[0].device_id, {
revoked: true,
});
}
throw e;
}
const response = await makeRequest('/customers_upc/v5/usage_points/contracts', data, accessToken);
const lastActivationDate = get(response, 'customer.usage_points.0.contracts.last_activation_date');
return {
lastActivationDate,
Expand Down

0 comments on commit 69892c1

Please sign in to comment.