Wrapper API- Integration

Proposal summary

We are returning the order and financial summary from Netsuite in the JSON format using the Restlet script whenever the API is requested from the external application. Specifically we are returning the school order details, parent-student order details, invoice and payment details.

Requirement 

XSEEED Education is developing an internal app product that is going to be deployed at schools(customers). All order details, billing information related to the schools are available on Netsuite. So using this app schools can check the order summary and financial summary (display purpose only). So the product vendor needs an API structure to collect the information from Netsuite in a specific data structure format.

Order Summary Module○Parent/Student Order -Currently, the parents order the books on XSEED’s HomeDelivery Shopify portal. These orders are stored on Netsuite which we want to display on our system to the following users: Subject Admin, Standard Admin,School Admin, Super Admin of the respective schools that are associated withXSEED.

School Orders -The orders that are placed by the schools to the XSEED team are also stored on the XSEED platform & we want to display them on our system to the following users: Subject Admin, Standard Admin, School Admin, Super Adminof the respective schools that are associated with XSEED

Financial Statement○This section is meant to show the school their payment status with XSEED. We Want to display them on our system to the following users: School Admin & Super Admin of the respective schools that are associated with XSEED.○School’s up-to-date account statement with invoiced, paid, and balance amounts showing clearly (what schools need to pay XSEED).

Prerequisites

  • API JSON structure from 9spl  //Got the final version
  • Get mapping for rbYear and cycle – XSEED
  • Get mapping for schoolXorgCode and discount code – XSEED
  • Test data (SO, invoice, Payment)

Our Solution

We are developing the wrapper APIs using the Netsuite Restlet script to achieve the integration requirement.

For authentication between Netsuite and the internal app we are using the TBA(OAUth 1.0) authentication. 9spl and XSEED can initiate the Restlets URL (API) from an external service which will invoke the Restlet in Netsuite and return the necessary details as a response in JSON format.

Detailed explanation for the authentication details including how to create the signature are added in the document below.

Signature Construction – TBA using OAuth 1.0 – XCEED

Restlet API’s are created in the following categories.

  • School Order
  • Parent_Student Orders 
  • Financial summary
    • Payment summary
    • Payment history

The detailed field mapping between Netsuite and API are given in the following document.

NS-API field mapping

School Order

For the school orders, we will find the sales orders that match the schoolXorgCode(from customer record) and rbYear(based on the mapping between year and cycle). Once we find the orders, we will return the details of multiple orders in the provided JSON format.

For finding the grade and total books packs: 

  • We are grouping based on the grade and the total quantity from the item lines.
  • If it is a pack item, then quantity = quantity in item line * pack quantity from item record

Parent_Student Orders 

For the Parent_Student orders, we will find the sales orders that match the schoolXorgCode (based on the mapping between schoolXorgCode and discount code) and rbYear(year in the tran_date of the order). Once we find the orders, we will return the details of multiple orders in the provided JSON format.

Financial summary

  • Payment summary: List of all invoices which are open and paid in full that matches the schoolXorgCode(from customer record) and rbYear(based on the mapping between year and cycle). Once we find the transactions, we will return the details of multiple orders in the provided JSON format.
  • Payment history: Finding all the invoices with status paid in full and open that have at least one payment created already. And it should match the  schoolXorgCode(from customer record) and rbYear(based on the mapping between year and cycle) in the API request.

We are not considering open invoices in which at least one payment record is not created.  Once we find the transactions, we will return the details of multiple orders in the provided JSON format.

Assumptions

  • For finding the grade and total books packs, we will consider inventory, assembly, and kit items. We don’t consider other type of non inventory items
  • Currently we are not using any middleware server. (Netsuite-Internal APP)
  • And data is returning to the internal APP in the real time from the Netsuite as JSON response for the Restlet API request.
  • Authentication details should be created by the entity who is initiating the API request.
  • We have not considered any extra filters in the API request other than schoolXorgCode and rbYear. If we need any extra filter, then we have to treat it as a different API and the estimate also varies.
  • We will be referring to the provided API JSON structure from 9spl for development of the four cases. (sample input and output example for School Order, Parent_Student Orders, Payment summary, Payment history)

Risks 

  • As per the current Netsuite setup the concurrency limit is 5 for all the web services. So if more than 5 requests are initiated at the same instant then the request from 6th will be failed. Possible workaround are,
    • Purchase extra suitecloud license to increase concurrency.
    • Use a middleware and cache the data OR cache the data in Netsuite as files and return the files
  • Restlet script chartersistcs
    • 5,000 usage units per script
    • Maximum 10MB per string used as RESTlet input or output

Leave a comment

Your email address will not be published. Required fields are marked *