Skip to content

Commit

Permalink
Merge pull request #3269 from craftcms/feature/fix-3265
Browse files Browse the repository at this point in the history
Fix for #3265
  • Loading branch information
lukeholder authored Oct 17, 2023
2 parents 75f4a0a + 21e3a10 commit 8700421
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed an error that could occur when rendering a PDF. ([#2633](https://github.com/craftcms/commerce/issues/2633))
- Fixed a bug where Sale’s and Discount’s date audit columns weren’t populated after saving. ([#3298](https://github.com/craftcms/commerce/issues/3298))
- Fixed a bug where duplicate inactive users could be created when using the `commerce/upgrade` command. ([#3286](https://github.com/craftcms/commerce/issues/3286))
- Fixed a bug where the `commerce/payments/pay` action was missing the `redirect` in JSON responses. ([#3265](https://github.com/craftcms/commerce/issues/3265))
- The order param is now included when triggering the `craft\commerce\services\Purchasables::EVENT_PURCHASABLE_SHIPPABLE` event. ([#3279](https://github.com/craftcms/commerce/pull/3279))
- The auto-generated variant titles and SKUs are now generated when before saving a product in addition to before validation. ((#3297)[https://github.com/craftcms/commerce/pull/3297])

Expand Down
15 changes: 6 additions & 9 deletions src/controllers/PaymentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,11 @@ public function actionPay(): ?Response
);
}

// If the gateway did not give us a redirect URL, use the order's return URL.
if (!$redirect) {
// Can be set from the redirect body param
$redirect = $order->returnUrl;
}

if ($this->request->getAcceptsJson()) {
return $this->asModelSuccess(
Expand All @@ -474,15 +479,7 @@ public function actionPay(): ?Response
);
}

if ($redirect) {
return $this->redirect($redirect);
}

if ($order->returnUrl) {
return $this->redirect($order->returnUrl);
}

return $this->redirectToPostedUrl($order);
return $this->redirect($redirect);
}

/**
Expand Down

0 comments on commit 8700421

Please sign in to comment.