Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public with sharing class Cenas implements CalloutActionInterface {
- private String theBody;
- private String theEndpoint;
- private Map<String,String> theHeaders;
- private String theCertificate;
- public String theAplicationId;
- public Cenas(Tenas.Menas sessionDetails) {
- Integration IntegrationS = Utils.getIntegrationSsMap().get('Start_Session_Mobile');
- theEndpoint = IntegrationS.Endpoint__c;
- theAplicationId=Utils.getApplicationId();
- CenasRequest requestBody = (CenasRequest) JSON.deserialize(IntegrationS.Body__c, CenasRequest.class);
- requestBody.Id = theAplicationId;
- requestBody.RemoteIPAddress = sessionDetails.RemoteIPAdress;
- requestBody.OSName = sessionDetails.OSName;
- requestBody.OSVersion = sessionDetails.OSVersion;
- theBody = JSON.serialize(requestBody);
- theCertificate = IntegrationS.Certificate_Name__c;
- theHeaders = Web.getGeneralHeaders('');
- }
- public Object doAction(){
- WebW.RequestParams Request = new WebW.RequestParams()
- .setEndpoint (theEndpoint)
- .addHeaders(theHeaders)
- .setBodyRequest(theBody)
- .setCertificateName(theCertificate)
- .setMethod(WebW.METHOD.POST);
- Web.StartSession deserializedResponse = (Web.StartSession) JSON.deserialize(WebW.doTheCallFor(ocktoRequest), Web.StartSession.class);
- System.debug(LoggingLevel.FINEST, deserializedResponse);
- if (deserializedResponse.HasError == 'True' || deserializedResponse.Result == '') throw new Web.WebException('Start session token not received');
- return deserializedResponse.Result==null?'Dummy':deserializedResponse.Result;
- }
- private class CenasRequest {
- public String Id;
- public String Provider;
- public String Type;
- public String CdmVersion;
- public String Mobile2Mobile;
- public String RemoteIPAddress;
- public String OSName;
- public String OSVersion;
- public String ConsentCode;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement