1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Added support for an additional payment gateway (paypal + credit card)

This commit is contained in:
Hillel Coren 2015-03-04 10:27:23 +02:00
parent 5853dd34de
commit 10bc43df91
3 changed files with 6 additions and 9 deletions

View File

@ -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;
}
}

View File

@ -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());

View File

@ -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;
}
}