Skip to content

Third-Party Integrations

BANA integrates with external services through modular components. Each integration is designed as a self-contained component that can be easily configured and mounted to your application.

Available Integrations

ModulePackageDescriptionProvider
MQ-Pay@nx-3rd/mq-payMulti-provider payment processingVNPAY, Internal
IIAPI@nx-3rd/iiapiElectronic invoice managementMultiple T-VAN
T-VAN@nx-3rd/t-vanTax authority integrationCQT Vietnam

Integration Architecture

All third-party integrations follow the IGNIS Component pattern:

📱 Your Application
preConfigure() {
  // 1. Bind configuration options
  this.bind<IOptions>({ key: BindingKeys.OPTIONS })
    .toValue({ ... });

  // 2. Load the component
  this.component(IntegrationComponent);
}
▼ Loads
🧩 Integration Component
🔗setupCustomBindings()Providers, Registries
⚙️setupServices()Business logic services
🌐setupControllers()REST API endpoints
▼ Registers
📦 Available Resources
DI Container
services.*Injectable services
repositories.*Data access layer
controllers.*REST endpoints
AppRegistry (Singleton)
redis:*Redis connections
payment-provider:*Payment providers
bullmq:queue:*Job queues

Common Configuration Pattern

All integrations follow a similar configuration pattern:

typescript
// 1. Import the component and types
import {
  IntegrationComponent,
  BindingKeys,
  IOptions
} from '@nx-3rd/integration';

// 2. Configure in your application's preConfigure()
class MyApplication extends BaseApplication {
  preConfigure() {
    // Bind options before loading component
    this.bind<IOptions>({ key: BindingKeys.OPTIONS })
      .toValue({
        enableControllers: true,  // Auto-register REST endpoints
        clients: [
          {
            name: 'default',
            provider: 'PROVIDER_NAME',
            // Provider-specific config...
          },
        ],
      });

    // Load the component
    this.component(IntegrationComponent);
  }
}

Environment Variables

Each integration uses a specific prefix for environment variables:

IntegrationPrefixExample
MQ-PayAPP_ENV_MQ_PAY_*APP_ENV_MQ_PAY_POSTGRES_HOST
IIAPIAPP_ENV_IIAPI_*APP_ENV_IIAPI_API_KEY
T-VANAPP_ENV_TVAN_*APP_ENV_TVAN_TAX_CODE

Accessing Integration Services

Via Dependency Injection

typescript
import { inject } from '@venizia/ignis';
import { PaymentService } from '@nx-3rd/mq-pay';

export class SaleOrderService {
  constructor(
    @inject({ key: 'services.PaymentService' })
    private paymentService: PaymentService,
  ) {}

  async checkout(orderId: string) {
    return this.paymentService.makePayment({
      source: { type: 'SaleOrder', id: orderId },
      payment: { provider: 'VNPAY_QR_MMS', total: 100000 },
    });
  }
}

Via AppRegistry (for Redis, Providers)

typescript
import { AppRegistry } from '@nx-3rd/mq-pay';

// Get Redis instance
const registry = AppRegistry.getInstance();
const redis = registry.getRedis({ name: 'redis:@nx-3rd/mq-pay/redis-cache' });

// Get Payment Provider
const provider = registry.getPaymentProvider({ name: 'VNPAY_QR_MMS' });

Next Steps

Choose an integration to learn more:

  • MQ-Pay - Payment processing with VNPAY, Cash, Card
  • IIAPI - Electronic invoice management
  • T-VAN - Tax authority compliance

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.