Esempio n. 1
0
        private PayPalEnvironment GetEnvironment(PayPalPaymentGatewayConfiguration configuration)
        {
            switch (configuration.Environment)
            {
            case "sandbox":
            {
                return(new SandboxEnvironment(configuration.ClientId, configuration.ClientSecret));
            }

            case "live":
            {
                return(new LiveEnvironment(configuration.ClientId, configuration.ClientSecret));
            }

            default:
            {
                throw new ApplicationException("Unknown PayPal environment");
            }
            }
        }
Esempio n. 2
0
        public PayPalGatewayManager(PayPalPaymentGatewayConfiguration configuration)
        {
            var environment = GetEnvironment(configuration);

            _client = new PayPalHttpClient(environment);
        }