npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gw-mobile-api

v1.3.37

Published

WeInvest GrowWealth Mobile SDK for Javascript

Downloads

183

Readme

gw-mobile-api

WeInvest GrowWealth Mobile SDK for Javascript

Getting started

These instructions will help you install the gw-mobile-api SDK on your local machine and start using it.

Installation

Add the package to your npm dependencies as follows:

npm install --save gw-mobile-api

API Config Settings File

Before using the SDK you must copy the api configuration file which comes with the package into your project and make necessary changes to it to make sure that the API is pointing to the corrct environment, host, end points and related settings received from WeInvest.

Note that the "body" values are not used, they are given so that you know what values to send in the request Parameter for each SDK function.

{
    "deployment_stage": "dev",
    "applicationId": "com.weinvest.gwmobile",
    "api": {

        "register_device":{
            "host": "host.domain.com",
            "port": 443,
            "method": "POST",
            "url": "/register_device/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json"
            },
            "body": {
                "deviceId": "{deviceId}",
                "nickName": "{nickName}"
            }
        },

        "get_goal_types":{
            "host": "host.domain.com",
            "port": 443,
            "method": "GET",
            "url": "/goal_types/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json"
            },
            "body": {}
        },

        "pre_signup_update_investor":{
            "host": "host.domain.com",
            "port": 443,
            "method": "PUT",
            "url": "/pre_signup_update_investor/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json"
            },
            "body": {
                "deviceId": "{deviceId}",
                "crr": "{optional:crr}",
                "first_name": "{optional:first_name}",
                "last_name": "{optional:last_name}",
                "nick_name": "{optional:nick_name}",
                "citizenship": "{optional:citizenship}",
                "salutation": "{optional:salutation}",
                "client_segment": "{optional:client_segment}",
                "dob": "{optional:dob}",
                "gender": "{optional:gender}",
                "residential_status": "{optional:residential_status}",
                "country_of_tax_residence": "{optional:country_of_tax_residence}",
                "tin": "{optional:tin}",
                "occupation_status": "{optional:occupation_status}",
                "gross_annual_income": 0.00,
                "length_of_employment": 0,
                "investment_source": "{optional:investment_source}",
                "us_person": "{optional:us_person}"
            }
        },

        "pre_signup_create_goal":{
            "host": "host.domain.com",
            "port": 443,
            "method": "POST",
            "url": "/pre_signup_create_goal/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json"
            },
            "body": {
                "deviceId":"{deviceId}",
                "goalType": "{goalType}",
                "goalName": "{goalName}",
                "initialInvestmentAmount": 0.00,
                "monthlyInvestmentAmount": 0.00,
                "targetAmount": 0.00,
                "timeline": 0
            }                   
        },

        "signup_user":{
            "host": "host.domain.com",
            "port": 443,
            "method": "POST",
            "url": "/signup_user/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json"
            },
            "body":{
                "userName": "{userName}",
                "password": "{password}",
                "deviceId": "{deviceId}",
                "email": "{email}",
                "mobile": "{optional:mobile}"
              }
        },

        "confirm_signup_user":{
            "host": "host.domain.com",
            "port": 443,
            "method": "POST",
            "url": "/confirm_signup_user/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json"
            },
            "body":{
                "deviceId": "{deviceId}",
                "userName": "{userName}",
                "confirmationCode": "{confirmationCode}"
            }
        },

        "authenticate_user_pwd":{
            "host": "host.domain.com",
            "port": 443,
            "method": "POST",
            "url": "/authenticate_user/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json",
                "Auth-Application-Id": "{applicationId}",
                "Auth-Device-Id": "{deviceId}"
            },
            "body": {
                "userName": "{userName}",
                "password": "{password}"
            }
        },

        "authenticate_user_refreshtoken":{
            "host": "host.domain.com",
            "port": 443,
            "method": "POST",
            "url": "/authenticate_user/{deployment-stage}/",
            "headers": {
                "Content-Type": "application/json",
                "Auth-Application-Id": "{applicationId}",
                "Auth-Device-Id": "{deviceId}"
            },
            "body": {
                "refreshToken": "{refreshToken}"
            }
        }
    },

    "goalTypes":[
        "HOME",
        "RAINYDAY",
        "BIGSPEND",
        "RETIREMENT",
        "EDUCATION",
        "GENERAL"
    ],

    "logging": {
        "logLevel": "Full"
    }

}

Importing the SDK

Once you have the correct settings, you can use the SDK in your project by defining it as follows:

Define the SDK

var api = require('gw-mobile-api');

USAGE SUMMARY

API Index and Usage

