mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 11:04:41 -04:00
Updated Payments and routes to support additional PHP-Payments gateways. Masked account info on payments page.
This commit is contained in:
parent
57c588c3bc
commit
a952d90c24
@ -191,10 +191,17 @@ class AccountController extends \BaseController {
|
|||||||
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$configFields = json_decode($config);
|
||||||
|
|
||||||
|
foreach($configFields as $configField => $value)
|
||||||
|
{
|
||||||
|
$configFields->$configField = str_repeat('*', strlen($value));
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'accountGateway' => $accountGateway,
|
'accountGateway' => $accountGateway,
|
||||||
'config' => json_decode($config),
|
'config' => $configFields,
|
||||||
'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)
|
'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)
|
||||||
->orderBy('name')
|
->orderBy('name')
|
||||||
->get(),
|
->get(),
|
||||||
|
@ -177,12 +177,17 @@ class PaymentController extends \BaseController
|
|||||||
'currency_code' => $invoice->client->currency->code,
|
'currency_code' => $invoice->client->currency->code,
|
||||||
];
|
];
|
||||||
|
|
||||||
if(strtolower($gateway->name) == 'beanstream')
|
switch($gateway->id)
|
||||||
{
|
{
|
||||||
$data['phone'] = $input['phone'];
|
case GATEWAY_BEANSTREAM:
|
||||||
$data['email'] = $input['email'];
|
$data['phone'] = $input['phone'];
|
||||||
$data['country'] = $input['country'];
|
$data['email'] = $input['email'];
|
||||||
$data['ship_to_country'] = $input['country'];
|
$data['country'] = $input['country'];
|
||||||
|
$data['ship_to_country'] = $input['country'];
|
||||||
|
break;
|
||||||
|
case GATEWAY_BRAINTREE:
|
||||||
|
$data['ship_to_state'] = 'Ohio'; //$input['state'];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strlen($data['cc_exp']) == 5)
|
if(strlen($data['cc_exp']) == 5)
|
||||||
@ -345,10 +350,28 @@ class PaymentController extends \BaseController
|
|||||||
}
|
}
|
||||||
else if ($paymentLibrary->id == PAYMENT_LIBRARY_PHP_PAYMENTS)
|
else if ($paymentLibrary->id == PAYMENT_LIBRARY_PHP_PAYMENTS)
|
||||||
{
|
{
|
||||||
$provider = $accountGateway->gateway->provider;
|
$gateway = $accountGateway->gateway;
|
||||||
$p = new PHP_Payments;
|
$provider = $gateway->provider;
|
||||||
|
$p = new PHP_Payments(array('mode' => 'test'));
|
||||||
|
|
||||||
$config = Payment_Utility::load('config', 'drivers/'.$provider);
|
$config = Payment_Utility::load('config', 'drivers/'.$provider);
|
||||||
|
|
||||||
|
switch($gateway->id)
|
||||||
|
{
|
||||||
|
case GATEWAY_BEANSTREAM:
|
||||||
|
$config['delay_charge'] = FALSE;
|
||||||
|
$config['bill_outstanding'] = TRUE;
|
||||||
|
break;
|
||||||
|
case GATEWAY_AMAZON:
|
||||||
|
$config['return_url'] = URL::to('complete');
|
||||||
|
$config['abandon_url'] = URL::to('/');
|
||||||
|
$config['immediate_return'] = 0;
|
||||||
|
$config['process_immediate'] = 1;
|
||||||
|
$config['ipn_url'] = URL::to('ipn');
|
||||||
|
$config['collect_shipping_address'] = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$details = self::getPaymentDetails($invoice, Input::all());
|
$details = self::getPaymentDetails($invoice, Input::all());
|
||||||
|
|
||||||
$response = $p->oneoff_payment($provider, $details, $config);
|
$response = $p->oneoff_payment($provider, $details, $config);
|
||||||
|
@ -237,6 +237,14 @@ define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
|
|||||||
define('PAYMENT_LIBRARY_OMNIPAY', 1);
|
define('PAYMENT_LIBRARY_OMNIPAY', 1);
|
||||||
define('PAYMENT_LIBRARY_PHP_PAYMENTS', 2);
|
define('PAYMENT_LIBRARY_PHP_PAYMENTS', 2);
|
||||||
|
|
||||||
|
define('GATEWAY_BEANSTREAM', 29);
|
||||||
|
define('GATEWAY_AMAZON', 30);
|
||||||
|
define('GATEWAY_BLUEPAY', 31);
|
||||||
|
define('GATEWAY_BRAINTREE', 32);
|
||||||
|
define('GATEWAY_GOOGLE', 33);
|
||||||
|
define('GATEWAY_PSIGATE', 34);
|
||||||
|
define('GATEWAY_QUICKBOOKS', 35);
|
||||||
|
|
||||||
if (Auth::check() && !Session::has(SESSION_TIMEZONE))
|
if (Auth::check() && !Session::has(SESSION_TIMEZONE))
|
||||||
{
|
{
|
||||||
Event::fire('user.refresh');
|
Event::fire('user.refresh');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user