Skip to content

Commit

Permalink
Fixed #312
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Apr 9, 2018
1 parent a928fbf commit 985537e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Fixed a bug where PHP 7.1 was required to update the addresses on the cart ([#305](https://github.com/craftcms/commerce/issues/305))
- Fixed a PHP error that would occur when using `count()` in variant queries.
- Fixed a PHP error that would occur when submitting a payment source at checkout. ([#313](https://github.com/craftcms/commerce/issues/313))
- Fixed a PHP error that would occur when submitting a gateway choice at checkout. ([#312](https://github.com/craftcms/commerce/issues/312))

### Added
- Added the `VariantQuery::hasSales()` method.
Expand Down
5 changes: 4 additions & 1 deletion src/controllers/PaymentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ public function actionPay()

if ($gatewayId && $order->gatewayId != $gatewayId) {
try {
$plugin->getCarts()->setGateway($order, (int)$gatewayId);
if (!($gateway = Plugin::getInstance()->getGateways()->getGatewayById($gatewayId)) || (Craft::$app->getRequest()->getIsSiteRequest() && !$gateway->isFrontendEnabled)) {
throw new GatewayException(Craft::t('commerce', 'Payment gateway does not exist or is not allowed.'));
}
$order->gatewayId = (int)$gateway->id;
} catch (GatewayException $exception) {
if ($request->getAcceptsJson()) {
return $this->asErrorJson($exception->getMessage());
Expand Down

0 comments on commit 985537e

Please sign in to comment.