Skip to content

Commit d0ba254

Browse files
committed
numberOfSeats
1 parent f23e16f commit d0ba254

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

services/static-webserver/client/source/class/osparc/store/Pricing.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ qx.Class.define("osparc.store.Pricing", {
106106
return this.pricingPlansCached.find(f => f.getPricingPlanId() === pricingPlanId);
107107
},
108108

109+
getPricingUnits: function(pricingPlanId) {
110+
const pricingPlan = this.getPricingPlan(pricingPlanId);
111+
if (pricingPlan) {
112+
return pricingPlan.getPricingUnits();
113+
}
114+
return null;
115+
},
116+
117+
getPricingUnit: function(pricingPlanId, pricingUnitId) {
118+
const pricingPlan = this.getPricingPlan(pricingPlanId);
119+
if (pricingPlan) {
120+
return pricingPlan.getPricingUnits().find(pricingUnit => pricingUnit.getPricingUnitId() === pricingUnitId);
121+
}
122+
return null;
123+
},
124+
109125
__addToCache: function(pricingPlanData) {
110126
let pricingPlan = this.pricingPlansCached.find(f => f.getPricingPlanId() === pricingPlanData["pricingPlanId"]);
111127
if (pricingPlan) {

services/static-webserver/client/source/class/osparc/vipMarket/VipMarket.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
250250
pricingPlanId,
251251
pricingUnitId,
252252
} = e.getData();
253+
let numberOfSeats = null;
254+
const pricingUnit = osparc.store.Pricing.getInstance().getPricingUnit(pricingPlanId, pricingUnitId);
255+
if (pricingUnit) {
256+
const split = pricingUnit.getName().split(" ");
257+
numberOfSeats = parseInt(split[0]);
258+
}
253259
const params = {
254260
url: {
255261
licensedItemId
@@ -258,16 +264,16 @@ qx.Class.define("osparc.vipMarket.VipMarket", {
258264
"wallet_id": walletId,
259265
"pricing_plan_id": pricingPlanId,
260266
"pricing_unit_id": pricingUnitId,
261-
"num_of_seats": 1, // it might not be used
267+
"num_of_seats": numberOfSeats, // this should go away
262268
},
263269
}
264270
osparc.data.Resources.fetch("market", "purchase", params)
265271
.then(() => {
266272
const found = this.__anatomicalModels.find(model => model["ID"] === modelId);
267273
if (found) {
268274
found["purchased"] = {
269-
expiresAt: new Date(),
270-
numberOfSeats: 1,
275+
expiresAt: new Date(), // get this info from the response
276+
numberOfSeats, // get this info from the response
271277
};
272278
this.__populateModels();
273279
anatomicModelDetails.setAnatomicalModelsData(found);

0 commit comments

Comments
 (0)