|
1 |
| -using Stripe; |
2 |
| -using Stripe.Checkout; |
3 | 1 | using System;
|
4 | 2 | using System.Collections.Generic;
|
5 | 3 | using System.Linq;
|
6 | 4 | using System.Net.Http;
|
7 | 5 | using System.Net.Http.Formatting;
|
8 | 6 | using System.Threading;
|
9 | 7 | using System.Threading.Tasks;
|
| 8 | +using Stripe; |
| 9 | +using Stripe.Checkout; |
10 | 10 | using Umbraco.Commerce.Common.Logging;
|
11 | 11 | using Umbraco.Commerce.Core;
|
12 | 12 | using Umbraco.Commerce.Core.Api;
|
13 | 13 | using Umbraco.Commerce.Core.Models;
|
14 | 14 | using Umbraco.Commerce.Core.PaymentProviders;
|
15 | 15 | using Umbraco.Commerce.Extensions;
|
16 |
| - |
17 | 16 | using CustomerService = Stripe.CustomerService;
|
18 | 17 | using RefundService = Stripe.RefundService;
|
19 | 18 |
|
@@ -224,23 +223,15 @@ public override async Task<PaymentFormResult> GenerateFormAsync(PaymentProviderC
|
224 | 223 | { "stripeSessionId", session.Id },
|
225 | 224 | { "stripeCustomerId", session.CustomerId }
|
226 | 225 | },
|
227 |
| - Form = new PaymentForm(ctx.Urls.ContinueUrl, PaymentFormMethod.Post) |
| 226 | + Form = new PaymentForm(ctx.Urls.ErrorUrl, PaymentFormMethod.Post) |
228 | 227 | .WithAttribute("onsubmit", "return handleStripeCheckout(event)")
|
229 |
| - .WithJsFile("https://js.stripe.com/v3/") |
230 | 228 | .WithJs(@"
|
231 |
| - var stripe = Stripe('" + publicKey + @"'); |
232 | 229 | window.handleStripeCheckout = function (e) {
|
233 | 230 | e.preventDefault();
|
234 |
| - stripe.redirectToCheckout({ |
235 |
| - sessionId: '" + session.Id + @"' |
236 |
| - }).then(function (result) { |
237 |
| - // If `redirectToCheckout` fails due to a browser or network |
238 |
| - // error, display the localized error message to your customer |
239 |
| - // using `result.error.message`. |
240 |
| - }); |
| 231 | + window.location.href = '" + session.Url + @"'; |
241 | 232 | return false;
|
242 | 233 | }
|
243 |
| - ") |
| 234 | + "), |
244 | 235 | };
|
245 | 236 | }
|
246 | 237 |
|
@@ -347,7 +338,7 @@ private async Task<CallbackResult> ProcessWebhookCallbackAsync(PaymentProviderCo
|
347 | 338 | stripeSession.PaymentIntentId,
|
348 | 339 | new PaymentIntentGetOptions
|
349 | 340 | {
|
350 |
| - Expand = new List<string>(new [] |
| 341 | + Expand = new List<string>(new[] |
351 | 342 | {
|
352 | 343 | "latest_charge",
|
353 | 344 | "review"
|
@@ -379,9 +370,9 @@ private async Task<CallbackResult> ProcessWebhookCallbackAsync(PaymentProviderCo
|
379 | 370 | var subscription = await subscriptionService.GetAsync(
|
380 | 371 | stripeSession.SubscriptionId,
|
381 | 372 | new SubscriptionGetOptions
|
382 |
| - { |
| 373 | + { |
383 | 374 | Expand = new List<string>(new[]
|
384 |
| - { |
| 375 | + { |
385 | 376 | "latest_invoice",
|
386 | 377 | "latest_invoice.charge",
|
387 | 378 | "latest_invoice.charge.review",
|
|
0 commit comments