modified customer response, enabled create product through API

This commit is contained in:
John Yeo
2025-04-17 19:08:53 +01:00
parent ffa5009960
commit db87d7b748
29 changed files with 240 additions and 208 deletions

View File

@@ -21,14 +21,14 @@ let pro = {
prepaid: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 50,
amount: 10,
price: 10,
interval: BillingInterval.Month,
usage_model: UsageModel.Prepaid,
}),
payPerUse: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 0,
amount: 0.5,
price: 0.5,
interval: BillingInterval.Month,
usage_model: UsageModel.PayPerUse,
}),
@@ -43,7 +43,7 @@ let premium = {
prepaid: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 100,
amount: 15,
price: 15,
interval: BillingInterval.Month,
usage_model: UsageModel.Prepaid,
}),
@@ -52,7 +52,7 @@ let premium = {
payPerUse: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 0,
amount: 1,
price: 1,
interval: BillingInterval.Month,
usage_model: UsageModel.PayPerUse,
}),
@@ -227,10 +227,10 @@ describe(`${chalk.yellowBright(
// 2. Let invoices[0] be value * pro pay per use price
let invoice1Amount =
(premium.items.prepaid.amount ?? 0) * prepaidQuantity -
(pro.items.prepaid.amount ?? 0) * prepaidQuantity;
(premium.items.prepaid.price ?? 0) * prepaidQuantity -
(pro.items.prepaid.price ?? 0) * prepaidQuantity;
let invoice0Amount = value * (pro.items.payPerUse.amount ?? 0);
let invoice0Amount = value * (pro.items.payPerUse.price ?? 0);
expect(invoices[1].total).to.equal(invoice1Amount);
expect(invoices[0].total).to.equal(invoice0Amount);

View File

@@ -37,7 +37,7 @@ let pro = {
payPerUse: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 0,
amount: 0.5,
price: 0.5,
interval: BillingInterval.Month,
usage_model: UsageModel.PayPerUse,
}),
@@ -61,7 +61,7 @@ let premium = {
payPerUse: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 0,
amount: 1,
price: 1,
interval: BillingInterval.Month,
usage_model: UsageModel.PayPerUse,
}),
@@ -209,7 +209,7 @@ describe(`${chalk.yellowBright(
// 1. Let invoices[1] be 10 * premium prepaid price - pro prepaid price
// 2. Let invoices[0] be value * pro pay per use price
let invoice0Amount = value * (pro.items.payPerUse.amount ?? 0);
let invoice0Amount = value * (pro.items.payPerUse.price ?? 0);
expect(invoices[0].total).to.equal(invoice0Amount);
expect(lifetimeCusEnt).to.not.exist;

View File

@@ -43,7 +43,7 @@ let pro = {
payPerUse: constructFeaturePriceItem({
feature_id: features.metered1.id,
included_usage: 0,
amount: 0.5,
price: 0.5,
interval: BillingInterval.Month,
usage_model: UsageModel.PayPerUse,
}),