Wallet Integration
Architecture
Design a resilient wallet system using bKash Tokenized Checkout. Prioritize atomic transactions, idempotency, and automated reconciliation.
* You are not restricted to the public sandbox. If you have official bKash API access, you are encouraged to use it.
Public Sandbox Credentials
Use these if you do not have your own official API credentials.
Identity & Localization
Core User Session. Implement a secure authentication layer. Wallet balances and agreement tokens must be strictly scoped to the user.
Localization (i18n) Required
The application must support switching between English and Bangla. Use standard Laravel Localization (PHP/JSON files). Implement a language toggle and persist preference.
Agreement Binding
Execute createAgreement to generate the binding flow.
Upon success, store the returned agreementId permanently.
// Store the Agreement
$wallet = Wallet::create([
'user_id' => $user->id,
'token' => $response['agreementId'],
'masked' => $response['payerAccount']
]);
Balance Injection
Payment w/ Agreement
Charge the user without OTP re-entry.
POST /tokenized-checkout/payment-with-agreement/create
Critical: Flow & Lock Strategy
Use Redis to implement an atomic lock (setnx) during the payment process.
Prevent double-submissions (e.g., user clicking "Pay" twice).
Handle success, failure, and cancel redirects gracefully.
Refund Logic
Refunds require the original trxId and paymentId.
The system must support partial refunds and deduct the amount from the internal wallet records.
$payload = [
'paymentId' => $pId,
'trxId' => $trx,
'amount' => '50.00',
'reason' => 'User request'
];
History & Statements
01. Transaction History UI
Build a comprehensive, paginated view listing all wallet activities (Credits, Debits, Refunds). Users must be able to view their balance history directly on the dashboard.
02. PDF Statement Action
Implement a "Download Statement" button within the history view. This action must trigger the Gotenberg microservice to render the transaction data into a high-fidelity PDF file.
Deployment & Infrastructure
Flexible Infrastructure
We focus on results. While Redis and Gotenberg must run via Docker (as they are microservices), the core Application, Web Server, and Database can be dockerized OR set up locally/on a server.
Top Priority
Must be testable via URL.
Submission Protocol
Authenticity & AI Tools
We understand AI tools (ChatGPT, Copilot) are part of modern development. You are free to use them for assistance, but do not let them write the core logic for you. The interview will focus heavily on why you structured the code the way you did. You must be able to explain every line of your implementation. Code you cannot explain is effectively code you didn't write.
Public Repository
Host on GitHub. Ensure .gitignore is properly configured (no vendor/node_modules).
Clean Commit Log
Atomic commits with descriptive messages. No "WIP" or "Fixed bug" spam.
Documentation
Comprehensive README.md detailing architecture choices and startup instructions.