コード例 #1
0
        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";
        }
コード例 #2
0
 public PaymentController(IPaymentService paymentService,
                          IPlanRepository planRepository, ITenantPlanRepository tenantPlanRepository,
                          ITenantRepository tenantRepository)
 {
     _paymentService       = paymentService;
     _planRepository       = planRepository;
     _tenantPlanRepository = tenantPlanRepository;
     _tenantRepository     = tenantRepository;
 }
コード例 #3
0
 public TenantService(ITenantRepository tenantRepository,
                      IPlanRepository planRepository,
                      ITenantPlanRepository tenantPlanRepository,
                      IPaymentService paymentService)
 {
     _tenantRepository     = tenantRepository;
     _planRepository       = planRepository;
     _tenantPlanRepository = tenantPlanRepository;
     _paymentService       = paymentService;
 }
コード例 #4
0
 public void Initialize()
 {
     _tenantPlanRepository = Mock.Of <ITenantPlanRepository>();
     _planRepository       = Mock.Of <IPlanRepository>();
     _paymentService       = new PaymentService(_planRepository, _tenantPlanRepository);
 }