Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e8e0cba2e | |||
| 3a84740d9a | |||
| cb77a55281 | |||
| 11445f0a07 | |||
| c2a861041f | |||
| 50d9fb2274 | |||
| 2768611a7c | |||
| b1a02d6b0d | |||
| 8b901e4d02 | |||
| 43b4f05894 | |||
| 7bef7d414a | |||
| 30dba5ae37 |
+11
-7
@@ -2,10 +2,14 @@
|
|||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine AS base
|
||||||
|
|
||||||
ENV TZ=Asia/Tehran
|
ENV TZ=Asia/Tehran
|
||||||
|
# Use the public npm registry to avoid paid/unstable mirror outages.
|
||||||
|
ENV NPM_CONFIG_REGISTRY=https://package-mirror.liara.ir/repository/npm
|
||||||
|
|
||||||
# Runflare build hosts cannot reach registry.npmjs.org; use their npm mirror.
|
# Change Alpine repo
|
||||||
# RUN npm install -g pnpm@9.15.9 --registry=https://mirror-npm.runflare.com
|
RUN sed -i 's|https://dl-cdn.alpinelinux.org/alpine|https://mirror.de.velop.ir/alpine|g' /etc/apk/repositories
|
||||||
RUN npm install -g pnpm@9.15.9
|
|
||||||
|
# Install pnpm globally (uses NPM_CONFIG_REGISTRY mirror above).
|
||||||
|
RUN npm install -g pnpm@9.15.9 --registry=https://package-mirror.liara.ir/repository/npm
|
||||||
|
|
||||||
# Stage 2: Install all dependencies (including dev)
|
# Stage 2: Install all dependencies (including dev)
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
@@ -15,9 +19,9 @@ COPY package.json pnpm-lock.yaml ./
|
|||||||
# @nestjs/cli and typescript are required for the build step.
|
# @nestjs/cli and typescript are required for the build step.
|
||||||
ENV NODE_ENV=development
|
ENV NODE_ENV=development
|
||||||
# RUN pnpm install --frozen-lockfile --loglevel info \
|
# RUN pnpm install --frozen-lockfile --loglevel info \
|
||||||
# --registry=https://mirror-npm.runflare.com
|
# --registry=https://package-mirror.liara.ir/repository/npm
|
||||||
|
|
||||||
RUN pnpm install --frozen-lockfile --loglevel info
|
RUN pnpm install --frozen-lockfile --loglevel info --registry=https://package-mirror.liara.ir/repository/npm
|
||||||
|
|
||||||
|
|
||||||
# Stage 3: Build
|
# Stage 3: Build
|
||||||
@@ -32,8 +36,8 @@ FROM base AS prod-deps
|
|||||||
WORKDIR /temp-deps
|
WORKDIR /temp-deps
|
||||||
COPY package.json pnpm-lock.yaml ./
|
COPY package.json pnpm-lock.yaml ./
|
||||||
# RUN pnpm install --prod --frozen-lockfile --loglevel info \
|
# RUN pnpm install --prod --frozen-lockfile --loglevel info \
|
||||||
# --registry=https://mirror-npm.runflare.com
|
# --registry=https://package-mirror.liara.ir/repository/npm
|
||||||
RUN pnpm install --prod --frozen-lockfile --loglevel info
|
RUN pnpm install --prod --frozen-lockfile --loglevel info --registry=https://package-mirror.liara.ir/repository/npm
|
||||||
|
|
||||||
|
|
||||||
# Stage 5: Runner
|
# Stage 5: Runner
|
||||||
|
|||||||
@@ -444,6 +444,46 @@ export class RestaurantService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async finishChargeRequest(invoiceId: string) {
|
||||||
|
this.logger.log(`Finishing charge request for invoice ${invoiceId}`);
|
||||||
|
try {
|
||||||
|
const url = `${this.config.baseUrl}/super-admin/restaurants/charge-request/finish`;
|
||||||
|
const { data } = await firstValueFrom(
|
||||||
|
this.httpService
|
||||||
|
.post(url, { invoiceId }, {
|
||||||
|
headers: this.getHeaders(),
|
||||||
|
})
|
||||||
|
.pipe(
|
||||||
|
catchError((err: AxiosError) => {
|
||||||
|
this.logger.error(
|
||||||
|
`Failed to finish charge request for invoice ${invoiceId}: ${err.message}`,
|
||||||
|
err.stack,
|
||||||
|
);
|
||||||
|
return throwError(() => err);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
this.logger.log(`Successfully finished charge request for invoice ${invoiceId}`);
|
||||||
|
return data;
|
||||||
|
} catch (error: unknown) {
|
||||||
|
if (error instanceof AxiosError && error.response) {
|
||||||
|
this.logger.error(
|
||||||
|
`External API error finishing charge request for invoice ${invoiceId} (status ${error.response.status}):`,
|
||||||
|
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 finishing charge request for invoice ${invoiceId}: ${error instanceof Error ? error.message : "Unknown error"}`,
|
||||||
|
);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async directLogin(userSubscriptionId: string, userId: string) {
|
async directLogin(userSubscriptionId: string, userId: string) {
|
||||||
try {
|
try {
|
||||||
// 1. Get userSubscription by id
|
// 1. Get userSubscription by id
|
||||||
|
|||||||
@@ -948,9 +948,13 @@ 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_design') {
|
if (invoice.items[0]?.name == 'dmenu_wallet_charge') {
|
||||||
|
this.restaurantService.finishChargeRequest(invoice.id);
|
||||||
|
} else if (invoice.items[0]?.name == 'purchase_plan') {
|
||||||
this.dpageService.finishPurchaseDesign(invoice.externalBusinessId!, invoice.id)
|
this.dpageService.finishPurchaseDesign(invoice.externalBusinessId!, invoice.id)
|
||||||
} else if (invoice.items[0]?.name == 'purchase_new_catalogue') {
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user