- Create Spring Boot project with dependencies
- Set up PostgreSQL database
- Set up Redis server
- Configure application.yml with environment variables
- Create all entity classes
- Create all repository interfaces
- Run Flyway migrations
- Test database connectivity
- Implement
EncryptionUtilandValidationUtil - Implement
MessageTemplateUtil - Implement
DateUtil - Implement
AuthenticationServiceImpl - Implement
OTPServiceImpl - Implement
AccountServiceImpl - Implement
AuditServiceImpl - Write unit tests for core services
- Implement
TransactionServiceImpl - Implement internal transfer logic
- Implement external transfer logic
- Implement transaction reversal
- Implement statement generation
- Add transaction validations
- Test transaction flows
- Sign up for Paystack account
- Get API keys (test & live)
- Implement
PaystackServiceImpl - Implement account name verification
- Implement transfer initiation
- Implement webhook handler
- Test with Paystack test cards
- Test bank transfers
- Create Meta Business account
- Set up WhatsApp Business API
- Get phone number ID and access token
- Configure webhook URL
- Implement
WhatsAppServiceImpl - Implement
WhatsAppWebhookServiceImpl - Test message sending
- Test webhook reception
- Implement
MessageHandler - Implement
CommandHandler - Implement session management
- Implement menu navigation
- Implement command routing
- Test conversation flows
- Handle edge cases
- Implement
BeneficiaryServiceImpl - Implement
NotificationServiceImpl - Implement scheduled tasks
- Add rate limiting
- Add input validation
- Add error handling
- Write integration tests
- Test all user flows
- Load testing
- Security audit
- Deploy to staging
- Configure production environment
- Deploy to production
- Monitor logs and metrics
Copy all entity classes and enums to your project.
Copy all repository interfaces - no implementation needed!
SecurityConfig.java
RedisConfig.java
WhatsAppConfig.java
PaymentGatewayConfig.java
AsyncConfig.javaEncryptionUtil.java // PIN hashing, encryption
ValidationUtil.java // Input validation
MessageTemplateUtil.java // Message formatting
DateUtil.java // Date operationsStart in this exact order:
1. AuditServiceImpl // Logging (used by all)
2. OTPServiceImpl // OTP generation
3. AuthenticationServiceImpl // User auth
4. AccountServiceImpl // Account operations
5. NotificationServiceImpl // NotificationsTransactionServiceImpl // All transaction logicPaystackServiceImpl // External transfersWhatsAppServiceImpl // Message sending
WhatsAppWebhookServiceImpl // Webhook handling
MessageHandler // Message processing
CommandHandler // Command routingWhatsAppWebhookController
AccountController
TransactionController
AdminControllerWhy? Best documentation, easy integration, reliable
Setup Steps:
- Visit: https://paystack.com/
- Sign up and verify business
- Get API keys from Settings β API Keys
- Test Mode Keys (for development):
- Secret Key:
sk_test_xxxxx - Public Key:
pk_test_xxxxx
- Secret Key:
Key Features:
- β Transfer API - Send money to any Nigerian bank
- β Account Name Verification - Verify before transfer
- β Bank List API - Get all Nigerian banks
- β Webhook Support - Real-time notifications
- β Great Documentation
Pricing: 1.5% + β¦100 cap per transaction
Test Card Numbers:
Success: 4084084084084081
Insufficient Funds: 5060666666666666666
Setup: https://flutterwave.com/ Features: Similar to Paystack, supports more African countries Pricing: 1.4% per transaction
Setup: https://monnify.com/ Best for: Reserved/Virtual accounts Features: Great for collections and automated reconciliation
@Autowired
private WhatsAppService whatsAppService;
public void sendBalanceToUser(String phoneNumber, BigDecimal balance) {
String message = String.format(
"π° *Your Balance*\n\nAvailable: β¦%,.2f",
balance
);
whatsAppService.sendMessage(phoneNumber, message);
}@Autowired
private TransactionService transactionService;
public void transferMoney() {
TransactionRequestDto request = TransactionRequestDto.builder()
.sourceAccountNumber("1234567890")
.destinationAccountNumber("0987654321")
.amount(new BigDecimal("5000.00"))
.pin("1234")
.narration("Payment")
.phoneNumber("+2348012345678")
.build();
TransactionResponseDto response = transactionService.transfer(request);
if (response.getStatus() == TransactionStatus.SUCCESSFUL) {
System.out.println("Transfer successful!");
}
}@Autowired
private PaymentGatewayService paymentGatewayService;
public void verifyAccount(String accountNumber, String bankCode) {
AccountNameEnquiryDto result = paymentGatewayService
.verifyAccountName(accountNumber, bankCode);
if (result.getSuccess()) {
System.out.println("Account Name: " + result.getAccountName());
}
}- Use HTTPS only (no HTTP)
- Encrypt PINs with BCrypt
- Store API keys in environment variables
- Implement rate limiting
- Validate all inputs
- Use parameterized queries (JPA handles this)
- Enable CORS properly
- Implement session timeouts
- Log all transactions
- Enable 2FA for high-value transactions
- Regularly backup database
- Monitor for suspicious activities
User: register
Bot: Welcome! Please provide details...
User: John | Doe | john@email.com | 1234
Bot: OTP sent
User: 123456
Bot: β
Registration successful! Account: 1234567890
User: 1
Bot: π° ACCOUNT BALANCE
Account: 1234567890
Available Balance: β¦50,000.00
User: 2
Bot: πΈ TRANSFER MENU...
User: 2
Bot: Enter account number:
User: 0123456789
Bot: Enter bank code:
User: 058
Bot: Account Name: Jane Smith. Confirm? YES/NO
User: YES
Bot: Enter amount:
User: 5000
Bot: Enter PIN:
User: 1234
Bot: β
Transaction successful!
| Table | Purpose | Key Columns |
|---|---|---|
| users | User accounts | phone_number, pin, bvn |
| accounts | Bank accounts | account_number, balance |
| transactions | Transaction records | reference_number, amount, status |
| beneficiaries | Saved beneficiaries | account_number, account_name |
| whatsapp_sessions | Active sessions | phone_number, state, context |
| otps | OTP verification | otp_code, expires_at |
| audit_logs | Audit trail | action, user_id, success |
| payment_gateway_transactions | External payments | gateway_reference, status |
Solution: Check database is running, verify credentials in application.yml
Solution: Start Redis server: redis-server
Solution: Verify webhook token matches in application.yml
Solution: Check API key is correct, use test key for testing
Solution: Credit test account first before transfers
Solution: Normal behavior after 15 minutes inactivity
- Paystack Docs: https://paystack.com/docs/api/
- WhatsApp Business API: https://developers.facebook.com/docs/whatsapp/
- Spring Boot Docs: https://docs.spring.io/spring-boot/
- PostgreSQL Docs: https://www.postgresql.org/docs/
- Use production database (not test DB)
- Switch to Paystack live keys
- Enable SSL/HTTPS
- Set up domain name
- Configure firewall rules
- Set up monitoring (Prometheus/Grafana)
- Configure log rotation
- Set up database backups
- Enable application monitoring
- Set up error alerting
- Load test the application
- Prepare rollback plan
- Document API endpoints
- Train support team
π You now have everything needed to build a complete WhatsApp Banking System!
Start with Phase 1 and work through each phase systematically. Good luck! π