Fixed naming in billing
MODIFY
src/server/rest/CentralRestServerService.ts
src/server/rest/CentralRestServerService.ts
@@ -148,7 +148,6 @@ class RequestMapper {
[ServerAction.USERS_IN_ERROR]: UserService.handleGetUsersInError.bind(this),
[ServerAction.USER_IMAGE]: UserService.handleGetUserImage.bind(this),
[ServerAction.USER]: UserService.handleGetUser.bind(this),
- [ServerAction.USER_INVOICE]: UserService.handleGetUserInvoice.bind(this),
[ServerAction.NOTIFICATIONS]: NotificationService.handleGetNotifications.bind(this),
[ServerAction.TRANSACTIONS_COMPLETED]: TransactionService.handleGetTransactionsCompleted.bind(this),
[ServerAction.TRANSACTIONS_TO_REFUND]: TransactionService.handleGetTransactionsToRefund.bind(this),
@@ -181,6 +180,7 @@ class RequestMapper {
[ServerAction.CHECK_BILLING_CONNECTION]: BillingService.handleCheckBillingConnection.bind(this),
[ServerAction.BILLING_TAXES]: BillingService.handleGetBillingTaxes.bind(this),
[ServerAction.BILLING_USER_INVOICES]: BillingService.handleGetUserInvoices.bind(this),
+ [ServerAction.BILLING_USER_INVOICE]: UserService.handleGetUserInvoice.bind(this),
[ServerAction.OCPI_ENDPOINTS]: OCPIEndpointService.handleGetOcpiEndpoints.bind(this),
[ServerAction.OCPI_ENDPOINT]: OCPIEndpointService.handleGetOcpiEndpoint.bind(this),
[ServerAction.INTEGRATION_CONNECTIONS]: ConnectionService.handleGetConnections.bind(this),

MODIFY
src/server/rest/service/security/BillingSecurity.ts
src/server/rest/service/security/BillingSecurity.ts
@@ -7,6 +7,7 @@ import { HttpBillingInvoiceRequest } from '../../../../types/requests/HttpBillin
import UserToken from '../../../../types/UserToken';
import UtilsSecurity from './UtilsSecurity';
import sanitize from 'mongo-sanitize';
+import UserSecurity from './UserSecurity';
export default class BillingSecurity {
static filterTaxesResponse(taxes: BillingTax[], loggedUser: UserToken): BillingTax[] {
@@ -63,14 +64,13 @@ export default class BillingSecurity {
// Check auth
if (Authorizations.canReadInvoicesBilling(loggedUser)) {
// Set only necessary info
- filteredInvoice.user = invoice.user;
+ filteredInvoice.user = UserSecurity.filterMinimalUserResponse(invoice.user, loggedUser);
filteredInvoice.invoiceID = invoice.invoiceID;
filteredInvoice.number = invoice.number;
filteredInvoice.status = invoice.status;
filteredInvoice.amount = invoice.amount;
filteredInvoice.createdOn = invoice.createdOn;
filteredInvoice.currency = invoice.currency;
- filteredInvoice.customerID = invoice.customerID;
}
return filteredInvoice;
}

MODIFY
src/types/Server.ts
src/types/Server.ts
@@ -316,8 +316,6 @@ export enum ServerAction {
REFUND = 'Refund',
USER_READ = 'UserRead',
- USER_INVOICE = 'UserInvoice',
- USER_INVOICES = 'UserInvoices',
USER_CREATE = 'UserCreate',
USER_DELETE = 'UserDelete',
USER_UPDATE = 'UserUpdate',
@@ -342,6 +340,7 @@ export enum ServerAction {
CHECK_BILLING_CONNECTION = 'CheckBillingConnection',
BILLING_TAXES = 'BillingTaxes',
BILLING_USER_INVOICES = 'BillingUserInvoices',
+ BILLING_USER_INVOICE = 'BillingUserInvoice',
BILLING_SYNCHRONIZE_INVOICES = 'BillingSynchronizeInvoices',
BILLING_FORCE_SYNCHRONIZE_USER_INVOICES = 'BillingForceSynchronizeUserInvoices',

Fixed naming in billing