Skip to content

Instantly share code, notes, and snippets.

csharp try{
PrcSaveLog.Call('ANNAINTEGRATIONLOG','',&Pgmname+ ' / "CALLBACK"')
&AuxVar = &HttpRequest.GetVariable(!"CALLBACK")
&CallBackCollection.FromJson(&AuxVar)
if &CallBackCollection.Count = 0
&Ret = format(!'%1: CallBackCollection não foi recebido (&AuxVar= %2)', &Pgmname, &AuxVar)
PrcSaveLog.Call('ANNAINTEGRATIONLOG','',&Pgmname+ ' / '+&Ret)
else
for &CallBack in &CallBackCollection
Parm(in:&InInputString, out:&Key);
&InputString = &InInputString.TrimStart().TrimEnd()
csharp byte[/**/] bin = System.Text.Encoding.UTF8.GetBytes( [!&InputString!]);
csharp System.Security.Cryptography.HashAlgorithm alg = new System.Security.Cryptography.SHA1CryptoServiceProvider();
csharp [!&Key!] = System.Convert.ToBase64String(alg.ComputeHash(bin));
Parm(In:&Text, In:&Key, In:&IV, Out:&OutText);
//Decrypted using the TripleDES algorithm using CBC mode (Cipher Block Chaining).
&CryptoEncrypt.Algorithm = CryptoEncryptAlgorithm.TripleDES
&CryptoEncrypt.Key = &Key
&CryptoEncrypt.IV = &IV
&OutText = &CryptoEncrypt.Decrypt(&Text)
Parm(In:&Text, In:&Key, In:&IV, Out:&OutText);
//Encrypted using the TripleDES algorithm using CBC mode (Cipher Block Chaining).
&CryptoEncrypt.Algorithm = CryptoEncryptAlgorithm.TripleDES
&CryptoEncrypt.Key = &Key
&CryptoEncrypt.IV = &IV
&OutText = &CryptoEncrypt.Encrypt(&Text) //The text is encrypted and the result obtained.
parm(out:&CallHash);
&Agora = now()
&AgoraStr = &Agora.Year().ToString().Trim()
&AgoraStr += substr(trim(str(&Agora.Month() + 100)),2,2)
&AgoraStr += substr(trim(str(&Agora.Day() + 100)),2,2)
&AgoraStr += substr(trim(str(&Agora.Hour() + 100)),2,2)
&AgoraStr += substr(trim(str(&Agora.Minute() + 100)),2,2)
&AgoraStr += substr(trim(str(&Agora.Second() + 100)),2,2)
&RandomStr = trim(str(int(Random()*9)))
Parm(In: &Json, In: &EncKEY, In: &DecKEY, In: &IV, Out: &StringResponse);
&CryptoEncrypt = new()
&CryptoEncrypt.Algorithm = CryptoEncryptAlgorithm.TripleDES
&Result = &CryptoEncrypt.Encrypt(!'DUMMY')
&NewIV = &CryptoEncrypt.IV
&NewIVCript = PrcEncryptTripleDES.Udp(&NewIV, &DecKEY, &IV )
&StringResponse = PrcEncryptTripleDES.Udp(&Json, &EncKEY, &NewIV) + &IV + &NewIVCript
Parm(in:&LogType,in:&LogUser,in:&LogDescription);
New
LogType = &LogType
LogUser = &LogUser
LogDescription = &LogDescription
LogDate = now()
endnew
Parm(in:&CallHash,in:&SdtMacroAnswers,in:&UserCelphone,inout:&Place,inout:&NextPlace,in:&Provider,out:&WSPlace,out:&SdtWSContainers);
&SdtWSContainers = new()
&SdtWSContainers.ClientStatus = !'OK'
do case
case &Place.ToUpper() = 'QUESTIONS'
//Chamo a sub com a pergunta 1
Parm(
in:&WSPlace,
inout:&NextPlace,
inout:&Saudacao,
inout:&CallHash,
out:&SdtWSContainersContainer);
&LinkWSIntegracao = 'http://itda.com.br/mxns/aPrcWSAnnAMxns.aspx'
&LinkWSCallBack = 'http://itda.com.br/mxns/aPrcAnnACallBack.aspx'
Main Program: True
encryppt parameters: no
call protocol: HTTP
webservice
csharp try{
PrcSaveLog.Call(!'ANNAINTEGRATIONLOG',&UserCelphone,&Pgmname+ !' / '+!'Entrou')