soupmarkets-client-sdk
v1.0.4
Published
Comprehensive NodeJS SDK for integration with soup services
Readme
SoupMarkets Client Software Development Kit
Comprehensive NodeJS SDK for integration with soup services
Overview
This repository provides an SDK that facilitates communication with soupmarkets backend API for various client-related services such as account management and investment order requests, asset allocation, identity information, request custody & valuation statements and perform various investment-related transactions. This SDK is designed for integration into applications where API communication is required, abstracting away complex requests.
Features
- Client registration and account management.
- Pin reset and pin management.
- Security and asset allocation requests.
- Order requests, including status tracking and history.
- Fetch and update various types of client information (personal, address, employment, etc.).
- Enum utilities and industry listings for additional client information.
Getting Started
This SDK allows your Node.js application to communicate with backend APIs efficiently. To get started, follow the installation instructions and use the examples to make API requests.
Prerequisites
- Node.js installed on your system.
- Axios: For making HTTP requests
Installation
- Clone this repository to your local machine.
git clone https://github.com/enscriptgh/soupmarkets-client-sdk.git- Navigate to the project directory in your terminal.
cd soupmarkets-node-sdk- Install dependencies using npm.
npm install- Create a configuration file (e.g., config.json) in the root directory. This file will hold the necessary credentials and configuration details.
JSON Configuration
- Obtain the required credentials for API authentication:
baseURL: The URL of the API endpoint where the USSD requests will be sent.apiId: Your API ID for basic authentication.apiSecret: Your API secret key for basic authentication.
Environment Variables
Create a .json file in the root directory based on the provided .json example below. Update the environment variables with the obtained credentials:
{
"baseURL": "https://your-api-endpoint.com",
"apiId": "your_api_id",
"apiSecret": "your_api_secret_key"
}Ensure that you replace "https://your-api-endpoint.com", "your_api_id", and "your_api_secret_key" with the actual API endpoint URL, API ID, and API secret key required for authentication.
With this configuration, your USSD application will be set up to send requests to the specified API endpoint using basic authentication with the provided API credentials.
Make API REQUESTS
After loading the configuration, instantiate the ApiService class and start making API requests. Below is an example of how to request client account services.
const ApiService = require('./apiService');
const config = loadConfig('./config.json'); // Load from config file
const apiService = new ApiService(config);
async function fetchClientData() {
try {
const contact = 'your_contact_info';
const clientData = await apiService.apiClientData(contact);
console.log(clientData);
} catch (error) {
console.error('Error fetching client data:', error.message);
}
}
fetchClientData();Available Methods
The following methods are available in apiService.js:
- Client Management:
- apiClientData(contact): Fetch client account details.
- apiClientRegister(contact, bodyData): Register a new client.
- apiClientNewPortfolio(contact): Create a new portfolio for the client.
- Order and Asset Management:
- apiDoOrderRequest(bodyData, contact): Submit a new order request.
- apiCheckOrderStatus(bodyData, contact): Check the status of an order.
- apiClientAssets(contact): Fetch the client’s available assets.
- Identity and Personal Information:
- apiIndividual(contact): Retrieve individual details.
- apiIndividualBasicInformation(contact, id): Get basic information for a client.
- apiUpdateIndividualBasicInformation(bodyData, contact, id): Update basic client information.
- Utility and Support:
- apiEnumUtilityList(contact): Fetch a list of enums used within the application.
- apiPaymentMethodList(contact): Get available payment methods.
For a full list of API endpoints and their corresponding methods, refer to the code inside apiService.js.
