///<summary>Validate xWebResponse and create a new credit card from the XWebResponse.</summary> public static long InsertFromXWeb(XWebResponse xWebResponse) { //No need to check RemotingRole;no call to db. if (GetTokenCount(xWebResponse.Alias, new List <CreditCardSource> { CreditCardSource.XWeb, CreditCardSource.XWebPortalLogin }) > 0) { //Prevent duplicates. throw new Exception("XCharge token already exists: " + xWebResponse.Alias); } return(Insert(new CreditCard() { PatNum = xWebResponse.PatNum, XChargeToken = xWebResponse.Alias, CCNumberMasked = xWebResponse.MaskedAcctNum, CCExpiration = xWebResponse.AccountExpirationDate, CCSource = xWebResponse.CCSource, ClinicNum = xWebResponse.ClinicNum, ItemOrder = Refresh(xWebResponse.PatNum).Count, Address = "", Zip = "", ChargeAmt = 0, DateStart = DateTime.MinValue, DateStop = DateTime.MinValue, Note = "", PayPlanNum = 0, PayConnectToken = "", PayConnectTokenExp = DateTime.MinValue, PaySimpleToken = "", Procedures = "", })); }
///<summary></summary> public static void Update(XWebResponse xWebResponse) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(), xWebResponse); return; } Crud.XWebResponseCrud.Update(xWebResponse); }
///<summary></summary> public static long Insert(XWebResponse xWebResponse) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { xWebResponse.XWebResponseNum = Meth.GetLong(MethodBase.GetCurrentMethod(), xWebResponse); return(xWebResponse.XWebResponseNum); } return(Crud.XWebResponseCrud.Insert(xWebResponse)); }
///<summary>Logging event for a specific PayConnect. Uses json serializer so use sparingly if speed is an issue. ///Sent as Verbose by default but can be sent as any log level.</summary> protected static void OnLoggerEventForSingleResponse(XWebResponse response, string s, LogLevel logLevel = LogLevel.Verbose) { OnLoggerEvent(s + "\r\n\t" + JsonConvert.SerializeObject(response), logLevel); }