微信SDK接通
This commit is contained in:
@@ -167,7 +167,19 @@ export class TradeService {
|
||||
throw new BadRequestException('订单状态不可支付');
|
||||
}
|
||||
|
||||
const { externalNo } = await this.payProvider.payOrder(orderId);
|
||||
const user = await this.prisma.user.findUnique({ where: { id: userId } });
|
||||
const openId = user?.wxOpenId ?? undefined;
|
||||
const payResult = await this.payProvider.payOrder(orderId, openId);
|
||||
|
||||
if (payResult.mode === 'jsapi') {
|
||||
return {
|
||||
mode: 'jsapi' as const,
|
||||
orderId: order.id.toString(),
|
||||
prepay: payResult.prepay,
|
||||
};
|
||||
}
|
||||
|
||||
const { externalNo } = payResult;
|
||||
const now = new Date();
|
||||
|
||||
await this.prisma.$transaction(async (tx) => {
|
||||
|
||||
Reference in New Issue
Block a user