public PaymentService(IPlanRepository planRepository, ITenantPlanRepository tenantPlanRepository) { this._planRepository = planRepository; this._tenantPlanRepository = tenantPlanRepository; var config = new Dictionary <string, string>(); var mode = ConfigurationManager.AppSettings["mode"]; var clientId = ConfigurationManager.AppSettings["clientId"]; var clientSecret = ConfigurationManager.AppSettings["clientSecret"]; config.Add("mode", mode); config.Add("clientId", clientId); config.Add("clientSecret", clientSecret); // Use OAuthTokenCredential to request an access token from PayPal var accessToken = new OAuthTokenCredential(config).GetAccessToken(); _apiContext = new APIContext(accessToken); // Initialize the apiContext's configuration with the default configuration for this application. _apiContext.Config = ConfigManager.Instance.GetProperties(); // Define any custom configuration settings for calls that will use this object. _apiContext.Config["connectionTimeout"] = "3000"; // Quick timeout for testing purposes // Define any HTTP headers to be used in HTTP requests made with this APIContext object if (_apiContext.HTTPHeaders == null) { _apiContext.HTTPHeaders = new Dictionary <string, string>(); } _apiContext.HTTPHeaders["some-header-name"] = "some-value"; }
public PaymentController(IPaymentService paymentService, IPlanRepository planRepository, ITenantPlanRepository tenantPlanRepository, ITenantRepository tenantRepository) { _paymentService = paymentService; _planRepository = planRepository; _tenantPlanRepository = tenantPlanRepository; _tenantRepository = tenantRepository; }
public TenantService(ITenantRepository tenantRepository, IPlanRepository planRepository, ITenantPlanRepository tenantPlanRepository, IPaymentService paymentService) { _tenantRepository = tenantRepository; _planRepository = planRepository; _tenantPlanRepository = tenantPlanRepository; _paymentService = paymentService; }
public void Initialize() { _tenantPlanRepository = Mock.Of <ITenantPlanRepository>(); _planRepository = Mock.Of <IPlanRepository>(); _paymentService = new PaymentService(_planRepository, _tenantPlanRepository); }