SHARE
TWEET

auditVars

a guest Oct 14th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. BROKER SCHEMA Service
  4. -- **************************************************************** --
  5. -- Developer : Ahmed Safwat
  6. -- Date : 25/2/2018
  7. -- Version :
  8. -- Implementation ID : --
  9. -- Comments : --
  10. -- **************************************************************** --
  11.  
  12. CREATE COMPUTE MODULE LoanCancelation_AuditVarsContextRouting_WS
  13.     CREATE FUNCTION Main() RETURNS BOOLEAN
  14.     BEGIN
  15.         CALL CopyMessageHeaders();
  16.  
  17.         DECLARE ENV REFERENCE TO Environment.Variables;
  18.         DECLARE inHdr REFERENCE TO InputRoot.XMLNSC.alr:LoanCancelationRq.Hdr;
  19.         DECLARE inBody REFERENCE TO InputRoot.XMLNSC.alr:LoanCancelationRq.Body;
  20.         --Save Soap Context Data
  21.         SET ENV.Context.OriginalProperties = InputRoot.Properties;
  22.         SET ENV.Context.SOAPReplyID = InputLocalEnvironment.Destination.SOAP.Reply.ReplyIdentifier;
  23.         --Routing
  24.         SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = 'GetT24ContractExitenceStatus';
  25.         --Context
  26.         CREATE FIELD ENV.Context.LoanCancelationRq;
  27.         DECLARE LoanCancelationRq REFERENCE TO ENV.Context.LoanCancelationRq;
  28.         -- setting destination to FinanceBulkCancelation
  29.         SET OutputLocalEnvironment.Destination.RouterList.DestinationData[1].labelName = 'GetT24ContractExitenceStatus';
  30.  
  31.         CREATE FIELD ENV.Context.GetT24ContractExitenceStatusRq;
  32.         DECLARE GetT24ContractExitenceStatusRq REFERENCE TO ENV.Context.GetT24ContractExitenceStatusRq;
  33.         -- Parameters of GetT24ContractExitenceStatus
  34.        
  35.         --previous audit
  36.         /*
  37.         -- Parameters of GetT24ContractExitenceStatus
  38.         SET GetT24ContractExitenceStatusRq.MsgId = SUBSTRING(CAST(Environment.Variables.MsgId AS CHAR) FROM 3 FOR 48);
  39.         SET GetT24ContractExitenceStatusRq.RqID = inHdr.alr:Msg.alr:RqID;
  40.         SET GetT24ContractExitenceStatusRq.SvcID = inHdr.alr:Msg.alr:SvcID;
  41.         SET GetT24ContractExitenceStatusRq.FuncID = '0001';
  42.         SET GetT24ContractExitenceStatusRq.UserLang = COALESCE(inHdr.alr:Sys.alr:SessionLang, inHdr.alr:Agt.alr:UserLang, 'EN');
  43.         SET GetT24ContractExitenceStatusRq.Cic = inHdr.alr:Agt.alr:CICNum;
  44.         SET GetT24ContractExitenceStatusRq.UserID = inHdr.alr:Sys.alr:LoginInfo.alr:UserID;
  45.         SET GetT24ContractExitenceStatusRq.DossierNum = inBody.DossierNum;
  46.         SET GetT24ContractExitenceStatusRq.BranchId = inHdr.alr:Sys.alr:BranchID;
  47.         SET GetT24ContractExitenceStatusRq.NumOfInstallments = COALESCE(inBody.NumOfInstallments, 0);
  48.         SET GetT24ContractExitenceStatusRq.ChID =  inHdr.alr:Sys.alr:ChID;
  49.         SET GetT24ContractExitenceStatusRq.TerminalID = COALESCE(inHdr.alr:Sys.alr:TerminalID, '0000');
  50.         RETURN TRUE;
  51.        
  52.         */
  53.        
  54.         SET ENV.AuditVars.UsrDef1 = inBody.ContractNum;
  55.  
  56.         SET LoanCancelationRq.serviceID = inHdr.alr1:Msg.alr1:SvcID;
  57.         SET LoanCancelationRq.subServiceID = inHdr.alr1:Msg.alr1:SubSvcID;
  58.         SET LoanCancelationRq.RqID = inHdr.alr1:Msg.alr1:RqID;
  59.         SET LoanCancelationRq.msgTimeStamp = CAST ((CURRENT_TIMESTAMP - TIMESTAMP '1970-01-01 00:00:00') SECOND as INTEGER);
  60.         SET LoanCancelationRq.channelID = inHdr.alr1:Sys.alr1:ChID;
  61.         SET LoanCancelationRq.userID = 'INTERNET';
  62.         SET LoanCancelationRq.bankID = '1';
  63.         SET LoanCancelationRq.language = COALESCE(inHdr.alr1:Sys.alr1:SessionLang , 'EN' );
  64.         SET LoanCancelationRq.dossierID = inBody.ContractNum;
  65.  
  66.         RETURN TRUE;
  67.     END;
  68.  
  69.     CREATE PROCEDURE CopyMessageHeaders() BEGIN
  70.         DECLARE I INTEGER 1;
  71.         DECLARE J INTEGER;
  72.         SET J = CARDINALITY(InputRoot.*[]);
  73.         WHILE I < J DO
  74.             SET OutputRoot.*[I] = InputRoot.*[I];
  75.             SET I = I + 1;
  76.         END WHILE;
  77.     END;
  78. END MODULE;
  79.  
  80. CREATE COMPUTE MODULE LoanCancelation_ParseRs_WS
  81.     CREATE FUNCTION Main() RETURNS BOOLEAN
  82.     BEGIN
  83.         CALL CopyMessageHeaders();
  84.         SET OutputRoot.XMLNSC.alr:LoanCancelationRs.(XMLNSC.NamespaceDecl)xmlns:alr = alr;
  85.         SET OutputRoot.XMLNSC.alr:LoanCancelationRs.(XMLNSC.NamespaceDecl)xmlns:alr1 = alr1;
  86.  
  87.         CREATE FIELD OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr;
  88.         --CREATE FIELD OutputRoot.XMLNSC.alr:LoanCancelationRs.Body;
  89.         DECLARE outHdr REFERENCE TO OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr;
  90.         --DECLARE outBody REFERENCE TO OutputRoot.XMLNSC.alr:LoanCancelationRs.Body;
  91.  
  92.         DECLARE ENV REFERENCE TO Environment.Variables;
  93.         DECLARE inMsg REFERENCE TO ENV.Context.SetLoanCancelationRs;
  94.  
  95.         DECLARE RequestMsg REFERENCE TO ENV.Context.LoanCancelationRq;
  96.         DECLARE ResponseMsg REFERENCE TO ENV.Context.SetLoanCancelationRs;
  97.  
  98.         SET ENV.AuditVars.ReturnCd = ResponseMsg.Hdr.Status.StatusCd;
  99.  
  100.         -- T24 procedure call instead
  101.        
  102.         IF 1=1 THEN
  103.             IF ENV.AuditVars.RejectnReason = '200' THEN
  104.                 SET outHdr.alr1:Status.alr1:StatusCd = SuccessErrorCode;
  105.                 SET outHdr.alr1:Status.alr1:StatusDesc = SuccessErrorDesc;
  106.             ELSE
  107.                 SET outHdr.alr1:Status.alr1:StatusCd = BackendErrorCode;
  108.                 SET outHdr.alr1:Status.alr1:StatusDesc = BackendErrorDesc;
  109.             END IF;
  110.  
  111.             SET outHdr.alr1:RqID = RequestMsg.RqID;
  112.         ELSE
  113.             IF EXISTS(ResponseMsg.Response.resultCode[]) THEN
  114.                 CALL util.GetErrorMapping('CTFError',
  115.                 'EAIError',
  116.                 '*',
  117.                 ResponseMsg.Response.resultCode,
  118.                 ResponseMsg.Response.statusCode,
  119.                 outHdr.alr1:Status.alr1:StatusCd,
  120.                 outHdr.alr1:Status.alr1:StatusDesc,
  121.                 Environment.Variables.ErrorMapping.TARGETVAL3);
  122.             ELSE
  123.                 SET outHdr.alr1:Status.alr1:StatusCd = BackendErrorCode;
  124.                 SET outHdr.alr1:Status.alr1:StatusDesc = BackendErrorDesc;
  125.             END IF;        
  126.  
  127.  
  128.         END IF;
  129.  
  130.  
  131.  
  132.         SET OutputLocalEnvironment.Destination.SOAP.Reply.ReplyIdentifier = ENV.Context.SOAPReplyID;
  133.         SET OutputRoot.Properties.Encoding = 546;
  134.         SET OutputRoot.Properties.CodedCharSetId = 1208;
  135.         RETURN TRUE;
  136.     END;
  137.  
  138.     CREATE PROCEDURE CopyMessageHeaders() BEGIN
  139.         DECLARE I INTEGER 1;
  140.         DECLARE J INTEGER;
  141.         SET J = CARDINALITY(InputRoot.*[]);
  142.         WHILE I < J DO
  143.             SET OutputRoot.*[I] = InputRoot.*[I];
  144.             SET I = I + 1;
  145.         END WHILE;
  146.     END;
  147. END MODULE;
  148.  
  149. CREATE COMPUTE MODULE LoanCancelation_ErrorHandler_WS
  150.     CREATE FUNCTION Main() RETURNS BOOLEAN
  151.     BEGIN
  152.         IF EXISTS(Environment.Variables.Context.OriginalProperties[]) THEN
  153.             SET OutputRoot.Properties = Environment.Variables.Context.OriginalProperties;
  154.         ELSE
  155.             SET OutputRoot.Properties = InputRoot.Properties;
  156.         END IF;
  157.         IF NOT EXISTS(OutputRoot.MQMD[]) THEN
  158.             CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN ('MQMD') NAME 'MQMD';
  159.             IF NOT(EXISTS(Environment.Variables.Context.OriginalMQMD[])) THEN
  160.                 SET OutputRoot.MQMD = InputRoot.MQMD;
  161.             ELSE
  162.                 SET OutputRoot.MQMD = Environment.Variables.Context.OriginalMQMD;
  163.             END IF;
  164.         END IF;
  165.  
  166.         DECLARE FailureStatusCode CHARACTER NULLIF(COALESCE(Environment.Variables.Status.StatusCd, Environment.Variables.StatusCd, SuccessErrorCode), SuccessErrorCode);
  167.         IF FailureStatusCode IS NULL THEN
  168.             SET Environment.Variables.AuditVars.ReturnCode = GeneralIntegrationErrorCode;
  169.             SET OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr.alr1:Status.alr1:StatusCd = GeneralIntegrationErrorCode;
  170.             SET OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr.alr1:Status.alr1:StatusDesc = GeneralIntegrationErrorDesc;
  171.         ELSE
  172.             SET Environment.Variables.AuditVars.ReturnCode = Environment.Variables.StatusCd;
  173.             SET OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr.alr1:Status.alr1:StatusCd = COALESCE(Environment.Variables.Status.StatusCd, Environment.Variables.StatusCd);
  174.             SET OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr.alr1:Status.alr1:StatusDesc = COALESCE(Environment.Variables.Status.StatusDesc, Environment.Variables.StatusDesc);
  175.         END IF;
  176.         SET OutputRoot.XMLNSC.alr:LoanCancelationRs.Hdr.alr1:RqID = Environment.Variables.MsgRqHdr.Msg.RqID;
  177.         RETURN TRUE;
  178.     END;
  179. END MODULE;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top