sdk:37ios支付及退款

This commit is contained in:
luying
2022-03-31 16:15:49 +08:00
parent 9da83c56be
commit 76fe3adb7f
15 changed files with 275 additions and 14 deletions

View File

@@ -68,6 +68,22 @@ export default class UserOrder extends BaseModel {
return result;
}
// 准备退款
public static async startRefund(roleId: string, localOrderID: string, message: string = '') {
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID },
{ $set: { state: ORDER_STATE.CHECK_TO_REFUND, message } },
{ new: true }).lean(true);
return result;
}
// 退款
public static async refund(roleId: string, localOrderID: string, message: string = '') {
let result: UserOrderModelType = await UserOrderModel.findOneAndUpdate({ roleId, localOrderID },
{ $set: { state: ORDER_STATE.REFUND, message } },
{ new: true }).lean(true);
return result;
}
//查询成功订单详情
public static async findSuccessOrderByProductID(productID: string, roleId: string, activityId: number) {
let result: UserOrderModelType[] = await UserOrderModel.find({ productID, roleId, activityId, state: ORDER_STATE.RESULT_SUCCESS }).lean(true);