feat: implement billing module for tenant subscription management and super-admin payment processing
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Query, UseGuards } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
import { TenantWalletService } from './tenant-wallet.service';
|
||||
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
|
||||
@@ -39,4 +39,35 @@ export class TenantWalletController {
|
||||
currency || 'JOD',
|
||||
);
|
||||
}
|
||||
|
||||
/** كشف حساب تفصيلي للدفتر. book يمكن أن يكون 'revenue' أو 'pending' */
|
||||
@Get('statement')
|
||||
statement(
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Query('book') book: 'revenue' | 'pending',
|
||||
@Query('currency') currency?: string,
|
||||
@Query('limit') limit?: string,
|
||||
@Query('offset') offset?: string,
|
||||
) {
|
||||
return this.wallet.statement(
|
||||
book || 'revenue',
|
||||
user.tenantId,
|
||||
currency || 'JOD',
|
||||
limit ? parseInt(limit, 10) : 100,
|
||||
offset ? parseInt(offset, 10) : 0,
|
||||
);
|
||||
}
|
||||
|
||||
/** سحب أرباح المستأجر (من دفتر الإيرادات حصراً) */
|
||||
@Post('withdraw')
|
||||
withdraw(
|
||||
@CurrentUser() user: AuthUser,
|
||||
@Body() body: { amount: number; currency?: string },
|
||||
) {
|
||||
return this.wallet.withdraw(
|
||||
user.tenantId,
|
||||
Number(body.amount),
|
||||
body.currency || 'JOD',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user