Challenge Overview
Background
Topcoder is considering to refactor the TC Direct application by using RESTful APIs instead of calling various EJBs and directly contacting the underline database, which will allow us to begin decoupling TC Direct from its existing backend and provide exposure to some of its core services. As a first step, we want to avoid rewriting some of the complex business logic.
For the initial stage, we'd like to use AWS Lambda Function and AWS API Gateway to wrap around the EJB calls and database calls, and make the TC Direct to call the AWS API gateway instead. This way we isolate the depenencies between TC Direct and EJB services/informix, then we can move ahead quickly.
Scope
Previously in we have launched severeal challenges like Proof Of Concept - AWS Lambda Function to Invoke Direct EJB Service etc, and sorted out the way to use AWS Lambda Function to wrap arround the EJB calls and Database calls.
For this challenge, we'd like to follow the same approach to create AWS Lambda Function for add payment for member.
Requirements
1. Currently in legacy applications, there are many places that contains the functionality for paying members. like
- https://coder.topcoder.com/internal/web_module/trunk/src/main/com/topcoder/utilities/pacts/ProcessJiraPayments.java
https://coder.topcoder.com/tcs/clients/cronos/applications/online_review/trunk/src/java/main/com/cronos/onlinereview/actions/projectpayments/
...
They are all calling the PactsClientServices EJB by delegation, which handles the real creation of payments.
2. For this challenge, we are going to implement pay one member functionality by calling the corresponding EJB, like
com.topcoder.web.ejb.pacts.PactsServicesBean#addPayment(BasePayment payment, long operatorUserId) throws SQLException
3. There are many implementations of BasePayment, you are expected to properly defined the Input JSON format, and in the Lambda Function it will recreate the corresponding concrete instance, so we can easily handle all different payments.
You are not going to create all logic for creating payment object from the JSON format, but you should include the general approach which we can follow to support more payment types.
You may be able to use BasePayment#createPayment(int paymentTypeId, long coderId, double grossAmount, long referenceId, int placed)
4. Please create the swagger api doc for the created aws lambda function, please following the example provided in forum, and properly desribe the input JSON for various payment.
5. Please use AWS lambda swagger https://github.com/awslabs/aws-apigateway-importer to create api gateway endpoint using the created swagger api doc, and hook it with the aws lambda function
6. The json response should be simple and clear, and properly handle the error cases with proper messages.
7. You are expected to create a complete new codebase similar as the the one provided in forum.
8. For configuration, please create a token.properties file in the root directory, and define properly gradle task to execute before build.
Reference
1. Competitors need to request your own VM for development and testing.
2. To verify the payment is created properly, you can check the payment page in legacy www, like https://tc.cloud.topcoder.com/PactsMemberServlet?module=PaymentHistory&full_list=false or directly checking the database.
3. Please reuse any components instead of creating your own if possible, like shared.jar, PactsServices.jar (don't use the EJB related class)
4. The previous challenges will be provided in forum for reference.
VM ENVIRONMENT
If you need a Topcoder VM to work on this challenge, Please request the VM in the challenge forum.
Information about VM can be found below:
VM specific information is found here: http://www.topcoder.com/wiki/display/docs/VM+Image+2.5
Upon registration as a submitter or reviewer you will need to request a VM based on the new TopCoder Cockpit/Direct image. To request your image, please use the forum. Before requesting your VM, you need to ensure that you have an SSH key created and in your member profile. If you don't have your SSH key set in your profile, please follow https://help.github.com/articles/generating-an-ssh-key/, and send the public ssh key to support@topcoder.com, once it is setup, you can request your VM in forum.
Final Submission Guidelines
1. Complete source code for aws lambda function2. Working VM and aws lambda function for testing
3. Deployment Guide and Verification Documentation