This PR improves the payment monitoring system by normalizing payment statuses, adding support for cumulative/partial payments, and integrating with the Soroban smart contract for on-chain verification.
- Refactored
paymentMonitor.service.tsto use consistent statuses:confirmed: Exact payment received.overpaid: More than the expected amount received.partially_paid: Some payment has been received, but it is less than the expected amount.expired: Payment window closed without completion.
- The system now checks the total account balance for USDC on the derived address.
- This allows multiple small payments to sum up to the total expected amount.
- Introduced
SorobanService.tsfor contract interactions. - Added a call to
verify_paymenton the Soroban contract upon payment confirmation. - Includes safe amount conversion (stroops as BigInt/i128).
- Automated expiration handling in the monitoring loop.
- Improved error handling for cases where the Stellar account hasn't been created on-chain.
- Merged normalization logic with the new
runPaymentMonitorTickstructure frommain, ensuring compatibility with the project's background job system.
- Added
PAYMENT_CONTRACT_IDto.env.example. - Updated unit tests in
paymentMonitor.service.test.tsto match the new status logic and cumulative checks.
- Unit tests updated.
- Code reviewed for Stellar/Soroban SDK compatibility.
- Pushed to branch
feature/payment-monitor-normalization. - Merge conflicts with
mainresolved.
#136