Git Product home page Git Product logo

tc-billing-account-service's Introduction

TOPCODER - IMPLEMENT BILLING ACCOUNT SERVICE

Prerequesits

  • Java 8 with Maven 3
  • Docker

Docker Informix Image

To run Informix locally go to the 'local' folder and execute the following command:

docker-compose up

If you should ever encounter the error:

[java] Caused by: com.topcoder.db.connectionfactory.DBConnectionException: error occurs while creating the connection.
You already have 20 connections at this
time. Any further connections

Try to restart the informix database server as below:

# log into the tc-informix docker container first
docker exec -it tc-informix bash

# restart the database server
onmode -ky
oninit

Configuration

The configuration is done via environment variables, these can be set in 'local/run.sh'.

Name Description
IP The IP of your docker container
TIME_OLTP_PW The Informix password
TIME_OLTP_USER The Informix user
TIME_OLTP_URL The Informix URL
TC_JWT_KEY The JWT key

Start Microservice

In the 'service' folder of this project run:

mvn clean package

Then start the service using the following command in the 'local' folder:

./run.sh

You may use git bash under windows to run shell script.

Data setup

Connect to informix server with informix/1nf0rm1x credentials and execute the SQL file doc/test_data.sql. If you are executing these SQL statements one by one, then make sure that the correct database is selected.

Verification

If the maven build process was successful the unit tests ran without error.

-- Postman collection : doc/billing-accounts-and-clients.postman_collection.json -- Postman environment : doc/billing-accounts_clients-env.postman_environment.json

The postman environment defines the following variables :

  • apiUrl : The base API URL
  • no-admin-token : A token for user with no admin access.
  • admin-token : A token for an admin user ( 'heffan')

Load the postman collection and environemnt in the 'doc' folder and execute the provided requests to verify the REST API.

Please make sure to update the billing accounts ids and user ids and client ids in the REST path accordingly.

There are two 'Add User to billing account' tests in the provided collection, this is to validate the following requirement : "6. When Adding Billing Account Users, If the tc handle doesn’t exist in the time_oltp:user_account table, then we’ll need to add it before we can create a project_manager record"

-- The user 'Yoshi', already has a user account in time_oltp:user_account ( From initial informix data setup). -- The user 'wyzmo' does not have a user account.

'Get Billing Account Users' can be used to check if the users are actually added to the billing account.

--You can check if the user account is created by querying the user_account table in time_oltp :

select * from time_oltp:user_account

The existing code mixed the userId (from common_oltp:user) with user account id (from time_oltp:user_account). The userId to specify for the Add/Remove user from billing account is the user id from common_oltp, these ids can be retrieved by executing the following statement :

select  user_id, handle from common_oltp:user

tc-billing-account-service's People

Contributors

ajefts avatar bannie2492 avatar cwdcwd avatar eisbilir avatar gunasekar-k avatar rakibansary avatar skyhit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.