activate dign purchase after invoice payment
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-06-07 16:01:54 +03:30
parent 3bdb303101
commit 9e65be2c58
2 changed files with 36 additions and 2 deletions
+32
View File
@@ -224,6 +224,38 @@ export class DPageService {
throw error;
}
}
async finishPurchaseDesign(businessId: string, invoiceId: string) {
try {
const { data } = await firstValueFrom(
this.httpService
.post(`${this.config.baseUrl}/super-admin/design-request/finish`, {
businessId,
invoiceId
}, {
headers: this.getHeaders(),
})
.pipe(
catchError((err: AxiosError) => {
this.logger.error(`Failed to perform finish request design purchase: ${err.message}`, err.stack);
return throwError(() => err);
}),
),
);
return data;
} catch (error: unknown) {
if (error instanceof AxiosError && error.response) {
this.logger.error(`External API error response:`, error.response.data);
const errorResponse = {
...error.response.data,
message: error.response.data.error?.message || error.message,
};
throw new HttpException(errorResponse, error.response.status);
}
this.logger.error(`Error performing to finish purchase catalogue: ${error instanceof Error ? error.message : "Unknown error"}`);
throw error;
}
}
}
@@ -948,7 +948,9 @@ export class InvoicesService {
await this.addNotifyForWalletDeduction(invoice, user, userWallet, WalletMessage.SUPPORT_PLAN_WALLET_TRANSFER);
//
} else if (invoice.isExternal) {
if (invoice.items[0]?.name == 'purchase_new_catalogue') {
if (invoice.items[0]?.name == 'purchase_design') {
this.dpageService.finishPurchaseDesign(invoice.externalBusinessId!, invoice.id)
} else if (invoice.items[0]?.name == 'purchase_new_catalogue') {
// call dpage api
const businessId = invoice.externalBusinessId
if (!businessId) {