增加广播栏
This commit is contained in:
1 parent
85b0e70907
commit
d8786eb28a
21 files changed
+516
-59
No files matched your search
@@ -34,7 +34,10 @@ export class OrdersService {
|
||||
quantity = 1,
|
||||
terminal: string | null = null,
|
||||
): Promise<{ outTradeNo: string; payData: PayData }> {
|
||||
if (!this.wxpay.enabled) {
|
||||
// 支付配置跟着「小程序当前数据源」走:切到开发库就用开发那套(默认沙箱),不会误收真钱
|
||||
const source = this.prisma.activeEnv;
|
||||
const pay = this.wxpay.configFor(source);
|
||||
if (!this.wxpay.enabledFor(source)) {
|
||||
throw new AppError(ErrorCode.PAY_NOT_ENABLED, '支付尚未开通,请联系管理员', 503);
|
||||
}
|
||||
if (!Number.isInteger(quantity) || quantity < 1 || quantity > 10) {
|
||||
@@ -76,7 +79,7 @@ export class OrdersService {
|
||||
quantity,
|
||||
amount_fen: amountFen,
|
||||
status: OrderStatus.CREATED,
|
||||
env: this.wxpay.env,
|
||||
env: pay.env,
|
||||
terminal,
|
||||
attach: `course:${course.code}`,
|
||||
},
|
||||
@@ -84,9 +87,9 @@ export class OrdersService {
|
||||
|
||||
const sessionKey = await this.payments.requireSessionKey(userId);
|
||||
const signData = JSON.stringify({
|
||||
offerId: this.wxpay.offerId,
|
||||
offerId: pay.offerId,
|
||||
buyQuantity: quantity,
|
||||
env: this.wxpay.env,
|
||||
env: pay.env,
|
||||
currencyType: 'CNY',
|
||||
productId: product.wx_product_id,
|
||||
goodsPrice: product.price_fen,
|
||||
@@ -99,7 +102,7 @@ export class OrdersService {
|
||||
payData: {
|
||||
signData,
|
||||
mode: 'short_series_goods',
|
||||
paySig: this.wxpay.calcPaySig('requestVirtualPayment', signData),
|
||||
paySig: this.wxpay.calcPaySig('requestVirtualPayment', signData, pay.appkey),
|
||||
signature: this.wxpay.calcSignature(signData, sessionKey),
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user