| No. | API Function name | Usage summary | |------------|----------|-------| | 1.| registerDevice | register device using the unique device number for android and ios device | 2.| getGoalTypes | goal types used in mobile with mappings to WMS goal types for validation during goal input |3.| preSignupUpdateInvestor | update investor risk rating before signup for anonymous prospect - temporary use until risk rating API is available in WMS |4.| preSignupCreateGoal | create a goal / proposal for a anonymous prospect |5.| signupUser | register the user with username, password, email, mobile |6.| confirmSignupUser | confirm user with OTP received via email or SMS |7.| loginUserPwd | login with username, password login |8.| loginToken | login using fingerprint/faceid |9.| investorUpdate | update an investor details including customer risk rating (CRR) |10.| investorGetDetails | get the investors details including CRR |11.| goalGetQuestions | get goal calculator quesitons for RETIREMENT, HOME, EDUCATION goal types |12.| goalCalculateTarget | calculate the target based on input values for RETIREMENT, HOME and EDUCATION goal types, |13.| goalCreateNewProposal | create a new goal plan and proposal for an existing signedup user. When a logged in user decided to continue after goal input to investment plan summary |14.| goalAcceptProposal | accept a goal proposal that has been created, when the user selects to invest and continue to choose the proposed investment from investment plan summary |15.| goalRefreshProposal | if a user has accepted a proposal before but comes back on a later day, the proposal should be refreshed to get the new investment plan |16.| goalApplySuggestionToProposal | when the user has been offered multiple suggestions to bring a new goal plan back to target, when the user selects the suggesiton and applies it call this api to update the goal plan and get the relevant response for display |17.| goalApplySuggestionToInvestment | when the user has been offered multiple suggestions to bring an existing invested goal back to target, when the user selects the suggesiton and applies it call this api to update the goal and get the relevant response for display |18.| goalApplyManualOptimisation | if the user decides to optmise the goal plan by manually re-entering the goal parameters, use this API to update the goal and get the relevant response for display |19.| goalPaymentInitiate | Must be run anytime after a goal is accepted when the user wants to fund the goal (online or offline). a cash trasfer request CTR will be created and returned to be accepted once the funds are moved to the investment account |20.| goalPaymentAcceptCashTransfer | (for online payments only) When the funds are moved for online payments accept the CTR wil move the goal into "funded" state and now should be displayed in the "Investments" carousel. | | | | (for offline payments) this will happen when the funds reach the account and updated by backend |21.| goalInvestMore | API to invest additional funds to an existing goal investment |22.| goalFullWithdraw | API to fully withdraw / redeem a goal investment |23.| goalPartialWithdraw | API to partially withdraw / redeem a goal investment |24.| goalRebalanceRequest | API to request for a rebalance as part of acting upon a rebalance notification, this will return the rebalance details to be displayed to the user for confirmation |25.| goalRebalanceConfirmation | API to confirm the rebalance after the rebalance details have been displayed and accepted by the user |26.| goalGetInvestmentListing | API to get a listing of all goal investments. This will bring back a list of goals that are funded (invested) as well as awaiting funds (goals in planning) |27.| goalGetInvestmentDetails | Get all details for a specific goal investment. This will return goal performance, expected returns, transactions and notifications |28.| goalGetInvestmentPerformance | Get goal performance data for a specific goal investment |29.| goalGetInvestmentTransactions | Get transactions for any active goal (active goals are those that are funded and orders have been executed and confirmed) |30.| goalGetInvestmentRequests | Get all investment requests that are raised for a specific goal (investment requests are for initial payment, additional payments etc and must be used to initiate payment)

Example Sequence of API calls for goal creation (for a new user before signup going through the goal investment journey to signup)

FOR NEW USER JOURNEY:

  1. registerDevice
  2. goalGetQuestions (for RETIREMENT, HOME, EDUCATION only)
  3. goalCalculateTarget (for RETIREMENT, HOME, EDUCATION only)
  4. preSignupUpdateInvestor (update the investors risk rating after risk assessment - if the risk level changed - risk assessment API is not available yet)
  5. preSignupCreateGoal (goal plan can be displayed and then user must signup if they want to proceed)
  6. signupUser
  7. confirmSignupUser
  8. loginUserPwd
  9. (onbaording data input + document collection) we still dont have APIs for customer onboarding - so the onboarding data will not be saved in the server - keep it in the device
  10. goalAcceptProposal (user must be logged in to accept a proposal - this wil create a goal with status "awiting _funds" which will be displayed as goals in planning)
  11. goalPaymentInitiate (can be done anytime after a goal is accepted when the user wants to fund the goal. a cash trasfer request CTR will be created and returned to be accepted once the funds are moved to the investment account)
  12. goalPaymentAcceptCashTransfer (accept the CTR wil move the goal into "funded" state and now should be displayed in the "Investments" carousel)

FOR EXISTING / LOGGED IN USER JOURNEY:

  1. goalGetQuestions (for RETIREMENT, HOME, EDUCATION only)
  2. goalCalculateTarget (for RETIREMENT, HOME, EDUCATION only)
  3. (optional) investorUpdate (update the investors risk rating after risk assessment - if the risk level changed - risk assessment API is not available yet)
  4. goalCreateNewProposal
  5. (optional) for optimisation (currently only works for logged in users - it needs to work for pre-sign up also will introduce later) 5.1 goalApplySuggestionToProposal 5.2 goalApplyManualOptimisation
  6. goalAcceptProposal (user must be logged in to accept a proposal - this wil create a goal with status "awiting _funds" which will be displayed as goals in planning)
  7. goalPaymentInitiate (can be done anytime after a goal is accepted when the user wants to fund the goal. a cash trasfer request CTR will be created and returned to be accepted once the funds are moved to the investment account)
  8. (optional) goalRefreshProposal (if the user doesnt initiate payment on the same day then run this api to get a fresh proposal and walk through with the user)
  9. goalPaymentAcceptCashTransfer (accept the CTR wil move the goal into "funded" state and now should be displayed in the "Investments" carousel)

--

API USAGE DETAILS

1

registerDevice(settings, requestParams)

