Example #1
0
        public HttpHelper(IOptions <PagSeguroOptions> options)
        {
            _options = options.Value;
            var query = HttpUtility.ParseQueryString(string.Empty);

            query["email"]      = _options.Email;
            query["token"]      = _options.Token;
            _defaultQueryString = query.ToString();
        }
Example #2
0
        public static void AddRecurringPayment(this IServiceCollection services, PagSeguroOptions options)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }


            services.Configure <PagSeguroOptions>(opt =>
            {
                opt.Email             = options.Email;
                opt.SandboxMode       = options.SandboxMode;
                opt.Token             = options.Token;
                opt.SandboxBuyerEmail = options.SandboxBuyerEmail;
            });
            services.AddSingleton <IHttpHelper, HttpHelper>();
            services.AddScoped <IPagseguroPaymentMethodService, PagseguroPaymentMethodService>();
            services.AddScoped <IPagseguroPlanService, PagseguroPlanService>();
            services.AddScoped <IPagseguroSessionService, PagseguroSessionService>();
        }
Example #3
0
 public PagseguroPlanService(IHttpHelper httpHelper,
                             IOptions <PagSeguroOptions> options)
 {
     _httpHelper = httpHelper;
     _options    = options.Value;
 }