Пример #1
0
        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);
        }
Пример #2
0
        ///<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);
        }
Пример #3
0
        public static bool IsValidCardAndExp(string cardNumber, int expYear, int expMonth, Action <string> showError)
        {
            bool isValid = false;

            try {
                PayConnectService.expiration pcExp = new PayConnectService.expiration();
                pcExp.year  = expYear;
                pcExp.month = expMonth;
                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
                isValid = (ms.isValidCard(cardNumber) && ms.isValidExpiration(pcExp));
                ms.Dispose();
            }
            catch (Exception ex) {
                showError(Lans.g("PayConnect", "Credit Card validation failed") + ". \r\n" + Lans.g("PayConnect", "Error message from")
                          + " Open Dental: \"" + ex.Message + "\"");
            }
            return(isValid);
        }