bp - rename action
MODIFY
src/authorization/AuthorizationsDefinition.ts
src/authorization/AuthorizationsDefinition.ts
@@ -478,7 +478,7 @@ export const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
{ resource: Entity.BILLING, action: [Action.CHECK_CONNECTION, Action.CLEAR_BILLING_TEST_DATA] },
{
resource: Entity.BILLING_ACCOUNT,
- action: [Action.LIST, Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE, Action.BILLING_ONBOARD_SUB_ACCOUNT],
+ action: [Action.LIST, Action.CREATE, Action.READ, Action.UPDATE, Action.DELETE, Action.BILLING_ONBOARD_ACCOUNT],
attributes: [
'id', 'accountExternalID', 'businessOwnerID', 'user.id', 'user.firstName', 'user.lastName', 'user.email', 'status'
]

MODIFY
src/notification/remote-push-notification/RemotePushNotificationTask.ts
src/notification/remote-push-notification/RemotePushNotificationTask.ts
@@ -349,7 +349,7 @@ export default class RemotePushNotificationTask implements NotificationTask {
const body = i18nManager.translate('notifications.billingAccountCreationLink.body',
{ onboardingLink: data.onboardingLink, tenantName: tenant.name });
// Send Notification
- return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.BILLING_CREATE_SUB_ACCOUNT,
+ return this.sendRemotePushNotificationToUser(tenant, UserNotificationType.BILLING_CREATE_ACCOUNT,
title, body, user, { 'onboardingLink': data.onboardingLink }, severity);
}

MODIFY
src/server/rest/v1/service/BillingService.ts
src/server/rest/v1/service/BillingService.ts
@@ -503,7 +503,7 @@ export default class BillingService {
billingAccount.businessOwnerID = user.id;
// Save the sub account
billingAccount.id = await BillingStorage.saveAccount(req.tenant, billingAccount);
- res.status(StatusCodes.CREATED).json(billingAccount);
+ res.status(StatusCodes.CREATED).json(Object.assign(billingAccount, Constants.REST_RESPONSE_SUCCESS));
next();
}
@@ -530,7 +530,7 @@ export default class BillingService {
// Notify the user
void NotificationHandler.sendBillingAccountActivationNotification(
req.tenant, Utils.generateUUID(), user, { evseDashboardURL: Utils.buildEvseURL(req.tenant.subdomain), user });
- res.status(StatusCodes.OK).json(billingAccount);
+ res.status(StatusCodes.OK).json(Object.assign(billingAccount, Constants.REST_RESPONSE_SUCCESS));
next();
}
@@ -577,10 +577,10 @@ export default class BillingService {
public static async handleOnboardAccount(action: ServerAction, req: Request, res: Response, next: NextFunction): Promise<void> {
// Check if component is active
UtilsService.assertComponentIsActiveFromToken(req.user, TenantComponents.BILLING_PLATFORM,
- Action.BILLING_ONBOARD_SUB_ACCOUNT, Entity.BILLING_ACCOUNT, MODULE_NAME, 'handleOnboardAccount');
+ Action.BILLING_ONBOARD_ACCOUNT, Entity.BILLING_ACCOUNT, MODULE_NAME, 'handleOnboardAccount');
const filteredRequest = BillingValidatorRest.getInstance().validateBillingAccountGetReq(req.params);
// Check authorization
- await AuthorizationService.checkAndGetBillingAccountAuthorizations(req.tenant, req.user, filteredRequest, Action.BILLING_ONBOARD_SUB_ACCOUNT);
+ await AuthorizationService.checkAndGetBillingAccountAuthorizations(req.tenant, req.user, filteredRequest, Action.BILLING_ONBOARD_ACCOUNT);
const billingAccount = await BillingStorage.getAccountByID(req.tenant, filteredRequest.ID);
UtilsService.assertObjectExists(action, billingAccount, `Sub account ID '${filteredRequest.ID}' does not exist`, MODULE_NAME, 'handleOnboardAccount', req.user);
// Check if the sub account onboarding is already sent
@@ -602,7 +602,7 @@ export default class BillingService {
// Notify the user
void NotificationHandler.sendBillingAccountCreationLink(
req.tenant, Utils.generateUUID(), user, { onboardingLink: billingAccount.activationLink, evseDashboardURL: Utils.buildEvseURL(req.tenant.subdomain), user });
- res.status(StatusCodes.OK).json(billingAccount);
+ res.status(StatusCodes.OK).json(Object.assign(billingAccount, Constants.REST_RESPONSE_SUCCESS));
next();
}

MODIFY
src/types/Authorization.ts
src/types/Authorization.ts
@@ -138,8 +138,8 @@ export enum Action {
BILLING_PAYMENT_METHODS = 'BillingPaymentMethods',
BILLING_DELETE_PAYMENT_METHOD = 'BillingDeletePaymentMethod',
BILLING_CHARGE_INVOICE = 'BillingChargeInvoice',
- BILLING_ACTIVATE_SUB_ACCOUNT = 'BillingAccountActivate',
- BILLING_ONBOARD_SUB_ACCOUNT = 'BillingAccountOnboard',
+ BILLING_ACTIVATE_ACCOUNT = 'BillingAccountActivate',
+ BILLING_ONBOARD_ACCOUNT = 'BillingAccountOnboard',
BILLING_FINALIZE_TRANSFER = 'BillingFinalizeTransfer',
BILLING_SEND_TRANSFER = 'BillingSendTransfer',
CHECK_CONNECTION = 'CheckConnection',

MODIFY
src/types/UserNotifications.ts
src/types/UserNotifications.ts
@@ -71,7 +71,7 @@ export enum UserNotificationType {
BILLING_INVOICE_SYNCHRONIZATION_FAILED = 'BillingInvoiceSynchronizationFailed',
BILLING_PERIODIC_OPERATION_FAILED = 'BillingPeriodicOperationFailed',
BILLING_NEW_INVOICE = 'BillingNewInvoice',
- BILLING_CREATE_SUB_ACCOUNT = 'BillingAccountCreate',
+ BILLING_CREATE_ACCOUNT = 'BillingAccountCreate',
BILLING_ACCOUNT_ACTIVATED = 'BillingAccountActivated',
CAR_CATALOG_SYNCHRONIZATION_FAILED = 'CarCatalogSynchronizationFailed',
CHECK_AND_APPLY_SMART_CHARGING_FAILED = 'ComputeAndApplyChargingProfilesFailed',

MODIFY
test/api/BillingPlatformTest.ts
test/api/BillingPlatformTest.ts
@@ -55,7 +55,7 @@ describeif(isBillingProperlyConfigured)('Billing', () => {
await billingTestHelper.initChargingStationContext2TestChargingTime();
});
- xit('should create an invoice, and get transfers generated', async () => {
+ it('should create an invoice, and get transfers generated', async () => {
// -------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------
// -------------------------------------------------------------------------------------------------------------
@@ -94,6 +94,7 @@ describeif(isBillingProperlyConfigured)('Billing', () => {
const nbDraftInvoices = await billingTestHelper.checkForDraftInvoices();
assert(nbDraftInvoices === 0, 'The expected number of DRAFT invoices is not correct');
});
+ });
describe('Sub accounts', () => {
it('should create a sub account', async () => {
@@ -423,8 +424,6 @@ describeif(isBillingProperlyConfigured)('Billing', () => {
});
});
- });
-
// describe('Billing Test Data Cleanup (utbilling)', () => {
// beforeAll(async () => {
// await stripeTestHelper.initialize();

bp - rename action