Пример #1
0
        private string GetServiceUri(PlatformEnvironment platformEnvironment)
        {
            switch (platformEnvironment)
            {
            case PlatformEnvironment.Production:
                return(this.GetConfigurationString("GatewayService.ProductionHostUri"));

            case PlatformEnvironment.Sandbox:
                return(this.GetConfigurationString("GatewayService.SandboxHostUri"));

            default:
                return(null);
            }
        }
        protected BaseResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, string resourceName, Uri hostUri)
        {
            if (merchantKey == Guid.Empty) {
                merchantKey = this.GetConfigurationKey("GatewayService.MerchantKey");
            }

            this.HttpUtility = new HttpUtility();
            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

            this.MerchantKey = merchantKey;
            this.PlatformEnvironment = platformEnvironment;
            this.HttpContentType = httpContentType;
            if (hostUri != null) {
                this._hostUri = hostUri.ToString();
                this._hostUri = this._hostUri.Remove(this._hostUri.Length - 1);
            }
            else {
                this._hostUri = this.GetServiceUri(platformEnvironment);
            }
            this._resourceName = resourceName;
        }
Пример #3
0
        protected BaseResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, string resourceName, Uri hostUri)
        {
            if (merchantKey == Guid.Empty)
            {
                merchantKey = this.GetConfigurationKey("GatewayService.MerchantKey");
            }

            this.HttpUtility = new HttpUtility();
            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };

            this.MerchantKey         = merchantKey;
            this.PlatformEnvironment = platformEnvironment;
            this.HttpContentType     = httpContentType;
            if (hostUri != null)
            {
                this._hostUri = hostUri.ToString();
                this._hostUri = this._hostUri.Remove(this._hostUri.Length - 1);
            }
            else
            {
                this._hostUri = this.GetServiceUri(platformEnvironment);
            }
            this._resourceName = resourceName;
        }
Пример #4
0
 /// <summary>
 /// FOR TEST ONLY! Allows the session to act as if it is held in an HttpContext durring tests.
 /// </summary>
 public static void MockBrowserEnvironment()
 {
     _platformEnvironment = PlatformEnvironment.Browser;
 }
Пример #5
0
 /// <summary>
 /// For test ONLY! Clears the static Platform Environment variable after it has been mocked.
 /// </summary>
 public static void ClearPlatformEnvironment()
 {
     _platformEnvironment = PlatformEnvironment.None;
 }
 public GatewayServiceClient(Guid merchantKey, PlatformEnvironment environment, HttpContentTypeEnum httpContentType, Uri hostUri)
 {
     this._sale = new SaleResource(merchantKey, environment, httpContentType, hostUri);
     this._creditCard = new CreditCardResource(merchantKey, environment, httpContentType, hostUri);
 }
 public GatewayServiceClient(Guid merchantKey, PlatformEnvironment environment, HttpContentTypeEnum httpContentType)
     : this(merchantKey, environment, httpContentType, null)
 {
 }
 public GatewayServiceClient(Guid merchantKey, PlatformEnvironment environment, HttpContentTypeEnum httpContentType, Uri hostUri)
 {
     this._sale       = new SaleResource(merchantKey, environment, httpContentType, hostUri);
     this._creditCard = new CreditCardResource(merchantKey, environment, httpContentType, hostUri);
 }
 public GatewayServiceClient(Guid merchantKey, PlatformEnvironment environment, HttpContentTypeEnum httpContentType) : this(merchantKey, environment, httpContentType, null)
 {
 }
 protected BaseResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, string resourceName)
     : this(merchantKey, platformEnvironment, httpContentType, resourceName, null)
 {
 }
 private string GetServiceUri(PlatformEnvironment platformEnvironment)
 {
     switch (platformEnvironment) {
         case PlatformEnvironment.Production:
             return this.GetConfigurationString("GatewayService.ProductionHostUri");
         case PlatformEnvironment.Sandbox:
             return this.GetConfigurationString("GatewayService.SandboxHostUri");
         default:
             return null;
     }
 }
 public CreditCardResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType) : base(merchantKey, platformEnvironment, httpContentType, "/CreditCard")
 {
 }
 public CreditCardResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, Uri hostUri)
     : base(merchantKey, platformEnvironment, httpContentType, "/CreditCard", hostUri)
 {
 }
Пример #14
0
 public SaleResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, Uri hostUri) : base(merchantKey, platformEnvironment, httpContentType, "/Sale", hostUri)
 {
 }
 public SaleResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, Uri hostUri)
     : base(merchantKey, platformEnvironment, httpContentType, "/Sale", hostUri)
 {
 }
Пример #16
0
 protected BaseResource(Guid merchantKey, PlatformEnvironment platformEnvironment, HttpContentTypeEnum httpContentType, string resourceName)
     : this(merchantKey, platformEnvironment, httpContentType, resourceName, null)
 {
 }