Example #1
0
        internal override void ConfigureContainer(ConfiguredServices services)
        {
            base.ConfigureContainer(services);

            if (string.IsNullOrEmpty(ServiceUrl))
            {
                if (Environment.Equals(Entities.Environment.TEST))
                {
                    ServiceUrl = ServiceEndpoints.GLOBAL_ECOM_TEST;
                }
                else
                {
                    ServiceUrl = ServiceEndpoints.GLOBAL_ECOM_PRODUCTION;
                }
            }

            var gateway = new GpEcomConnector {
                AccountId           = AccountId,
                Channel             = Channel,
                MerchantId          = MerchantId,
                RebatePassword      = RebatePassword,
                RefundPassword      = RefundPassword,
                SharedSecret        = SharedSecret,
                Timeout             = Timeout,
                ServiceUrl          = ServiceUrl,
                HostedPaymentConfig = HostedPaymentConfig,
                RequestLogger       = RequestLogger,
                WebProxy            = WebProxy
            };

            services.GatewayConnector   = gateway;
            services.RecurringConnector = gateway;

            // set reporting gateway
            if (!UseDataReportingService)
            {
                services.ReportingService = gateway;
            }

            // set default
            if (Secure3dVersion == null)
            {
                Secure3dVersion = Entities.Secure3dVersion.One;
            }

            // secure 3d v1
            if (Secure3dVersion.Equals(Entities.Secure3dVersion.One) || Secure3dVersion.Equals(Entities.Secure3dVersion.Any))
            {
                services.SetSecure3dProvider(Entities.Secure3dVersion.One, gateway);
            }

            // secure 3d v2
            if (Secure3dVersion.Equals(Entities.Secure3dVersion.Two) || Secure3dVersion.Equals(Entities.Secure3dVersion.Any))
            {
                Gp3DSProvider secure3d2 = new Gp3DSProvider {
                    MerchantId               = MerchantId,
                    AccountId                = AccountId,
                    SharedSecret             = SharedSecret,
                    ServiceUrl               = Environment.Equals(Entities.Environment.TEST) ? ServiceEndpoints.THREE_DS_AUTH_TEST : ServiceEndpoints.THREE_DS_AUTH_PRODUCTION,
                    MerchantContactUrl       = MerchantContactUrl,
                    MethodNotificationUrl    = MethodNotificationUrl,
                    ChallengeNotificationUrl = ChallengeNotificationUrl,
                    Timeout       = Timeout,
                    RequestLogger = RequestLogger,
                    WebProxy      = WebProxy
                                    //secure3d2.EnableLogging = EnableLogging
                };

                services.SetSecure3dProvider(Entities.Secure3dVersion.Two, secure3d2);
            }
        }
Example #2
0
        internal override void ConfigureContainer(ConfiguredServices services)
        {
            if (!string.IsNullOrEmpty(MerchantId))
            {
                if (string.IsNullOrEmpty(ServiceUrl))
                {
                    if (Environment.Equals(Entities.Environment.TEST))
                    {
                        ServiceUrl = ServiceEndpoints.GLOBAL_ECOM_TEST;
                    }
                    else
                    {
                        ServiceUrl = ServiceEndpoints.GLOBAL_ECOM_PRODUCTION;
                    }
                }

                var gateway = new RealexConnector {
                    AccountId           = AccountId,
                    Channel             = Channel,
                    MerchantId          = MerchantId,
                    RebatePassword      = RebatePassword,
                    RefundPassword      = RefundPassword,
                    SharedSecret        = SharedSecret,
                    Timeout             = Timeout,
                    ServiceUrl          = ServiceUrl,
                    HostedPaymentConfig = HostedPaymentConfig
                };
                services.GatewayConnector   = gateway;
                services.RecurringConnector = gateway;

                var reportingService = new DataServicesConnector {
                    ClientId     = DataClientId,
                    ClientSecret = DataClientSecret,
                    UserId       = DataClientUserId,
                    ServiceUrl   = DataClientSeviceUrl ?? "https://globalpay-test.apigee.net/apis/reporting/",
                    Timeout      = Timeout
                };
                services.ReportingService = reportingService;

                // set default
                if (Secure3dVersion == null)
                {
                    Secure3dVersion = Entities.Secure3dVersion.One;
                }

                // secure 3d v1
                if (Secure3dVersion.Equals(Entities.Secure3dVersion.One) || Secure3dVersion.Equals(Entities.Secure3dVersion.Any))
                {
                    services.SetSecure3dProvider(Entities.Secure3dVersion.One, gateway);
                }

                // secure 3d v2
                if (Secure3dVersion.Equals(Entities.Secure3dVersion.Two) || Secure3dVersion.Equals(Entities.Secure3dVersion.Any))
                {
                    Gp3DSProvider secure3d2 = new Gp3DSProvider {
                        MerchantId               = MerchantId,
                        AccountId                = AccountId,
                        SharedSecret             = SharedSecret,
                        ServiceUrl               = Environment.Equals(Entities.Environment.TEST) ? ServiceEndpoints.THREE_DS_AUTH_TEST : ServiceEndpoints.THREE_DS_AUTH_PRODUCTION,
                        MerchantContactUrl       = MerchantContactUrl,
                        MethodNotificationUrl    = MethodNotificationUrl,
                        ChallengeNotificationUrl = ChallengeNotificationUrl,
                        Timeout = Timeout
                                  //secure3d2.EnableLogging = EnableLogging
                    };

                    services.SetSecure3dProvider(Entities.Secure3dVersion.Two, secure3d2);
                }
            }
            else
            {
                if (string.IsNullOrEmpty(ServiceUrl))
                {
                    if (Environment.Equals(Entities.Environment.TEST))
                    {
                        ServiceUrl = ServiceEndpoints.PORTICO_TEST;
                    }
                    else
                    {
                        ServiceUrl = ServiceEndpoints.PORTICO_PRODUCTION;
                    }
                }

                var gateway = new PorticoConnector {
                    SiteId         = SiteId,
                    LicenseId      = LicenseId,
                    DeviceId       = DeviceId,
                    Username       = Username,
                    Password       = Password,
                    SecretApiKey   = SecretApiKey,
                    DeveloperId    = DeveloperId,
                    VersionNumber  = VersionNumber,
                    Timeout        = Timeout,
                    ServiceUrl     = ServiceUrl + "/Hps.Exchange.PosGateway/PosGatewayService.asmx",
                    UniqueDeviceId = UniqueDeviceId
                };
                services.GatewayConnector = gateway;

                if (!string.IsNullOrEmpty(DataClientId))
                {
                    services.ReportingService = new DataServicesConnector {
                        ClientId     = DataClientId,
                        ClientSecret = DataClientSecret,
                        UserId       = DataClientUserId,
                        ServiceUrl   = DataClientSeviceUrl ?? "https://globalpay-test.apigee.net/apis/reporting/",
                        Timeout      = Timeout
                    };
                }
                else
                {
                    services.ReportingService = gateway;
                }

                var payplan = new PayPlanConnector {
                    SecretApiKey = SecretApiKey,
                    Timeout      = Timeout,
                    ServiceUrl   = ServiceUrl + getPayPlanEndpoint(SecretApiKey)
                };
                services.RecurringConnector = payplan;
            }
        }