mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-07 07:04:37 -04:00
Added support for Bitcoin
This commit is contained in:
parent
868744c696
commit
be327fbcbf
@ -153,7 +153,7 @@ class AccountController extends BaseController
|
|||||||
if ($count == 0) {
|
if ($count == 0) {
|
||||||
return Redirect::to('gateways/create');
|
return Redirect::to('gateways/create');
|
||||||
} else {
|
} else {
|
||||||
return View::make('accounts.payments', ['showAdd' => $count < 2]);
|
return View::make('accounts.payments', ['showAdd' => $count < 3]);
|
||||||
}
|
}
|
||||||
} elseif ($section == ACCOUNT_NOTIFICATIONS) {
|
} elseif ($section == ACCOUNT_NOTIFICATIONS) {
|
||||||
$data = [
|
$data = [
|
||||||
|
@ -25,10 +25,11 @@ class AccountGatewayController extends BaseController
|
|||||||
->join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
|
->join('gateways', 'gateways.id', '=', 'account_gateways.gateway_id')
|
||||||
->where('account_gateways.deleted_at', '=', null)
|
->where('account_gateways.deleted_at', '=', null)
|
||||||
->where('account_gateways.account_id', '=', Auth::user()->account_id)
|
->where('account_gateways.account_id', '=', Auth::user()->account_id)
|
||||||
->select('account_gateways.public_id', 'gateways.name', 'account_gateways.deleted_at');
|
->select('account_gateways.public_id', 'gateways.name', 'account_gateways.deleted_at', 'account_gateways.gateway_id');
|
||||||
|
|
||||||
return Datatable::query($query)
|
return Datatable::query($query)
|
||||||
->addColumn('name', function ($model) { return link_to('gateways/'.$model->public_id.'/edit', $model->name); })
|
->addColumn('name', function ($model) { return link_to('gateways/'.$model->public_id.'/edit', $model->name); })
|
||||||
|
->addColumn('payment_type', function ($model) { return Gateway::getPrettyPaymentType($model->gateway_id); })
|
||||||
->addColumn('dropdown', function ($model) {
|
->addColumn('dropdown', function ($model) {
|
||||||
$actions = '<div class="btn-group tr-action" style="visibility:hidden;">
|
$actions = '<div class="btn-group tr-action" style="visibility:hidden;">
|
||||||
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown">
|
||||||
@ -68,6 +69,7 @@ class AccountGatewayController extends BaseController
|
|||||||
$data['method'] = 'PUT';
|
$data['method'] = 'PUT';
|
||||||
$data['title'] = trans('texts.edit_gateway') . ' - ' . $accountGateway->gateway->name;
|
$data['title'] = trans('texts.edit_gateway') . ' - ' . $accountGateway->gateway->name;
|
||||||
$data['config'] = $configFields;
|
$data['config'] = $configFields;
|
||||||
|
$data['paymentTypeId'] = $accountGateway->getPaymentType();
|
||||||
|
|
||||||
return View::make('accounts.account_gateway', $data);
|
return View::make('accounts.account_gateway', $data);
|
||||||
}
|
}
|
||||||
@ -101,6 +103,17 @@ class AccountGatewayController extends BaseController
|
|||||||
$selectedCards = $accountGateway ? $accountGateway->accepted_credit_cards : 0;
|
$selectedCards = $accountGateway ? $accountGateway->accepted_credit_cards : 0;
|
||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
|
|
||||||
|
$paymentTypes = [];
|
||||||
|
foreach ([PAYMENT_TYPE_CREDIT_CARD, PAYMENT_TYPE_PAYPAL, PAYMENT_TYPE_BITCOIN] as $type) {
|
||||||
|
if ($accountGateway || !$account->getGatewayByType($type)) {
|
||||||
|
$paymentTypes[$type] = trans('texts.'.strtolower($type));
|
||||||
|
|
||||||
|
if ($type == PAYMENT_TYPE_BITCOIN) {
|
||||||
|
$paymentTypes[$type] .= ' - BitPay';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$creditCardsArray = unserialize(CREDIT_CARDS);
|
$creditCardsArray = unserialize(CREDIT_CARDS);
|
||||||
$creditCards = [];
|
$creditCards = [];
|
||||||
foreach ($creditCardsArray as $card => $name) {
|
foreach ($creditCardsArray as $card => $name) {
|
||||||
@ -113,25 +126,11 @@ class AccountGatewayController extends BaseController
|
|||||||
|
|
||||||
$account->load('account_gateways');
|
$account->load('account_gateways');
|
||||||
$currentGateways = $account->account_gateways;
|
$currentGateways = $account->account_gateways;
|
||||||
$gateways = Gateway::where('payment_library_id', '=', 1)->orderBy('name');
|
$gateways = Gateway::where('payment_library_id', '=', 1)->orderBy('name')->get();
|
||||||
$onlyPayPal = false;
|
$selectGateways = Gateway::where('payment_library_id', '=', 1)->where('id', '!=', GATEWAY_PAYPAL_EXPRESS)->where('id', '!=', GATEWAY_PAYPAL_EXPRESS)->orderBy('name')->get();
|
||||||
if (!$accountGateway) {
|
|
||||||
if (count($currentGateways) > 0) {
|
|
||||||
$currentGateway = $currentGateways[0];
|
|
||||||
if ($currentGateway->isPayPal()) {
|
|
||||||
$gateways->where('id', '!=', GATEWAY_PAYPAL_EXPRESS);
|
|
||||||
} else {
|
|
||||||
$gateways->where('id', '=', GATEWAY_PAYPAL_EXPRESS);
|
|
||||||
$onlyPayPal = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$gateways = $gateways->get();
|
|
||||||
|
|
||||||
foreach ($gateways as $gateway) {
|
foreach ($gateways as $gateway) {
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
|
||||||
$gateway->fields = $gateway->getFields();
|
$gateway->fields = $gateway->getFields();
|
||||||
|
|
||||||
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
|
if ($accountGateway && $accountGateway->gateway_id == $gateway->id) {
|
||||||
$accountGateway->fields = $gateway->fields;
|
$accountGateway->fields = $gateway->fields;
|
||||||
}
|
}
|
||||||
@ -143,14 +142,15 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'paymentTypes' => $paymentTypes,
|
||||||
'account' => $account,
|
'account' => $account,
|
||||||
'accountGateway' => $accountGateway,
|
'accountGateway' => $accountGateway,
|
||||||
'config' => false,
|
'config' => false,
|
||||||
'gateways' => $gateways,
|
'gateways' => $gateways,
|
||||||
|
'selectGateways' => $selectGateways,
|
||||||
'creditCardTypes' => $creditCards,
|
'creditCardTypes' => $creditCards,
|
||||||
'tokenBillingOptions' => $tokenBillingOptions,
|
'tokenBillingOptions' => $tokenBillingOptions,
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
'onlyPayPal' => $onlyPayPal,
|
|
||||||
'countGateways' => count($currentGateways)
|
'countGateways' => count($currentGateways)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -183,7 +183,6 @@ class AccountGatewayController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$gateway = Gateway::findOrFail($gatewayId);
|
$gateway = Gateway::findOrFail($gatewayId);
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
|
||||||
$fields = $gateway->getFields();
|
$fields = $gateway->getFields();
|
||||||
|
|
||||||
foreach ($fields as $field => $details) {
|
foreach ($fields as $field => $details) {
|
||||||
|
@ -176,6 +176,7 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$invoice->load('user', 'invoice_items', 'invoice_design', 'account.country', 'client.contacts', 'client.country');
|
$invoice->load('user', 'invoice_items', 'invoice_design', 'account.country', 'client.contacts', 'client.country');
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
|
$account = $client->account;
|
||||||
|
|
||||||
if (!$client || $client->is_deleted) {
|
if (!$client || $client->is_deleted) {
|
||||||
return View::make('invoices.deleted');
|
return View::make('invoices.deleted');
|
||||||
@ -188,13 +189,13 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
Session::set($invitationKey, true);
|
Session::set($invitationKey, true);
|
||||||
Session::set('invitation_key', $invitationKey);
|
Session::set('invitation_key', $invitationKey);
|
||||||
Session::set('white_label', $client->account->isWhiteLabel());
|
Session::set('white_label', $account->isWhiteLabel());
|
||||||
|
|
||||||
$client->account->loadLocalizationSettings();
|
$account->loadLocalizationSettings();
|
||||||
|
|
||||||
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
|
||||||
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
|
||||||
$invoice->is_pro = $client->account->isPro();
|
$invoice->is_pro = $account->isPro();
|
||||||
|
|
||||||
$contact = $invitation->contact;
|
$contact = $invitation->contact;
|
||||||
$contact->setVisible([
|
$contact->setVisible([
|
||||||
@ -203,16 +204,30 @@ class InvoiceController extends BaseController
|
|||||||
'email',
|
'email',
|
||||||
'phone', ]);
|
'phone', ]);
|
||||||
|
|
||||||
|
// Determine payment options
|
||||||
|
$paymentTypes = [];
|
||||||
|
if ($client->getGatewayToken()) {
|
||||||
|
$paymentTypes[] = [
|
||||||
|
'url' => URL::to("payment/{$invitation->invitation_key}/".PAYMENT_TYPE_TOKEN), 'label' => trans('texts.use_card_on_file')
|
||||||
|
];
|
||||||
|
}
|
||||||
|
foreach([PAYMENT_TYPE_CREDIT_CARD, PAYMENT_TYPE_PAYPAL, PAYMENT_TYPE_BITCOIN] as $type) {
|
||||||
|
if ($account->getGatewayByType($type)) {
|
||||||
|
$paymentTypes[] = [
|
||||||
|
'url' => URL::to("/payment/{$invitation->invitation_key}/{$type}"), 'label' => trans('texts.'.strtolower($type))
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'isConverted' => $invoice->quote_invoice_id ? true : false,
|
'isConverted' => $invoice->quote_invoice_id ? true : false,
|
||||||
'showBreadcrumbs' => false,
|
'showBreadcrumbs' => false,
|
||||||
'hideLogo' => $client->account->isWhiteLabel(),
|
'hideLogo' => $account->isWhiteLabel(),
|
||||||
'invoice' => $invoice->hidePrivateFields(),
|
'invoice' => $invoice->hidePrivateFields(),
|
||||||
'invitation' => $invitation,
|
'invitation' => $invitation,
|
||||||
'invoiceLabels' => $client->account->getInvoiceLabels(),
|
'invoiceLabels' => $account->getInvoiceLabels(),
|
||||||
'contact' => $contact,
|
'contact' => $contact,
|
||||||
'hasToken' => $client->getGatewayToken(),
|
'paymentTypes' => $paymentTypes
|
||||||
'countGateways' => AccountGateway::scope(false, $client->account->id)->count(),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return View::make('invoices.view', $data);
|
return View::make('invoices.view', $data);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use Datatable;
|
use Datatable;
|
||||||
use Input;
|
use Input;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
|
use Request;
|
||||||
use Session;
|
use Session;
|
||||||
use Utils;
|
use Utils;
|
||||||
use View;
|
use View;
|
||||||
@ -11,12 +12,15 @@ use Omnipay;
|
|||||||
use CreditCard;
|
use CreditCard;
|
||||||
use URL;
|
use URL;
|
||||||
use Cache;
|
use Cache;
|
||||||
|
use Event;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Invitation;
|
use App\Models\Invitation;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\PaymentType;
|
use App\Models\PaymentType;
|
||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
|
use App\Models\Payment;
|
||||||
|
use App\Models\AccountGatewayToken;
|
||||||
use App\Ninja\Repositories\PaymentRepository;
|
use App\Ninja\Repositories\PaymentRepository;
|
||||||
use App\Ninja\Repositories\InvoiceRepository;
|
use App\Ninja\Repositories\InvoiceRepository;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
@ -244,116 +248,57 @@ class PaymentController extends BaseController
|
|||||||
$invoice = $invitation->invoice;
|
$invoice = $invitation->invoice;
|
||||||
$key = $invoice->invoice_number.'_details';
|
$key = $invoice->invoice_number.'_details';
|
||||||
$gateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'))->gateway;
|
$gateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'))->gateway;
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
|
||||||
$currencyCode = $invoice->client->currency ? $invoice->client->currency->code : ($invoice->account->currency ? $invoice->account->currency->code : 'USD');
|
$currencyCode = $invoice->client->currency ? $invoice->client->currency->code : ($invoice->account->currency ? $invoice->account->currency->code : 'USD');
|
||||||
|
|
||||||
if ($input && $paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) {
|
if ($input) {
|
||||||
$data = self::convertInputForOmnipay($input);
|
$data = self::convertInputForOmnipay($input);
|
||||||
|
|
||||||
Session::put($key, $data);
|
Session::put($key, $data);
|
||||||
} elseif ($input && $paymentLibrary->id == PAYMENT_LIBRARY_PHP_PAYMENTS) {
|
|
||||||
$input = Input::all();
|
|
||||||
$data = [
|
|
||||||
'first_name' => $input['first_name'],
|
|
||||||
'last_name' => $input['last_name'],
|
|
||||||
'cc_number' => $input['card_number'],
|
|
||||||
'cc_exp' => $input['expiration_month'].$input['expiration_year'],
|
|
||||||
'cc_code' => $input['cvv'],
|
|
||||||
'street' => $input['address1'],
|
|
||||||
'street2' => $input['address2'],
|
|
||||||
'city' => $input['city'],
|
|
||||||
'state' => $input['state'],
|
|
||||||
'postal_code' => $input['postal_code'],
|
|
||||||
'amt' => $invoice->balance,
|
|
||||||
'ship_to_street' => $input['address1'],
|
|
||||||
'ship_to_city' => $input['city'],
|
|
||||||
'ship_to_state' => $input['state'],
|
|
||||||
'ship_to_postal_code' => $input['postal_code'],
|
|
||||||
'currency_code' => $currencyCode,
|
|
||||||
];
|
|
||||||
|
|
||||||
switch ($gateway->id) {
|
|
||||||
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) {
|
|
||||||
$data['cc_exp'] = '0'.$data['cc_exp'];
|
|
||||||
}
|
|
||||||
|
|
||||||
Session::put($key, $data);
|
|
||||||
|
|
||||||
return $data;
|
|
||||||
} elseif (Session::get($key)) {
|
} elseif (Session::get($key)) {
|
||||||
$data = Session::get($key);
|
$data = Session::get($key);
|
||||||
} else {
|
} else {
|
||||||
$data = [];
|
$data = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) {
|
$card = new CreditCard($data);
|
||||||
$card = new CreditCard($data);
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'amount' => $invoice->balance,
|
'amount' => $invoice->balance,
|
||||||
'card' => $card,
|
'card' => $card,
|
||||||
'currency' => $currencyCode,
|
'currency' => $currencyCode,
|
||||||
'returnUrl' => URL::to('complete'),
|
'returnUrl' => URL::to('complete'),
|
||||||
'cancelUrl' => $invitation->getLink(),
|
'cancelUrl' => $invitation->getLink(),
|
||||||
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}",
|
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}",
|
||||||
];
|
];
|
||||||
} else {
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show_payment($invitationKey)
|
public function show_payment($invitationKey, $paymentType = false)
|
||||||
{
|
{
|
||||||
// Handle token billing
|
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail();
|
||||||
if (Input::get('use_token') == 'true') {
|
$invoice = $invitation->invoice;
|
||||||
return self::do_payment($invitationKey, false, true);
|
$client = $invoice->client;
|
||||||
}
|
$account = $client->account;
|
||||||
|
$useToken = false;
|
||||||
|
|
||||||
if (Input::has('use_paypal')) {
|
if (!$paymentType) {
|
||||||
Session::put('payment_type', Input::get('use_paypal') == 'true' ? PAYMENT_TYPE_PAYPAL : PAYMENT_TYPE_CREDIT_CARD);
|
$paymentType = $account->account_gateways[0]->getPaymentType();
|
||||||
} elseif (!Session::has('payment_type')) {
|
} else if ($paymentType == PAYMENT_TYPE_TOKEN) {
|
||||||
Session::put('payment_type', PAYMENT_TYPE_ANY);
|
$useToken = true;
|
||||||
|
$paymentType = PAYMENT_TYPE_CREDIT_CARD;
|
||||||
}
|
}
|
||||||
|
Session::put('payment_type', $paymentType);
|
||||||
|
|
||||||
// For PayPal we redirect straight to their site
|
// Handle offsite payments
|
||||||
$usePayPal = false;
|
if ($useToken || $paymentType != PAYMENT_TYPE_CREDIT_CARD) {
|
||||||
if ($usePayPal = Input::get('use_paypal')) {
|
|
||||||
$usePayPal = $usePayPal == 'true';
|
|
||||||
} else {
|
|
||||||
$invitation = Invitation::with('invoice.client.account', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail();
|
|
||||||
$account = $invitation->invoice->client->account;
|
|
||||||
if (count($account->account_gateways) == 1 && $account->getGatewayByType(PAYMENT_TYPE_PAYPAL)) {
|
|
||||||
$usePayPal = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($usePayPal) {
|
|
||||||
if (Session::has('error')) {
|
if (Session::has('error')) {
|
||||||
Session::reflash();
|
Session::reflash();
|
||||||
return Redirect::to('view/'.$invitationKey);
|
return Redirect::to('view/'.$invitationKey);
|
||||||
} else {
|
} else {
|
||||||
return self::do_payment($invitationKey, false);
|
return self::do_payment($invitationKey, false, $useToken);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
Session::put('payment_type', PAYMENT_TYPE_ANY);
|
|
||||||
}
|
|
||||||
|
|
||||||
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $invitationKey)->firstOrFail();
|
$accountGateway = $invoice->client->account->getGatewayByType($paymentType);
|
||||||
$invoice = $invitation->invoice;
|
$gateway = $accountGateway->gateway;
|
||||||
$client = $invoice->client;
|
|
||||||
$accountGateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'));
|
|
||||||
$gateway = $invoice->client->account->getGatewayByType(Session::get('payment_type'))->gateway;
|
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
|
||||||
$acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
|
$acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@ -363,7 +308,6 @@ class PaymentController extends BaseController
|
|||||||
'invoiceNumber' => $invoice->invoice_number,
|
'invoiceNumber' => $invoice->invoice_number,
|
||||||
'client' => $client,
|
'client' => $client,
|
||||||
'contact' => $invitation->contact,
|
'contact' => $invitation->contact,
|
||||||
'paymentLibrary' => $paymentLibrary,
|
|
||||||
'gateway' => $gateway,
|
'gateway' => $gateway,
|
||||||
'acceptedCreditCardTypes' => $acceptedCreditCardTypes,
|
'acceptedCreditCardTypes' => $acceptedCreditCardTypes,
|
||||||
'countries' => Cache::get('countries'),
|
'countries' => Cache::get('countries'),
|
||||||
@ -400,7 +344,6 @@ class PaymentController extends BaseController
|
|||||||
$account->load('account_gateways.gateway');
|
$account->load('account_gateways.gateway');
|
||||||
$accountGateway = $account->getGatewayByType(Session::get('payment_type'));
|
$accountGateway = $account->getGatewayByType(Session::get('payment_type'));
|
||||||
$gateway = $accountGateway->gateway;
|
$gateway = $accountGateway->gateway;
|
||||||
$paymentLibrary = $gateway->paymentlibrary;
|
|
||||||
$acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
|
$acceptedCreditCardTypes = $accountGateway->getCreditcardTypes();
|
||||||
|
|
||||||
$affiliate = Affiliate::find(Session::get('affiliate_id'));
|
$affiliate = Affiliate::find(Session::get('affiliate_id'));
|
||||||
@ -412,7 +355,6 @@ class PaymentController extends BaseController
|
|||||||
'amount' => $affiliate->price,
|
'amount' => $affiliate->price,
|
||||||
'client' => false,
|
'client' => false,
|
||||||
'contact' => false,
|
'contact' => false,
|
||||||
'paymentLibrary' => $paymentLibrary,
|
|
||||||
'gateway' => $gateway,
|
'gateway' => $gateway,
|
||||||
'acceptedCreditCardTypes' => $acceptedCreditCardTypes,
|
'acceptedCreditCardTypes' => $acceptedCreditCardTypes,
|
||||||
'countries' => Cache::get('countries'),
|
'countries' => Cache::get('countries'),
|
||||||
@ -563,8 +505,7 @@ class PaymentController extends BaseController
|
|||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
$account = $client->account;
|
$account = $client->account;
|
||||||
$accountGateway = $account->getGatewayByType(Session::get('payment_type'));
|
$accountGateway = $account->getGatewayByType(Session::get('payment_type'));
|
||||||
$paymentLibrary = $accountGateway->gateway->paymentlibrary;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($onSite) {
|
if ($onSite) {
|
||||||
$client->address1 = trim(Input::get('address1'));
|
$client->address1 = trim(Input::get('address1'));
|
||||||
@ -577,65 +518,63 @@ class PaymentController extends BaseController
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) {
|
$gateway = self::createGateway($accountGateway);
|
||||||
$gateway = self::createGateway($accountGateway);
|
$details = self::getPaymentDetails($invitation, $useToken || !$onSite ? false : Input::all());
|
||||||
$details = self::getPaymentDetails($invitation, $useToken || !$onSite ? false : Input::all());
|
|
||||||
|
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
||||||
if ($accountGateway->gateway_id == GATEWAY_STRIPE) {
|
if ($useToken) {
|
||||||
if ($useToken) {
|
$details['cardReference'] = $client->getGatewayToken();
|
||||||
$details['cardReference'] = $client->getGatewayToken();
|
} elseif ($account->token_billing_type_id == TOKEN_BILLING_ALWAYS || Input::get('token_billing')) {
|
||||||
} elseif ($account->token_billing_type_id == TOKEN_BILLING_ALWAYS || Input::get('token_billing')) {
|
$tokenResponse = $gateway->createCard($details)->send();
|
||||||
$tokenResponse = $gateway->createCard($details)->send();
|
$cardReference = $tokenResponse->getCardReference();
|
||||||
$cardReference = $tokenResponse->getCardReference();
|
$details['cardReference'] = $cardReference;
|
||||||
$details['cardReference'] = $cardReference;
|
|
||||||
|
|
||||||
$token = AccountGatewayToken::where('client_id', '=', $client->id)
|
$token = AccountGatewayToken::where('client_id', '=', $client->id)
|
||||||
->where('account_gateway_id', '=', $accountGateway->id)->first();
|
->where('account_gateway_id', '=', $accountGateway->id)->first();
|
||||||
|
|
||||||
if (!$token) {
|
if (!$token) {
|
||||||
$token = new AccountGatewayToken();
|
$token = new AccountGatewayToken();
|
||||||
$token->account_id = $account->id;
|
$token->account_id = $account->id;
|
||||||
$token->contact_id = $invitation->contact_id;
|
$token->contact_id = $invitation->contact_id;
|
||||||
$token->account_gateway_id = $accountGateway->id;
|
$token->account_gateway_id = $accountGateway->id;
|
||||||
$token->client_id = $client->id;
|
$token->client_id = $client->id;
|
||||||
}
|
|
||||||
|
|
||||||
$token->token = $cardReference;
|
|
||||||
$token->save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$token->token = $cardReference;
|
||||||
|
$token->save();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = $gateway->purchase($details)->send();
|
||||||
|
$ref = $response->getTransactionReference();
|
||||||
|
|
||||||
|
if (!$ref) {
|
||||||
|
|
||||||
$response = $gateway->purchase($details)->send();
|
Session::flash('error', $response->getMessage());
|
||||||
$ref = $response->getTransactionReference();
|
|
||||||
|
|
||||||
if (!$ref) {
|
if ($onSite) {
|
||||||
|
return Redirect::to('payment/'.$invitationKey)->withInput();
|
||||||
Session::flash('error', $response->getMessage());
|
|
||||||
|
|
||||||
if ($onSite) {
|
|
||||||
return Redirect::to('payment/'.$invitationKey)->withInput();
|
|
||||||
} else {
|
|
||||||
return Redirect::to('view/'.$invitationKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($response->isSuccessful()) {
|
|
||||||
$payment = self::createPayment($invitation, $ref);
|
|
||||||
Session::flash('message', trans('texts.applied_payment'));
|
|
||||||
|
|
||||||
return Redirect::to('view/'.$payment->invitation->invitation_key);
|
|
||||||
} elseif ($response->isRedirect()) {
|
|
||||||
$invitation->transaction_reference = $ref;
|
|
||||||
$invitation->save();
|
|
||||||
|
|
||||||
Session::save();
|
|
||||||
$response->redirect();
|
|
||||||
} else {
|
} else {
|
||||||
Session::flash('error', $response->getMessage());
|
return Redirect::to('view/'.$invitationKey);
|
||||||
|
|
||||||
return Utils::fatalError('Sorry, there was an error processing your payment. Please try again later.<p>', $response->getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($response->isSuccessful()) {
|
||||||
|
$payment = self::createPayment($invitation, $ref);
|
||||||
|
Session::flash('message', trans('texts.applied_payment'));
|
||||||
|
|
||||||
|
return Redirect::to('view/'.$payment->invitation->invitation_key);
|
||||||
|
} elseif ($response->isRedirect()) {
|
||||||
|
$invitation->transaction_reference = $ref;
|
||||||
|
$invitation->save();
|
||||||
|
|
||||||
|
Session::save();
|
||||||
|
$response->redirect();
|
||||||
|
} else {
|
||||||
|
Session::flash('error', $response->getMessage());
|
||||||
|
|
||||||
|
return Utils::fatalError('Sorry, there was an error processing your payment. Please try again later.<p>', $response->getMessage());
|
||||||
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$errorMessage = trans('texts.payment_error');
|
$errorMessage = trans('texts.payment_error');
|
||||||
Session::flash('error', $errorMessage."<p>".$e->getMessage());
|
Session::flash('error', $errorMessage."<p>".$e->getMessage());
|
||||||
|
@ -10,7 +10,7 @@ use Cache;
|
|||||||
use Session;
|
use Session;
|
||||||
use Event;
|
use Event;
|
||||||
use App\Models\Language;
|
use App\Models\Language;
|
||||||
|
use App\Events\UserSettingsChanged;
|
||||||
|
|
||||||
class StartupCheck
|
class StartupCheck
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ Route::post('get_started', 'AccountController@getStarted');
|
|||||||
// Client visible pages
|
// Client visible pages
|
||||||
Route::get('view/{invitation_key}', 'InvoiceController@view');
|
Route::get('view/{invitation_key}', 'InvoiceController@view');
|
||||||
Route::get('approve/{invitation_key}', 'QuoteController@approve');
|
Route::get('approve/{invitation_key}', 'QuoteController@approve');
|
||||||
Route::get('payment/{invitation_key}', 'PaymentController@show_payment');
|
Route::get('payment/{invitation_key}/{payment_type?}', 'PaymentController@show_payment');
|
||||||
Route::post('payment/{invitation_key}', 'PaymentController@do_payment');
|
Route::post('payment/{invitation_key}', 'PaymentController@do_payment');
|
||||||
Route::get('complete', 'PaymentController@offsite_payment');
|
Route::get('complete', 'PaymentController@offsite_payment');
|
||||||
Route::get('client/quotes', 'QuoteController@clientIndex');
|
Route::get('client/quotes', 'QuoteController@clientIndex');
|
||||||
@ -336,6 +336,7 @@ define('GATEWAY_TWO_CHECKOUT', 27);
|
|||||||
define('GATEWAY_BEANSTREAM', 29);
|
define('GATEWAY_BEANSTREAM', 29);
|
||||||
define('GATEWAY_PSIGATE', 30);
|
define('GATEWAY_PSIGATE', 30);
|
||||||
define('GATEWAY_MOOLAH', 31);
|
define('GATEWAY_MOOLAH', 31);
|
||||||
|
define('GATEWAY_BITPAY', 42);
|
||||||
|
|
||||||
define('EVENT_CREATE_CLIENT', 1);
|
define('EVENT_CREATE_CLIENT', 1);
|
||||||
define('EVENT_CREATE_INVOICE', 2);
|
define('EVENT_CREATE_INVOICE', 2);
|
||||||
@ -378,6 +379,8 @@ define('TOKEN_BILLING_ALWAYS', 4);
|
|||||||
|
|
||||||
define('PAYMENT_TYPE_PAYPAL', 'PAYMENT_TYPE_PAYPAL');
|
define('PAYMENT_TYPE_PAYPAL', 'PAYMENT_TYPE_PAYPAL');
|
||||||
define('PAYMENT_TYPE_CREDIT_CARD', 'PAYMENT_TYPE_CREDIT_CARD');
|
define('PAYMENT_TYPE_CREDIT_CARD', 'PAYMENT_TYPE_CREDIT_CARD');
|
||||||
|
define('PAYMENT_TYPE_BITCOIN', 'PAYMENT_TYPE_BITCOIN');
|
||||||
|
define('PAYMENT_TYPE_TOKEN', 'PAYMENT_TYPE_TOKEN');
|
||||||
define('PAYMENT_TYPE_ANY', 'PAYMENT_TYPE_ANY');
|
define('PAYMENT_TYPE_ANY', 'PAYMENT_TYPE_ANY');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -31,8 +31,10 @@ class HandleInvoicePaid {
|
|||||||
*/
|
*/
|
||||||
public function handle(InvoicePaid $event)
|
public function handle(InvoicePaid $event)
|
||||||
{
|
{
|
||||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
$payment = $event->payment;
|
||||||
$invoice = $payment->invoice;
|
$invoice = $payment->invoice;
|
||||||
|
|
||||||
|
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||||
|
|
||||||
foreach ($invoice->account->users as $user)
|
foreach ($invoice->account->users as $user)
|
||||||
{
|
{
|
||||||
|
@ -113,9 +113,7 @@ class Account extends Eloquent
|
|||||||
foreach ($this->account_gateways as $gateway) {
|
foreach ($this->account_gateways as $gateway) {
|
||||||
if (!$type || $type == PAYMENT_TYPE_ANY) {
|
if (!$type || $type == PAYMENT_TYPE_ANY) {
|
||||||
return $gateway;
|
return $gateway;
|
||||||
} elseif ($gateway->isPayPal() && $type == PAYMENT_TYPE_PAYPAL) {
|
} elseif ($gateway->isPaymentType($type)) {
|
||||||
return $gateway;
|
|
||||||
} elseif (!$gateway->isPayPal() && $type == PAYMENT_TYPE_CREDIT_CARD) {
|
|
||||||
return $gateway;
|
return $gateway;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php namespace App\Models;
|
<?php namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Gateway;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class AccountGateway extends EntityModel
|
class AccountGateway extends EntityModel
|
||||||
@ -26,8 +27,12 @@ class AccountGateway extends EntityModel
|
|||||||
return $arrayOfImages;
|
return $arrayOfImages;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isPayPal() {
|
public function getPaymentType() {
|
||||||
return $this->gateway_id == GATEWAY_PAYPAL_EXPRESS;
|
return Gateway::getPaymentType($this->gateway_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isPaymentType($type) {
|
||||||
|
return $this->getPaymentType() == $type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,6 @@ class Gateway extends Eloquent
|
|||||||
{
|
{
|
||||||
public $timestamps = true;
|
public $timestamps = true;
|
||||||
|
|
||||||
public function paymentlibrary()
|
|
||||||
{
|
|
||||||
return $this->belongsTo('\App\Models\PaymentLibrary', 'payment_library_id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLogoUrl()
|
public function getLogoUrl()
|
||||||
{
|
{
|
||||||
return '/images/gateways/logo_'.$this->provider.'.png';
|
return '/images/gateways/logo_'.$this->provider.'.png';
|
||||||
@ -37,18 +32,20 @@ class Gateway extends Eloquent
|
|||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
{
|
{
|
||||||
$paymentLibrary = $this->paymentlibrary;
|
return Omnipay::create($this->provider)->getDefaultParameters();
|
||||||
|
}
|
||||||
|
|
||||||
if ($paymentLibrary->id == PAYMENT_LIBRARY_OMNIPAY) {
|
public static function getPaymentType($gatewayId) {
|
||||||
$fields = Omnipay::create($this->provider)->getDefaultParameters();
|
if ($gatewayId == GATEWAY_PAYPAL_EXPRESS) {
|
||||||
|
return PAYMENT_TYPE_PAYPAL;
|
||||||
|
} else if ($gatewayId == GATEWAY_BITPAY) {
|
||||||
|
return PAYMENT_TYPE_BITCOIN;
|
||||||
} else {
|
} else {
|
||||||
$fields = Payment_Utility::load('config', 'drivers/'.strtolower($this->provider));
|
return PAYMENT_TYPE_CREDIT_CARD;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($fields == null) {
|
public static function getPrettyPaymentType($gatewayId) {
|
||||||
$fields = array();
|
return trans('texts.' . strtolower(Gateway::getPaymentType($gatewayId)));
|
||||||
}
|
|
||||||
|
|
||||||
return $fields;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
"coatesap/omnipay-realex": "~2.0",
|
"coatesap/omnipay-realex": "~2.0",
|
||||||
"fruitcakestudio/omnipay-sisow": "~2.0",
|
"fruitcakestudio/omnipay-sisow": "~2.0",
|
||||||
"alfaproject/omnipay-skrill": "dev-master",
|
"alfaproject/omnipay-skrill": "dev-master",
|
||||||
"illuminate/html": "5.*"
|
"illuminate/html": "5.*",
|
||||||
|
"omnipay/bitpay": "dev-master"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.0",
|
"phpunit/phpunit": "~4.0",
|
||||||
|
73
composer.lock
generated
73
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "f464570c808999ffcb0fa78193b13229",
|
"hash": "4093891914bbd46ffab78737da36898a",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "alfaproject/omnipay-neteller",
|
"name": "alfaproject/omnipay-neteller",
|
||||||
@ -2346,6 +2346,64 @@
|
|||||||
],
|
],
|
||||||
"time": "2015-01-19 19:06:04"
|
"time": "2015-01-19 19:06:04"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "omnipay/bitpay",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thephpleague/omnipay-bitpay.git",
|
||||||
|
"reference": "e659f0e993c586cb36acafaf50835570b4a16eb2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thephpleague/omnipay-bitpay/zipball/e659f0e993c586cb36acafaf50835570b4a16eb2",
|
||||||
|
"reference": "e659f0e993c586cb36acafaf50835570b4a16eb2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"omnipay/common": "~2.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"omnipay/tests": "~2.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Omnipay\\BitPay\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Adrian Macneil",
|
||||||
|
"email": "adrian@adrianmacneil.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Omnipay Contributors",
|
||||||
|
"homepage": "https://github.com/thephpleague/omnipay-bitpay/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "BitPay driver for the Omnipay payment processing library",
|
||||||
|
"homepage": "https://github.com/thephpleague/omnipay-bitpay",
|
||||||
|
"keywords": [
|
||||||
|
"bitcoin",
|
||||||
|
"bitpay",
|
||||||
|
"gateway",
|
||||||
|
"merchant",
|
||||||
|
"omnipay",
|
||||||
|
"pay",
|
||||||
|
"payment"
|
||||||
|
],
|
||||||
|
"time": "2015-03-23 14:18:26"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "omnipay/buckaroo",
|
"name": "omnipay/buckaroo",
|
||||||
"version": "v2.0.1",
|
"version": "v2.0.1",
|
||||||
@ -3730,16 +3788,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "omnipay/stripe",
|
"name": "omnipay/stripe",
|
||||||
"version": "v2.2.0",
|
"version": "v2.2.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/thephpleague/omnipay-stripe.git",
|
"url": "https://github.com/thephpleague/omnipay-stripe.git",
|
||||||
"reference": "b3ed1028bb72837905012311fa74259d9ed8ba3c"
|
"reference": "906377e50045dc2ba9c612aa1f6924157e1f750e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/thephpleague/omnipay-stripe/zipball/b3ed1028bb72837905012311fa74259d9ed8ba3c",
|
"url": "https://api.github.com/repos/thephpleague/omnipay-stripe/zipball/906377e50045dc2ba9c612aa1f6924157e1f750e",
|
||||||
"reference": "b3ed1028bb72837905012311fa74259d9ed8ba3c",
|
"reference": "906377e50045dc2ba9c612aa1f6924157e1f750e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -3783,7 +3841,7 @@
|
|||||||
"payment",
|
"payment",
|
||||||
"stripe"
|
"stripe"
|
||||||
],
|
],
|
||||||
"time": "2015-03-16 19:24:07"
|
"time": "2015-04-14 18:55:56"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "omnipay/targetpay",
|
"name": "omnipay/targetpay",
|
||||||
@ -6115,7 +6173,8 @@
|
|||||||
"webpatser/laravel-countries": 20,
|
"webpatser/laravel-countries": 20,
|
||||||
"lokielse/omnipay-alipay": 20,
|
"lokielse/omnipay-alipay": 20,
|
||||||
"alfaproject/omnipay-neteller": 20,
|
"alfaproject/omnipay-neteller": 20,
|
||||||
"alfaproject/omnipay-skrill": 20
|
"alfaproject/omnipay-skrill": 20,
|
||||||
|
"omnipay/bitpay": 20
|
||||||
},
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
|
@ -22,7 +22,8 @@ class PaymentLibrariesSeeder extends Seeder
|
|||||||
['name' => 'PaymentSense', 'provider' => 'PaymentSense', 'payment_library_id' => 1],
|
['name' => 'PaymentSense', 'provider' => 'PaymentSense', 'payment_library_id' => 1],
|
||||||
['name' => 'Realex', 'provider' => 'Realex_Remote', 'payment_library_id' => 1],
|
['name' => 'Realex', 'provider' => 'Realex_Remote', 'payment_library_id' => 1],
|
||||||
['name' => 'Sisow', 'provider' => 'Sisow', 'payment_library_id' => 1],
|
['name' => 'Sisow', 'provider' => 'Sisow', 'payment_library_id' => 1],
|
||||||
['name' => 'Skrill', 'provider' => 'Skrill', 'payment_library_id' => 1]
|
['name' => 'Skrill', 'provider' => 'Skrill', 'payment_library_id' => 1],
|
||||||
|
['name' => 'BitPay', 'provider' => 'BitPay', 'payment_library_id' => 1],
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($gateways as $gateway)
|
foreach ($gateways as $gateway)
|
||||||
|
@ -586,5 +586,10 @@ return array(
|
|||||||
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -577,4 +577,11 @@ return array(
|
|||||||
'notification_quote_approved' => 'Der folgende Kunde :client nahm das Angebot :invoice über :amount an.',
|
'notification_quote_approved' => 'Der folgende Kunde :client nahm das Angebot :invoice über :amount an.',
|
||||||
'resend_confirmation' => 'Bestätigungsmail erneut senden',
|
'resend_confirmation' => 'Bestätigungsmail erneut senden',
|
||||||
'confirmation_resent' => 'Bestätigungsemail wurde erneut gesendet',
|
'confirmation_resent' => 'Bestätigungsemail wurde erneut gesendet',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -173,7 +173,7 @@ return array(
|
|||||||
'are_you_sure' => 'Are you sure?',
|
'are_you_sure' => 'Are you sure?',
|
||||||
|
|
||||||
// payment pages
|
// payment pages
|
||||||
'payment_type_id' => 'Payment type',
|
'payment_type_id' => 'Payment Type',
|
||||||
'amount' => 'Amount',
|
'amount' => 'Amount',
|
||||||
|
|
||||||
// account/company pages
|
// account/company pages
|
||||||
@ -187,7 +187,7 @@ return array(
|
|||||||
'remove_logo' => 'Remove logo',
|
'remove_logo' => 'Remove logo',
|
||||||
'logo_help' => 'Supported: JPEG, GIF and PNG. Recommended size: 200px width by 120px height',
|
'logo_help' => 'Supported: JPEG, GIF and PNG. Recommended size: 200px width by 120px height',
|
||||||
'payment_gateway' => 'Payment Gateway',
|
'payment_gateway' => 'Payment Gateway',
|
||||||
'gateway_id' => 'Provider',
|
'gateway_id' => 'Gateway',
|
||||||
'email_notifications' => 'Email Notifications',
|
'email_notifications' => 'Email Notifications',
|
||||||
'email_sent' => 'Email me when an invoice is <b>sent</b>',
|
'email_sent' => 'Email me when an invoice is <b>sent</b>',
|
||||||
'email_viewed' => 'Email me when an invoice is <b>viewed</b>',
|
'email_viewed' => 'Email me when an invoice is <b>viewed</b>',
|
||||||
@ -585,5 +585,9 @@ return array(
|
|||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -556,7 +556,12 @@ return array(
|
|||||||
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -580,5 +580,16 @@ return array(
|
|||||||
'Whoops, looks like something went wrong.' => 'Vaya, parece que algo salió mal',
|
'Whoops, looks like something went wrong.' => 'Vaya, parece que algo salió mal',
|
||||||
'Sorry, the page you are looking for could not be found.' => 'Lo sentimos, la página que está buscando no se pudo encontrar.',
|
'Sorry, the page you are looking for could not be found.' => 'Lo sentimos, la página que está buscando no se pudo encontrar.',
|
||||||
|
|
||||||
|
'email_approved' => 'Email me when a quote is <b>approved</b>',
|
||||||
|
'notification_quote_approved_subject' => 'Quote :invoice was approved by :client',
|
||||||
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -578,5 +578,10 @@ return array(
|
|||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -580,5 +580,10 @@ return array(
|
|||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -587,6 +587,11 @@ return array(
|
|||||||
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -586,5 +586,10 @@ return array(
|
|||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
@ -580,6 +580,11 @@ return array(
|
|||||||
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -580,6 +580,11 @@ return array(
|
|||||||
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -583,6 +583,11 @@ return array(
|
|||||||
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
'notification_quote_approved' => 'The following client :client approved Quote :invoice for :amount.',
|
||||||
'resend_confirmation' => 'Resend confirmation email',
|
'resend_confirmation' => 'Resend confirmation email',
|
||||||
'confirmation_resent' => 'The confirmation email was resent',
|
'confirmation_resent' => 'The confirmation email was resent',
|
||||||
|
|
||||||
|
'gateway_help_42' => 'Note: use a BitPay Legacy API Key, not an API token.',
|
||||||
|
'payment_type_credit_card' => 'Credit card',
|
||||||
|
'payment_type_paypal' => 'PayPal',
|
||||||
|
'payment_type_bitcoin' => 'Bitcoin',
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
{!! Former::legend($title) !!}
|
{!! Former::legend($title) !!}
|
||||||
|
|
||||||
@if ($accountGateway)
|
@if ($accountGateway)
|
||||||
|
{!! Former::populateField('payment_type_id', $paymentTypeId) !!}
|
||||||
{!! Former::populateField('gateway_id', $accountGateway->gateway_id) !!}
|
{!! Former::populateField('gateway_id', $accountGateway->gateway_id) !!}
|
||||||
{!! Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) !!}
|
{!! Former::populateField('recommendedGateway_id', $accountGateway->gateway_id) !!}
|
||||||
@if ($config)
|
@if ($config)
|
||||||
@foreach ($accountGateway->fields as $field => $junk)
|
@foreach ($accountGateway->fields as $field => $junk)
|
||||||
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
|
@if (in_array($field, ['solutionType', 'landingPage', 'headerImageUrl', 'brandName']))
|
||||||
@ -21,12 +22,17 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
{!! Former::select('payment_type_id')
|
||||||
{!! Former::select('gateway_id')->label('Select Gateway')->addOption('', '')
|
->options($paymentTypes)
|
||||||
|
->addGroupClass('payment-type-option')
|
||||||
|
->onchange('setPaymentType()') !!}
|
||||||
|
|
||||||
|
{!! Former::select('gateway_id')->addOption('', '')
|
||||||
->dataClass('gateway-dropdown')
|
->dataClass('gateway-dropdown')
|
||||||
->fromQuery($gateways, 'name', 'id')
|
->addGroupClass('gateway-option')
|
||||||
->onchange('setFieldsShown()'); !!}
|
->fromQuery($selectGateways, 'name', 'id')
|
||||||
|
->onchange('setFieldsShown()') !!}
|
||||||
|
|
||||||
@foreach ($gateways as $gateway)
|
@foreach ($gateways as $gateway)
|
||||||
|
|
||||||
@ -61,8 +67,11 @@
|
|||||||
|
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
{!! Former::checkboxes('creditCardTypes[]')->label('Accepted Credit Cards')
|
{!! Former::checkboxes('creditCardTypes[]')
|
||||||
->checkboxes($creditCardTypes)->class('creditcard-types')
|
->label('Accepted Credit Cards')
|
||||||
|
->checkboxes($creditCardTypes)
|
||||||
|
->class('creditcard-types')
|
||||||
|
->addGroupClass('gateway-option')
|
||||||
!!}
|
!!}
|
||||||
|
|
||||||
|
|
||||||
@ -76,8 +85,27 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
function setFieldsShown() {
|
function setPaymentType() {
|
||||||
var val = $('#gateway_id').val();
|
var val = $('#payment_type_id').val();
|
||||||
|
if (val == 'PAYMENT_TYPE_CREDIT_CARD') {
|
||||||
|
$('.gateway-option').show();
|
||||||
|
setFieldsShown();
|
||||||
|
} else {
|
||||||
|
$('.gateway-option').hide();
|
||||||
|
|
||||||
|
if (val == 'PAYMENT_TYPE_PAYPAL') {
|
||||||
|
setFieldsShown({{ GATEWAY_PAYPAL_EXPRESS }});
|
||||||
|
} else {
|
||||||
|
setFieldsShown({{ GATEWAY_BITPAY }});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setFieldsShown(val) {
|
||||||
|
if (!val) {
|
||||||
|
val = $('#gateway_id').val();
|
||||||
|
}
|
||||||
|
|
||||||
$('.gateway-fields').hide();
|
$('.gateway-fields').hide();
|
||||||
$('#gateway_' + val + '_div').show();
|
$('#gateway_' + val + '_div').show();
|
||||||
}
|
}
|
||||||
@ -89,6 +117,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
setPaymentType();
|
||||||
|
@if ($accountGateway)
|
||||||
|
$('.payment-type-option').hide();
|
||||||
|
@endif
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@stop
|
@stop
|
@ -16,20 +16,20 @@
|
|||||||
{!! Button::success(trans('texts.add_gateway'))
|
{!! Button::success(trans('texts.add_gateway'))
|
||||||
->asLinkTo('/gateways/create')
|
->asLinkTo('/gateways/create')
|
||||||
->withAttributes(['class' => 'pull-right'])
|
->withAttributes(['class' => 'pull-right'])
|
||||||
->appendIcon(Icon::create('plus-sign'))
|
->appendIcon(Icon::create('plus-sign')) !!}
|
||||||
->large() !!}
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{!! Datatable::table()
|
{!! Datatable::table()
|
||||||
->addColumn(
|
->addColumn(
|
||||||
trans('texts.name'),
|
trans('texts.name'),
|
||||||
|
trans('texts.payment_type_id'),
|
||||||
trans('texts.action'))
|
trans('texts.action'))
|
||||||
->setUrl(url('api/gateways/'))
|
->setUrl(url('api/gateways/'))
|
||||||
->setOptions('sPaginationType', 'bootstrap')
|
->setOptions('sPaginationType', 'bootstrap')
|
||||||
->setOptions('bFilter', false)
|
->setOptions('bFilter', false)
|
||||||
->setOptions('bAutoWidth', false)
|
->setOptions('bAutoWidth', false)
|
||||||
->setOptions('aoColumns', [[ "sWidth"=> "80%" ], ["sWidth"=> "20%"]])
|
->setOptions('aoColumns', [[ "sWidth"=> "50%" ], [ "sWidth"=> "30%" ], ["sWidth"=> "20%"]])
|
||||||
->setOptions('aoColumnDefs', [['bSortable'=>false, 'aTargets'=>[1]]])
|
->setOptions('aoColumnDefs', [['bSortable'=>false, 'aTargets'=>[2]]])
|
||||||
->render('datatable') !!}
|
->render('datatable') !!}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -28,19 +28,11 @@
|
|||||||
@endif
|
@endif
|
||||||
@elseif ($invoice->client->account->isGatewayConfigured() && !$invoice->isPaid() && !$invoice->is_recurring)
|
@elseif ($invoice->client->account->isGatewayConfigured() && !$invoice->isPaid() && !$invoice->is_recurring)
|
||||||
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
{!! Button::normal(trans('texts.download_pdf'))->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
||||||
@if ($hasToken)
|
@if (count($paymentTypes) > 1)
|
||||||
{!! DropdownButton::success_lg(trans('texts.pay_now'), [
|
{!! DropdownButton::success(trans('texts.pay_now'))->withContents($paymentTypes)->large() !!}
|
||||||
['url' => URL::to("payment/{$invitation->invitation_key}?use_token=true&use_paypal=false"), 'label' => trans('texts.use_card_on_file')],
|
|
||||||
['url' => URL::to("payment/{$invitation->invitation_key}?use_paypal=false"), 'label' => trans('texts.edit_payment_details')]
|
|
||||||
])->addClass('btn-lg') !!}
|
|
||||||
@elseif ($countGateways == 2)
|
|
||||||
{!! DropdownButton::success_lg(trans('texts.pay_now'), [
|
|
||||||
['url' => URL::to("payment/{$invitation->invitation_key}?use_paypal=true"), 'label' => trans('texts.pay_with_paypal')],
|
|
||||||
['url' => URL::to("payment/{$invitation->invitation_key}?use_paypal=false"), 'label' => trans('texts.pay_with_card')]
|
|
||||||
])->addClass('btn-lg') !!}
|
|
||||||
@else
|
@else
|
||||||
{!! Button::success(trans('texts.pay_now'))->asLinkTo('/payment/' . $invitation->invitation_key)->large() !!}
|
{!! Button::success(trans('texts.pay_now'))->asLinkTo('/payment/' . $invitation->invitation_key)->large() !!}
|
||||||
@endif
|
@endif
|
||||||
@else
|
@else
|
||||||
{!! Button::normal('Download PDF')->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
{!! Button::normal('Download PDF')->withAttributes(['onclick' => 'onDownloadClick()'])->large() !!}
|
||||||
@endif
|
@endif
|
||||||
|
@ -262,7 +262,7 @@ header h3 em {
|
|||||||
@if ($client && $account->showTokenCheckbox())
|
@if ($client && $account->showTokenCheckbox())
|
||||||
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
|
<input id="token_billing" type="checkbox" name="token_billing" {{ $account->selectTokenCheckbox() ? 'CHECKED' : '' }} value="1" style="margin-left:0px; vertical-align:top">
|
||||||
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
|
<label for="token_billing" class="checkbox" style="display: inline;">{{ trans('texts.token_billing') }}</label>
|
||||||
<span class="help-block" style="font-size:15px">{{ trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) }}</span>
|
<span class="help-block" style="font-size:15px">{!! trans('texts.token_billing_secure', ['stripe_link' => link_to('https://stripe.com/', 'Stripe.com', ['target' => '_blank'])]) !!}</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -192,15 +192,15 @@ table.table thead .sorting_desc_disabled:after { content: '' !important }
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@if (Session::has('warning'))
|
@if (Session::has('warning'))
|
||||||
<div class="alert alert-warning">{{ Session::get('warning') }}</div>
|
<div class="alert alert-warning">{!! Session::get('warning') !!}</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (Session::has('message'))
|
@if (Session::has('message'))
|
||||||
<div class="alert alert-info">{{ Session::get('message') }}</div>
|
<div class="alert alert-info">{!! Session::get('message') !!}</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (Session::has('error'))
|
@if (Session::has('error'))
|
||||||
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
<div class="alert alert-danger">{!! Session::get('error') !!}</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user