diff --git a/app/controllers/AccountGatewayController.php b/app/controllers/AccountGatewayController.php index 21b1aad749..e6f646e4e7 100755 --- a/app/controllers/AccountGatewayController.php +++ b/app/controllers/AccountGatewayController.php @@ -137,11 +137,9 @@ class AccountGatewayController extends BaseController if (count($currentGateways) > 0) { $currentGateway = $currentGateways[0]; if ($currentGateway->isPayPal()) { - $gateways->where('id', '!=', GATEWAY_PAYPAL_EXPRESS) - ->where('id', '!=', GATEWAY_PAYPAL_PRO); + $gateways->where('id', '!=', GATEWAY_PAYPAL_EXPRESS); } else { - $gateways->where('id', '>=', GATEWAY_PAYPAL_EXPRESS) - ->where('id', '<=', GATEWAY_PAYPAL_PRO); + $gateways->where('id', '=', GATEWAY_PAYPAL_EXPRESS); $onlyPayPal = true; } } diff --git a/app/controllers/PaymentController.php b/app/controllers/PaymentController.php index 71ce186bac..af651e117c 100755 --- a/app/controllers/PaymentController.php +++ b/app/controllers/PaymentController.php @@ -304,11 +304,10 @@ class PaymentController extends \BaseController if (Input::has('use_paypal')) { Session::put('payment_type', Input::get('use_paypal') == 'true' ? PAYMENT_TYPE_PAYPAL : PAYMENT_TYPE_CREDIT_CARD); - } else { + } elseif (!Session::has('payment_type')) { Session::put('payment_type', PAYMENT_TYPE_ANY); } - Session::save(); - + // For PayPal we redirect straight to their site $usePayPal = false; if ($usePayPal = Input::get('use_paypal')) { @@ -316,7 +315,7 @@ class PaymentController extends \BaseController } else { $invitation = Invitation::with('invoice.client.account', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail(); $account = $invitation->invoice->client->account; - if ($account->getGatewayByType(PAYMENT_TYPE_PAYPAL)) { + if (count($account->account_gateways) == 1 && $account->getGatewayByType(PAYMENT_TYPE_PAYPAL)) { $usePayPal = true; } } @@ -607,6 +606,7 @@ class PaymentController extends \BaseController $invitation->transaction_reference = $ref; $invitation->save(); + Session::save(); $response->redirect(); } else { Session::flash('error', $response->getMessage()); diff --git a/app/models/AccountGateway.php b/app/models/AccountGateway.php index f2f0954895..002bc83079 100755 --- a/app/models/AccountGateway.php +++ b/app/models/AccountGateway.php @@ -22,7 +22,6 @@ class AccountGateway extends EntityModel } public function isPayPal() { - //return $this->gateway_id == GATEWAY_PAYPAL_EXPRESS || $this->gateway_id == GATEWAY_PAYPAL_PRO; return $this->gateway_id == GATEWAY_PAYPAL_EXPRESS; } }