Challenge Overview
We have developed the Legacy Challenge Processor (LCP) microservice that processes Kafka events related to challenges & backfills data via v4 Challenge API. In this challenge, the objective is to create a similar Legacy Payment Processor (LPP) microservice using v5 challenge API. The LPP will be a simplified version of the LCP that will strip out unnecessary functions used in LCP.
Technology Stack
-
NodeJS v12
-
Docker
-
Docker Compose
-
Kafka
-
Informix
-
JavaScript
General Requirements
Existing Conventions
Follow the existing conventions in the app. Like instead of using async, await use generators.
Code Formatting
-
Make sure code is well documented, all classes, methods, variables, parameters, return values must be documented in every single code file, and appropriate inline comments should be provided too where the code is not straightforward to understand.
-
Please use clean INDENTATION for all the code so future developers can follow the code.
-
Use appropriate linter to validate your code.
Javascript Specific
-
Code written in JavaScript/NodeJS should pass the lint Validation.
Resources
Legacy-payment-processor (develop branch): Should be the base of your submission. It has all the configs required to set up the processor.
Submission API Postman collection
V5 Challenge Resource API docs
Steps to generate M2M token: Provided in the forums.
Payment processor files: ProcessorService.js, copilotPaymentService.js & paymentService.js
Payment task overview
Existing Payment task Architecture
https://i.imgur.com/K3tXZ2a.jpg
As seen in the architectural diagram above, the existing payment task depends on v5 Challenge API, v5 Resource API, Legacy Challenge Processor, challenge-processor, Legacy Challenge Resource Processor, v4 Challenge API, Informix, Autopilot, v4 -> v5 Sync���(legacy challenge migration).
Payment task flow
The flow to process a payment has the following steps:
Create challenge > Register User for Task > Activate Task > Open Submission Phase > Update v5 > Close Task
In this some of the steps like (Open Submission Phase & Update v5) are unnecessary & should be stripped out for the new payment task flow.
New Payment task Architecture
https://i.imgur.com/P54ekAt.png
As seen in the architectural diagram above, the new payment task will depend on v5 Challenge API, v5 Resource API, challenge-processor, Legacy Payment Processor & Informix.
Payment task flow
The flow to process a payment has the following steps:
Create challenge > Register User for Task > Activate Task > Close Task
Business Requirements
Legacy Payment Processor (LPP)
Create the LPP, the LPP should listen for changes in challenge.notifcations.update event. Here’s a sample response to this event. If the challenge type is task and status is Completed, insert payment information into PACTs tables. The two PACTs tables to be updated are payment & payment_detail with the prize values present in the prizeSets property. Take the memberId to be paid from the task.memberId property & get the copilot information from the createdBy field.
Ref to this document to get the structure of these two tables.
Also, refer to the existing Java functions: createPayment, makeNewPayment, split payment into two installments to get an idea about inserting records in the required tables.
For this challenge, we don’t want to split the payment into two installments. Only add a single entry with full payment for each of the payments listed in prizeSets property (i.e member payment & copilot payment).
Code cleanup
After creating the LPP, remove the unused code present in the given code from the develop branch.
Final Submission Guidelines
- Submit a zip folder containing the source code with all the requirements implemented.
- Submit a verification document or a verification video, showing the records added into the database tables.