bp - adapt tests
MODIFY
src/assets/server/rest/v1/docs/e-mobility-oas.json
src/assets/server/rest/v1/docs/e-mobility-oas.json
"transferAmount": {
"type": "number"
},
- "platformFeeData": {
- "type": "object",
- "properties": {
- "taxExternalID": {
- "type": "string"
- },
- "feeAmount": {
- "type": "number"
- },
- "feeTaxAmount": {
- "type": "number"
- },
- "invoiceExternalID": {
- "type": "string"
- }
- }
- },
"transferExternalID": {
"type": "string"
}

MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -490,7 +490,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
attributes: [
'id', 'status', 'createdOn', 'sessions', 'totalAmount', 'transferAmount', 'accountID', 'transferExternalID',
'account.businessOwnerID', 'account.accountExternalID', 'businessOwner.name', 'businessOwner.firstName',
- 'platformFeeData.feeAmount', 'platformFeeData.feeTaxAmount', 'platformFeeData.invoiceExternalID', 'platformFeeData.taxExternalID', 'currency'
+ 'platformFeeData.feeAmount', 'platformFeeData.feeTaxAmount', 'currency'
]
},
{ resource: Entity.TAX, action: [Action.LIST] },

MODIFY
src/storage/mongodb/BillingStorage.ts
src/storage/mongodb/BillingStorage.ts
@@ -360,10 +360,8 @@ export default class BillingStorage {
};
if (transfer.platformFeeData) {
transferMDB.platformFeeData = {
- taxExternalID: transfer.platformFeeData.taxExternalID,
feeAmount: transfer.platformFeeData.feeAmount,
feeTaxAmount: transfer.platformFeeData.feeTaxAmount,
- invoiceExternalID: transfer.platformFeeData.invoiceExternalID
};
}
if (transfer.invoice) {

MODIFY
src/types/Billing.ts
src/types/Billing.ts
@@ -187,10 +187,8 @@ export enum BillingTransferStatus {
}
export interface BillingPlatformFeeData {
- taxExternalID: string; // Tax to apply on the platform fee
feeAmount: number;
feeTaxAmount: number;
- invoiceExternalID?: string; // Invoice sent to the CPO
}
export interface BillingAccountSessionFee extends BillingPlatformFeeStrategy {

MODIFY
test/api/BillingPlatformTest.ts
test/api/BillingPlatformTest.ts
@@ -331,7 +331,7 @@ describeif(isBillingProperlyConfigured)('Billing', () => {
expect(finalizedTransfer.status).to.eq(BillingTransferStatus.FINALIZED);
});
- it('should not finalize not draft transfer', async () => {
+ it('should not finalize a draft transfer', async () => {
const transfer = BillingTransferFactory.build();
transfer.status = BillingTransferStatus.FINALIZED;
const transferID = await BillingStorage.saveTransfer(billingTestHelper.tenantContext.getTenant(), transfer);

MODIFY
test/factories/BillingFactory.ts
test/factories/BillingFactory.ts
@@ -8,12 +8,10 @@ export const BillingTransferFactory = Factory.define<BillingTransfer>('billingtr
.attr('accountID', () => faker.datatype.hexaDecimal(24).substring(2).toLowerCase())
.attr('status', () => faker.random.arrayElement([BillingTransferStatus.DRAFT, BillingTransferStatus.PENDING, BillingTransferStatus.FINALIZED, BillingTransferStatus.TRANSFERRED]))
.attr('transferAmount', () => faker.datatype.number())
- .attr('transferExternalID', () => faker.datatype.uuid())
+ .attr('transferExternalID', () => null)
.attr('platformFeeData', () => ({
- feeAmount: faker.datatype.number(),
- feeTaxAmount: faker.datatype.number(),
- taxExternalID: faker.datatype.uuid(),
- invoiceExternalID: faker.datatype.uuid(),
+ feeAmount: 0,
+ feeTaxAmount: 0
}))
.attr('sessions', () =>
[BillingTransferSessionFactory.build()])
@@ -23,18 +21,18 @@ export const BillingTransferSessionFactory = Factory.define<BillingTransferSessi
.attr('transactionID', () => faker.datatype.number())
.attr('amount', () => faker.datatype.number())
.attr('accountSessionFee', () => ({
- flatFeePerSession: faker.datatype.number(),
- percentage: faker.datatype.number(),
- taxExternalID: faker.datatype.string(),
- feeAmount: faker.datatype.number()
+ flatFeePerSession: 0.5,
+ percentage: 3,
+ taxExternalID: null,
+ feeAmount: 0
}));
export const BillingPlatformFeeStrategyFactory = Factory.define<BillingPlatformFeeStrategy>('billingplatformfeestrategy')
- .attr('flatFeePerSession', () => faker.datatype.number())
- .attr('percentage', () => faker.datatype.number());
+ .attr('flatFeePerSession', () => 0.5)
+ .attr('percentage', () => 3);
export const BillingPlatformSessionFeeFactory = Factory.define<BillingAccountSessionFee>('billingaccountSessionFee')
- .attr('flatFeePerSession', () => faker.datatype.number())
- .attr('percentage', () => faker.datatype.number())
- .attr('taxExternalID', () => faker.datatype.string())
- .attr('feeAmount', () => faker.datatype.number());
+ .attr('flatFeePerSession', 0.5)
+ .attr('percentage', 3)
+ .attr('taxExternalID', null)
+ .attr('feeAmount', 0);

bp - adapt tests