|
@@ -7,6 +7,7 @@ import { ILogger } from '@midwayjs/logger';
|
|
|
import { WalletService } from './wallet';
|
|
|
import { DispatchService } from './channels/dispatch';
|
|
|
import { WithdrawNotifyService } from './withdrawNotify';
|
|
|
+import { WithdrawChannelService } from './withdrawChannel';
|
|
|
|
|
|
@Provide()
|
|
|
export class WithdrawStateService extends BaseService {
|
|
@@ -22,6 +23,9 @@ export class WithdrawStateService extends BaseService {
|
|
|
@Inject()
|
|
|
dispatchService: DispatchService;
|
|
|
|
|
|
+ @Inject()
|
|
|
+ withdrawChannelService: WithdrawChannelService;
|
|
|
+
|
|
|
@Logger()
|
|
|
logger: ILogger;
|
|
|
|
|
@@ -146,6 +150,12 @@ export class WithdrawStateService extends BaseService {
|
|
|
// 发起代付:已受理=》银行处理中
|
|
|
async acceptToProcessiong(withdraw) {
|
|
|
try {
|
|
|
+ const channel = await this.withdrawChannelService.queryByCode(withdraw.code);
|
|
|
+ let channelCharge = (+withdraw.amount * +channel.rate) / 100 + +channel.basicFee;
|
|
|
+ if (channelCharge < channel.feeMin) {
|
|
|
+ channelCharge = channel.feeMin;
|
|
|
+ }
|
|
|
+ withdraw.channelCharge = channelCharge;
|
|
|
const { traceNo } = await this.dispatchService.withdraw(withdraw);
|
|
|
withdraw.traceNo = traceNo;
|
|
|
} catch (err) {
|