using SinochemPosClient; using SinochemPosClient.Models; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; using Wayne.Lib.Log; namespace SinochemInternetPlusApp { public class PosManager { private readonly string UrlPrefix = App.AppSettings["SinochemPosUrlPrefix"]; private readonly string TrxNotifyApi = App.AppSettings["SinochemPosNotifyApi"]; public TrxNotificationResponse NotifyPosSuccessfulTrx(EpsTransactionModel epsTrxModel, DebugLogger debugLogger) { PosCommunicator communicator = new PosCommunicator(UrlPrefix + TrxNotifyApi); TrxNotificationRequest request = new TrxNotificationRequest { ticketId = epsTrxModel.ttc, person = "pump", cardNo = epsTrxModel.card_no, cardType = "1", oilName = epsTrxModel.youpin, units = epsTrxModel.qty, price = epsTrxModel.danjia, totalAmount = epsTrxModel.amount, amount = epsTrxModel.real_pay_amount, oilLiuShuiNo = epsTrxModel.liushuino, gunNum = epsTrxModel.jihao.ToString(), oilTime = epsTrxModel.xf_time, cardDiscount = epsTrxModel.amount - epsTrxModel.real_pay_amount, promDiscount = 0.00, payMethod = "01", transId = epsTrxModel.bill_id }; debugLogger.Add("Send TrxNotify to Pos: \n" + request.ToString()); communicator.SendRequest(request); debugLogger.Add("Got TrxNotify response: " + communicator.Response?.ToString()); return communicator.Response; } } }