Exemplo n.º 1
0
        public ChargeServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new ChargeService(this.StripeClient);

            this.captureOptions = new ChargeCaptureOptions
            {
                Amount = 123,
            };

            this.createOptions = new ChargeCreateOptions
            {
                Amount   = 123,
                Currency = "usd",
                Source   = "tok_123",
            };

            this.updateOptions = new ChargeUpdateOptions
            {
                FraudDetails = new ChargeFraudDetailsOptions
                {
                    UserReport = "safe",
                },
            };

            this.listOptions = new ChargeListOptions
            {
                Limit = 1,
            };
        }
Exemplo n.º 2
0
        public ChargeServiceTest()
        {
            this.service = new ChargeService();

            this.captureOptions = new ChargeCaptureOptions
            {
                Amount = 123,
            };

            this.createOptions = new ChargeCreateOptions
            {
                Amount   = 123,
                Currency = "usd",
                SourceId = "tok_123",
            };

            this.updateOptions = new ChargeUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new ChargeListOptions
            {
                Limit = 1,
            };
        }
        public ChargeServiceTest(
            StripeMockFixture stripeMockFixture,
            MockHttpClientFixture mockHttpClientFixture)
            : base(stripeMockFixture, mockHttpClientFixture)
        {
            this.service = new ChargeService(this.StripeClient);

            this.captureOptions = new ChargeCaptureOptions
            {
                Amount = 123,
            };

            this.createOptions = new ChargeCreateOptions
            {
                Amount   = 123,
                Currency = "usd",
                Source   = "tok_123",
            };

            this.updateOptions = new ChargeUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "key", "value" },
                },
            };

            this.listOptions = new ChargeListOptions
            {
                Limit = 1,
            };
        }
Exemplo n.º 4
0
 public virtual async Task UpdateAsync(
     string chargeId,
     string description,
     CancellationToken token)
 {
     var chargeUpdateOptions = new ChargeUpdateOptions
     {
         Description = description
     };
     await _chargeService.UpdateAsync(
         chargeId,
         chargeUpdateOptions,
         cancellationToken : token).ConfigureAwait(false);
 }
Exemplo n.º 5
0
        public static Charge MakeCapture(string customerId, string chargeId, string orderId, string clientId)
        {
            StripeConfiguration.ApiKey = "sk_test_dBR2X5yRuQklppKxRz7jCbuT";

            var chargeUpdateOptions = new ChargeUpdateOptions()
            {
                Description = orderId
            };

            var chargeService = new ChargeService();

            chargeService.Update(chargeId, chargeUpdateOptions);


            Charge charge = chargeService.Capture(chargeId, null);

            return(charge);
        }
Exemplo n.º 6
0
        public static Charge UpdateCharge(string id, Transactions transactionModel)
        {
            // Set your secret key: remember to change this to your live secret key in production
            // See your keys here: https://dashboard.stripe.com/account/apikeys
            StripeConfiguration.SetApiKey(SecretKey);


            var options = new ChargeUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "order_id", transactionModel.OrderId },
                },
            };
            var chargeService = new ChargeService();
            var charge        = chargeService.Update(id, options);

            return(charge);
        }
Exemplo n.º 7
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Press Enter");
            Console.ReadLine();

            //CulqiConfiguration.ApiKey = "pk_test_8MtrpF4Kw1pAjdYX";

            CulqiConfiguration.ApiKey = "sk_test_iSCxCg7THuZB2DwG";

            var tokenOptions = new TokenCreateOptions()
            {
                CardNumber      = "4111111111111111",
                ExpirationMonth = "09",
                ExpirationYear  = "2029",
                Cvv             = "123",
                Email           = "*****@*****.**"
            };

            var tokenService = new TokenService();
            //var tokens = await tokenService.Create(tokenOptions);

            //var tokens = await tokenService.Get("tkn_test_rk0lMDeGolf9fBa5");

            var tokenUpdateOptions = new TokenUpdateOptions {
                Metadata = new Dictionary <string, string>
                {
                    { "email", "*****@*****.**" },
                    { "active", "false" }
                }
            };
            //var tokens = await tokenService.Update("tkn_test_rk0lMDeGolf9fBa5", tokenUpdateOptions);

            var tokenListOptions = new TokenListOptions
            {
                Limit       = 2,
                Bin         = 411111,
                CountryCode = "PE"
            };
            //var tokens = await tokenService.List(tokenListOptions);


            ChargeService chargeService = new ChargeService();

            var chargeCreateOptions = new ChargeCreateOptions
            {
                Amount       = 100000,
                CurrencyCode = "PEN",
                Email        = "*****@*****.**",
                SourceId     = "tkn_test_o1tYygTfUzugALDq",
                Description  = "Test Charge from .net platform"
            };
            //chr_test_QezSVuBoRuSsrslL
            //var charge = await chargeService.Create(chargeCreateOptions);

            //var charge = await chargeService.Get("chr_test_QezSVuBoRuSsrslL");

            //var charge = await chargeService.Capture("chr_test_Wmr3PB18xmwyMtOq");

            var chargeListOptions = new ChargeListOptions
            {
                Limit  = 3,
                Amount = 10000
            };

            //var charge = await chargeService.List(chargeListOptions);

            var chargeUpdateOptions = new ChargeUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "email", "*****@*****.**" },
                    { "dni", "77777770" }
                }
            };

            var charge = await chargeService.Update("chr_test_QezSVuBoRuSsrslL", chargeUpdateOptions);

            Console.WriteLine(charge);
            Console.ReadLine();
        }
Exemplo n.º 8
0
 public async Task <Charge> UpdateAsync(string chargeId, ChargeUpdateOptions options, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
 {
     return(await chargeService.UpdateAsync(chargeId, options, requestOptions, cancellationToken));
 }