public System.Threading.Tasks.Task <WebPosTest.CmdResponse> CmdAsync(WebPosTest.WebPOSCredentials WebPOSCredentials, string reqXMLString) { WebPosTest.CmdRequest inValue = new WebPosTest.CmdRequest(); inValue.WebPOSCredentials = WebPOSCredentials; inValue.reqXMLString = reqXMLString; return(((WebPosTest.WebPOSSoap)(this)).CmdAsync(inValue)); }
/// <summary> /// 自动积分并微信推送接口 /// </summary> /// <param name="webPosArg"></param> /// <returns></returns> private async static Task <Result> WebPosForPoint(WebPosArg webPosArg) { int amount = new Random(((unchecked ((int)DateTime.Now.Millisecond + (int)DateTime.Now.Ticks)))).Next(10, 2000); string testString = $@"<cmd type=""SALES"" appCode=""POS""> <shared offline=""true""> <companyID>{webPosArg.companyID}</companyID> <orgID>{webPosArg.orgID}</orgID> <storeID>{webPosArg.storeID}</storeID> <cashierID>{webPosArg.cashierID}</cashierID> </shared> <sales discountPercentage=""{webPosArg.discountPercentage}"" cardID=""{webPosArg.cardID}"" txnDateTime=""{webPosArg.txnDateTime}"" receiptNo=""12L102N10120180321uytu7t876896{amount}"" actualAmount=""{amount}"" payableAmount=""{amount}"" verificationCode="""" /> </cmd>"; WebPosTest.WebPOSSoapClient ws = new WebPosTest.WebPOSSoapClient(WebPosTest.WebPOSSoapClient.EndpointConfiguration.WebPOSSoap); WebPosTest.WebPOSCredentials mwc = new WebPosTest.WebPOSCredentials(); mwc.Username = ConfigurationUtil.GetSection("ObjectConfig:WebPosService:UserName"); mwc.Password = ws.GetEncryptedCharAsync(ConfigurationUtil.GetSection("ObjectConfig:WebPosService:PassWord")).Result; try { var cmdResult = await ws.CmdAsync(mwc, testString); if (!string.IsNullOrWhiteSpace(cmdResult.CmdResult) && cmdResult.CmdResult.Contains("hasError=\"false\"")) { return(new Result(true, "OCR识别成功,完成自动积分且进行微信推送", null)); } return(new Result(false, $"OCR验证通过,{cmdResult.CmdResult}", null)); } catch (Exception ex) { Log.Error("WebPos接口", ex); return(new Result(false, $"OCR验证通过,{ex.Message}", null)); } }
public CmdRequest(WebPosTest.WebPOSCredentials WebPOSCredentials, string reqXMLString) { this.WebPOSCredentials = WebPOSCredentials; this.reqXMLString = reqXMLString; }