init
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
export interface IPayProvider {
|
||||
payOrder(orderId: bigint): Promise<{ externalNo: string }>;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { loadAppConfig } from '@dukang/shared-types';
|
||||
import { IPayProvider } from './pay.interface';
|
||||
|
||||
@Injectable()
|
||||
export class PayMockProvider implements IPayProvider {
|
||||
private readonly config = loadAppConfig();
|
||||
|
||||
async payOrder(_orderId: bigint): Promise<{ externalNo: string }> {
|
||||
if (!this.config.mockPay) {
|
||||
throw new Error('Real WeChat pay not implemented in preV1');
|
||||
}
|
||||
return { externalNo: `MOCK-${Date.now()}` };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user