Exemplo n.º 1
0
        public transfer_reversals_fixture()
        {
            // make sure the account has sufficient funds first
            new StripeChargeService(Cache.ApiKey).Create(new StripeChargeCreateOptions
            {
                Amount     = 10000,
                Currency   = "usd",
                SourceCard = new SourceCard
                {
                    Number          = "4000000000000077",
                    ExpirationMonth = "10",
                    ExpirationYear  = "2019",
                    Cvc             = "123"
                }
            });

            // create transfer to be reversed
            Transfer = new StripeTransferService(Cache.ApiKey).Create(new StripeTransferCreateOptions
            {
                Amount      = 1000,
                Currency    = "usd",
                Destination = Cache.GetAccount().Id
            });

            TransferReversalCreateOptions = new StripeTransferReversalCreateOptions
            {
                Amount      = 1000,
                Description = "Transfer reversed"
            };

            TransferReversalUpdateOptions = new StripeTransferReversalUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "some-key", "some-value" }
                }
            };

            var service = new StripeTransferReversalService(Cache.ApiKey);

            service.ExpandBalanceTransaction = true;
            service.ExpandTransfer           = true;

            TransferReversal          = service.Create(Transfer.Id, TransferReversalCreateOptions);
            TransferReversalUpdated   = service.Update(Transfer.Id, TransferReversal.Id, TransferReversalUpdateOptions);
            TransferReversalRetrieved = service.Get(Transfer.Id, TransferReversal.Id);
            TransferReversalList      = service.List(Transfer.Id, new StripeListOptions()).ToList();

            // get the original transfer
            Transfer = new StripeTransferService(Cache.ApiKey).Get(Transfer.Id);
        }
Exemplo n.º 2
0
        public transfer_reversals_fixture()
        {
            // make sure the account has sufficient funds first
            new StripeChargeService(Cache.ApiKey).Create(new StripeChargeCreateOptions
            {
                Amount   = 10000,
                Currency = "usd",
                SourceTokenOrExistingSourceId = "tok_bypassPending"
            });

            // create transfer to be reversed
            Transfer = new StripeTransferService(Cache.ApiKey).Create(new StripeTransferCreateOptions
            {
                Amount      = 1000,
                Currency    = "usd",
                Destination = Cache.GetAccount().Id
            });

            TransferReversalCreateOptions = new StripeTransferReversalCreateOptions
            {
                Amount      = 1000,
                Description = "Transfer reversed"
            };

            TransferReversalUpdateOptions = new StripeTransferReversalUpdateOptions
            {
                Metadata = new Dictionary <string, string>
                {
                    { "some-key", "some-value" }
                }
            };

            TransferReversalListOptions = new StripeTransferReversalListOptions();

            var service = new StripeTransferReversalService(Cache.ApiKey);

            service.ExpandBalanceTransaction = true;
            service.ExpandTransfer           = true;

            TransferReversal          = service.Create(Transfer.Id, TransferReversalCreateOptions);
            TransferReversalUpdated   = service.Update(Transfer.Id, TransferReversal.Id, TransferReversalUpdateOptions);
            TransferReversalRetrieved = service.Get(Transfer.Id, TransferReversal.Id);
            TransferReversalList      = service.List(Transfer.Id, TransferReversalListOptions);

            // get the original transfer
            Transfer = new StripeTransferService(Cache.ApiKey).Get(Transfer.Id);
        }