示例#1
0
        public Boolean PreapprovalActive(string pakey, bool Live_Trial, int txkey)
        {
            Boolean isactive = false;

            PreapprovalDetailsRequest preapprovalRequest = null;
            BaseAPIProfile profile2 = new BaseAPIProfile();

            profile2.APIProfileType = ProfileType.ThreeToken;

            if (Live_Trial)//true = Live , false = trial
            {
                profile2.Environment = ConfigurationManager.AppSettings.Get("Live_Environment").ToString();
                profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID_Live").ToString();
                profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername_Live").ToString();
                profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword_Live").ToString();
                profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature_Live").ToString();
            }
            else
            {
                profile2.Environment = ConfigurationManager.AppSettings.Get("Trial_Environment").ToString();
                profile2.ApplicationID = ConfigurationManager.AppSettings.Get("AppID").ToString();
                profile2.APIUsername = ConfigurationManager.AppSettings.Get("APIUsername").ToString();
                profile2.APIPassword = ConfigurationManager.AppSettings.Get("APIPassword").ToString();
                profile2.APISignature = ConfigurationManager.AppSettings.Get("APISignature").ToString();
            }
            profile2.RequestDataformat = "SOAP11";
            profile2.ResponseDataformat = "SOAP11";

            profile2.IsTrustAllCertificates = Convert.ToBoolean(ConfigurationManager.AppSettings["TrustAll"]);

            try
            {

                preapprovalRequest = new PreapprovalDetailsRequest();

                //preapprovalRequest.senderEmail = senderEmail.Value;
                preapprovalRequest.requestEnvelope = new RequestEnvelope();
                preapprovalRequest.requestEnvelope.errorLanguage = "en-US";
                preapprovalRequest.preapprovalKey = pakey;

                AdapativePayments ap = new AdapativePayments();
                ap.APIProfile = profile2;

                PreapprovalDetailsResponse PResponse = ap.preapprovalDetails(preapprovalRequest);

                if (ap.isSuccess.ToUpper() == "FAILURE")
                {
                    //HttpContext.Current.Session[Constants.SessionConstants.FAULT] = ap.LastError;
                    //HttpContext.Current.Response.Redirect("APIError.aspx", false);
                }
                else
                {
                    if (PResponse.status == "ACTIVE")
                    {
                        isactive = true;
                    }
                    else if ((PResponse.status == "CANCELED") || (PResponse.status == "DEACTIVED"))
                    {
                        BlueIkons_DB.SPs.UpdateTransactionExpired(txkey).Execute();
                    }
                }

            }
            catch (FATALException FATALEx)
            {
                //   Session[Constants.SessionConstants.FATALEXCEPTION] = FATALEx;
                // this.Response.Redirect(Constants.ASPXPages.APIERROR + "?" + Constants.QueryStringConstants.TYPE + "=FATAL", false);

            }
            catch (Exception ex)
            {

                //FATALException FATALEx = new FATALException("Error occurred in PreApproval Page.", ex);
                //Session[Constants.SessionConstants.FATALEXCEPTION] = FATALEx;
                //this.Response.Redirect("APIError.aspx?type=FATAL", false);

            }

            return isactive;
        }
示例#2
0
 /**
  * AUTO_GENERATED
  */
 public PreapprovalDetailsResponse PreapprovalDetails(PreapprovalDetailsRequest preapprovalDetailsRequest)
 {
     return(PreapprovalDetails(preapprovalDetailsRequest, null));
 }