public virtual StripeDeleted Delete(string recipientId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeDeleted>.MapFromJson(
         Requestor.Delete($"{Urls.Recipients}/{recipientId}",
         SetupRequestOptions(requestOptions))
     );
 }
Пример #2
0
 public virtual IEnumerable<StripeEvent> List(StripeEventListOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeEvent>.MapCollectionFromJson(
         Requestor.GetString(this.ApplyAllParameters(listOptions, Urls.Events, true),
         SetupRequestOptions(requestOptions))
     );
 }
 public virtual IEnumerable<StripeInvoiceLineItem> ListLineItems(string invoiceId, StripeInvoiceListLineItemsOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoiceLineItem>.MapCollectionFromJson(
         Requestor.GetString(this.ApplyAllParameters(listOptions, $"{Urls.Invoices}/{invoiceId}/lines", true),
         SetupRequestOptions(requestOptions))
     );
 }
 public virtual StripeRecipient Get(string recipientId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeRecipient>.MapFromJson(
         Requestor.GetString(this.ApplyAllParameters(null, $"{Urls.Recipients}/{recipientId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #5
0
 public virtual async Task<StripeInvoice> UpdateAsync(string invoiceId, StripeInvoiceUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoice>.MapFromJson(
         await Requestor.PostStringAsync(this.ApplyAllParameters(updateOptions, $"{Urls.Invoices}/{invoiceId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #6
0
 //Sync
 public virtual StripeEvent Get(string eventId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeEvent>.MapFromJson(
         Requestor.GetString($"{Urls.Events}/{eventId}",
         SetupRequestOptions(requestOptions))
     );
 }
 //Sync
 public virtual StripeOAuthToken Create(StripeOAuthTokenCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeOAuthToken>.MapFromJson(
         Requestor.PostStringBearer(this.ApplyAllParameters(createOptions, Urls.OAuthToken, false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #8
0
 public virtual StripeInvoice Pay(string invoiceId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoice>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(null, $"{Urls.Invoices}/{invoiceId}/pay", false),
         SetupRequestOptions(requestOptions))
     );
 }
 public virtual StripeTransfer Cancel(string transferId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeTransfer>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(null, $"{Urls.Transfers}/{transferId}/cancel", false),
         SetupRequestOptions(requestOptions))
     );
 }
        internal static WebRequest GetWebRequest(string url, string method, StripeRequestOptions requestOptions, bool useBearer = false)
        {
            requestOptions.ApiKey = requestOptions.ApiKey ?? StripeConfiguration.GetApiKey();

            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = method;

            if(!useBearer)
                request.Headers.Add("Authorization", GetAuthorizationHeaderValue(requestOptions.ApiKey));
            else
                request.Headers.Add("Authorization", GetAuthorizationHeaderValueBearer(requestOptions.ApiKey));

            request.Headers.Add("Stripe-Version", StripeConfiguration.ApiVersion);

            if (requestOptions.StripeConnectAccountId != null)
                request.Headers.Add("Stripe-Account", requestOptions.StripeConnectAccountId);

            if (requestOptions.IdempotencyKey != null)
                request.Headers.Add("Idempotency-Key", requestOptions.IdempotencyKey);

            request.ContentType = "application/x-www-form-urlencoded";
            request.UserAgent = "Stripe.net (https://github.com/jaymedavis/stripe.net)";

            return request;
        }
Пример #11
0
 public virtual StripeDeleted Delete(string customerId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeDeleted>.MapFromJson(
         Requestor.Delete($"{Urls.Customers}/{customerId}",
         SetupRequestOptions(requestOptions))
      );
 }
Пример #12
0
 //Sync
 public virtual StripeTransfer Create(StripeTransferCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeTransfer>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.Transfers, false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #13
0
 //Sync
 public virtual StripeRefund Create(string chargeId, StripeRefundCreateOptions createOptions = null, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeRefund>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(createOptions, $"{Urls.Charges}/{chargeId}/refunds", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #14
0
 public virtual StripeCustomer Update(string customerId, StripeCustomerUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeCustomer>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(updateOptions, $"{Urls.Customers}/{customerId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #15
0
 public virtual async Task<StripeInvoiceLineItem> GetAsync(string invoiceItemId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoiceLineItem>.MapFromJson(
         await Requestor.GetStringAsync(this.ApplyAllParameters(null, $"{Urls.InvoiceItems}/{invoiceItemId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #16
0
 public virtual async Task<StripeEvent> GetAsync(string eventId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeEvent>.MapFromJson(
         await Requestor.GetStringAsync($"{Urls.Events}/{eventId}",
         SetupRequestOptions(requestOptions))
     );
 }
Пример #17
0
 public virtual async Task<IEnumerable<StripeInvoiceLineItem>> ListAsync(StripeInvoiceItemListOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoiceLineItem>.MapCollectionFromJson(
         await Requestor.GetStringAsync(this.ApplyAllParameters(listOptions, Urls.InvoiceItems, true),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #18
0
 public virtual StripeInvoiceLineItem Update(string invoiceItemId, StripeInvoiceItemUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoiceLineItem>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(updateOptions, $"{Urls.InvoiceItems}/{invoiceItemId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #19
0
 public virtual async Task<StripeInvoiceLineItem> CreateAsync(StripeInvoiceItemCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeInvoiceLineItem>.MapFromJson(
         await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.InvoiceItems, false),
         SetupRequestOptions(requestOptions))
     );
 }
 public virtual StripeDeleted Delete(string invoiceItemId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeDeleted>.MapFromJson(
         Requestor.Delete($"{Urls.InvoiceItems}/{invoiceItemId}",
         SetupRequestOptions(requestOptions))
     );
 }
Пример #21
0
 public virtual StripeToken Get(string tokenId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeToken>.MapFromJson(
         Requestor.GetString($"{Urls.Tokens}/{tokenId}",
         SetupRequestOptions(requestOptions))
     );
 }
Пример #22
0
 public virtual async Task<StripePlan> GetAsync(string planId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripePlan>.MapFromJson(
         await Requestor.GetStringAsync(this.ApplyAllParameters(null, $"{Urls.Plans}/{planId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #23
0
 public virtual StripeDeleted Delete(string accountId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeDeleted>.MapFromJson(
         Requestor.Delete(this.ApplyAllParameters(null, $"{Urls.Accounts}/{accountId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #24
0
 public virtual StripeCoupon Get(string couponId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeCoupon>.MapFromJson(
         Requestor.GetString(this.ApplyAllParameters(null, $"{Urls.Coupons}/{couponId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #25
0
 public virtual StripeAccount Update(string accountId, StripeAccountUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeAccount>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(updateOptions, $"{Urls.Accounts}/{accountId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #26
0
 public virtual async Task<StripeToken> GetAsync(string tokenId, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeToken>.MapFromJson(
         await Requestor.GetStringAsync($"{Urls.Tokens}/{tokenId}",
         SetupRequestOptions(requestOptions))
     );
 }
 public virtual StripeBalanceTransaction Get(string id, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeBalanceTransaction>.MapFromJson(
         Requestor.GetString(this.ApplyAllParameters(null, $"{Urls.BalanceTransactions}/{id}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #28
0
 public virtual StripePlan Update(string planId, StripePlanUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripePlan>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(updateOptions, $"{Urls.Plans}/{planId}", false),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #29
0
 public virtual void Delete(string customerId, string bankAccountId, StripeRequestOptions requestOptions = null)
 {
     Requestor.Delete(
         this.ApplyAllParameters(null, $"{Urls.BaseUrl}/customers/{customerId}/sources/{bankAccountId}"),
         SetupRequestOptions(requestOptions)
     );
 }
 public virtual IEnumerable<StripeBalanceTransaction> List(StripeBalanceTransactionListOptions options = null, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeBalanceTransaction>.MapCollectionFromJson(
         Requestor.GetString(this.ApplyAllParameters(options, Urls.BalanceTransactions, true),
         SetupRequestOptions(requestOptions))
     );
 }
Пример #31
0
        public virtual async Task <StripeCard> CreateAsync(string recipientId, StripeCreditCardOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            var url = SetupUrl(recipientId, true);

            return(Mapper <StripeCard> .MapFromJson(
                       await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, url, false),
                                                       SetupRequestOptions(requestOptions))
                       ));
        }
Пример #32
0
        public virtual IEnumerable <StripeCard> List(string customerOrRecipientId, StripeListOptions listOptions = null, bool isRecipient = false, StripeRequestOptions requestOptions = null)
        {
            var url = SetupUrl(customerOrRecipientId, isRecipient);

            return(Mapper <StripeCard> .MapCollectionFromJson(
                       Requestor.GetString(this.ApplyAllParameters(listOptions, url, true),
                                           SetupRequestOptions(requestOptions))
                       ));
        }
 //Async
 public virtual async Task <StripeApplicationFee> GetAsync(string applicationFeeId, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Mapper <StripeApplicationFee> .MapFromJson(
                await Requestor.GetStringAsync(this.ApplyAllParameters(null, $"{Urls.ApplicationFees}/{applicationFeeId}", false),
                                               SetupRequestOptions(requestOptions),
                                               cancellationToken)
                ));
 }
Пример #34
0
        public virtual async Task DeleteAsync(string customerOrRecipientId, string cardId, bool isRecipient = false, StripeRequestOptions requestOptions = null)
        {
            var url = SetupUrl(customerOrRecipientId, isRecipient, cardId);

            await Requestor.DeleteAsync(url, SetupRequestOptions(requestOptions));
        }
Пример #35
0
 public virtual async Task <StripeList <StripeEvent> > ListAsync(StripeEventListOptions listOptions = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Mapper <StripeList <StripeEvent> > .MapFromJson(
                await Requestor.GetStringAsync(this.ApplyAllParameters(listOptions, Urls.Events, true),
                                               SetupRequestOptions(requestOptions),
                                               cancellationToken)
                ));
 }
Пример #36
0
 public virtual StripeList <StripeEvent> List(StripeEventListOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeList <StripeEvent> > .MapFromJson(
                Requestor.GetString(this.ApplyAllParameters(listOptions, Urls.Events, true),
                                    SetupRequestOptions(requestOptions))
                ));
 }
Пример #37
0
 public virtual async Task <IEnumerable <CountrySpec> > ListAsync(StripeListOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <CountrySpec> .MapCollectionFromJson(
                await Requestor.GetStringAsync(
                    this.ApplyAllParameters(listOptions, $"{Urls.CountrySpecs}", true),
                    SetupRequestOptions(requestOptions)
                    )
                ));
 }
        public virtual async Task <StripeApplicationFee> RefundAsync(string applicationFeeId, int?refundAmount = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var url = this.ApplyAllParameters(null, $"{Urls.ApplicationFees}/{applicationFeeId}/refund", false);

            if (refundAmount.HasValue)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "amount", refundAmount.Value.ToString());
            }

            return(Mapper <StripeApplicationFee> .MapFromJson(
                       await Requestor.PostStringAsync(url, SetupRequestOptions(requestOptions), cancellationToken)
                       ));
        }
Пример #39
0
        public virtual IEnumerable <StripePlan> List(StripeListOptions listOptions = null, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = Urls.Plans;

            url = this.ApplyAllParameters(listOptions, url, true);

            var response = Requestor.GetString(url, requestOptions);

            return(Mapper <StripePlan> .MapCollectionFromJson(response));
        }
 // Async
 public virtual Task <StripeLoginLink> CreateAsync(string accountId, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(PostAsync($"{Urls.BaseUrl}/accounts/{accountId}/login_links", requestOptions, cancellationToken, null));
 }
Пример #41
0
        public virtual StripePlan Update(string planId, StripePlanUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = string.Format("{0}/{1}", Urls.Plans, planId);

            url = this.ApplyAllParameters(updateOptions, url, false);

            var response = Requestor.PostString(url, requestOptions);

            return(Mapper <StripePlan> .MapFromJson(response));
        }
        public virtual StripeApplicationFee Refund(string applicationFeeId, int?refundAmount = null, StripeRequestOptions requestOptions = null)
        {
            var url = this.ApplyAllParameters(null, $"{Urls.ApplicationFees}/{applicationFeeId}/refund", false);

            if (refundAmount.HasValue)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "amount", refundAmount.Value.ToString());
            }

            return(Mapper <StripeApplicationFee> .MapFromJson(
                       Requestor.PostString(url, SetupRequestOptions(requestOptions))
                       ));
        }
Пример #43
0
 public virtual async Task <IEnumerable <StripeBalanceTransaction> > ListAsync(StripeBalanceTransactionListOptions options = null, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeBalanceTransaction> .MapCollectionFromJson(
                await Requestor.GetStringAsync(this.ApplyAllParameters(options, Urls.BalanceTransactions, true),
                                               SetupRequestOptions(requestOptions))
                ));
 }
Пример #44
0
        public virtual void Delete(string customerOrRecipientId, string cardId, bool isRecipient = false, StripeRequestOptions requestOptions = null)
        {
            var url = SetupUrl(customerOrRecipientId, isRecipient, cardId);

            Requestor.Delete(url, SetupRequestOptions(requestOptions));
        }
Пример #45
0
 public virtual StripeBalance Get(StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeBalance> .MapFromJson(
                Requestor.GetString(Urls.Balance, SetupRequestOptions(requestOptions))
                ));
 }
 //Sync
 public virtual StripeLoginLink Create(string accountId, StripeRequestOptions requestOptions = null)
 {
     return(CreateAsync(accountId, requestOptions, CancellationToken.None).Result);
 }
Пример #47
0
        public virtual StripeList <StripeInvoiceLineItem> ListUpcomingLineItems(string customerId, StripeUpcomingInvoiceOptions listOptions = null, StripeRequestOptions requestOptions = null)
        {
            var url = ParameterBuilder.ApplyParameterToUrl($"{Urls.Invoices}/upcoming/lines", "customer", customerId);

            return(Mapper <StripeList <StripeInvoiceLineItem> > .MapFromJson(
                       Requestor.GetString(this.ApplyAllParameters(listOptions, url, true),
                                           SetupRequestOptions(requestOptions))
                       ));
        }
Пример #48
0
 public virtual async Task <StripeBalance> GetAsync(StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeBalance> .MapFromJson(
                await Requestor.GetStringAsync(Urls.Balance, SetupRequestOptions(requestOptions))
                ));
 }
Пример #49
0
 public virtual StripeInvoice Update(string invoiceId, StripeInvoiceUpdateOptions updateOptions, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeInvoice> .MapFromJson(
                Requestor.PostString(this.ApplyAllParameters(updateOptions, $"{Urls.Invoices}/{invoiceId}", false),
                                     SetupRequestOptions(requestOptions))
                ));
 }
Пример #50
0
        public virtual StripeInvoice Create(string customerId, StripeInvoiceCreateOptions createOptions = null, StripeRequestOptions requestOptions = null)
        {
            var url = ParameterBuilder.ApplyParameterToUrl(Urls.Invoices, "customer", customerId);

            return(Mapper <StripeInvoice> .MapFromJson(
                       Requestor.PostString(this.ApplyAllParameters(createOptions, url, false),
                                            SetupRequestOptions(requestOptions))
                       ));
        }
Пример #51
0
        public virtual async Task <StripeInvoice> CreateAsync(string customerId, StripeInvoiceCreateOptions createOptions = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var url = ParameterBuilder.ApplyParameterToUrl(Urls.Invoices, "customer", customerId);

            return(Mapper <StripeInvoice> .MapFromJson(
                       await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, url),
                                                       SetupRequestOptions(requestOptions),
                                                       cancellationToken)
                       ));
        }
Пример #52
0
 public virtual StripeList <StripeInvoiceLineItem> ListLineItems(string invoiceId, StripeInvoiceListLineItemsOptions listOptions = null, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeList <StripeInvoiceLineItem> > .MapFromJson(
                Requestor.GetString(this.ApplyAllParameters(listOptions, $"{Urls.Invoices}/{invoiceId}/lines", true),
                                    SetupRequestOptions(requestOptions))
                ));
 }
Пример #53
0
 public virtual async Task <StripeList <StripeInvoiceLineItem> > ListLineItemsAsync(string invoiceId, StripeInvoiceListLineItemsOptions listOptions = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Mapper <StripeList <StripeInvoiceLineItem> > .MapFromJson(
                await Requestor.GetStringAsync(
                    this.ApplyAllParameters(listOptions, $"{Urls.Invoices}/{invoiceId}/lines", true),
                    SetupRequestOptions(requestOptions),
                    cancellationToken)
                ));
 }
Пример #54
0
        public virtual StripeInvoice Upcoming(string customerId, StripeUpcomingInvoiceOptions upcomingOptions = null, StripeRequestOptions requestOptions = null)
        {
            var url = ParameterBuilder.ApplyParameterToUrl($"{Urls.Invoices}/upcoming", "customer", customerId);

            return(Mapper <StripeInvoice> .MapFromJson(
                       Requestor.GetString(this.ApplyAllParameters(upcomingOptions, url, false),
                                           SetupRequestOptions(requestOptions))
                       ));
        }
Пример #55
0
 public virtual async Task <StripeToken> CreateAsync(StripeTokenCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeToken> .MapFromJson(
                await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Tokens, false),
                                                SetupRequestOptions(requestOptions))
                ));
 }
Пример #56
0
        public virtual async Task <StripeList <StripeInvoiceLineItem> > ListUpcomingLineItemsAsync(string customerId, StripeUpcomingInvoiceOptions listOptions = null, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            var url = ParameterBuilder.ApplyParameterToUrl($"{Urls.Invoices}/upcoming/lines", "customer", customerId);

            return(Mapper <StripeList <StripeInvoiceLineItem> > .MapFromJson(
                       await Requestor.GetStringAsync(this.ApplyAllParameters(listOptions, url, true),
                                                      SetupRequestOptions(requestOptions),
                                                      cancellationToken)
                       ));
        }
Пример #57
0
        public virtual StripeCard Update(string customerOrRecipientId, string cardId, StripeCardUpdateOptions updateOptions, bool isRecipient = false, StripeRequestOptions requestOptions = null)
        {
            var url = SetupUrl(customerOrRecipientId, isRecipient, cardId);

            return(Mapper <StripeCard> .MapFromJson(
                       Requestor.PostString(this.ApplyAllParameters(updateOptions, url, false),
                                            SetupRequestOptions(requestOptions))
                       ));
        }
Пример #58
0
 public virtual async Task <StripeInvoice> UpdateAsync(string invoiceId, StripeInvoiceUpdateOptions updateOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Mapper <StripeInvoice> .MapFromJson(
                await Requestor.PostStringAsync(this.ApplyAllParameters(updateOptions, $"{Urls.Invoices}/{invoiceId}", false),
                                                SetupRequestOptions(requestOptions),
                                                cancellationToken)
                ));
 }
Пример #59
0
        public virtual StripeCard Create(string customerId, StripeCardCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            var url = SetupUrl(customerId, false);

            return(Mapper <StripeCard> .MapFromJson(
                       Requestor.PostString(this.ApplyAllParameters(createOptions, url, false),
                                            SetupRequestOptions(requestOptions))
                       ));
        }
Пример #60
0
        public virtual StripeCharge Capture(string chargeId, int?captureAmount = null, int?applicationFee = null, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = string.Format("{0}/{1}/capture", Urls.Charges, chargeId);

            url = this.ApplyAllParameters(null, url, false);

            if (captureAmount.HasValue)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "amount", captureAmount.Value.ToString());
            }
            if (applicationFee.HasValue)
            {
                url = ParameterBuilder.ApplyParameterToUrl(url, "application_fee", applicationFee.Value.ToString());
            }

            var response = Requestor.PostString(url, requestOptions);

            return(Mapper <StripeCharge> .MapFromJson(response));
        }