1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Updated Payments and routes to support additional PHP-Payments gateways. Masked account info on payments page.

This commit is contained in:
blkmutt 2014-04-09 22:33:32 -04:00
parent 57c588c3bc
commit a952d90c24
3 changed files with 46 additions and 8 deletions

View File

@ -191,10 +191,17 @@ class AccountController extends \BaseController {
$recommendedGatewayArray[$recommendedGateway->name] = $arrayItem;
}
$configFields = json_decode($config);
foreach($configFields as $configField => $value)
{
$configFields->$configField = str_repeat('*', strlen($value));
}
$data = [
'account' => $account,
'accountGateway' => $accountGateway,
'config' => json_decode($config),
'config' => $configFields,
'gateways' => Gateway::remember(DEFAULT_QUERY_CACHE)
->orderBy('name')
->get(),

View File

@ -177,12 +177,17 @@ class PaymentController extends \BaseController
'currency_code' => $invoice->client->currency->code,
];
if(strtolower($gateway->name) == 'beanstream')
switch($gateway->id)
{
$data['phone'] = $input['phone'];
$data['email'] = $input['email'];
$data['country'] = $input['country'];
$data['ship_to_country'] = $input['country'];
case GATEWAY_BEANSTREAM:
$data['phone'] = $input['phone'];
$data['email'] = $input['email'];
$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)
@ -345,10 +350,28 @@ class PaymentController extends \BaseController
}
else if ($paymentLibrary->id == PAYMENT_LIBRARY_PHP_PAYMENTS)
{
$provider = $accountGateway->gateway->provider;
$p = new PHP_Payments;
$gateway = $accountGateway->gateway;
$provider = $gateway->provider;
$p = new PHP_Payments(array('mode' => 'test'));
$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());
$response = $p->oneoff_payment($provider, $details, $config);

View File

@ -237,6 +237,14 @@ define('NINJA_ACCOUNT_KEY', 'zg4ylmzDkdkPOT8yoKQw9LTWaoZJx79h');
define('PAYMENT_LIBRARY_OMNIPAY', 1);
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))
{
Event::fire('user.refresh');