billing - item description per dimension - 1st step
MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -1069,7 +1069,8 @@ export default class StripeBillingIntegration extends BillingIntegration {
// Destructuring transaction.stop
const transactionID = transaction.id;
const { price, priceUnit, roundedPrice, totalConsumptionWh, timestamp } = transaction.stop;
- const description = this.buildLineItemDescription(transaction);
+ // TODO - we need a description per dimension type
+ const itemDescription = this.buildLineItemDescription(transaction);
// -------------------------------------------------------------------------------
// ACHTUNG - STRIPE expects the amount and prices in CENTS!
// -------------------------------------------------------------------------------
@@ -1080,11 +1081,12 @@ export default class StripeBillingIntegration extends BillingIntegration {
const taxes = this.getTaxRateIds(); // TODO - take into account SITE settings
// Build a billing invoice item based on the transaction
const billingInvoiceItem: BillingInvoiceItem = {
- description,
+ description: itemDescription,
transactionID,
effectivePricing: {
currency,
energy: {
+ itemDescription,
amount,
quantity
}

MODIFY
src/types/Pricing.ts
src/types/Pricing.ts
@@ -54,7 +54,6 @@ export enum DayOfWeek {
// }
export interface EffectivePricing {
- // description: string,
currency: string,
// pricingSource: EffectivePricingData;
flatFee?: EffectivePricingData,
@@ -64,11 +63,14 @@ export interface EffectivePricing {
}
export interface EffectivePricingData {
+ itemDescription: string,
amount: number;
quantity: number;
cumulatedAmount?: number;
roundedAmount?: number;
}
+
+// TODO - to be removed - current interface exposed by the pricing integration layer
export interface PricedConsumption {
amount: number;
cumulatedAmount: number;

MODIFY
test/api/BillingStripeTestData.ts
test/api/BillingStripeTestData.ts
@@ -253,9 +253,10 @@ export default class StripeIntegrationTestData {
assert(this.billingUser, 'Billing user cannot be null');
const price = amount / quantity;
+ const itemDescription = `Stripe Integration - ${quantity} kWh * ${price} Eur`;
// array of tax ids to apply to the line item
const invoiceItem:BillingInvoiceItem = {
- description: `Stripe Integration - ${quantity} kWh * ${price} Eur`,
+ description: itemDescription,
transactionID: 777,
// pricingData: {
// quantity, // kW.h
@@ -265,6 +266,7 @@ export default class StripeIntegrationTestData {
effectivePricing: {
currency: 'EUR',
energy: {
+ itemDescription,
amount, // total amount to bill - not yet in cents
quantity, // kW.h
}

billing - item description per dimension - 1st step