activate dign purchase after invoice payment
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled
Build and Deploy Docker Images / build_and_deploy (push) Has been cancelled
This commit is contained in:
@@ -224,6 +224,38 @@ export class DPageService {
|
|||||||
throw error;
|
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);
|
await this.addNotifyForWalletDeduction(invoice, user, userWallet, WalletMessage.SUPPORT_PLAN_WALLET_TRANSFER);
|
||||||
//
|
//
|
||||||
} else if (invoice.isExternal) {
|
} 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
|
// call dpage api
|
||||||
const businessId = invoice.externalBusinessId
|
const businessId = invoice.externalBusinessId
|
||||||
if (!businessId) {
|
if (!businessId) {
|
||||||
@@ -1475,7 +1477,7 @@ export class InvoicesService {
|
|||||||
//*********************************** */
|
//*********************************** */
|
||||||
|
|
||||||
async findInvoicesByCustomerIds(custmerIds: string[], query: SearchResellerInvoicesQueryDto) {
|
async findInvoicesByCustomerIds(custmerIds: string[], query: SearchResellerInvoicesQueryDto) {
|
||||||
|
|
||||||
return this.invoiceRepository.findPaginatedListByUserIds(query, custmerIds)
|
return this.invoiceRepository.findPaginatedListByUserIds(query, custmerIds)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user