How To Integrate Plaid With ERP CRM

Posted By : Vikash Patwal | 24-Dec-2017

This diary is facilitate to search out the way to integrate cloth with ERP CRM project and check all on-line bank group action.

1)first off we have a tendency to go this link https://plaid.com/docs/api/ and register then we are able to get client_id, public_key, secret key this key's employed in all cloth API.

(i)Item: a collection of credentials at a monetary institution; every Item will have several Accounts, and a fewAccounts have Transactions related to them.
(ii)client_id ANd secret: 2 non-public API keys; employed in conjunction with AN access_token to access knowledgefor an Item.
(iii)public_key: a public API identifier; accustomed initialize Link and establish things you produce or update via Link.
(iv)access_token: A mobile token distinctive to one Item; accustomed access knowledge for that Item.
(v)public_token: A ephemeral token which will be changed for AN access_token or accustomed initialize Link in update mode for AN Item.

2)than we have a tendency to used on-line bank username arcanum.and additionally we are able to be employed in the various setting.The Sandbox setting is unrestricted and supports solely take a look at things. the eventsetting supports up to one hundred live things. All testing ought to be tired our Sandbox and Development environments. All requests for Production are beaked.

 

(i)https://sandbox.plaid.com (Sandbox).
(ii)https://development.plaid.com (Development).
(iii)https://production.plaid.com (Production).

 


->Controller-:

 

 

@RequestMapping(value = URLMapping.FINANCIALS_CONFIGURATIONS_PLAID_ACCOUNT_CREATE, method = RequestMethod.POST)
public Map createAccountWithPlaid(@RequestBody Map map,HttpServletResponse response,HttpServletRequest request) {
HttpSession session = request.getSession();
Locale locale = (Locale) session.getAttribute("locale");
Map result = plaidService.createAccountWithPlaid(map,request, null);
if (result==null) 
{
return ResponseHandler.generateResponse(HttpStatus.BAD_REQUEST, true, "Bad Request", null,
result);
}
return ResponseHandler.generateResponse(HttpStatus.ACCEPTED, false,"Success", null, result);
}

 

->Service-:

 




public Map createAccountWithPlaid(Map map,HttpServletRequest request, HttpServletResponse response) {

Delegator delegator = infrastructure.getDelegator(); 
    RestTemplate restTemplate = new RestTemplate();
    HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set("Content-Type", "application/json");
    String url=plaidCreateUrl;
    Map getInstitutionName=FastMap.newInstance();
    getInstitutionName.put("query", map.get("query"));
    getInstitutionName.put("products",map.get("products"));
    getInstitutionName.put("public_key", publicKey);
         Map getName = restTemplate.postForObject("https://sandbox.plaid.com/institutions/search",getInstitutionName, Map.class);
      Map accountMap=FastMap.newInstance();

      accountMap.put("public_key",publicKey);
    List init=new ArrayList();
    init.add("auth");
    Map result2=null;
    accountMap.put("credentials", map.get("credentials"));
    accountMap.put("initial_products",init);
    ArrayList institutions=(ArrayList) getName.get("institutions");
    String institution_name=null;
    for(int i=0; i< institutions.size(); i++){
     Map data=(Map) institutions.get(i);
     institution_name= (String) data.get("institution_id");
    }
    accountMap.put("institution_id", institution_name);
  try{
         Map result = restTemplate.postForObject(plaidCreateUrl,accountMap, Map.class);
    String public_token=(String) result.get("public_token");
    String institution_id=(String) accountMap.get("institution_id");
    Map credentials= (Map) map.get("credentials");
    String username=(String) credentials.get("username");
    
    String url1=plaidExchangeTokenUrl;
      Map newMap1=FastMap.newInstance();
      newMap1.put("client_id", clientId);
      newMap1.put("secret", secret);
      newMap1.put("public_token", public_token);

    result2 = restTemplate.postForObject(plaidExchangeTokenUrl,newMap1, Map.class);
    
    Map data=FastMap.newInstance();
    data.put("accessToken", result2.get("access_token"));
    data.put("userName", username);
    data.put("institutionId", institution_id);
    data.put("itemId", result2.get("item_id"));

GenericValue plaid = delegator.makeValue("Plaid", data);
plaid = delegator.create(plaid, false);
  }

catch(Exception ex){
ex.printStackTrace();
}

return result2; 

}

 

3) additionally we are able to go this link https://plaid.com/docs/api/ and used all api

(i)Auth-> POST /auth/get (ii)Transactions-> POST /transactions/get

(iii)Identity-> POST /identity/get

(iv)Income-> POST /income/get

(v)Balance-> POST /accounts/balance/get


Thanks.

About Author

Author Image
Vikash Patwal

Vikash Patwal is Masters in Computer Applications and good in Java , he is hardworking team player.

Request for Proposal

Name is required

Comment is required

Sending message..