fix: Resolve TypeScript build errors in billing service
This commit is contained in:
@@ -65,7 +65,7 @@ export class BillingService {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (result.mode === 'redirect') {
|
if (result.mode === 'redirect') {
|
||||||
payment.tx_ref = result.providerRef;
|
payment.tx_ref = result.providerRef || null;
|
||||||
payment.meta = { redirect_url: result.redirectUrl };
|
payment.meta = { redirect_url: result.redirectUrl };
|
||||||
await this.payments.save(payment);
|
await this.payments.save(payment);
|
||||||
return { paymentId: payment.id, redirectUrl: result.redirectUrl };
|
return { paymentId: payment.id, redirectUrl: result.redirectUrl };
|
||||||
@@ -89,10 +89,10 @@ export class BillingService {
|
|||||||
throw new BadRequestException('Unexpected charge mode');
|
throw new BadRequestException('Unexpected charge mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
async submitBankTransfer(tenantId: string, amount: number, currency: string, imageFile: Express.Multer.File) {
|
async submitBankTransfer(tenantId: string, amount: number, currency: string, imageFile: any) {
|
||||||
if (!imageFile) throw new BadRequestException('Receipt image is required');
|
if (!imageFile || !imageFile.buffer) throw new BadRequestException('Receipt image is required');
|
||||||
|
|
||||||
const imageUrl = await this.storage.upload(imageFile, `transfers/${tenantId}`);
|
const imageUrl = await this.storage.save(tenantId, 'transfers', imageFile.buffer, imageFile.originalname || '');
|
||||||
|
|
||||||
const payment = await this.payments.save(
|
const payment = await this.payments.save(
|
||||||
this.payments.create({
|
this.payments.create({
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export class TenantBillingController {
|
|||||||
submitTransfer(
|
submitTransfer(
|
||||||
@CurrentUser() user: AuthUser,
|
@CurrentUser() user: AuthUser,
|
||||||
@Body() body: { amount: number; currency?: string },
|
@Body() body: { amount: number; currency?: string },
|
||||||
@UploadedFile() receipt: Express.Multer.File,
|
@UploadedFile() receipt: any,
|
||||||
) {
|
) {
|
||||||
return this.billing.submitBankTransfer(user.tenantId, body.amount, body.currency || 'JOD', receipt);
|
return this.billing.submitBankTransfer(user.tenantId, body.amount, body.currency || 'JOD', receipt);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user