mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Refactor billing unit names and remove debugger statements
This commit is contained in:
@@ -85,7 +85,6 @@ export default class BaseAnalyticsAPI<
|
||||
next: NextFunction
|
||||
) => {
|
||||
try {
|
||||
debugger;
|
||||
await this.getList(req, res);
|
||||
} catch (err) {
|
||||
next(err);
|
||||
|
||||
@@ -892,7 +892,7 @@ export class BillingService extends BaseService {
|
||||
priceId: this.getMeteredPlanPriceId(data.productType),
|
||||
pricePerUnitInUSD:
|
||||
0.1 * dataRetentionDays * dataRetentionMultiplier,
|
||||
unitName: `per GB for ${dataRetentionDays} days data retention.`,
|
||||
unitName: `GB (${dataRetentionDays} days data retention)`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -901,7 +901,7 @@ export class BillingService extends BaseService {
|
||||
priceId: this.getMeteredPlanPriceId(data.productType),
|
||||
pricePerUnitInUSD:
|
||||
0.1 * dataRetentionDays * dataRetentionMultiplier,
|
||||
unitName: `per GB for ${dataRetentionDays} days data retention.`,
|
||||
unitName: `GB (${dataRetentionDays} days data retention)`,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -910,7 +910,7 @@ export class BillingService extends BaseService {
|
||||
priceId: this.getMeteredPlanPriceId(data.productType),
|
||||
pricePerUnitInUSD:
|
||||
0.1 * dataRetentionDays * dataRetentionMultiplier,
|
||||
unitName: `per GB for ${dataRetentionDays} days data retention.`,
|
||||
unitName: `GB (${dataRetentionDays} days data retention)`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ export class Service extends DatabaseService<Model> {
|
||||
productType: ProductType;
|
||||
usageCount: number;
|
||||
}): Promise<void> {
|
||||
|
||||
const serverMeteredPlan: ServerMeteredPlan =
|
||||
MeteredPlanUtil.getServerMeteredPlanByProductType(data.productType);
|
||||
|
||||
|
||||
@@ -24,8 +24,11 @@ export default class ServerMeteredPlan {
|
||||
return meteredPlan.getPricePerUnit() * quantity;
|
||||
}
|
||||
|
||||
public async getMeteredPlan(_projectId: ObjectID): Promise<MeteredPlan> {
|
||||
throw new NotImplementedException();
|
||||
public async getMeteredPlan(projectId: ObjectID): Promise<MeteredPlan> {
|
||||
return await BillingService.getMeteredPlan({
|
||||
projectId: projectId,
|
||||
productType: this.getProductType(),
|
||||
});
|
||||
}
|
||||
|
||||
public async reportQuantityToBillingProvider(
|
||||
|
||||
@@ -48,8 +48,6 @@ export class Statement implements BaseQueryParams {
|
||||
|
||||
public get query_params(): Record<string, unknown> {
|
||||
|
||||
debugger;
|
||||
|
||||
return Object.fromEntries(
|
||||
this.values.map((v: StatementParameter | string, i: integer) => {
|
||||
let finalValue: any = v;
|
||||
|
||||
@@ -153,7 +153,6 @@ router.use(
|
||||
);
|
||||
|
||||
// report to Usage Service.
|
||||
|
||||
UsageBillingService.updateUsageBilling({
|
||||
projectId: (req as OtelRequest).projectId,
|
||||
productType: productType,
|
||||
|
||||
@@ -169,7 +169,7 @@ export default class UsageBilling extends AccessControlModel {
|
||||
})
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: ColumnType.Number,
|
||||
type: ColumnType.Decimal,
|
||||
})
|
||||
public usageCount?: number = undefined;
|
||||
|
||||
@@ -215,7 +215,7 @@ export default class UsageBilling extends AccessControlModel {
|
||||
})
|
||||
@Column({
|
||||
nullable: false,
|
||||
type: ColumnType.Number,
|
||||
type: ColumnType.Decimal,
|
||||
})
|
||||
public totalCostInUSD?: number = undefined;
|
||||
|
||||
|
||||
@@ -17,8 +17,11 @@ import Sleep from 'Common/Types/Sleep';
|
||||
|
||||
RunCron(
|
||||
'MeteredPlan:ReportTelemetryMeteredPlan',
|
||||
{ schedule: IsDevelopment ? EVERY_MINUTE : EVERY_DAY, runOnStartup: false },
|
||||
{ schedule: IsDevelopment ? EVERY_MINUTE : EVERY_DAY, runOnStartup: true },
|
||||
async () => {
|
||||
|
||||
debugger;
|
||||
|
||||
if (!IsBillingEnabled) {
|
||||
logger.info(
|
||||
'MeteredPlan:ReportTelemetryMeteredPlan Billing is not enabled. Skipping job.'
|
||||
|
||||
Reference in New Issue
Block a user