feat: complete cmpp platform phases 0-5
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
import { Body, Controller, Get, Post } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { TenantId } from '../common/tenant-id.decorator';
|
||||
import {
|
||||
BillingService,
|
||||
BillingActionDto,
|
||||
CreateRechargeOrderDto,
|
||||
CreateAccountTransactionDto,
|
||||
CreateBillingPlanDto,
|
||||
CreateBillingRuleDto,
|
||||
CreateSmsBillingRecordDto,
|
||||
CreateTenantAccountDto,
|
||||
EstimateSmsCostDto,
|
||||
} from './billing.service';
|
||||
|
||||
@ApiTags('billing')
|
||||
@Controller('admin/billing')
|
||||
export class BillingController {
|
||||
constructor(private readonly billing: BillingService) {}
|
||||
|
||||
@Get('plans')
|
||||
listPlans() {
|
||||
return this.billing.listPlans();
|
||||
}
|
||||
|
||||
@Post('plans')
|
||||
createPlan(@Body() body: CreateBillingPlanDto) {
|
||||
return this.billing.createPlan(body);
|
||||
}
|
||||
|
||||
@Get('accounts')
|
||||
listAccounts() {
|
||||
return this.billing.listAccounts();
|
||||
}
|
||||
|
||||
@Post('accounts')
|
||||
createAccount(@Body() body: CreateTenantAccountDto) {
|
||||
return this.billing.createAccount(body);
|
||||
}
|
||||
|
||||
@Get('transactions')
|
||||
listTransactions(@TenantId() tenantId?: string) {
|
||||
return this.billing.listTransactions(tenantId);
|
||||
}
|
||||
|
||||
@Post('transactions')
|
||||
createTransaction(@Body() body: CreateAccountTransactionDto) {
|
||||
return this.billing.createTransaction(body);
|
||||
}
|
||||
|
||||
@Get('recharges')
|
||||
listRechargeOrders(@TenantId() tenantId?: string) {
|
||||
return this.billing.listRechargeOrders(tenantId);
|
||||
}
|
||||
|
||||
@Post('recharges')
|
||||
createRechargeOrder(@Body() body: CreateRechargeOrderDto) {
|
||||
return this.billing.createRechargeOrder(body);
|
||||
}
|
||||
|
||||
@Post('estimate')
|
||||
estimateSmsCost(@Body() body: EstimateSmsCostDto) {
|
||||
return this.billing.estimateSmsCost(body);
|
||||
}
|
||||
|
||||
@Post('check')
|
||||
checkAccount(@Body() body: BillingActionDto) {
|
||||
return this.billing.checkAccount(body);
|
||||
}
|
||||
|
||||
@Post('freeze')
|
||||
freeze(@Body() body: BillingActionDto) {
|
||||
return this.billing.freeze(body);
|
||||
}
|
||||
|
||||
@Post('charge')
|
||||
charge(@Body() body: BillingActionDto) {
|
||||
return this.billing.charge(body);
|
||||
}
|
||||
|
||||
@Post('release')
|
||||
release(@Body() body: BillingActionDto) {
|
||||
return this.billing.release(body);
|
||||
}
|
||||
|
||||
@Post('refund')
|
||||
refund(@Body() body: BillingActionDto) {
|
||||
return this.billing.refund(body);
|
||||
}
|
||||
|
||||
@Post('adjust')
|
||||
adjust(@Body() body: BillingActionDto) {
|
||||
return this.billing.adjust(body);
|
||||
}
|
||||
|
||||
@Get('sms-billing-records')
|
||||
listSmsBillingRecords(@TenantId() tenantId?: string) {
|
||||
return this.billing.listSmsBillingRecords(tenantId);
|
||||
}
|
||||
|
||||
@Post('sms-billing-records')
|
||||
createSmsBillingRecord(@Body() body: CreateSmsBillingRecordDto) {
|
||||
return this.billing.createSmsBillingRecord(body);
|
||||
}
|
||||
|
||||
@Get('rules')
|
||||
listRules() {
|
||||
return this.billing.listRules();
|
||||
}
|
||||
|
||||
@Post('rules')
|
||||
createRule(@Body() body: CreateBillingRuleDto) {
|
||||
return this.billing.createRule(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiTags('client-billing')
|
||||
@Controller('client/billing')
|
||||
export class ClientBillingController {
|
||||
constructor(private readonly billing: BillingService) {}
|
||||
|
||||
@Get('plans')
|
||||
listPlans() {
|
||||
return this.billing.listPlans();
|
||||
}
|
||||
|
||||
@Get('transactions')
|
||||
listTransactions(@TenantId() tenantId?: string) {
|
||||
return this.billing.listTransactions(tenantId);
|
||||
}
|
||||
|
||||
@Post('orders')
|
||||
createRechargeOrder(@Body() body: CreateRechargeOrderDto) {
|
||||
return this.billing.createRechargeOrder(body);
|
||||
}
|
||||
|
||||
@Get('orders')
|
||||
listRechargeOrders(@TenantId() tenantId?: string) {
|
||||
return this.billing.listRechargeOrders(tenantId);
|
||||
}
|
||||
|
||||
@Post('estimate')
|
||||
estimateSmsCost(@Body() body: EstimateSmsCostDto) {
|
||||
return this.billing.estimateSmsCost(body);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user