Align admin optional-services billing UI with runtimes and bill RAM proportionally.

Split optional pricing vs deploy defaults and move custom domain to its own card; parse Mi as decimal GB so fractional memory scales linearly with per-GB rates. Deploy wizard hides env and optional services for WordPress and sanitizes create payloads.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-16 00:39:37 +03:30
parent 3a4fffcec4
commit 67b41ae311
4 changed files with 253 additions and 157 deletions
@@ -76,6 +76,29 @@ describe('PricingCatalogService', () => {
expect(service.parseCpuToCores('2')).toBe(2);
});
it('parses memory Mi to decimal GB for proportional billing (500Mi = 0.5 GB)', () => {
expect(service.parseMemoryToGb('500Mi')).toBe(0.5);
expect(service.parseMemoryToGb('1000Mi')).toBe(1);
expect(service.parseMemoryToGb('1Gi')).toBe(1);
});
it('bills memory proportional to decimal GB (500Mi at half the per-GB monthly rate)', () => {
const rates = [
{
runtime: AppRuntime.NODEJS,
resourceType: PricingResourceType.MEMORY_PER_GB,
hourlyPrice: 0,
monthlyPrice: 10_000,
yearlyPrice: 0,
isActive: true,
},
] as PricingRate[];
const dto = { ...baseDto(), memoryLimit: '500Mi' };
const result = service.computeTotalsWithRates(dto, rates, emptyOptional());
expect(result.monthly).toBe(5000);
});
it('computes CPU line with cycle-native prices (no conversion)', () => {
const rates = [
{