Files
maps-saas/apps/api/src/billing/providers/binance.provider.ts
T
2026-04-15 19:56:49 +03:00

34 lines
1.0 KiB
TypeScript

import { Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
@Injectable()
export class BinanceProvider {
private readonly logger = new Logger(BinanceProvider.name);
constructor(private configService: ConfigService) {}
/**
* Mock Binance Pay Order Creation
* Will lead to a success/fail redirect for testing
*/
async createOrder(tenantId: string, amount: number, plan: string) {
this.logger.log(`[Mock] Creating Binance Pay order for ${tenantId} - ${plan}`);
// In production, this calls https://bpay.binanceapi.com/binancepay/openapi/v2/order
// and returns a checkoutUrl.
return {
checkoutUrl: `https://map-dashbord.intaleqapp.com/api/billing/mock-binance-success?tenantId=${tenantId}&plan=${plan}`,
prepayId: `mock_${Date.now()}`
};
}
/**
* Mock Webhook Signature Verification
*/
verifySignature(payload: any, signature: string): boolean {
// In production, uses HMAC-SHA512 with Binance Secret Key
return true;
}
}