Ejemplo n.º 1
0
        public static async Task AuditTrail()
        {
            Config    config  = new Config();
            Transaksi trx     = new Transaksi();
            string    _myURL  = config.Read("LINK", Config.PARAM_SERVICES_LINK);
            string    saveURL = config.Read("LINK", Config.PARAM_SERVICES_SAVE);

            //trans.endTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();

            string auditTrail = string.Empty;
            int    stepTrail  = 1;

            auditTrail = auditTrail + "[ ";
            foreach (dynamic at in trx._auditTrail)
            {
                auditTrail = auditTrail +
                             "{ \"step\" : \"" + stepTrail + "\"," +
                             "\"action\" : \"" + at._action + "\"," +
                             "\"data\" : \"" + at._data + "\"," +
                             "\"result\" : \"" + at._result + "\"" +
                             "},";
                stepTrail += 1;
            }
            auditTrail = auditTrail.Remove(auditTrail.Length - 1);

            string myJson2 = "{ \"transaction\" : " +
                             "{ \"transactionId\" : \"" + trx._TransaksiID + "\"," +
                             "\"terminalId\" : \"" + trx._TerminalID + "\"," +
                             "\"transactionType\" : \"" + trx._JenisTransaksi + "\"," +
                             "\"startTime\" : \"" + trx.startTime.ToString() + "\"," +
                             "\"endTime\" : \"" + trx.endTime.ToString() + "\"," +
                             "\"status\" : \"" + trx._StatusTransaksi + "\"," +
                             "\"description\" : \"" + trx._ErrorCode + "\"," +
                             "}, \"auditTrail\" : " + auditTrail + "]}";
            string myURL2 = _myURL + saveURL;

            //OurUtility.Write_Log("== Request API : " + myJson2, "step-action");
            string strResult2 = await HitServices.PostCallAPI(myURL2, myJson2);

            //OurUtility.Write_Log("== Response API : " + strResult2, "step-action");
        }
Ejemplo n.º 2
0
        private async Task GetReport()
        {
            string errorcode;
            string errormessage;

            try
            {
                string myJson = "{" +
                                "\"startDate\":\"" + startdate + "\"," +
                                "\"endDate\":\"" + enddate + "\"" +
                                "}";
                string myLink = config.Read("LINK", Config.PARAM_SERVICES_REPORT);
                string myUrl  = myLink + @"/log/daily";

                Utility.WriteLog("Histori condition : post service start", "step-action");
                try
                {
                    string strResult = await HitServices.PostCallAPI(myUrl, myJson);

                    if (strResult != null)
                    {
                        JObject jobResult = JObject.Parse(strResult);

                        if ((string)jobResult["responseCode"] == "0000")
                        {
                            foreach (var response in jobResult["listReport"].Select((response) => (response)))
                            {
                                addListReport((string)response.SelectToken("externalId"), (string)response.SelectToken("id"), (string)response.SelectToken("tglTransaksi"), (string)response.SelectToken("namaNasabah"),
                                              (string)response.SelectToken("noRekening"), (string)response.SelectToken("noKartu"), (string)response.SelectToken("noSeriPassbook"), (string)response.SelectToken("statusTransaksi"),
                                              (string)response.SelectToken("jenisTransaksi"), (string)response.SelectToken("kodeTransaksi"), (string)response.SelectToken("idTransaksi"), (string)response.SelectToken("idxMonth"),
                                              (string)response.SelectToken("emailNotif"), (string)response.SelectToken("lineInput"), (string)response.SelectToken("saldoBuku"), (string)response.SelectToken("smsNotif"),
                                              (string)response.SelectToken("startDate"), (string)response.SelectToken("endDate"), (string)response.SelectToken("errorMessage"));
                            }
                            trx.reportStatus = "SUCCESS";
                            Console.WriteLine("GAIN DATA REPORT SUCCESS");
                        }
                        else
                        {
                            //tambahan
                            errorcode    = "ReportError";
                            errormessage = "GainDataReportError";
                            //return;
                            trx.reportStatus = "FAILED";
                            Console.WriteLine("GAIN DATA REPORT FAILED");
                        }
                    }
                }
                catch (Exception ex)
                {
                    //tambahan
                    errorcode    = "ReportError";
                    errormessage = ex.Message;
                    //return;
                    trx.reportStatus = "FAILED";
                    Console.WriteLine(ex.Message);
                }
            }
            catch (Exception ex)
            {
                //tambahan
                errorcode    = "ReportError";
                errormessage = ex.Message;
                //return;
                trx.reportStatus = "FAILED";
                Console.WriteLine(ex.Message);
            }
        }