Skip to content

Commit 794eddf

Browse files
committed
Merge remote-tracking branch 'origin/7.x'
2 parents 54ee069 + 985528b commit 794eddf

4 files changed

Lines changed: 18 additions & 13 deletions

File tree

docs/installation.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: Installation
33
---
44

5+
:::note
6+
[Cargo](https://builtwithcargo.dev), the successor to Simple Commerce, is now in alpha and will be released fully in the next couple of months. If you're starting a new project, you should probably use Cargo instead. To learn more, check out the [Cargo documentation](https://builtwithcargo.dev).
7+
:::
8+
59
To install Simple Commerce, there's two routes you can take. You can either [install into an existing site](#content-installing-into-an-existing-site) or create a fresh Statamic project using the Simple Commerce [starter kit](#content-installing-with-the-starter-kit).
610

711
## Requirements

src/Gateways/Builtin/StripeGateway.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public function prepare(Request $request, OrderContract $order): array
7676
if ($this->inPaymentElementsMode()) {
7777
$intentData['automatic_payment_methods'] = [
7878
'enabled' => true,
79-
'allow_redirects' => 'never',
8079
];
8180
}
8281

src/Http/Controllers/GatewayCallbackController.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ class GatewayCallbackController extends BaseActionController
1818

1919
public function index(Request $request, $gateway)
2020
{
21-
if ($request->has('_order_id')) {
22-
$order = Order::find($request->get('_order_id'));
23-
} else {
24-
$order = $this->getCart();
25-
}
21+
$order = $request->has('_order_id')
22+
? Order::find($request->get('_order_id'))
23+
: $this->getCart();
2624

2725
$gatewayName = $gateway;
2826

@@ -40,11 +38,15 @@ public function index(Request $request, $gateway)
4038
$callbackSuccess = $order->paymentStatus() === PaymentStatus::Paid;
4139
}
4240

41+
$order->fresh();
42+
4343
if (! $callbackSuccess) {
4444
return $this->withErrors($request, "Order [{$order->get('title')}] has not been marked as paid yet.");
4545
}
4646

47-
$order->status(OrderStatus::Placed)->save();
47+
if ($order->status() !== OrderStatus::Placed) {
48+
$order->status(OrderStatus::Placed)->save();
49+
}
4850

4951
$this->forgetCart();
5052

src/Tags/CheckoutTags.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ public function index()
3434
return true;
3535
})
3636
->each(function ($gateway) use (&$cart, &$data) {
37-
$config = Gateway::use($gateway['handle'])->config();
38-
$prepare = Gateway::use($gateway['handle'])->prepare(request(), $cart);
39-
40-
$callbackUrl = Gateway::use($gateway['handle'])
37+
$gatewayInstance = Gateway::use($gateway['handle'])
4138
->withRedirectUrl($this->params->get('redirect') ?? request()->path())
42-
->withErrorRedirectUrl($this->params->get('error_redirect') ?? request()->path())
43-
->callbackUrl();
39+
->withErrorRedirectUrl($this->params->get('error_redirect') ?? request()->path());
40+
41+
$config = $gatewayInstance->config();
42+
$prepare = $gatewayInstance->prepare(request(), $cart);
43+
$callbackUrl = $gatewayInstance->callbackUrl();
4444

4545
$data[$gateway['handle']] = array_merge($prepare, [
4646
'config' => $config,

0 commit comments

Comments
 (0)