public static PayConnectService.signatureResponse ProcessSignature(PayConnectService.signatureRequest sigRequest, long clinicNum, Action <string> showError) { try { Program prog = Programs.GetCur(ProgramName.PayConnect); PayConnectService.Credentials cred = GetCredentials(prog, clinicNum); PayConnectService.MerchantService ms = new PayConnectService.MerchantService(); #if DEBUG ms.Url = "https://prelive.dentalxchange.com/merchant/MerchantService?wsdl"; #else ms.Url = "https://webservices.dentalxchange.com/merchant/MerchantService?wsdl"; #endif PayConnectService.signatureResponse response = ms.processSignature(cred, sigRequest); ms.Dispose(); if (response.Status.code != 0) //Error { showError(Lans.g("PayConnect", "Signature capture failed") + ". \r\n" + Lans.g("PayConnect", "Error message from") + " Pay Connect: \"" + response.Status.description + "\""); } return(response); } catch (Exception ex) { showError(Lans.g("PayConnect", "Signature capture failed") + ". \r\n" + Lans.g("PayConnect", "Error message from") + " Open Dental: \"" + ex.Message + "\""); } return(null); }
private static PayConnectService.Credentials GetCredentials(Program prog, long clinicNum) { PayConnectService.Credentials cred = new PayConnectService.Credentials(); cred.Username = OpenDentBusiness.ProgramProperties.GetPropVal(prog.ProgramNum, "Username", clinicNum); cred.Password = OpenDentBusiness.ProgramProperties.GetPropVal(prog.ProgramNum, "Password", clinicNum); cred.Client = "OpenDental2"; #if DEBUG cred.ServiceID = "DCI Web Service ID: 002778"; //Testing #else cred.ServiceID = "DCI Web Service ID: 006328"; //Production #endif cred.version = "0310"; return(cred); }
///<summary>Shows a message box on error.</summary> public static PayConnectService.transResponse ProcessCreditCard(PayConnectService.creditCardRequest request) { try{ Program prog = Programs.GetCur(ProgramName.PayConnect); PayConnectService.Credentials cred = GetCredentials(prog); PayConnectService.MerchantService ms = new OpenDental.PayConnectService.MerchantService(); PayConnectService.transResponse response = ms.processCreditCard(cred, request); ms.Dispose(); if (response.Status.code != 0) //Error { MessageBox.Show(Lan.g("PayConnect", "Payment failed") + ". " + response.Status.description); } return(response); }catch (Exception ex) { MessageBox.Show(Lan.g("PayConnect", "Payment failed") + ". " + ex.Message); } return(null); }
///<summary>Shows a message box on error.</summary> public static PayConnectService.transResponse ProcessCreditCard(PayConnectService.creditCardRequest request, long clinicNum, Action <string> showError) { try { Program prog = Programs.GetCur(ProgramName.PayConnect); PayConnectService.Credentials cred = GetCredentials(prog, clinicNum); PayConnectService.MerchantService ms = new PayConnectService.MerchantService(); ms.Url = Introspection.GetOverride(Introspection.IntrospectionEntity.PayConnectRestURL, "https://webservices.dentalxchange.com/merchant/MerchantService?wsdl"); #if DEBUG ms.Url = "https://prelive.dentalxchange.com/merchant/MerchantService?wsdl"; #endif PayConnectService.transResponse response = ms.processCreditCard(cred, request); ms.Dispose(); if (response.Status.code != 0 && response.Status.description.ToLower().Contains("duplicate")) { showError(Lans.g("PayConnect", "Payment failed") + ". \r\n" + Lans.g("PayConnect", "Error message from") + " Pay Connect: \"" + response.Status.description + "\"\r\n" + Lans.g("PayConnect", "Try using the Force Duplicate checkbox if a duplicate is intended.")); } if (response.Status.code != 0 && response.Status.description.ToLower().Contains("invalid user")) { showError(Lans.g("PayConnect", "Payment failed") + ".\r\n" + Lans.g("PayConnect", "PayConnect username and password combination invalid.") + "\r\n" + Lans.g("PayConnect", "Verify account settings by going to") + "\r\n" + Lans.g("PayConnect", "Setup | Program Links | PayConnect. The PayConnect username and password are probably the same as the DentalXChange login ID and password.")); } else if (response.Status.code != 0) //Error { showError(Lans.g("PayConnect", "Payment failed") + ". \r\n" + Lans.g("PayConnect", "Error message from") + " Pay Connect: \"" + response.Status.description + "\""); } return(response); } catch (Exception ex) { showError(Lans.g("PayConnect", "Payment failed") + ". \r\n" + Lans.g("PayConnect", "Error message") + ": \"" + ex.Message + "\""); } return(null); }