Skip to content

Commit

Permalink
fix(pci.instances): use productAvailability to get snapshot price (#1…
Browse files Browse the repository at this point in the history
…3827)

ref: TAPC-2070

Signed-off-by: Yann Lojewski <[email protected]>
  • Loading branch information
y4nnL authored Oct 31, 2024
1 parent d217168 commit c99648a
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit c99648a

Please sign in to comment.