From c99648a0ec4c44c38ff7f7ab0d86e71c4d631f5c Mon Sep 17 00:00:00 2001 From: Yann Lojewski Date: Thu, 31 Oct 2024 18:03:55 +0100 Subject: [PATCH] fix(pci.instances): use productAvailability to get snapshot price (#13827) ref: TAPC-2070 Signed-off-by: Yann Lojewski --- .../project/instances/instances.service.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/manager/modules/pci/src/projects/project/instances/instances.service.js b/packages/manager/modules/pci/src/projects/project/instances/instances.service.js index 52705755906b..ee64498d9ae7 100644 --- a/packages/manager/modules/pci/src/projects/project/instances/instances.service.js +++ b/packages/manager/modules/pci/src/projects/project/instances/instances.service.js @@ -327,8 +327,16 @@ export default class PciProjectInstanceService { catalogEndpoint, ).then((catalog) => instance.isLocalZone - ? catalog[`snapshot.consumption.${instance.region}`] ?? - catalog['snapshot.consumption.LZ'] + ? this.getProductAvailability(projectId).then( + ({ plans }) => + catalog[ + plans.find( + ({ code, regions }) => + code.startsWith('snapshot.consumption') && + regions.find(({ name }) => name === instance.region), + )?.code + ] ?? catalog['snapshot.consumption.LZ'], + ) : get( catalog, `snapshot.monthly.postpaid.${instance.region}`, @@ -546,7 +554,10 @@ export default class PciProjectInstanceService { }); } - getProductAvailability(projectId, ovhSubsidiary) { + getProductAvailability( + projectId, + ovhSubsidiary = this.coreConfig.getUser().ovhSubsidiary, + ) { return this.$http .get(`/cloud/project/${projectId}/capabilities/productAvailability`, { params: {