|
@@ -1,6 +1,7 @@
|
|
|
import { CoolController, BaseController } from '@cool-midway/core';
|
|
|
-import { ALL, Body, Get, Inject, Post, Provide } from '@midwayjs/decorator';
|
|
|
+import { ALL, Body, Get, Inject, Post, Provide,Query,Param } from '@midwayjs/decorator';
|
|
|
import { BusinessEntity } from '../../payment/entity/business';
|
|
|
+import { OrderService } from "../../payment/service/order";
|
|
|
|
|
|
/**
|
|
|
* 入金
|
|
@@ -8,6 +9,8 @@ import { BusinessEntity } from '../../payment/entity/business';
|
|
|
@Provide()
|
|
|
@CoolController('/api/v1/Fiat')
|
|
|
export class PayInController extends BaseController {
|
|
|
+ @Inject()
|
|
|
+ orderService: OrderService;
|
|
|
/**
|
|
|
* 创建订单
|
|
|
* /api/v3/Fiat/PayIn
|
|
@@ -20,38 +23,38 @@ export class PayInController extends BaseController {
|
|
|
// 关键参数校验
|
|
|
// 数据落库
|
|
|
// 回调
|
|
|
- console.log(business);
|
|
|
- return this.ok('hello, cool-admin!!!');
|
|
|
+ console.log('createPayInOrder-=-=payIn-=-=000',business);
|
|
|
+ return this.ok(await this.orderService.recharge(business));
|
|
|
}
|
|
|
/**
|
|
|
* 查询订单
|
|
|
* /api/v3/Fiat/PayIn/{orderNo}
|
|
|
*/
|
|
|
- @Get('/PayIn/:orderNo', { summary: '查询订单' })
|
|
|
- async getPayInForOrderNo(@Body(ALL) business: BusinessEntity) {
|
|
|
+ @Get('/PayIn/', { summary: '查询订单' })
|
|
|
+ async getPayInForOrderNo(@Query('orderNo') orderNo: string,) {
|
|
|
// if (!this.allowKeys.includes(key)) {
|
|
|
// return this.fail('非法操作');
|
|
|
// }
|
|
|
// 关键参数校验
|
|
|
// 数据落库
|
|
|
// 回调
|
|
|
- console.log(business);
|
|
|
- return this.ok('hello, cool-admin!!!');
|
|
|
+ console.log('getPayInForOrderNo-=-=-=-111',orderNo);
|
|
|
+ return this.ok(await this.orderService.rechargeOrder({ orderNo: orderNo,channel:'SUNPAY'}));
|
|
|
}
|
|
|
/**
|
|
|
* 取消订单
|
|
|
* /api/v3/Fiat/PayIn/{orderNo}/Cancel
|
|
|
*/
|
|
|
@Post('/PayIn/:orderNo/Cancel', { summary: '取消订单' })
|
|
|
- async cancelPayInOrderForOrderNo(@Body(ALL) business: BusinessEntity) {
|
|
|
+ async cancelPayInOrderForOrderNo(@Param('orderNo') orderNo: string) {
|
|
|
// if (!this.allowKeys.includes(key)) {
|
|
|
// return this.fail('非法操作');
|
|
|
// }
|
|
|
// 关键参数校验
|
|
|
// 数据落库
|
|
|
// 回调
|
|
|
- console.log(business);
|
|
|
- return this.ok('hello, cool-admin!!!');
|
|
|
+ console.log('cancelPayInOrderForOrderNo-=-=-=111',orderNo);
|
|
|
+ return this.ok(await this.orderService.rechargeOrderCancel({orderNo:orderNo}));
|
|
|
}
|
|
|
// /**
|
|
|
// * TODO 创建订单回调通知
|