Added transaction export test
MODIFY
src/server/rest/v1/router/api/TransactionRouter.ts
src/server/rest/v1/router/api/TransactionRouter.ts
@@ -136,7 +136,7 @@ export default class TransactionRouter {
}
protected buildRouteTransactionsRefundReports(): void {
- this.router.post(`/${ServerRoute.REST_TRANSACTIONS_REFUND_REPORTS}`, async (req: Request, res: Response, next: NextFunction) => {
+ this.router.get(`/${ServerRoute.REST_TRANSACTIONS_REFUND_REPORTS}`, async (req: Request, res: Response, next: NextFunction) => {
await RouterUtils.handleServerAction(TransactionService.handleGetRefundReports.bind(this), ServerAction.TRANSACTIONS_TO_REFUND_REPORTS, req, res, next);
});
}

MODIFY
test/api/TransactionCommonTests.ts
test/api/TransactionCommonTests.ts
@@ -1373,4 +1373,14 @@ export default class TransactionCommonTests {
expect(response.data).not.null;
expect(responseFileArray.length).to.be.eql(transactionsToRefund.data.result.length);
}
+
+ public async testExportTransactions(params) {
+ const response = await this.centralUserService.transactionApi.exportTransactions(params);
+ const transactions = await this.centralUserService.transactionApi.readAllCompleted(params);
+ const responseFileArray = TestUtils.convertExportFileToObjectArray(response.data);
+
+ expect(response.status).eq(StatusCodes.OK);
+ expect(response.data).not.null;
+ expect(responseFileArray.length).to.be.eql(transactions.data.result.length);
+ }
}

MODIFY
test/api/TransactionTest.ts
test/api/TransactionTest.ts
@@ -726,6 +726,11 @@ describe('Transaction', function() {
});
+ describe('Using function "exportTransactions"', () => {
+ it('Should export completed transactions', async () => {
+ await testData.transactionCommonTests.testExportTransactions({});
+ });
+ });
});
describe('Where admin user', () => {

MODIFY
test/api/client/TransactionApi.ts
test/api/client/TransactionApi.ts
@@ -57,4 +57,8 @@ export default class TransactionApi extends CrudApi {
return await super.read(params, this.buildRestEndpointUrl(ServerRoute.REST_TRANSACTIONS_REFUND_EXPORT));
}
+ public async exportTransactions(params) {
+ return await super.read(params, this.buildRestEndpointUrl(ServerRoute.REST_TRANSACTIONS_EXPORT));
+ }
+
}

Added transaction export test