Skip to content

Commit

Permalink
Fixes bug where HttpException does not exists. #2
Browse files Browse the repository at this point in the history
  • Loading branch information
andrelopez committed Nov 19, 2018
1 parent f420bce commit d00eebc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/controllers/PaypalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
use craft\web\Controller as BaseController;

use enupal\paypal\contracts\PaypalIPN;
use enupal\paypal\elements\Order;
use enupal\paypal\enums\OrderStatus;
use yii\web\NotFoundHttpException;
use enupal\paypal\Paypal;

class PaypalController extends BaseController
Expand Down Expand Up @@ -88,10 +87,10 @@ public function actionIpn()
return $this->asJson(['success' => 'true']);
}


/**
* @return \yii\web\Response
* @throws \HttpException
* @throws NotFoundHttpException
* @throws \Throwable
* @throws \yii\base\Exception
*/
public function actionCompletePayment()
Expand All @@ -106,8 +105,8 @@ public function actionCompletePayment()
if ($txnId){
$order = Paypal::$app->orders->getOrderByPaypalTransactionId($txnId);

if (!$order) {
throw new \HttpException(400, Craft::t('enupal-paypal', 'Can not find the order for missing PayPal transaction id.'));
if (is_null($order)) {
throw new NotFoundHttpException(Craft::t('enupal-paypal', 'Order does not exists'));
}

$button = $order->getButton();
Expand Down

0 comments on commit d00eebc

Please sign in to comment.