1.5.0 • Published 5 years ago
honey-lending-transactions v1.5.0
honey-lending-transactions
Service responsible for dealing with payment transactions
Responsibilities
DailyCron task:
- Cron task will be responsible for running on a daily basis at 1PM
- Queries honey-lending for all the autopay loans which payment is due (excluding first payment)
- Kicks off RetryableJobs for each transaction to be created, each job:
- Create transaction in platform adapter with unique Idempotency Key, note LOAN_REPAYMENT_BY_HONEY
- Insert TransactionEvents with type LOAN_REPAYMENT_BY_HONEY
Retryable Job Listener
- Accept Retryable Jobs and squash them to avoid sending too many requests to platform adapter.
Transactions Endpoint
- Endpoint to create payment transaction.
- To be used to process first payment. Eventually to create any transaction
- Used to initiate first payment upon loan activation
Cron task to verify transactions
- Verifies:
- installmentIds of transactionEvents === installmentIds due for that day
- synapseTransactionIds of transactionEvents for a date present in synapseTransactions table
Swagger
Routes
- When adding or updating a route, please update
src/config/swagger.yaml
. - Online Swagger Editor is available here.
- View all routes at
/api-routes
Client Generation
In order to generate a client based on the routes: 1. Install Swagger Client. 2. Instantiate and use client:
import Swagger from 'swagger-client';
const swaggerClient = await new Swagger('http://localhost:8080/api-docs/swagger.json');
const lendingTransactionsClient = swaggerClient.apis;