Exemplo n.º 1
0
        ///////////////////////////////////////////////////     MAIN
        static async Task Main()
        {
            client.BaseAddress = new Uri(Constants.URL_BASE_PARAM);

            //RunAllAsync().GetAwaiter().GetResult();
            AuthRequestModel r1 = new AuthRequestModel()
            {
                ClientId = "Messenger", ClientPassword = "******"
            };
            GetDataRequestModel r2 = new GetDataRequestModel()
            {
                CustomerId = "00000102"
            };


            CloseOperationRequestModel r6 = new CloseOperationRequestModel()
            {
                AcceptTermsData = 322322, TransactionId = "asdasdasdw"
            };

            try
            {
                var abs = await GetResponseAsync("auth", r1); /////////// METHOD WITH JSONSERALIZER

                //AuthResponseModel authTest = await authRequest(r1);
                ShowAuth(abs);


                GetDataResponseModel getDataT = await GetDataResponseAsync("GetData", r2, abs);

                ShowGetData(getDataT);
                SendDataRequestModel r3 = new SendDataRequestModel()
                {
                    TransactionId = getDataT.TransactionId, UserEmail = "*****@*****.**", UserKeyword = "ABC"
                };


                SendDataResponseModel sendDataT = await SendDataResponseAsync("SendData", r3, abs.AuthKey);

                ShowSendData(sendDataT);

                GenerateSmsRequestModel r4 = new GenerateSmsRequestModel()
                {
                    TransactionId = sendDataT.TransactionId
                };

                GenerateSmsResponseModel generateSmsT = await GenerateSMSResponseAsync("GenerateSMS", r4, abs.AuthKey);

                ShowGenerateSms(generateSmsT);

                ValidateSmsRequestModel r5 = new ValidateSmsRequestModel()
                {
                    Code = "6666", TransactionId = generateSmsT.TransactionId
                };

                ValidateSmsResponseModel validateSmsT = await ValidateSMSResponseAsync("ValidateSMS", r5, abs.AuthKey);

                ShowValidateSms(validateSmsT);

                CloseOperationResponseModel closeOperationT = await CloseOperationResponseAsync("CloseOperation", r6, abs.AuthKey);

                ShowCloseOperation(closeOperationT);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.ReadLine();
        }
Exemplo n.º 2
0
 static void ShowValidateSms(ValidateSmsResponseModel validateSmsT)
 {
     Console.WriteLine($"ValidateSMS credentials.\ntransActionId: {validateSmsT.TransactionId}\nresponseCode: {validateSmsT.ResponseCode}\nresponseMessage: {validateSmsT.ResponseMessage}\n\n");
 }