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"); } } }
public PayPalGatewayManager(PayPalPaymentGatewayConfiguration configuration) { var environment = GetEnvironment(configuration); _client = new PayPalHttpClient(environment); }