use this API to register the device which will create an anonymous user in WeInvest platform associated to the device. Use the mobile or device information to retrieve the unique device Number / ID, since this ID cannot be duplicate and must be globally unique. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |------------|----------|-------------|-------------| | deviceId | string | mandatory | minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier retrieved using device info | | nick_name | string | optional | investor nick name (alphanumeric greater than 6 digits|

sample request

    var api = require('gw-mobile-api');

    let settings = require('./api_config.json');
    
    var requestParams = {
        body: {
            deviceId : "999870019002",
            nickName : "slimjim1345"
        }
    };
    
    var response = await api.registerDevice(settings, requestParams);

sample responses

Success response

{
  "code": 200,
  "status": "success",
  "message": "Succesfully registered user device!",
  "result": {
    "deviceId": "AWSLAMBDA13459",
    "nickName": "slimjim1345",
    "dateRegistered": "2019-09-09T19:51:47.912Z",
    "dateAccessed": "2019-09-09T19:51:47.912Z",
    "investorCreated": "ok"
  },
}

Error response

{
  "status": "error",
  "code": 400,
  "error": {
    "code": 10,
    "message": "Error: device already exists!"
  }
}

2.

getGoalTypes (settings, requestParams)

The getGoalTypes API must be called to retrieve the various goal types supported and their corresponding attributes rewuired for data input validation. Note that the function is async.


Usage

Request parameters

None

Sample Request


  let settings = require('./api_config.json');

  var requestParams = {
      body: ""
  };

  var response = await api.getGoalTypes (settings, requestParams);

Sample Responses

{
  "code": 200,
  "status": "ok",
  "message": "Succesfully processed request!",
    "result": {
        "goal_types_mapping": {
        "EDUCATION": {
          "name": "General Savings Plan",
          "id": 2
        },
        "RAINYDAY": {
          "name": "General Savings Plan",
          "id": 2
        },
        "GENERAL": {
          "name": "General Savings Plan",
          "id": 2
        },
        "BIGSPEND": {
          "name": "Major Purchase",
          "id": 1
        },
        "RETIREMENT": {
          "name": "Retirement Plan",
          "id": 3
        },
        "HOME": {
          "name": "Major Purchase",
          "id": 1
        }
      }
    },
    "goal_types": [
      {
        "id": 1,
        "name": "Major Purchase",
        "identifier": null,
        "description": null,
        "show_order": null,
        "image_url": null,
        "goal_plan_type": "Wms::GoalPlan",
        "min_initial_investment_amount": 10000,
        "max_initial_investment_amount": 2000000,
        "min_additional_investment_amount": 5000,
        "max_additional_investment_amount": 2000000,
        "min_monthly_investment_amount": 5000,
        "max_monthly_investment_amount": 200000,
        "min_debit_date_monthly_investment": 1,
        "max_debit_date_monthly_investment": 30,
        "min_withdrawal_amount": 5000,
        "max_withdrawal_amount": 10000000,
        "min_goal_timeline": 1,
        "max_goal_timeline": 600,
        "min_target_amount": 10000,
        "max_target_amount": 60000000,
        "optimisation_suggestion_mode": 1,
        "min_suggestion_threshold": 60,
        "max_suggestion_threshold": 75,
        "lower_tolerance": 5,
        "upper_tolerance": 6,
        "no_of_reco_strategies": 1,
        "reco_probability_thresholds": [
          60
        ],
        "mcs_percentiles": [
          40,
          25,
          50,
          75
        ],
        "risk_constraint_mode": 1,
        "outcome_percentile": 40,
        "health_track_threshold": 30,
        "default_timeline": null,
        "min_current_age": null,
        "max_current_age": null,
        "min_retirement_age": null,
        "max_retirement_age": null,
        "min_life_expectancy": null,
        "max_life_expectancy": null,
        "expense_types": [],
        "conservative_inv_rate": 0
      },
      {
        "id": 2,
        "name": "General Savings Plan",
        "identifier": null,
        "description": null,
        "show_order": null,
        "image_url": null,
        "goal_plan_type": "Wms::GsPlan",
        "min_initial_investment_amount": 10000,
        "max_initial_investment_amount": 2000000,
        "min_additional_investment_amount": 5000,
        "max_additional_investment_amount": 2000000,
        "min_monthly_investment_amount": 5000,
        "max_monthly_investment_amount": 2000000,
        "min_debit_date_monthly_investment": 1,
        "max_debit_date_monthly_investment": 27,
        "min_withdrawal_amount": 5000,
        "max_withdrawal_amount": 2000000,
        "min_goal_timeline": 1,
        "max_goal_timeline": 600,
        "min_target_amount": 10000,
        "max_target_amount": 60000000,
        "optimisation_suggestion_mode": 1,
        "min_suggestion_threshold": 60,
        "max_suggestion_threshold": 70,
        "lower_tolerance": 5,
        "upper_tolerance": 6,
        "no_of_reco_strategies": 1,
        "reco_probability_thresholds": [
          60
        ],
        "mcs_percentiles": [
          25,
          40,
          50,
          75
        ],
        "risk_constraint_mode": 0,
        "outcome_percentile": 50,
        "health_track_threshold": 30,
        "default_timeline": 60,
        "min_current_age": null,
        "max_current_age": null,
        "min_retirement_age": null,
        "max_retirement_age": null,
        "min_life_expectancy": null,
        "max_life_expectancy": null,
        "expense_types": [],
        "conservative_inv_rate": 0
      },
      {
        "id": 3,
        "name": "Retirement Plan",
        "identifier": null,
        "description": null,
        "show_order": null,
        "image_url": null,
        "goal_plan_type": "Wms::RetirementPlan",
        "min_initial_investment_amount": 10000,
        "max_initial_investment_amount": 2000000,
        "min_additional_investment_amount": 5000,
        "max_additional_investment_amount": 2000000,
        "min_monthly_investment_amount": 5000,
        "max_monthly_investment_amount": 2000000,
        "min_debit_date_monthly_investment": 1,
        "max_debit_date_monthly_investment": 27,
        "min_withdrawal_amount": 5000,
        "max_withdrawal_amount": 2000000,
        "min_goal_timeline": 1,
        "max_goal_timeline": 600,
        "min_target_amount": 10000,
        "max_target_amount": 60000000,
        "optimisation_suggestion_mode": 1,
        "min_suggestion_threshold": 50,
        "max_suggestion_threshold": 65,
        "lower_tolerance": 5,
        "upper_tolerance": 6,
        "no_of_reco_strategies": 1,
        "reco_probability_thresholds": [
          50
        ],
        "mcs_percentiles": [
          25,
          40,
          50,
          75
        ],
        "risk_constraint_mode": 1,
        "outcome_percentile": 50,
        "health_track_threshold": 30,
        "default_timeline": null,
        "min_current_age": 20,
        "max_current_age": 99,
        "min_retirement_age": 20,
        "max_retirement_age": 99,
        "min_life_expectancy": 20,
        "max_life_expectancy": 120,
        "expense_types": [
          "basic_need",
          "travel",
          "healthcare",
          "others"
        ],
        "conservative_inv_rate": 0
      }
    ]
}

3.

preSignupUpdateInvestor (settings, requestParams)

preSignupUpdateInvestor API is used to update the anonymous investor record created for a device before the user has signed up for the service. This is used when the users risk profile must be updated prior to creating a goal plan for example.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |------------|----------|-------------|-------------| | deviceId | string | mandatory | minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier | | crr | string | mandatory | cutomer risk rating (a value between 1 - 8). Mandatory if customr risk rating is to be updated for goal creation| | first_name | string | optional | investor first name | | last_name | string | optional | investor last name | | nick_name | string | optional | investor nick name | | citizenship | string | optional | investor citizenship country | | salutation | string | optional | salutation ("Mr", "Mrs", "Ms", "Dr") | | client_segment | string | optional | client segment ("retail", "premier", "priority", "private_bank") | | dob | date | optional | date of birth (YYYYMMDD)| | gender | string | optional | gender ("male", "female") | | residential_status | string | optional | status of residency ( "resident_citizen", "permanent_resident", "foreigner", "non_resident_citizen" ) | | country_of_tax_residence | string | optional | country of tax residence (valid list as per getCountryList API ) | | tin | string | optional | tax identification number | | occupation_status | string | optional | Occupation status ( "salaried", "self_employed", "retired", "student" ) | | gross_annual_income | amount | optional | gross annual income amount (Should be less than 10 with 2 decimal precision) | | length_of_employment | number | optional | length of employment in months | | investment_source | string | optional | sources of investment (comma separated multiple strings as tags) | | us_person | boolean | optional | a US tax payer (true, false) |

sample request


  let settings = require('./api_config.json');

  var requestParams = {
      body: {
          deviceId: "AWSLAMBDA1345",
          crr: "4",
          first_name: "Silmi",
          last_name: "Nawaz",
          nick_name: "silminawaz",
          dob: "1968-07-20T00:00:00.000Z",
          gender: "male",
          us_person: false
      }
  }
  
  var response = await api.preSignupUpdateInvestor (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "ok",
    "message": "Succesfully processed request!",
    "result": {
        "investor": {
            "id": "**********",
            "crr": 4,
            "investor_wrapper_id": "8143",
            "first_name": "Silmi",
            "last_name": "Nawaz",
            "nick_name": "Silmi Nawaz 030",
            "email": null,
            "mobile_number": null,
            "citizenship": "SINGAPORE",
            "salutation": null,
            "status": "onboarded",
            "risk_profiling_date": "2019-09-08",
            "risk_profiling_status": "accepted_and_valid",
            "onboarding_channel": null,
            "client_segment": null,
            "created_at": "2019-09-08T15:32:27.440Z",
            "updated_at": "2019-09-09T10:56:47.250Z",
            "deleted_at": null,
            "dob": "1968-07-20",
            "gender": "male",
            "residential_status": null,
            "country_of_tax_residence": null,
            "tin": null,
            "occupation_status": null,
            "gross_annual_income": null,
            "length_of_employment": null,
            "investment_source": "Balary",
            "us_person": false,
            "risk_expiry_date": "2109-09-08",
            "bankaccount_verification_status": null,
            "secondary_channel": null,
            "kyc_status": "kyc_done_by_fi",
            "rm_status": "not_applicable"
        }
    }
}

Error response

{
    "status": "error",
    "code": 400,
    "error": {
        "code": 7,
        "message": "Error: No such device"
    }
}
{
    "status": "error",
    "code": 412,
    "error": {
        "code": 412,
        "message": "'MALE' is not a valid gender"
    }
}

4.

preSignupCreateGoal (settings, requestParams)

This API is used to create a goal based investment proposal for an anonymous investor / prospect when they are using the application for the first time (prior to signing up, hence its called "preSignup"). You need to provide the unique device identifier from the device information in order to ensure that there will not be any duplicate device identifiers. Once a deviceId is registered it cannot be reclaimed or reused. Once a user is registered using the signupUser() API and lined to the deviceId, the deviceId will no longer be used, instead the user must login using the credentials and be authenticated for all subsequent API calls. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |-----------------------------|----------|-------------|-------------| | deviceId | string | mandatory | minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier | | body.goalType | string | mandatory | The goal type ("HOME", "RETIREMENT", "EDUCATION", "BIGSPEND", "RAINYDAY", "GENERAL" ) | | body.goalName | string | mandatory | a user input name for the goal | | body.initialInvestmentAmount | amount | mandatory | the initial investment amount for the goal must be greater than or equal to the minimum initial investment amount of the goal | | body.monthlyInvestmentAmount | amount | mandatory | the monthly recurring investment amount for the goal must be greater than or equal to the minimum monthly investment amount of the goal | | body.targetAmount | amount | mandatory | The target amount to achieve for this goal | | body.timeline | amount | mandatory | The target amount to achieve for this goal |

sample request


  let settings = require('./api_config.json');

  var requestParams = {
      "body": {
          "deviceId":"AWSLAMBDA1345",
          "goalType": "BIGSPEND",
          "goalName": "My big spend",
          "initialInvestmentAmount": 20000.00,
          "monthlyInvestmentAmount": 5000.00,
          "targetAmount": 50000.00,
          "timeline": 36
      }   
  }
  var response = await api.preSignupCreateGoal (settings, requestParams);

sample responses

Success response

{
    "status": "ok",
    "code": 200,
    "messages": [],
    "result": {
        "goal_plan": {
            "id": 7657,
            "name": "Silmi Nawaz - Goal Planning 4",
            "initial_investment_amount": 200000.0,
            "monthly_investment_amount": 20000.0,
            "timeline": 60,
            "target_amount": 2000000.0,
            "status": "complete",
            "reco_mode": 1,
            "risk_profile": 5,
            "goal_type": "Major Purchase",
            "currency": "THB",
            "strategy_id": null,
            "strategy_version_id": null,
            "investor_id": "abc5d638-0ebc-4ca9-a264-73cff076466e",
            "investor_reference_id": null,
            "created_at": "2019-09-26T10:32:27.726Z"
        },
        "suggested_products": [
            {
                "annualized_return": 7.15,
                "expected_outcome": 1630029.73,
                "id": 5049,
                "min_threshold": 60.0,
                "probability": 6.4,
                "threshold": "max",
                "timeline": 60,
                "version_id": 5033,
                "volatility": 8.0
            }
        ],
        "expected_return": {
            "5049": {
                "strategy_id": 5049,
                "expected_outcome_id": 8768,
                "expected_outcomes": {
                    "1": {
                        "10.0": 195134.8901468119,
                        "15.0": 196295.8845031539,
                        "25.0": 197899.4394343525,
                        "30.0": 198633.7749452679,
                        "40.0": 199713.354666972,
                        "50.0": 200883.7108975171,
                        "75.0": 203954.7805108918
                    },
                    "10": {
                        "10.0": 368487.0308679563,
                        "15.0": 373556.0999752278,
                        "25.0": 380921.256496458,
                        "30.0": 383998.8332673069,
                        "40.0": 390201.1254096605,
                        "50.0": 395507.2530773099,
                        "75.0": 409471.7449490118
                    },
                    "11": {
                        "10.0": 387523.5178593269,
                        "15.0": 394207.465038505,
                        "25.0": 403241.7711065953,
                        "30.0": 406474.1529285541,
                        "40.0": 411750.2133257939,
                        "50.0": 418177.8607203122,
                        "75.0": 434138.5856147784
                    },
                    "12": {
                        "10.0": 407998.7010390257,
                        "15.0": 413779.2460416607,
                        "25.0": 422114.6688582357,
                        "30.0": 425704.0669918038,
                        "40.0": 432309.3260469321,
                        "50.0": 439241.5800827771,
                        "75.0": 459443.631708542
                    },
                    "13": {
                        "10.0": 428409.6283599908,
                        "15.0": 433426.8697165564,
                        "25.0": 442372.0528201638,
                        "30.0": 446140.3766133907,
                        "40.0": 454364.3713052343,
                        "50.0": 461461.2862436014,
                        "75.0": 481150.3507358249
                    },
                    "14": {
                        "10.0": 447263.3561391911,
                        "15.0": 453977.8658598182,
                        "25.0": 465414.5201932955,
                        "30.0": 469757.0552205933,
                        "40.0": 477613.4818560691,
                        "50.0": 484420.0459862712,
                        "75.0": 505141.8645582384
                    },
                    "15": {
                        "10.0": 468536.6128855551,
                        "15.0": 475454.0213838061,
                        "25.0": 486165.7977077073,
                        "30.0": 491601.2033797696,
                        "40.0": 500327.9171944831,
                        "50.0": 507398.622205973,
                        "75.0": 530337.7845650314
                    },
                    "16": {
                        "10.0": 488797.1667180442,
                        "15.0": 496545.1164017266,
                        "25.0": 508579.1358256681,
                        "30.0": 513865.85242771,
                        "40.0": 522805.2743322152,
                        "50.0": 530156.4788504164,
                        "75.0": 554141.4497087765
                    },
                    "6": {
                        "10.0": 289888.8025280961,
                        "15.0": 293559.746740239,
                        "25.0": 298602.5786008599,
                        "30.0": 300502.7402960922,
                        "40.0": 304308.3482919781,
                        "50.0": 308377.8004855883,
                        "75.0": 317603.1497997907
                    },
                    "60": {
                        "10.0": 1446649.6925846455,
                        "15.0": 1494224.8846784374,
                        "25.0": 1551198.3638840227,
                        "30.0": 1577162.9570479267,
                        "40.0": 1630029.7250926504,
                        "50.0": 1680054.6676243036,
                        "75.0": 1813501.7591033825
                    },
                    "7": {
                        "10.0": 309489.0340974706,
                        "15.0": 312745.6030027103,
                        "25.0": 319427.2827700677,
                        "30.0": 321595.7455745224,
                        "40.0": 326139.5996706327,
                        "50.0": 330450.2398969412,
                        "75.0": 340476.067841325
                    },
                    "8": {
                        "10.0": 328232.9119506932,
                        "15.0": 332433.4704141021,
                        "25.0": 339744.1395917819,
                        "30.0": 342728.0144154785,
                        "40.0": 346562.003549363,
                        "50.0": 351141.8593601184,
                        "75.0": 364365.7147609796
                    },
                    "9": {
                        "10.0": 348423.6197133779,
                        "15.0": 352725.8866366713,
                        "25.0": 360398.8098635135,
                        "30.0": 362982.8243706169,
                        "40.0": 368085.5199353639,
                        "50.0": 373213.6601562279,
                        "75.0": 386996.6718395527
                    }
                },
                "annualized_return": 7.15,
                "currency": "THB",
                "expected_return": 1630029.73,
                "volatility": 8.0,
                "success_probability": 6.4
            }
        },
        "proposal": {
            "id": "da2f7289-2890-4f67-8fe7-0fa57a3f8ed6",
            "recommended_strategy_id": 5049,
            "recommended_strategy_version_id": 5033,
            "chosen_strategy_id": null,
            "chosen_strategy_version_id": null,
            "proposal_status": "created",
            "proposal_investment_amount": 200000.0,
            "investment_request_type": "Initial Investment",
            "created_at": "2019-09-26T10:32:27.922Z",
            "accepted_at": null
        },
        "suggestions": {
            "5049": [
                {
                    "id": "71061688-0f3b-4a49-9e4d-97595b574cae",
                    "suggestion_type": "initial_investment",
                    "suggestion_value": 473037,
                    "strategy_id": 5045,
                    "version_id": 5029
                },
                {
                    "id": "225c5a57-09e3-42c8-b577-c1b05f934399",
                    "suggestion_type": "dca",
                    "suggestion_value": 25390,
                    "strategy_id": 5045,
                    "version_id": 5029
                },
                {
                    "id": "18bfd9c8-f000-4477-9a72-95848efb977f",
                    "suggestion_type": "timeline",
                    "suggestion_value": 73,
                    "strategy_id": 5047,
                    "version_id": 5031
                }
            ]
        }
    },
    "request_id": "879c8b5e-519f-4b80-b857-7131fc14ac3b",
    "requested_at": "2019-09-26T10:32:28.581+00:00"
}

Error response


5.

signupUser (settings, requestParams)

use this API to register the user in WeInvest platform (i.e. signup the user). The deviceId must be already registered by calling the registerDevice API, prior to calling the signupUser API. When the user is signed up a confirmation code will be sent to the users email or mobile (SMS messages are charged extra , so dont use it durig testing). In order to confirm the user, call the "confirmSignupUser()" API. Note that the function is async.

Sequence for api calls to login / authenticate a user

  1. first call registerDevice() and your device will be registered along with an anonymous investor / prospect for who you can create proposals. deviceId must be unique across all devices, so retrieve the unique device number using the device information API on your mobile device.

  2. when the user is ready to signup, call signupUser() to Register the user when they want to go ahed with the investment (move user from prospect to go ahead and onboard them

  3. to confirm the user registration call confirmSignupUser() and provide the OTP => Verify the users account by providing the OTP / confirmation code sent to the user

  4. once the user is confirmed, you can login by callig loginUserPwd() to authenticate the user. You will receive an IDTOKEN and REFRESHTOKEN to call all secured APIs in future. IDTOKEN is valid for 1 Hour and REFRESHTOKEN is valid for 30 days and should be persisted if you want to use biometric login. You may use the REFRESHTOKEN to authenticate user when using the biometric login where the user does not provide username and password. Once the REFRESHTOKEN expires you must force an authentication using the username and password.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |--------------|----------|-------------|-------------| | deviceId | string | mandatory | minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier | | userName | string | mandatory | minimum 10 digits, alphanumeric + special characters| | password | string | mandatory | minimum 8 digits, 1 upper case, 1 lower case, 1 numeric , 1 special character| | email | string | mandatory | valid email address. A confirmation code will be sent to this email address for verification| | mobile | string | optional | valid mobile number e.g. +6598770234. A confirmation code will sent by SMS for verification|

sample request


  let settings = require('./api_config.json');

  var requestParams = {
      "body": {
        "userName": "silminawaz018",
        "password": "Password123",
        "deviceId": "123456789018",
        "email": "[email protected]",
        "mobile": ""
      }
  }

  var response = await api.signupUser (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "success",
    "message": "Succesfully registered user! A confirmation code (OTP) has been sent to the user EMAIL (s***@s***.com). Please enter the confirmation code!",
    "result": {
        "UserConfirmed": false,
        "CodeDeliveryDetails": {
            "Destination": "s***@s***.com",
            "DeliveryMedium": "EMAIL",
            "AttributeName": "email"
        },
        "UserSub": "8b3d5738-de0c-4031-b6c4-b6018a2d27d3"
    }
}

Error response

{
    "status": "error",
    "code": 400,
    "error": {
        "code": 5,
        "message": "Error: The deviceId is already claimed!  You must provide a deviceId that is unique to the device being used"
    }
}
{
    "status": "error",
    "code": 400,
    "error": {
        "code": 7,
        "message": "Error: No such device"
    }
}
{
    "status": "error",
    "code": 400,
    "error": {
        "code": 4,
        "message": "Password did not conform with policy: Password not long enough"
    }
}

6.

confirmSignupUser (settings, requestParams)

call confirmSignupUser() to confirm the user email/mobile using the one time confirmation code (OTP) sent to the user's email. It is not possible to login / authenticate a user until the user has been confirmed and the confirmation code is verified.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |--------------|----------|-------------|-------------| | deviceId | string | conditional | required if device tracking is turned on. minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier. user can login from any device - no restrictions apply | | userName | string | mandatory | minimum 10 digits, alphanumeric + special characters| | confirmationCode | string | mandatory | confirmation code received by email or SMS |

sample request


  let settings = require('./api_config.json');

  var requestParams = {
        "body": {
            "deviceId": "123456789018",
            "userName": "silminawaz018",
            "confirmationCode": "197244"
        }
  }

  var response = await api.confirmSignupUser (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "success",
    "message": "Succesfully confirmed user!",
    "result": {}
}

Error response

{
    "status": "error",
    "code": 400,
    "error": {
        "code": 12,
        "message": "Error: userName and deviceId mismatch, please contact administrator!"
    }
}
{
    "status": "error",
    "code": 400,
    "error": {
        "code": 0,
        "message": "User cannot be confirmed. Current status is CONFIRMED"
    }
}

7.

loginUserPwd (settings, requestParams)

call loginUserPwd() to authenticate the user with userName and Password. For biometric login you must use loginToken() once the device has successfully authenticated the user via either fingerprint or faceid. As response to loginUserPwd() you will receive an IDTOKEN and REFRESHTOKEN to call all secured APIs in future. IDTOKEN is valid for 1 Hour and REFRESHTOKEN is valid for 30 days and should be persisted if you want to use biometric login. Once the REFRESHTOKEN expires you must force an authentication using the username and password by calling this API. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |--------------|----------|-------------|-------------| | deviceId | string | conditional | required if device tracking is turned on. minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier. user can login from any device - no restrictions apply | | body.userName | string | mandatory | minimum 10 digits, alphanumeric + special characters| | body.password | string | mandatory | minimum 8 digits, 1 upper case, 1 lower case, 1 numeric , 1 special character|

sample request


  let settings = require('./api_config.json');

  var requestParams = {
        "deviceId": "123456789018",
        "body": {
            "userName": "silminawaz018",
            "password": "Password123",
        }
  }

  var response = await api.loginUserPwd (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "success",
    "message": "Succesfully processed request!",
    "result": {
        "ChallengeParameters": {},
        "AuthenticationResult": {
            "AccessToken": "eyJraWQiOiJYXC80VmRMaGFcL0ROT3VCUjNQVFNwamhMaTFvd2RzRFBSeUpEcXFTVG4wRjg9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4YjNkNTczOC1kZTBjLTQwMzEtYjZjNC1iNjAxOGEyZDI3ZDMiLCJldmVudF9pZCI6ImNiOTc1ODk4LWM5ZDQtNDVkOS04MTRjLWVjNzU4ZmM0YWVmNSIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE1NjgxMzY4NTQsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29tXC9hcC1zb3V0aGVhc3QtMV8xMktvaEdUSkkiLCJleHAiOjE1NjgxNDA0NTQsImlhdCI6MTU2ODEzNjg1NCwianRpIjoiZTZmMGVjZDktYzdkMC00OGJmLTk3NDgtZmM1MTQ4NzYyYjYzIiwiY2xpZW50X2lkIjoiNXZxN2JtNGlqNmE2N2IxMG9lZHNrZ3B0cnAiLCJ1c2VybmFtZSI6InNpbG1pbmF3YXowMTgifQ.n3AfYlDt-08fgc9ti63YimwhJ8NFKAaPiksGUWL6eS5rHK3bN5hmUkKnc-UfnL3qFaE7XmkdJn-ydXe4crEqknsbnkg9cLJ7B2ztc_ccF4kTCsejbJGuvNSbwpt3ipX5SKYOFiPpOe0vinLFB3oe5pucuaEsfA1v3JyqXQcA5EcpsxbaYQsHJRvhqUVgXw3mWhRmKEF9GVFvOQ5BQ0_mCBZY9jK4ya_UoFnaflt7438p_rw3B5iOLL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JldmVudF9pZCI6ImNiOTc1ODk4LWM5ZDQtNDVkOS04MTRjLWVjNzU4ZmM0YWVmNSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNTY4MTM2ODU0LCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAuYXAtc291dGhlYXN0LTEuYW1hem9uYXdzLmNvbVwvYXAtc291dGhlYXN0LTFfMTJLb2hHVEpJIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6InNpbG1pbmF3YXowMTgiLCJleHAiOjE1NjgxNDA0NTQsImlhdCI6MTU2ODEzNjg1NCwiZW1haWwiOiJzKioqKioqKioqKio4QHMqYXJrbGFzZXJzLmNvbSJ9.w991OAdXxe2kP6_TVpebJU49lVRNFHuvuu6XFUxXjSG7YtagIOA_oic0GypSQUJ8iIHDEyljuFP5FU4z3A2Wi_VlZv8rEQczCZy_UDTAHuefoOuTuboCHwlBe4Vjmy_59Pp7Go0oW4j1IWOi61x9V1Y-ubmb3IgomJYjn7O51gDP1ZxqlCF12QiPiVVUybA4NkuuhND-8mK2E8457oPsTT7Jz8XD-F_B5BpMKVHZmjeskeP-FtbnjxXNjqH8Q5HQ6lLtSeOBILn3uMtyCxLgb7Br5snrMG-LqQcgRNk82ZnToZLC_sktHPjAgMcHMNFcd59jI9UKfCDrAeNWTMQQOw"
        }
    }
}

Error response

{
    "status": "error",
    "code": 400,
    "error": {
        "code": 14,
        "message": "Error: Device session tracking is turned on, the request header must include Auth-Application-Id and Auth-Device-Id."
    }
}
{
    "status": "error",
    "code": 400,
    "error": {
        "code": 7,
        "message": "Error: No such device"
    }
}
{
    "status": "error",
    "code": 400,
    "error": {
        "code": 4,
        "message": "Password did not conform with policy: Password not long enough"
    }
}

8.

loginToken (settings, requestParams)

call loginToken() to authenticate the user with an existing RefreshToken if you do not wish to collect the user's password. This API is useful when you want to use thumbprint or faceid on the mobile device to authenticate the user. As response to loginUserToken() you will receive an IdToken for use when you call all secured APIs in future. IDTOKEN is valid for 1 Hour. Each time the IdToken expires, you must call loginToken() as long as the RefreshToken is valid. Once the RefreshToken expires you must force a login using the username and password by calling loginUserPwd() API to receive a new IdToken and RefreshToken. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |--------------|----------|-------------|-------------| | deviceId | string | conditional | required if device tracking is turned on. minimum 10 digits, alphanumeric + special characters, must be unique a device specific unique identifier. user can login from any device - no restrictions apply | | refreshToken | string | mandatory | must be a valid refreshToken received from the loginUserPwd() API |

sample request


  let settings = require('./api_config.json');

  var requestParams = {
            
            "deviceId": "123456789018",

            "body": {
                "refreshToken": "eyJjdHkiOiJKV1QiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAifQ.Lk268UNk-HgrVbI_pkPNkxOxWHOiSBgxZ2H85ljcRSI12dxHICuO4uDJzb7Ud_Wm2lSiCF0Mq2Zv6oYcOPvCoGWoW3RezuXLiD6SW_B6RQYq6qjGTzu38bdsV1UtGvhDV6kTP7ghsMwg5tqaF5p1rWdm6XivQrIkFWvnEKuUhyVqL5D555oazNQosyKHAAnD8xvXQGHCvULyRLIV4TDQ_i3f-XoDizl2gVYQUIWPXWsiMgxaeo_8Sk1n_hD_F3OHXGRIMYErG-CKblp_6GAbv4ovbIWJND6MMGcqA_hmYv2f3BBM8FBxAPA9-MaqeAcn1w6-_h8G9wfm6-3GmaVEug.9MbkVv9ZPHXBHSJ4.f2-ifUuvq8ozljkwFBUf_-e483zrBz5EoEdmLNouX54BTYL2h_CTixXCPSj5dhbkDafFBzm9mKcr56NWbgJSmHQCDkd0IHLHvPsuYPWP2OukyRGjVZWyk8hJiKYZSdlxah9AspGR71YpIV0OfaC3YCKbI-YC_ZXlo4YAH4gwIIZYFngqwOME77WV1wgPcnvvpQyg7jVyh0PRJi8FMfWCaZ2hD8YSLbEembk_T6W36taO7wrG_6yzeWAP1f_bC0qtJ3tsETBM1q8WsD_Zs8E2K3BT9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Ntvw"
              }
        }

  var response = await api.loginToken (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "success",
    "message": "Succesfully processed request!",
    "result": {
        "ChallengeParameters": {},
        "AuthenticationResult": {
            "AccessToken": "eyJraWQiOiJYXC80VmRMaGFcL0ROT3VCUjNQVFNwamhMaTFvd2RzRFBSeUpEcXFTVG4wRjg9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4YjNkNTczOC1kZTBjLTQwMzEtYjZjNC1iNjAxOGEyZDI3ZDMiLCJldmVudF9pZCI6IjliMjYwOTBiLWE1ZjUtNGJmOS1hNGRiLWUwMzUxMGU4MzU4ZSIsInRva2VuX3VzZSI6ImFjY2VzcyIsInNjb3BlIjoiYXdzLmNvZ25pdG8uc2lnbmluLnVzZXIuYWRtaW4iLCJhdXRoX3RpbWUiOjE1NjcyNzU2NzcsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC5hcC1zb3V0aGVhc3QtMS5hbWF6b25hd3MuY29tXC9hcC1zb3V0aGVhc3QtMV8xMktvaEdUSkkiLCJleHAiOjE1Njc3MDM1NzEsImlhdCI6MTU2NzY5OTk3MSwianRpIjoiNDY5MjEwODEtM2E1Ny00ZTg5LTgwZTEtNGVmYmQ0NmNjMjY3IiwiY2xpZW50X2lkIjoiNXZxN2JtNGlqNmE2N2IxMG9lZHNrZ3B0cnAiLCJ1c2VybmFtZSI6InNpbG1pbmF3YXowMTgifQ.cDXQvS0Y861Lk7NWyqYGBu1TBUU3Eaawi53-ZIBafIuVpyNXVKq0lyBf6IDZ0ARYkBTBGmyiSvwg-ISAB-8bjgXGFd9i2u_Ab6dWpYNDjxWvD8fxHTZ_h-cMPm7x6kk0NZ_mDFzb-AwJm24njBu_SLIwRl3NVIx5sjnmdF0e1x7Mh94D0JIYZPvy-EcjDXOUP3UFw17tda_Yvkp0S4VtYhk9JcL8yfZT5s6V4sfoL6E0zsIMGzl21zoDkya7PHLuA1CoRmemQpKrvgXhlZ6BgCODq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HMGH-YGaOl6XIJc1SilDl9uQ"
        }
    } 
}

Error response

{
    "status": "error",
    "code": 400,
    "error": {
        "code": 14,
        "message": "Error: Device session tracking is turned on, the request header must include Auth-Application-Id and Auth-Device-Id."
    }
}
{
    "status": "error",
    "code": 400,
    "error": {
        "code": 0,
        "message": "Invalid Refresh Token"
    }
}

9.

investorUpdate (settings, requestParams)

use this API to update investor details. This api requires authentication. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |------------|----------|-------------|-------------| | param1 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param1 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param1 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") |

sample request

    let settings = require('./api_config.json');

    requestParams = {
        headers: {
            Authorization: "[Place a valid IdToken for the logged in user here]"
        },
                body: {
                "crr": 8,
                "salutation": "",
                "first_name": "Silmi",
                "last_name": "Nawaz",
                "dob": "1968-07-20T00:00:00.000Z",
                "investment_source": "Salary",
                "gender": "male",
                "us_person": false,
                "citizenship": "SINGAPORE"
        }
    }

    response = await api.investorUpdate (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "ok",
    "message": "Succesfully processed request!",
    "result": {
        "investor": {
            "id": "**********",
            "crr": 4,
            "investor_wrapper_id": "20188",
            "first_name": "Silmi",
            "last_name": "Nawaz",
            "nick_name": "Silmi Nawaz 040",
            "email": null,
            "mobile_number": null,
            "citizenship": "SINGAPORE",
            "salutation": null,
            "status": "onboarded",
            "risk_profiling_date": "2019-09-20",
            "risk_profiling_status": "accepted_and_valid",
            "onboarding_channel": null,
            "client_segment": null,
            "created_at": "2019-09-20T16:14:19.823Z",
            "updated_at": "2019-09-20T16:14:46.149Z",
            "deleted_at": null,
            "dob": "1968-07-20",
            "gender": "male",
            "residential_status": null,
            "country_of_tax_residence": null,
            "tin": null,
            "occupation_status": null,
            "gross_annual_income": null,
            "length_of_employment": null,
            "investment_source": "Balary",
            "us_person": false,
            "risk_expiry_date": "2109-09-20",
            "bankaccount_verification_status": null,
            "secondary_channel": null,
            "kyc_status": "kyc_done_by_fi",
            "rm_status": "not_applicable"
        }
    }
}

Error response

{
    "message": "The incoming token has expired"
}
{
    "status": "error",
    "code": 422,
    "error": {
        "code": 422,
        "message": "Validation failed: Citizenship is not included in the list"
    }
}

10.

investorGetDetails(settings, requestParams)

use this API to ......
This api requires authentication. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |------------|----------|-------------|-------------| | param1 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param2 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param3 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") |

sample request

    let settings = require('./api_config.json');

    requestParams = {
        headers: {
            Authorization: "[Place a valid IdToken for the logged in user here]"
        },
                body: {
                "param1": "param1_value",
                "param2": "param2_value",
                "param3": "param2_value"
        }
    }

    response = await api.investorGetDetails (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "ok",
    "message": "Succesfully processed request!",
    "result": {

        }
    }
}

Error response

{
    "message": "The incoming token has expired"
}
{
    "status": "error",
    "code": 422,
    "error": {
        "code": 422,
        "message": "......."
    }
}

11.

goalGetQuestions (settings, requestParams)

use this API to ......
This api DOES NOT requires authentication. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |------------|----------|-------------|-------------| | param1 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param2 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param3 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") |

sample request

    let settings = require('./api_config.json');

    requestParams = {
                goalType: "RETIREMENT"
        }
    }

    response = await api.goalGetQuestions (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "ok",
    "message": "Succesfully processed request!",
    "result": {

        }
    }
}

