billing test - download document via new endpoint
MODIFY
test/api/BillingStripeTestData.ts
test/api/BillingStripeTestData.ts
@@ -232,7 +232,7 @@ export default class StripeIntegrationTestData {
// Stripe is using Unix Epoch for its date - and looses some precision
const lastPaidInvoiceDateTime = Utils.createDecimal(new Date(lastPaidInvoice.createdOn).getTime()).div(1000).trunc().toNumber();
expect(lastPaidInvoiceDateTime).to.be.gte(beforeInvoiceDateTime);
- const downloadResponse = await this.adminUserService.billingApi.downloadInvoiceDocument({ ID: lastPaidInvoice.id });
+ const downloadResponse = await this.adminUserService.billingApi.downloadInvoiceDocument({ invoiceID: lastPaidInvoice.id });
expect(downloadResponse.headers['content-type']).to.be.eq('application/pdf');
// User should not have any DRAFT invoices
const nbDraftInvoice:number = await this.checkForDraftInvoices(this.dynamicUser.id, 0);
@@ -312,7 +312,7 @@ export default class StripeIntegrationTestData {
public async checkDownloadInvoiceAsPdf(userId: string) : Promise<void> {
const paidInvoices = await this.getInvoicesByState(userId, BillingInvoiceStatus.PAID);
assert(paidInvoices, 'User should have at least a paid invoice');
- const downloadResponse = await this.adminUserService.billingApi.downloadInvoiceDocument({ ID: paidInvoices[0].id });
+ const downloadResponse = await this.adminUserService.billingApi.downloadInvoiceDocument({ invoiceID: paidInvoices[0].id });
expect(downloadResponse.headers['content-type']).to.be.eq('application/pdf');
}

MODIFY
test/api/client/BillingApi.ts
test/api/client/BillingApi.ts
@@ -29,22 +29,22 @@ export default class BillingApi extends CrudApi {
}
public async downloadInvoiceDocument(params?) {
- return await super.read(params, '/client/api/BillingDownloadInvoice');
+ return await super.read(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_DOWNLOAD_INVOICE, params));
}
public async getBillingSetting(params?) {
- return await super.read(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_SETTING));
+ return await super.read(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_SETTING, params));
}
public async checkBillingConnection(params?) {
- return await super.create(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_CHECK));
+ return await super.create(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_CHECK, params));
}
public async updateBillingSetting(params?) {
- return await super.update(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_SETTING));
+ return await super.update(params, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_SETTING, params));
}
public async readInvoices(params, paging = TestConstants.DEFAULT_PAGING, ordering = TestConstants.DEFAULT_ORDERING) {
- return super.readAll(params, paging, ordering, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_INVOICES));
+ return super.readAll(params, paging, ordering, super.buildRestEndpointUrl(ServerRoute.REST_BILLING_INVOICES, params));
}
}

billing test - download document via new endpoint