fix: connect operations pages to real backend
This commit is contained in:
@@ -35,6 +35,9 @@ function createPrismaMock() {
|
||||
findMany: jest.fn(),
|
||||
create: jest.fn(),
|
||||
},
|
||||
operationLog: {
|
||||
create: jest.fn(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -131,6 +134,13 @@ describe('BillingService', () => {
|
||||
relatedType: 'recharge_order',
|
||||
}),
|
||||
});
|
||||
expect(prisma.operationLog.create).toHaveBeenCalledWith({
|
||||
data: expect.objectContaining({
|
||||
action: 'billing.manual_recharge',
|
||||
resource: 'recharge_order',
|
||||
resourceId: 'order-1',
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
it('writes freeze, charge, release, refund, and adjustment transactions', async () => {
|
||||
|
||||
@@ -199,8 +199,8 @@ export class BillingService {
|
||||
return order;
|
||||
}
|
||||
|
||||
createManualRecharge(data: CreateManualRechargeDto) {
|
||||
return this.createRechargeOrder({
|
||||
async createManualRecharge(data: CreateManualRechargeDto) {
|
||||
const order = await this.createRechargeOrder({
|
||||
tenantId: data.tenantId,
|
||||
amountCents: data.amountCents,
|
||||
smsUnits: data.smsUnits ?? 0,
|
||||
@@ -208,6 +208,22 @@ export class BillingService {
|
||||
operatorId: data.operatorId,
|
||||
remark: data.remark,
|
||||
});
|
||||
await this.prisma.operationLog.create({
|
||||
data: {
|
||||
tenantId: data.tenantId,
|
||||
userId: data.operatorId,
|
||||
action: 'billing.manual_recharge',
|
||||
resource: 'recharge_order',
|
||||
resourceId: order.id,
|
||||
detail: {
|
||||
amountCents: data.amountCents,
|
||||
smsUnits: data.smsUnits ?? 0,
|
||||
orderNo: order.orderNo,
|
||||
remark: data.remark,
|
||||
} as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
return order;
|
||||
}
|
||||
|
||||
estimateSmsCost(data: EstimateSmsCostDto) {
|
||||
|
||||
Reference in New Issue
Block a user