Error response

{
    "message": "The incoming token has expired"
}
{
    "status": "error",
    "code": 422,
    "error": {
        "code": 422,
        "message": "......."
    }
}

12.

goalCalculateTarget (settings, requestParams)

use this API to ......
This api DOES NOT requires authentication. Note that the function is async.

Usage

Request Parameters

| parameter | type | mandatory? | valid values| |------------|----------|-------------|-------------| | param1 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param2 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") | | param3 | string | mandatory | minimum 10 digits, alphanumeric + special characters, valid valueds ("ABC", "DEF", "HIJ") |

sample request

    let settings = require('./api_config.json');

    requestParams = {
        headers: {
            Authorization: "[Place a valid IdToken for the logged in user here]"
        },
                body: {
                "param1": "param1_value",
                "param2": "param2_value",
                "param3": "param2_value"
        }
    }

    response = await api.goalCalculateTarget (settings, requestParams);

sample responses

Success response

{
    "code": 200,
    "status": "ok",
    "message": "Succesfully processed request!",
    "result": {

        }
    }
}

Error response

{
    "message": "The incoming token has expired"
}
{
    "status": "error",
    "code": 422,
    "error": {
        "code": 422,
        "message": "......."
    }
}

13.

goalCreateNewProposal(settings, requestParams)

use this API to create a new Goal plan and proposal for a signedup user This api requires authentication. Note that