mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Added support for an additional payment gateway (paypal + credit card)
This commit is contained in:
parent
5853dd34de
commit
10bc43df91
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user