mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Rollback to 2.6.5
This commit is contained in:
parent
dc22611d2f
commit
498578cefc
2
.bowerrc
2
.bowerrc
@ -1,3 +1,3 @@
|
||||
{
|
||||
"directory": "resources/assets/bower"
|
||||
"directory": "./public/vendor"
|
||||
}
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,7 +8,6 @@
|
||||
/public/build
|
||||
/public/packages
|
||||
/public/vendor
|
||||
/resources/assets/bower
|
||||
/storage
|
||||
/bootstrap/compiled.php
|
||||
/bootstrap/environment.php
|
||||
|
@ -7,9 +7,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
### Changed
|
||||
- Auto billing uses credits if they exist
|
||||
- All assets (CSS, JS) are minfied now
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.6.4] - 2016-07-19
|
||||
|
@ -11,7 +11,7 @@ Thanks for your contributions!
|
||||
* Make your changes and commit
|
||||
* Check if your branch is still in sync with the repositorys **`develop`** branch
|
||||
* _Read:_ [Syncing a fork](https://help.github.com/articles/syncing-a-fork/)
|
||||
* _Also read:_ [How to rebase a pull request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request)
|
||||
* _Also read:_ [How to rebase a pull request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request)
|
||||
* Push your branch and create a PR against the Invoice Ninja **`develop`** branch
|
||||
* Update the [Changelog](CHANGELOG.md)
|
||||
|
||||
@ -21,7 +21,7 @@ To make the contribution process nice and easy for anyone, please follow some ru
|
||||
to give a more detailed explanation.
|
||||
* Only one feature/bugfix per issue. If you want to submit more, create multiple issues.
|
||||
* Only one feature/bugfix per PR(pull request). Split more changes into multiple PRs.
|
||||
|
||||
|
||||
#### Coding Style
|
||||
Try to follow the [PSR-2 guidlines](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
|
||||
|
||||
@ -29,7 +29,7 @@ _Example styling:_
|
||||
```php
|
||||
/**
|
||||
* Gets a preview of the email
|
||||
*
|
||||
*
|
||||
* @param TemplateService $templateService
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
|
187
Gruntfile.js
Normal file
187
Gruntfile.js
Normal file
@ -0,0 +1,187 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('package.json'),
|
||||
dump_dir: (function() {
|
||||
var out = {};
|
||||
|
||||
grunt.file.expand({ filter: 'isDirectory'}, 'public/fonts/invoice-fonts/*').forEach(function(path) {
|
||||
var fontName = /[^/]*$/.exec(path)[0],
|
||||
files = {},
|
||||
license='';
|
||||
|
||||
// Add license text
|
||||
grunt.file.expand({ filter: 'isFile'}, path+'/*.txt').forEach(function(path) {
|
||||
var licenseText = grunt.file.read(path);
|
||||
|
||||
// Fix anything that could escape from the comment
|
||||
licenseText = licenseText.replace(/\*\//g,'*\\/');
|
||||
|
||||
license += "/*\n"+licenseText+"\n*/";
|
||||
});
|
||||
|
||||
// Create files list
|
||||
files['public/js/vfs_fonts/'+fontName+'.js'] = [path+'/*.ttf'];
|
||||
|
||||
out[fontName] = {
|
||||
options: {
|
||||
pre: license+'window.ninjaFontVfs=window.ninjaFontVfs||{};window.ninjaFontVfs.'+fontName+'=',
|
||||
rootPath: path+'/'
|
||||
},
|
||||
files: files
|
||||
};
|
||||
});
|
||||
|
||||
// Return the computed object
|
||||
return out;
|
||||
}()),
|
||||
concat: {
|
||||
options: {
|
||||
process: function(src, filepath) {
|
||||
var basepath = filepath.substring(7, filepath.lastIndexOf('/') + 1);
|
||||
// Fix relative paths for css files
|
||||
if(filepath.indexOf('.css', filepath.length - 4) !== -1) {
|
||||
return src.replace(/(url\s*[\("']+)\s*([^'"\)]+)(['"\)]+;?)/gi, function(match, start, url, end, offset, string) {
|
||||
if(url.indexOf('data:') === 0) {
|
||||
// Skip data urls
|
||||
return match;
|
||||
|
||||
} else if(url.indexOf('/') === 0) {
|
||||
// Skip absolute urls
|
||||
return match;
|
||||
|
||||
} else {
|
||||
return start + basepath + url + end;
|
||||
}
|
||||
});
|
||||
|
||||
// Fix source maps locations
|
||||
} else if(filepath.indexOf('.js', filepath.length - 4) !== -1) {
|
||||
return src.replace(/(\/[*\/][#@]\s*sourceMappingURL=)([^\s]+)/gi, function(match, start, url, offset, string) {
|
||||
if(url.indexOf('/') === 0) {
|
||||
// Skip absolute urls
|
||||
return match;
|
||||
|
||||
} else {
|
||||
return start + basepath + url;
|
||||
}
|
||||
});
|
||||
|
||||
// Don't do anything for unknown file types
|
||||
} else {
|
||||
return src;
|
||||
}
|
||||
},
|
||||
},
|
||||
js: {
|
||||
src: [
|
||||
'public/vendor/jquery/dist/jquery.js',
|
||||
'public/vendor/jquery-ui/jquery-ui.min.js',
|
||||
'public/vendor/bootstrap/dist/js/bootstrap.min.js',
|
||||
'public/vendor/datatables/media/js/jquery.dataTables.js',
|
||||
'public/vendor/datatables-bootstrap3/BS3/assets/js/datatables.js',
|
||||
'public/vendor/knockout.js/knockout.js',
|
||||
'public/vendor/knockout-mapping/build/output/knockout.mapping-latest.js',
|
||||
'public/vendor/knockout-sortable/build/knockout-sortable.min.js',
|
||||
'public/vendor/underscore/underscore.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.de.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.da.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.pt-BR.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.nl.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.fr.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.it.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.lt.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.no.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.es.min.js',
|
||||
'public/vendor/bootstrap-datepicker/dist/locales/bootstrap-datepicker.sv.min.js',
|
||||
'public/vendor/dropzone/dist/min/dropzone.min.js',
|
||||
'public/vendor/typeahead.js/dist/typeahead.jquery.min.js',
|
||||
'public/vendor/accounting/accounting.min.js',
|
||||
'public/vendor/spectrum/spectrum.js',
|
||||
'public/vendor/jspdf/dist/jspdf.min.js',
|
||||
'public/vendor/moment/min/moment.min.js',
|
||||
'public/vendor/moment-timezone/builds/moment-timezone-with-data.min.js',
|
||||
'public/vendor/stacktrace-js/dist/stacktrace-with-polyfills.min.js',
|
||||
'public/vendor/fuse.js/src/fuse.min.js',
|
||||
//'public/vendor/moment-duration-format/lib/moment-duration-format.js',
|
||||
//'public/vendor/handsontable/dist/jquery.handsontable.full.min.js',
|
||||
//'public/vendor/pdfmake/build/pdfmake.min.js',
|
||||
//'public/vendor/pdfmake/build/vfs_fonts.js',
|
||||
//'public/js/vfs_fonts.js',
|
||||
'public/js/bootstrap-combobox.js',
|
||||
'public/js/script.js',
|
||||
'public/js/pdf.pdfmake.js',
|
||||
],
|
||||
dest: 'public/built.js',
|
||||
nonull: true
|
||||
},
|
||||
js_public: {
|
||||
src: [
|
||||
/*
|
||||
'public/js/simpleexpand.js',
|
||||
'public/js/valign.js',
|
||||
'public/js/bootstrap.min.js',
|
||||
'public/js/simpleexpand.js',
|
||||
*/
|
||||
'public/vendor/bootstrap/dist/js/bootstrap.min.js',
|
||||
'public/js/bootstrap-combobox.js',
|
||||
|
||||
],
|
||||
dest: 'public/built.public.js',
|
||||
nonull: true
|
||||
},
|
||||
css: {
|
||||
src: [
|
||||
'public/vendor/bootstrap/dist/css/bootstrap.min.css',
|
||||
'public/vendor/datatables/media/css/jquery.dataTables.css',
|
||||
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
|
||||
'public/vendor/font-awesome/css/font-awesome.min.css',
|
||||
'public/vendor/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css',
|
||||
'public/vendor/dropzone/dist/min/dropzone.min.css',
|
||||
'public/vendor/spectrum/spectrum.css',
|
||||
'public/css/bootstrap-combobox.css',
|
||||
'public/css/typeahead.js-bootstrap.css',
|
||||
//'public/vendor/handsontable/dist/jquery.handsontable.full.css',
|
||||
'public/css/style.css',
|
||||
],
|
||||
dest: 'public/css/built.css',
|
||||
nonull: true,
|
||||
options: {
|
||||
process: false
|
||||
}
|
||||
},
|
||||
css_public: {
|
||||
src: [
|
||||
'public/vendor/bootstrap/dist/css/bootstrap.min.css',
|
||||
'public/vendor/font-awesome/css/font-awesome.min.css',
|
||||
'public/css/bootstrap-combobox.css',
|
||||
'public/vendor/datatables/media/css/jquery.dataTables.css',
|
||||
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
|
||||
'public/css/public.style.css',
|
||||
],
|
||||
dest: 'public/css/built.public.css',
|
||||
nonull: true,
|
||||
options: {
|
||||
process: false
|
||||
}
|
||||
},
|
||||
js_pdf: {
|
||||
src: [
|
||||
'public/js/pdf_viewer.js',
|
||||
'public/js/compatibility.js',
|
||||
'public/js/pdfmake.min.js',
|
||||
'public/js/vfs.js',
|
||||
],
|
||||
dest: 'public/pdf.built.js',
|
||||
nonull: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-dump-dir');
|
||||
|
||||
grunt.registerTask('default', ['dump_dir', 'concat']);
|
||||
|
||||
};
|
@ -74,4 +74,4 @@ For information on how contribute to Invoice Ninja, please see our [contributing
|
||||
|
||||
## License
|
||||
Invoice Ninja is released under the Attribution Assurance License.
|
||||
See [LICENSE](LICENSE) for details.
|
||||
See [LICENSE](LICENSE) for details.
|
@ -1,10 +1,5 @@
|
||||
<?php
|
||||
<?php namespace App\Commands;
|
||||
|
||||
namespace App\Commands;
|
||||
|
||||
/**
|
||||
* Class Command
|
||||
*/
|
||||
abstract class Command
|
||||
{
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Ninja\Mailers\ContactMailer as Mailer;
|
||||
@ -41,7 +39,6 @@ class ChargeRenewalInvoices extends Command
|
||||
|
||||
/**
|
||||
* ChargeRenewalInvoices constructor.
|
||||
*
|
||||
* @param Mailer $mailer
|
||||
* @param AccountRepository $repo
|
||||
* @param PaymentService $paymentService
|
||||
@ -70,11 +67,8 @@ class ChargeRenewalInvoices extends Command
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
|
||||
// check if account has switched to free since the invoice was created
|
||||
// check if account has switched to free since the invoice was created
|
||||
$account = Account::find($invoice->client->public_id);
|
||||
if ( ! $account) {
|
||||
continue;
|
||||
}
|
||||
$company = $account->company;
|
||||
if ( ! $company->plan || $company->plan == PLAN_FREE) {
|
||||
continue;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use DB;
|
||||
use Carbon;
|
||||
@ -176,6 +174,7 @@ class CheckData extends Command {
|
||||
|
||||
foreach ($clients as $client) {
|
||||
$this->info("=== Client:{$client->id} Balance:{$client->balance} Actual Balance:{$client->actual_balance} ===");
|
||||
$foundProblem = false;
|
||||
$lastBalance = 0;
|
||||
$lastAdjustment = 0;
|
||||
$lastCreatedAt = null;
|
||||
@ -183,16 +182,8 @@ class CheckData extends Command {
|
||||
$activities = DB::table('activities')
|
||||
->where('client_id', '=', $client->id)
|
||||
->orderBy('activities.id')
|
||||
->get(
|
||||
[
|
||||
'activities.id',
|
||||
'activities.created_at',
|
||||
'activities.activity_type_id',
|
||||
'activities.adjustment',
|
||||
'activities.balance',
|
||||
'activities.invoice_id'
|
||||
]
|
||||
);
|
||||
->get(['activities.id', 'activities.created_at', 'activities.activity_type_id', 'activities.adjustment', 'activities.balance', 'activities.invoice_id']);
|
||||
//$this->info(var_dump($activities));
|
||||
|
||||
foreach ($activities as $activity) {
|
||||
|
||||
@ -240,11 +231,13 @@ class CheckData extends Command {
|
||||
// **Fix for allowing converting a recurring invoice to a normal one without updating the balance**
|
||||
if ($noAdjustment && $invoice->invoice_type_id == INVOICE_TYPE_STANDARD && !$invoice->is_recurring) {
|
||||
$this->info("No adjustment for new invoice:{$activity->invoice_id} amount:{$invoice->amount} invoiceTypeId:{$invoice->invoice_type_id} isRecurring:{$invoice->is_recurring}");
|
||||
$foundProblem = true;
|
||||
$clientFix += $invoice->amount;
|
||||
$activityFix = $invoice->amount;
|
||||
// **Fix for updating balance when creating a quote or recurring invoice**
|
||||
} elseif ($activity->adjustment != 0 && ($invoice->invoice_type_id == INVOICE_TYPE_QUOTE || $invoice->is_recurring)) {
|
||||
$this->info("Incorrect adjustment for new invoice:{$activity->invoice_id} adjustment:{$activity->adjustment} invoiceTypeId:{$invoice->invoice_type_id} isRecurring:{$invoice->is_recurring}");
|
||||
$foundProblem = true;
|
||||
$clientFix -= $activity->adjustment;
|
||||
$activityFix = 0;
|
||||
}
|
||||
@ -252,6 +245,7 @@ class CheckData extends Command {
|
||||
// **Fix for updating balance when deleting a recurring invoice**
|
||||
if ($activity->adjustment != 0 && $invoice->is_recurring) {
|
||||
$this->info("Incorrect adjustment for deleted invoice adjustment:{$activity->adjustment}");
|
||||
$foundProblem = true;
|
||||
if ($activity->balance != $lastBalance) {
|
||||
$clientFix -= $activity->adjustment;
|
||||
}
|
||||
@ -261,6 +255,7 @@ class CheckData extends Command {
|
||||
// **Fix for updating balance when archiving an invoice**
|
||||
if ($activity->adjustment != 0 && !$invoice->is_recurring) {
|
||||
$this->info("Incorrect adjustment for archiving invoice adjustment:{$activity->adjustment}");
|
||||
$foundProblem = true;
|
||||
$activityFix = 0;
|
||||
$clientFix += $activity->adjustment;
|
||||
}
|
||||
@ -268,10 +263,12 @@ class CheckData extends Command {
|
||||
// **Fix for updating balance when updating recurring invoice**
|
||||
if ($activity->adjustment != 0 && $invoice->is_recurring) {
|
||||
$this->info("Incorrect adjustment for updated recurring invoice adjustment:{$activity->adjustment}");
|
||||
$foundProblem = true;
|
||||
$clientFix -= $activity->adjustment;
|
||||
$activityFix = 0;
|
||||
} else if ((strtotime($activity->created_at) - strtotime($lastCreatedAt) <= 1) && $activity->adjustment > 0 && $activity->adjustment == $lastAdjustment) {
|
||||
$this->info("Duplicate adjustment for updated invoice adjustment:{$activity->adjustment}");
|
||||
$foundProblem = true;
|
||||
$clientFix -= $activity->adjustment;
|
||||
$activityFix = 0;
|
||||
}
|
||||
@ -279,6 +276,7 @@ class CheckData extends Command {
|
||||
// **Fix for updating balance when updating a quote**
|
||||
if ($activity->balance != $lastBalance) {
|
||||
$this->info("Incorrect adjustment for updated quote adjustment:{$activity->adjustment}");
|
||||
$foundProblem = true;
|
||||
$clientFix += $lastBalance - $activity->balance;
|
||||
$activityFix = 0;
|
||||
}
|
||||
@ -286,6 +284,7 @@ class CheckData extends Command {
|
||||
// **Fix for deleting payment after deleting invoice**
|
||||
if ($activity->adjustment != 0 && $invoice->is_deleted && $activity->created_at > $invoice->deleted_at) {
|
||||
$this->info("Incorrect adjustment for deleted payment adjustment:{$activity->adjustment}");
|
||||
$foundProblem = true;
|
||||
$activityFix = 0;
|
||||
$clientFix -= $activity->adjustment;
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
<?php
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Vendor;
|
||||
use Auth;
|
||||
use Utils;
|
||||
use Illuminate\Console\Command;
|
||||
@ -35,7 +32,6 @@ class CreateTestData extends Command
|
||||
|
||||
/**
|
||||
* CreateTestData constructor.
|
||||
*
|
||||
* @param ClientRepository $clientRepo
|
||||
* @param InvoiceRepository $invoiceRepo
|
||||
* @param PaymentRepository $paymentRepo
|
||||
@ -130,9 +126,9 @@ class CreateTestData extends Command
|
||||
|
||||
/**
|
||||
* @param $client
|
||||
* @param Invoice $invoice
|
||||
* @param $invoice
|
||||
*/
|
||||
private function createPayment($client, Invoice $invoice)
|
||||
private function createPayment($client, $invoice)
|
||||
{
|
||||
$data = [
|
||||
'invoice_id' => $invoice->id,
|
||||
@ -171,9 +167,9 @@ class CreateTestData extends Command
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Vendor $vendor
|
||||
* @param $vendor
|
||||
*/
|
||||
private function createExpense(Vendor $vendor)
|
||||
private function createExpense($vendor)
|
||||
{
|
||||
for ($i=0; $i<$this->count; $i++) {
|
||||
$data = [
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use File;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace InvoiceNinja\Console\Commands;
|
||||
<?php namespace InvoiceNinja\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
@ -8,30 +6,30 @@ use Illuminate\Foundation\Inspiring;
|
||||
/**
|
||||
* Class Inspire
|
||||
*/
|
||||
class Inspire extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'inspire';
|
||||
class Inspire extends Command {
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'inspire';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL . Inspiring::quote() . PHP_EOL);
|
||||
}
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Display an inspiring quote';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use DB;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use DateTime;
|
||||
use App\Models\Document;
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Utils;
|
||||
use Illuminate\Console\Command;
|
||||
@ -10,6 +9,7 @@ use Illuminate\Console\Command;
|
||||
*/
|
||||
class ResetData extends Command
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use Utils;
|
||||
use Illuminate\Console\Command;
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
<?php namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Services\BankAccountService;
|
||||
|
@ -15,7 +15,6 @@ class Kernel extends ConsoleKernel
|
||||
'App\Console\Commands\SendRecurringInvoices',
|
||||
'App\Console\Commands\RemoveOrphanedDocuments',
|
||||
'App\Console\Commands\ResetData',
|
||||
'App\Console\Commands\ResetInvoiceSchemaCounter',
|
||||
'App\Console\Commands\CheckData',
|
||||
'App\Console\Commands\PruneData',
|
||||
'App\Console\Commands\CreateTestData',
|
||||
@ -53,10 +52,5 @@ class Kernel extends ConsoleKernel
|
||||
->sendOutputTo($logFile)
|
||||
->daily();
|
||||
}
|
||||
|
||||
// Reset the invoice schema counter at the turn of the year
|
||||
$schedule
|
||||
->command('ninja:reset-invoice-schema-counter')
|
||||
->daily();
|
||||
}
|
||||
}
|
||||
|
@ -16,17 +16,17 @@ use Illuminate\Validation\ValidationException;
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [
|
||||
AuthorizationException::class,
|
||||
HttpException::class,
|
||||
ModelNotFoundException::class,
|
||||
ValidationException::class,
|
||||
];
|
||||
];
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
@ -36,14 +36,14 @@ class Handler extends ExceptionHandler
|
||||
* @param \Exception $e
|
||||
* @return bool|void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
public function report(Exception $e)
|
||||
{
|
||||
// don't show these errors in the logs
|
||||
if ($e instanceof HttpResponseException) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Utils::isNinja() && !Utils::isTravis()) {
|
||||
|
||||
if (Utils::isNinja() && ! Utils::isTravis()) {
|
||||
Utils::logError(Utils::getErrorString($e));
|
||||
return false;
|
||||
} else {
|
||||
@ -51,16 +51,15 @@ class Handler extends ExceptionHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
if ($e instanceof ModelNotFoundException) {
|
||||
return Redirect::to('/');
|
||||
} elseif ($e instanceof \Illuminate\Session\TokenMismatchException) {
|
||||
@ -68,27 +67,26 @@ class Handler extends ExceptionHandler
|
||||
if ($request->path() != 'get_started') {
|
||||
// https://gist.github.com/jrmadsen67/bd0f9ad0ef1ed6bb594e
|
||||
return redirect()
|
||||
->back()
|
||||
->withInput($request->except('password', '_token'))
|
||||
->with([
|
||||
'warning' => trans('texts.token_expired')
|
||||
]);
|
||||
->back()
|
||||
->withInput($request->except('password', '_token'))
|
||||
->with([
|
||||
'warning' => trans('texts.token_expired')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// In production, except for maintenance mode, we'll show a custom error screen
|
||||
if (Utils::isNinjaProd()
|
||||
&& !Utils::isDownForMaintenance()
|
||||
&& !($e instanceof HttpResponseException)
|
||||
) {
|
||||
&& !($e instanceof HttpResponseException)) {
|
||||
$data = [
|
||||
'error' => get_class($e),
|
||||
'hideHeader' => true,
|
||||
];
|
||||
|
||||
|
||||
return response()->view('error', $data);
|
||||
} else {
|
||||
return parent::render($request, $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +1,51 @@
|
||||
<?php
|
||||
<?php namespace App\Handlers;
|
||||
|
||||
namespace App\Handlers;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Ninja\Mailers\UserMailer;
|
||||
use App\Ninja\Mailers\ContactMailer;
|
||||
|
||||
class InvoiceEventHandler
|
||||
{
|
||||
/**
|
||||
* @var UserMailer
|
||||
*/
|
||||
protected $userMailer;
|
||||
protected $userMailer;
|
||||
protected $contactMailer;
|
||||
|
||||
/**
|
||||
* @var ContactMailer
|
||||
*/
|
||||
protected $contactMailer;
|
||||
public function __construct(UserMailer $userMailer, ContactMailer $contactMailer)
|
||||
{
|
||||
$this->userMailer = $userMailer;
|
||||
$this->contactMailer = $contactMailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* InvoiceEventHandler constructor.
|
||||
*
|
||||
* @param UserMailer $userMailer
|
||||
* @param ContactMailer $contactMailer
|
||||
*/
|
||||
public function __construct(UserMailer $userMailer, ContactMailer $contactMailer)
|
||||
{
|
||||
$this->userMailer = $userMailer;
|
||||
$this->contactMailer = $contactMailer;
|
||||
}
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen('invoice.sent', 'InvoiceEventHandler@onSent');
|
||||
$events->listen('invoice.viewed', 'InvoiceEventHandler@onViewed');
|
||||
$events->listen('invoice.paid', 'InvoiceEventHandler@onPaid');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $events
|
||||
*/
|
||||
public function subscribe($events)
|
||||
{
|
||||
$events->listen('invoice.sent', 'InvoiceEventHandler@onSent');
|
||||
$events->listen('invoice.viewed', 'InvoiceEventHandler@onViewed');
|
||||
$events->listen('invoice.paid', 'InvoiceEventHandler@onPaid');
|
||||
}
|
||||
public function onSent($invoice)
|
||||
{
|
||||
$this->sendNotifications($invoice, 'sent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
*/
|
||||
public function onSent(Invoice $invoice)
|
||||
{
|
||||
$this->sendNotifications($invoice, 'sent');
|
||||
}
|
||||
public function onViewed($invoice)
|
||||
{
|
||||
$this->sendNotifications($invoice, 'viewed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
*/
|
||||
public function onViewed(Invoice $invoice)
|
||||
{
|
||||
$this->sendNotifications($invoice, 'viewed');
|
||||
}
|
||||
public function onPaid($payment)
|
||||
{
|
||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
*/
|
||||
public function onPaid(Payment $payment)
|
||||
{
|
||||
$this->contactMailer->sendPaymentConfirmation($payment);
|
||||
$this->sendNotifications($payment->invoice, 'paid', $payment);
|
||||
}
|
||||
|
||||
$this->sendNotifications($payment->invoice, 'paid', $payment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Invoice $invoice
|
||||
* @param $type
|
||||
* @param null $payment
|
||||
*/
|
||||
private function sendNotifications(Invoice $invoice, $type, $payment = null)
|
||||
{
|
||||
foreach ($invoice->account->users as $user) {
|
||||
if ($user->{'notify_' . $type}) {
|
||||
private function sendNotifications($invoice, $type, $payment = null)
|
||||
{
|
||||
foreach ($invoice->account->users as $user)
|
||||
{
|
||||
if ($user->{'notify_' . $type})
|
||||
{
|
||||
$this->userMailer->sendNotification($user, $invoice, $type, $payment);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1461,6 +1461,7 @@ class AccountController extends BaseController
|
||||
return trans('texts.create_invoice_for_sample');
|
||||
}
|
||||
|
||||
/** @var \App\Models\Account $account */
|
||||
$account = Auth::user()->account;
|
||||
$invitation = $invoice->invitations->first();
|
||||
|
||||
|
@ -62,7 +62,7 @@ class CreditController extends BaseController
|
||||
'method' => 'POST',
|
||||
'url' => 'credits',
|
||||
'title' => trans('texts.new_credit'),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('credits.edit', $data);
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?php namespace App\Http\Controllers;
|
||||
|
||||
use Utils;
|
||||
use Redirect;
|
||||
use View;
|
||||
use Response;
|
||||
@ -96,10 +95,6 @@ class DocumentController extends BaseController
|
||||
|
||||
public function postUpload(CreateDocumentRequest $request)
|
||||
{
|
||||
if (!Utils::hasFeature(FEATURE_DOCUMENTS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = $this->documentRepo->upload($request->all(), $doc_array);
|
||||
|
||||
if(is_string($result)){
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -56,4 +56,4 @@ class AnalyticsListener
|
||||
curl_setopt_array($curl, $opts);
|
||||
curl_close($curl);
|
||||
}
|
||||
}
|
||||
}
|
@ -49,13 +49,6 @@ class Client extends EntityModel
|
||||
'website',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $appends = [
|
||||
'display_name',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -338,17 +331,6 @@ class Client extends EntityModel
|
||||
return $contact->getDisplayName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Making the virtual property display_name accessible
|
||||
* via an accessor
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getDisplayNameAttribute()
|
||||
{
|
||||
return $this->getDisplayName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
@ -140,9 +140,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
*/
|
||||
public function getDisplayName()
|
||||
{
|
||||
return $this->is_recurring
|
||||
? trans('texts.recurring')
|
||||
: $this->invoice_number.' ('.$this->client->display_name.')';
|
||||
return $this->is_recurring ? trans('texts.recurring') : $this->invoice_number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,20 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use URL;
|
||||
use App\Models\AccountGateway;
|
||||
|
||||
/**
|
||||
* Class AccountGatewayDatatable
|
||||
*/
|
||||
class AccountGatewayDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_ACCOUNT_GATEWAY;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -56,9 +48,6 @@ class AccountGatewayDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
|
@ -1,19 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
|
||||
/**
|
||||
* Class ActivityDatatable
|
||||
*/
|
||||
class ActivityDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_ACTIVITY;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
|
@ -1,19 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* Class BankAccountDatatable
|
||||
*/
|
||||
class BankAccountDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_BANK_ACCOUNT;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -25,16 +17,13 @@ class BankAccountDatatable extends EntityDatatable
|
||||
],
|
||||
[
|
||||
'bank_library_id',
|
||||
function () {
|
||||
function ($model) {
|
||||
return 'OFX';
|
||||
}
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -46,4 +35,6 @@ class BankAccountDatatable extends EntityDatatable
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class ClientDatatable
|
||||
*/
|
||||
class ClientDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_CLIENT;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -58,9 +50,6 @@ class ClientDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -85,7 +74,7 @@ class ClientDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("tasks/create/{$model->public_id}");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_TASK);
|
||||
}
|
||||
],
|
||||
@ -94,7 +83,7 @@ class ClientDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("invoices/create/{$model->public_id}");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_INVOICE);
|
||||
}
|
||||
],
|
||||
@ -103,13 +92,13 @@ class ClientDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("quotes/create/{$model->public_id}");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->hasFeature(FEATURE_QUOTES) && Auth::user()->can('create', ENTITY_INVOICE);
|
||||
}
|
||||
],
|
||||
[
|
||||
'--divider--', function(){return false;},
|
||||
function () {
|
||||
function ($model) {
|
||||
$user = Auth::user();
|
||||
return ($user->can('create', ENTITY_TASK) || $user->can('create', ENTITY_INVOICE)) && ($user->can('create', ENTITY_PAYMENT) || $user->can('create', ENTITY_CREDIT) || $user->can('create', ENTITY_EXPENSE));
|
||||
}
|
||||
@ -119,7 +108,7 @@ class ClientDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("payments/create/{$model->public_id}");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_PAYMENT);
|
||||
}
|
||||
],
|
||||
@ -128,7 +117,7 @@ class ClientDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("credits/create/{$model->public_id}");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_CREDIT);
|
||||
}
|
||||
],
|
||||
@ -137,7 +126,7 @@ class ClientDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("expenses/create/0/{$model->public_id}");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_EXPENSE);
|
||||
}
|
||||
]
|
||||
|
@ -1,21 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class CreditDatatable
|
||||
*/
|
||||
class CreditDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_CREDIT;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -57,9 +49,6 @@ class CreditDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -68,7 +57,7 @@ class CreditDatatable extends EntityDatatable
|
||||
function ($model) {
|
||||
return URL::to("payments/create/{$model->client_public_id}") . '?paymentTypeId=1';
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_PAYMENT);
|
||||
}
|
||||
]
|
||||
|
@ -1,47 +1,22 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
|
||||
/**
|
||||
* Class EntityDatatable
|
||||
*/
|
||||
class EntityDatatable
|
||||
{
|
||||
public $entityType;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $isBulkEdit;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $hideClient;
|
||||
|
||||
/**
|
||||
* EntityDatatable constructor.
|
||||
*
|
||||
* @param bool $isBulkEdit
|
||||
* @param bool $hideClient
|
||||
*/
|
||||
public function __construct($isBulkEdit = true, $hideClient = false)
|
||||
{
|
||||
$this->isBulkEdit = $isBulkEdit;
|
||||
$this->hideClient = $hideClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [];
|
||||
|
@ -1,20 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class ExpenseCategoryDatatable
|
||||
*/
|
||||
class ExpenseCategoryDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_EXPENSE_CATEGORY;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -32,9 +25,6 @@ class ExpenseCategoryDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
|
@ -1,21 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class ExpenseDatatable
|
||||
*/
|
||||
class ExpenseDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_EXPENSE;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -95,9 +87,6 @@ class ExpenseDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -131,13 +120,7 @@ class ExpenseDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $invoiceId
|
||||
* @param $shouldBeInvoiced
|
||||
* @param $balance
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
private function getStatusLabel($invoiceId, $shouldBeInvoiced, $balance)
|
||||
{
|
||||
if ($invoiceId) {
|
||||
@ -158,4 +141,5 @@ class ExpenseDatatable extends EntityDatatable
|
||||
|
||||
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class InvoiceDatatable
|
||||
*/
|
||||
class InvoiceDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_INVOICE;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
$entityType = $this->entityType;
|
||||
@ -80,9 +72,6 @@ class InvoiceDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
$entityType = $this->entityType;
|
||||
@ -102,7 +91,7 @@ class InvoiceDatatable extends EntityDatatable
|
||||
function ($model) use ($entityType) {
|
||||
return URL::to("{$entityType}s/{$model->public_id}/clone");
|
||||
},
|
||||
function () {
|
||||
function ($model) {
|
||||
return Auth::user()->can('create', ENTITY_INVOICE);
|
||||
}
|
||||
],
|
||||
@ -166,11 +155,6 @@ class InvoiceDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getStatusLabel($model)
|
||||
{
|
||||
$entityType = $this->entityType;
|
||||
@ -205,4 +189,5 @@ class InvoiceDatatable extends EntityDatatable
|
||||
|
||||
return "<h4><div class=\"label label-{$class}\">$label</div></h4>";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,32 +1,20 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
|
||||
use App\Models\Payment;
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Class PaymentDatatable
|
||||
*/
|
||||
class PaymentDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_PAYMENT;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $refundableGateways = [
|
||||
GATEWAY_STRIPE,
|
||||
GATEWAY_BRAINTREE,
|
||||
GATEWAY_WEPAY,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -113,9 +101,7 @@ class PaymentDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -148,12 +134,7 @@ class PaymentDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getStatusLabel(Payment $model)
|
||||
private function getStatusLabel($model)
|
||||
{
|
||||
$label = trans('texts.status_' . strtolower($model->payment_status_name));
|
||||
$class = 'default';
|
||||
|
@ -1,22 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
use Str;
|
||||
|
||||
/**
|
||||
* Class ProductDatatable
|
||||
*/
|
||||
class ProductDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_PRODUCT;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -48,9 +40,6 @@ class ProductDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -62,4 +51,5 @@ class ProductDatatable extends EntityDatatable
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,21 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceDatatable
|
||||
*/
|
||||
class RecurringInvoiceDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_RECURRING_INVOICE;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -55,9 +47,6 @@ class RecurringInvoiceDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -72,4 +61,5 @@ class RecurringInvoiceDatatable extends EntityDatatable
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
use App\Models\Task;
|
||||
|
||||
/**
|
||||
* Class TaskDatatable
|
||||
*/
|
||||
class TaskDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_TASK;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -58,9 +50,6 @@ class TaskDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -103,11 +92,6 @@ class TaskDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getStatusLabel($model)
|
||||
{
|
||||
if ($model->invoice_number) {
|
||||
|
@ -1,19 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* Class TaxRateDatatable
|
||||
*/
|
||||
class TaxRateDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_TAX_RATE;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -32,9 +24,6 @@ class TaxRateDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
|
@ -1,19 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* Class TokenDatatable
|
||||
*/
|
||||
class TokenDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_TOKEN;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -32,9 +24,6 @@ class TokenDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
|
@ -1,19 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use URL;
|
||||
|
||||
/**
|
||||
* Class UserDatatable
|
||||
*/
|
||||
class UserDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_USER;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -50,9 +42,6 @@ class UserDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -77,11 +66,6 @@ class UserDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $state
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getStatusLabel($state)
|
||||
{
|
||||
$label = trans("texts.{$state}");
|
||||
|
@ -1,21 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Datatables;
|
||||
<?php namespace App\Ninja\Datatables;
|
||||
|
||||
use Utils;
|
||||
use URL;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Class VendorDatatable
|
||||
*/
|
||||
class VendorDatatable extends EntityDatatable
|
||||
{
|
||||
public $entityType = ENTITY_VENDOR;
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function columns()
|
||||
{
|
||||
return [
|
||||
@ -52,9 +44,6 @@ class VendorDatatable extends EntityDatatable
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
@ -85,4 +74,6 @@ class VendorDatatable extends EntityDatatable
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Mailers;
|
||||
<?php namespace App\Ninja\Mailers;
|
||||
|
||||
use App\Models\Invitation;
|
||||
use Utils;
|
||||
use Event;
|
||||
use Auth;
|
||||
use App\Services\TemplateService;
|
||||
use App\Models\Invoice;
|
||||
|
@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Mailers;
|
||||
<?php namespace App\Ninja\Mailers;
|
||||
|
||||
use Exception;
|
||||
use Mail;
|
||||
use App\Models\Invoice;
|
||||
|
||||
/**
|
||||
* Class Mailer
|
||||
@ -97,7 +96,6 @@ class Mailer
|
||||
|
||||
/**
|
||||
* @param $exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function handleFailure($exception)
|
||||
|
@ -1,15 +1,11 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\Mailers;
|
||||
|
||||
namespace App\Ninja\Mailers;
|
||||
|
||||
use App\Models\Invitation;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Class UserMailer
|
||||
*/
|
||||
class UserMailer extends Mailer
|
||||
{
|
||||
/**
|
||||
|
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class AuthorizeNetAIMPaymentDriver
|
||||
*/
|
||||
class AuthorizeNetAIMPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam = 'refId';
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use App\Models\AccountGateway;
|
||||
use App\Models\Invitation;
|
||||
use URL;
|
||||
use Session;
|
||||
use Request;
|
||||
@ -17,59 +13,26 @@ use App\Models\Payment;
|
||||
use App\Models\PaymentMethod;
|
||||
use App\Models\Country;
|
||||
|
||||
/**
|
||||
* Class BasePaymentDriver
|
||||
*/
|
||||
class BasePaymentDriver
|
||||
{
|
||||
public $invitation;
|
||||
|
||||
/**
|
||||
* @var AccountGateway
|
||||
*/
|
||||
public $accountGateway;
|
||||
|
||||
protected $gatewayType;
|
||||
protected $gateway;
|
||||
protected $customer;
|
||||
protected $sourceId;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
protected $customerResponse;
|
||||
protected $tokenResponse;
|
||||
protected $purchaseResponse;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sourceReferenceParam = 'token';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $customerReferenceParam;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam;
|
||||
|
||||
/**
|
||||
* BasePaymentDriver constructor.
|
||||
*
|
||||
* @param AccountGateway $accountGateway
|
||||
* @param Invitation $invitation
|
||||
* @param bool $gatewayType
|
||||
*/
|
||||
public function __construct(
|
||||
AccountGateway $accountGateway = null,
|
||||
Invitation $invitation = null,
|
||||
$gatewayType = false
|
||||
)
|
||||
public function __construct($accountGateway = false, $invitation = false, $gatewayType = false)
|
||||
{
|
||||
$this->accountGateway = $accountGateway;
|
||||
$this->invitation = $invitation;
|
||||
@ -91,9 +54,6 @@ class BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
return [
|
||||
@ -106,74 +66,44 @@ class BasePaymentDriver
|
||||
return in_array($type, $this->gatewayTypes());
|
||||
}
|
||||
|
||||
/**
|
||||
* When set to true we won't pass the card details with the form
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
// when set to true we won't pass the card details with the form
|
||||
public function tokenize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set payment method as pending until confirmed
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
// set payment method as pending until confirmed
|
||||
public function isTwoStep()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function providerName()
|
||||
{
|
||||
return strtolower($this->accountGateway->gateway->provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function invoice()
|
||||
{
|
||||
return $this->invitation->invoice;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function contact()
|
||||
{
|
||||
return $this->invitation->contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function client()
|
||||
{
|
||||
return $this->invoice()->client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function account()
|
||||
{
|
||||
return $this->client()->account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
* @param bool $sourceId
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
* @throws Exception
|
||||
*/
|
||||
public function startPurchase(array $input = null, $sourceId = false)
|
||||
public function startPurchase($input = false, $sourceId = false)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->sourceId = $sourceId;
|
||||
@ -220,11 +150,7 @@ class BasePaymentDriver
|
||||
return view($this->paymentView(), $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom view exists for this provider
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
// check if a custom view exists for this provider
|
||||
protected function paymentView()
|
||||
{
|
||||
$file = sprintf('%s/views/payments/%s/%s.blade.php', resource_path(), $this->providerName(), $this->gatewayType);
|
||||
@ -236,11 +162,7 @@ class BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a custom partial exists for this provider
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
// check if a custom partial exists for this provider
|
||||
public function partialView()
|
||||
{
|
||||
$file = sprintf('%s/views/payments/%s/partial.blade.php', resource_path(), $this->providerName());
|
||||
@ -252,9 +174,6 @@ class BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = [];
|
||||
@ -290,9 +209,6 @@ class BasePaymentDriver
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function gateway()
|
||||
{
|
||||
if ($this->gateway) {
|
||||
@ -305,14 +221,7 @@ class BasePaymentDriver
|
||||
return $this->gateway;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $input
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return Payment|mixed|void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function completeOnsitePurchase($input = false, PaymentMethod $paymentMethod = null)
|
||||
public function completeOnsitePurchase($input = false, $paymentMethod = false)
|
||||
{
|
||||
$this->input = count($input) ? $input : false;
|
||||
$gateway = $this->gateway();
|
||||
@ -406,12 +315,7 @@ class BasePaymentDriver
|
||||
$client->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$invoice = $this->invoice();
|
||||
$completeUrl = url('complete/' . $this->invitation->invitation_key . '/' . $this->gatewayType);
|
||||
@ -441,13 +345,9 @@ class BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function paymentDetailsFromInput(array $input)
|
||||
private function paymentDetailsFromInput($input)
|
||||
{
|
||||
$invoice = $this->invoice();
|
||||
$client = $this->client();
|
||||
|
||||
$data = [
|
||||
@ -488,11 +388,9 @@ class BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function paymentDetailsFromClient()
|
||||
{
|
||||
$invoice = $this->invoice();
|
||||
$client = $this->client();
|
||||
$contact = $this->invitation->contact ?: $client->contacts()->first();
|
||||
|
||||
@ -518,9 +416,6 @@ class BasePaymentDriver
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldCreateToken()
|
||||
{
|
||||
if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER)) {
|
||||
@ -538,11 +433,19 @@ class BasePaymentDriver
|
||||
return boolval(array_get($this->input, 'token_billing'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $clientId
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
/*
|
||||
protected function tokenDetails()
|
||||
{
|
||||
$details = [];
|
||||
|
||||
if ($customer = $this->customer()) {
|
||||
$details['customerReference'] = $customer->token;
|
||||
}
|
||||
|
||||
return $details;
|
||||
}
|
||||
*/
|
||||
|
||||
public function customer($clientId = false)
|
||||
{
|
||||
if ($this->customer) {
|
||||
@ -564,51 +467,27 @@ class BasePaymentDriver
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkCustomerExists($customer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $client
|
||||
* @param $publicId
|
||||
* @param $amount1
|
||||
* @param $amount2
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function verifyBankAccount($client, $publicId, $amount1, $amount2)
|
||||
{
|
||||
throw new Exception('verifyBankAccount not implemented');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
* @throws Exception
|
||||
*/
|
||||
public function removePaymentMethod(PaymentMethod $paymentMethod)
|
||||
public function removePaymentMethod($paymentMethod)
|
||||
{
|
||||
$paymentMethod->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Some gateways (ie, Checkout.com and Braintree) require generating a token before paying for the invoice
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
// Some gateways (ie, Checkout.com and Braintree) require generating a token before paying for the invoice
|
||||
public function createTransactionToken()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PaymentMethod
|
||||
*/
|
||||
public function createToken()
|
||||
{
|
||||
$account = $this->account();
|
||||
@ -623,6 +502,17 @@ class BasePaymentDriver
|
||||
$customer->save();
|
||||
}
|
||||
|
||||
/*
|
||||
// archive the old payment method
|
||||
$paymentMethod = PaymentMethod::clientId($this->client()->id)
|
||||
->isBankAccount($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER))
|
||||
->first();
|
||||
|
||||
if ($paymentMethod) {
|
||||
$paymentMethod->delete();
|
||||
}
|
||||
*/
|
||||
|
||||
$paymentMethod = $this->createPaymentMethod($customer);
|
||||
|
||||
if ($paymentMethod && ! $customer->default_payment_method_id) {
|
||||
@ -633,24 +523,13 @@ class BasePaymentDriver
|
||||
return $paymentMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function creatingCustomer($customer)
|
||||
{
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return PaymentMethod
|
||||
*/
|
||||
public function createPaymentMethod($customer)
|
||||
{
|
||||
/** @var PaymentMethod $paymentMethod */
|
||||
$paymentMethod = PaymentMethod::createNew($this->invitation);
|
||||
$paymentMethod->contact_id = $this->contact()->id;
|
||||
$paymentMethod->ip = Request::ip();
|
||||
@ -665,12 +544,7 @@ class BasePaymentDriver
|
||||
return $paymentMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return PaymentMethod
|
||||
*/
|
||||
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
|
||||
protected function creatingPaymentMethod($paymentMethod)
|
||||
{
|
||||
return $paymentMethod;
|
||||
}
|
||||
@ -680,13 +554,7 @@ class BasePaymentDriver
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $ref
|
||||
* @param PaymentMethod|null $paymentMethod
|
||||
*
|
||||
* @return Payment|mixed
|
||||
*/
|
||||
public function createPayment($ref = false, PaymentMethod $paymentMethod = null)
|
||||
public function createPayment($ref = false, $paymentMethod = null)
|
||||
{
|
||||
$invitation = $this->invitation;
|
||||
$invoice = $this->invoice();
|
||||
@ -773,24 +641,12 @@ class BasePaymentDriver
|
||||
return $payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param $paymentMethod
|
||||
*
|
||||
* @return Payment
|
||||
*/
|
||||
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
|
||||
protected function creatingPayment($payment, $paymentMethod)
|
||||
{
|
||||
return $payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param int $amount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function refundPayment(Payment $payment, $amount = 0)
|
||||
public function refundPayment($payment, $amount = 0)
|
||||
{
|
||||
if ($amount) {
|
||||
$amount = min($amount, $payment->getCompletedAmount());
|
||||
@ -822,13 +678,7 @@ class BasePaymentDriver
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param $amount
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function refundDetails(Payment $payment, $amount)
|
||||
protected function refundDetails($payment, $amount)
|
||||
{
|
||||
return [
|
||||
'amount' => $amount,
|
||||
@ -836,14 +686,7 @@ class BasePaymentDriver
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $response
|
||||
* @param Payment $payment
|
||||
* @param $amount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function attemptVoidPayment($response, Payment $payment, $amount)
|
||||
protected function attemptVoidPayment($response, $payment, $amount)
|
||||
{
|
||||
// Partial refund not allowed for unsettled transactions
|
||||
return $amount == $payment->amount;
|
||||
@ -854,13 +697,7 @@ class BasePaymentDriver
|
||||
return $payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return bool|mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function completeOffsitePurchase(array $input)
|
||||
public function completeOffsitePurchase($input)
|
||||
{
|
||||
$this->input = $input;
|
||||
$ref = array_get($this->input, 'token') ?: $this->invitation->transaction_reference;
|
||||
@ -893,9 +730,6 @@ class BasePaymentDriver
|
||||
return $this->createPayment($ref);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function tokenLinks()
|
||||
{
|
||||
if ( ! $this->customer()) {
|
||||
@ -933,9 +767,6 @@ class BasePaymentDriver
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function paymentLinks()
|
||||
{
|
||||
$links = [];
|
||||
@ -954,11 +785,6 @@ class BasePaymentDriver
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $gatewayType
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function paymentUrl($gatewayType)
|
||||
{
|
||||
$account = $this->account();
|
||||
@ -976,11 +802,6 @@ class BasePaymentDriver
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cardName
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function parseCardType($cardName) {
|
||||
$cardTypes = [
|
||||
'visa' => PAYMENT_TYPE_VISA,
|
||||
@ -1013,11 +834,6 @@ class BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handleWebHook($input)
|
||||
{
|
||||
throw new Exception('Unsupported gateway');
|
||||
|
@ -1,19 +1,12 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class BitPayPaymentDriver
|
||||
*/
|
||||
class BitPayPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
return [
|
||||
GATEWAY_TYPE_BITCOIN
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,31 +1,14 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
use Exception;
|
||||
use Session;
|
||||
use Braintree\Customer;
|
||||
use App\Models\Payment;
|
||||
|
||||
/**
|
||||
* Class BraintreePaymentDriver
|
||||
*/
|
||||
class BraintreePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $customerReferenceParam = 'customerId';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sourceReferenceParam = 'paymentMethodToken';
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
$types = [
|
||||
@ -40,36 +23,30 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function tokenize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
* @param bool $sourceId
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||
*/
|
||||
public function startPurchase(array $input = null, $sourceId = false)
|
||||
public function startPurchase($input = false, $sourceId = false)
|
||||
{
|
||||
$data = parent::startPurchase($input, $sourceId);
|
||||
|
||||
if ($this->isGatewayType(GATEWAY_TYPE_PAYPAL)) {
|
||||
/*
|
||||
if ( ! $sourceId || empty($input['device_data'])) {
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
Session::put($this->invitation->id . 'device_data', $input['device_data']);
|
||||
*/
|
||||
|
||||
$data['details'] = ! empty($input['device_data']) ? json_decode($input['device_data']) : false;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkCustomerExists($customer)
|
||||
{
|
||||
if ( ! parent::checkCustomerExists($customer)) {
|
||||
@ -83,12 +60,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return ($customer instanceof Customer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$data = parent::paymentDetails($paymentMethod);
|
||||
|
||||
@ -109,9 +81,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PaymentMethod|bool
|
||||
*/
|
||||
public function createToken()
|
||||
{
|
||||
if ($customer = $this->customer()) {
|
||||
@ -144,9 +113,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return parent::createToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function customerData()
|
||||
{
|
||||
return [
|
||||
@ -159,11 +125,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function creatingCustomer($customer)
|
||||
{
|
||||
$customer->token = $this->tokenResponse->customerId;
|
||||
@ -171,12 +132,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return PaymentMethod|null
|
||||
*/
|
||||
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
|
||||
protected function creatingPaymentMethod($paymentMethod)
|
||||
{
|
||||
$response = $this->tokenResponse;
|
||||
|
||||
@ -196,13 +152,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return $paymentMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function removePaymentMethod(PaymentMethod $paymentMethod)
|
||||
public function removePaymentMethod($paymentMethod)
|
||||
{
|
||||
parent::removePaymentMethod($paymentMethod);
|
||||
|
||||
@ -217,14 +167,7 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $response
|
||||
* @param Payment $payment
|
||||
* @param $amount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function attemptVoidPayment($response, Payment $payment, $amount)
|
||||
protected function attemptVoidPayment($response, $payment, $amount)
|
||||
{
|
||||
if ( ! parent::attemptVoidPayment($response, $payment, $amount)) {
|
||||
return false;
|
||||
@ -242,9 +185,6 @@ class BraintreePaymentDriver extends BasePaymentDriver
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function createTransactionToken()
|
||||
{
|
||||
return $this->gateway()
|
||||
|
@ -1,17 +1,7 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Class CheckoutComPaymentDriver
|
||||
*/
|
||||
class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function createTransactionToken()
|
||||
{
|
||||
$response = $this->gateway()->purchase([
|
||||
@ -31,12 +21,7 @@ class CheckoutComPaymentDriver extends BasePaymentDriver
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$data = parent::paymentDetails();
|
||||
|
||||
|
@ -1,24 +1,10 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class CybersourcePaymentDriver
|
||||
*/
|
||||
class CybersourcePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam = 'transaction_uuid';
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
*
|
||||
* @return \App\Models\Payment|mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function completeOffsitePurchase(array $input)
|
||||
public function completeOffsitePurchase($input)
|
||||
{
|
||||
if ($input['decision'] == 'ACCEPT') {
|
||||
return $this->createPayment($input['bill_trans_ref_no']);
|
||||
|
@ -1,23 +1,12 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class DwollaPaymentDriver
|
||||
*/
|
||||
class DwollaPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
return [GATEWAY_TYPE_DWOLLA];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
protected function gateway()
|
||||
{
|
||||
$gateway = parent::gateway();
|
||||
|
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class EwayRapidSharedPaymentDriver
|
||||
*/
|
||||
class EwayRapidSharedPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam = 'AccessCode';
|
||||
}
|
||||
|
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class GoCardlessPaymentDriver
|
||||
*/
|
||||
class GoCardlessPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam = 'signature';
|
||||
}
|
||||
|
@ -1,18 +1,8 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class MolliePaymentDriver
|
||||
*/
|
||||
class MolliePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return \App\Models\Payment|mixed
|
||||
*/
|
||||
public function completeOffsitePurchase(array $input)
|
||||
public function completeOffsitePurchase($input)
|
||||
{
|
||||
$details = $this->paymentDetails();
|
||||
|
||||
|
@ -1,18 +1,10 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class PayFastPaymentDriver
|
||||
*/
|
||||
class PayFastPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam = 'm_payment_id';
|
||||
|
||||
public function completeOffsitePurchase(array $input)
|
||||
public function completeOffsitePurchase($input)
|
||||
{
|
||||
if ($accountGateway->isGateway(GATEWAY_PAYFAST) && Request::has('pt')) {
|
||||
$token = Request::query('pt');
|
||||
|
@ -1,18 +1,8 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Class PayPalExpressPaymentDriver
|
||||
*/
|
||||
class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
return [
|
||||
@ -20,12 +10,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$data = parent::paymentDetails();
|
||||
|
||||
@ -34,13 +19,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return Payment
|
||||
*/
|
||||
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
|
||||
protected function creatingPayment($payment, $paymentMethod)
|
||||
{
|
||||
$payment->payer_id = $this->input['PayerID'];
|
||||
|
||||
|
@ -1,17 +1,7 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Class PayPalProPaymentDriver
|
||||
*/
|
||||
class PayPalProPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
return [
|
||||
@ -19,12 +9,7 @@ class PayPalProPaymentDriver extends BasePaymentDriver
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$data = parent::paymentDetails();
|
||||
|
||||
|
@ -1,25 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use Exception;
|
||||
use Cache;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PaymentMethod;
|
||||
|
||||
/**
|
||||
* Class StripePaymentDriver
|
||||
*/
|
||||
class StripePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $customerReferenceParam = 'customerReference';
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
$types = [
|
||||
@ -34,17 +23,11 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function tokenize()
|
||||
{
|
||||
return $this->accountGateway->getPublishableStripeKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
@ -56,11 +39,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkCustomerExists($customer)
|
||||
{
|
||||
$response = $this->gateway()
|
||||
@ -85,20 +63,12 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isTwoStep()
|
||||
{
|
||||
return $this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER) && empty($this->input['plaidPublicToken']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$data = parent::paymentDetails($paymentMethod);
|
||||
|
||||
@ -123,10 +93,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PaymentMethod
|
||||
* @throws Exception
|
||||
*/
|
||||
public function createToken()
|
||||
{
|
||||
$invoice = $this->invitation->invoice;
|
||||
@ -160,11 +126,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function creatingCustomer($customer)
|
||||
{
|
||||
$customer->token = $this->tokenResponse['id'];
|
||||
@ -172,12 +133,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return PaymentMethod|bool
|
||||
*/
|
||||
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
|
||||
protected function creatingPaymentMethod($paymentMethod)
|
||||
{
|
||||
$data = $this->tokenResponse;
|
||||
|
||||
@ -219,30 +175,16 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return $paymentMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return Payment
|
||||
*/
|
||||
protected function creatingPayment(Payment $payment, PaymentMethod $paymentMethod)
|
||||
protected function creatingPayment($payment, $paymentMethod)
|
||||
{
|
||||
if ($this->isGatewayType(GATEWAY_TYPE_BANK_TRANSFER, $paymentMethod)) {
|
||||
$payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded'
|
||||
? PAYMENT_STATUS_COMPLETED
|
||||
: PAYMENT_STATUS_PENDING;
|
||||
$payment->payment_status_id = $this->purchaseResponse['status'] == 'succeeded' ? PAYMENT_STATUS_COMPLETED : PAYMENT_STATUS_PENDING;
|
||||
}
|
||||
|
||||
return $payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function removePaymentMethod(PaymentMethod $paymentMethod)
|
||||
public function removePaymentMethod($paymentMethod)
|
||||
{
|
||||
parent::removePaymentMethod($paymentMethod);
|
||||
|
||||
@ -262,13 +204,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $publicToken
|
||||
* @param $accountId
|
||||
*
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
private function getPlaidToken($publicToken, $accountId)
|
||||
{
|
||||
$clientId = $this->accountGateway->getPlaidClientId();
|
||||
@ -311,14 +246,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $client
|
||||
* @param $publicId
|
||||
* @param $amount1
|
||||
* @param $amount2
|
||||
*
|
||||
* @return bool|mixed|string
|
||||
*/
|
||||
public function verifyBankAccount($client, $publicId, $amount1, $amount2)
|
||||
{
|
||||
$customer = $this->customer($client->id);
|
||||
@ -349,13 +276,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $method
|
||||
* @param $url
|
||||
* @param null $body
|
||||
*
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function makeStripeCall($method, $url, $body = null)
|
||||
{
|
||||
$apiKey = $this->accountGateway->getConfig()->apiKey;
|
||||
@ -392,12 +312,6 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return array|string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function handleWebHook($input)
|
||||
{
|
||||
$eventId = array_get($input, 'id');
|
||||
|
@ -1,24 +1,11 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
/**
|
||||
* Class TwoCheckoutPaymentDriver
|
||||
*/
|
||||
class TwoCheckoutPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $transactionReferenceParam = 'cart_order_id';
|
||||
|
||||
/**
|
||||
* Calling completePurchase results in an 'invalid key' error
|
||||
*
|
||||
* @param array $input
|
||||
* @return \App\Models\Payment|mixed
|
||||
*/
|
||||
public function completeOffsitePurchase(array $input)
|
||||
// Calling completePurchase results in an 'invalid key' error
|
||||
public function completeOffsitePurchase($input)
|
||||
{
|
||||
return $this->createPayment($input['order_number']);
|
||||
}
|
||||
|
@ -1,21 +1,12 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
namespace App\Ninja\PaymentDrivers;
|
||||
|
||||
use App\Models\PaymentMethod;
|
||||
use Session;
|
||||
use Utils;
|
||||
use App\Models\Payment;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Class WePayPaymentDriver
|
||||
*/
|
||||
class WePayPaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function gatewayTypes()
|
||||
{
|
||||
$types = [
|
||||
@ -30,27 +21,16 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function tokenize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function checkCustomerExists($customer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = parent::rules();
|
||||
@ -65,12 +45,7 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function paymentDetails(PaymentMethod $paymentMethod = null)
|
||||
protected function paymentDetails($paymentMethod = false)
|
||||
{
|
||||
$data = parent::paymentDetails($paymentMethod);
|
||||
|
||||
@ -89,9 +64,6 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PaymentMethod
|
||||
*/
|
||||
public function createToken()
|
||||
{
|
||||
$wepay = Utils::setupWePay($this->accountGateway);
|
||||
@ -105,6 +77,22 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
'payment_bank_id' => $token,
|
||||
]);
|
||||
} else {
|
||||
// Authorize credit card
|
||||
$tokenResponse = $wepay->request('credit_card/authorize', [
|
||||
'client_id' => WEPAY_CLIENT_ID,
|
||||
'client_secret' => WEPAY_CLIENT_SECRET,
|
||||
'credit_card_id' => $token,
|
||||
]);
|
||||
|
||||
// Update the callback uri and get the card details
|
||||
$tokenResponse = $wepay->request('credit_card/modify', [
|
||||
'client_id' => WEPAY_CLIENT_ID,
|
||||
'client_secret' => WEPAY_CLIENT_SECRET,
|
||||
'credit_card_id' => $token,
|
||||
'auto_update' => WEPAY_AUTO_UPDATE,
|
||||
'callback_uri' => $this->accountGateway->getWebhookUrl(),
|
||||
]);
|
||||
|
||||
$this->tokenResponse = $wepay->request('credit_card', [
|
||||
'client_id' => WEPAY_CLIENT_ID,
|
||||
'client_secret' => WEPAY_CLIENT_SECRET,
|
||||
@ -115,12 +103,23 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
return parent::createToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return PaymentMethod
|
||||
*/
|
||||
protected function creatingPaymentMethod(PaymentMethod $paymentMethod)
|
||||
/*
|
||||
public function creatingCustomer($customer)
|
||||
{
|
||||
if ($gatewayResponse instanceof \Omnipay\WePay\Message\CustomCheckoutResponse) {
|
||||
$wepay = \Utils::setupWePay($accountGateway);
|
||||
$paymentMethodType = $gatewayResponse->getData()['payment_method']['type'];
|
||||
|
||||
$gatewayResponse = $wepay->request($paymentMethodType, array(
|
||||
'client_id' => WEPAY_CLIENT_ID,
|
||||
'client_secret' => WEPAY_CLIENT_SECRET,
|
||||
$paymentMethodType.'_id' => $gatewayResponse->getData()['payment_method'][$paymentMethodType]['id'],
|
||||
));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
protected function creatingPaymentMethod($paymentMethod)
|
||||
{
|
||||
$source = $this->tokenResponse;
|
||||
|
||||
@ -149,13 +148,7 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
return $paymentMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PaymentMethod $paymentMethod
|
||||
*
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function removePaymentMethod(PaymentMethod $paymentMethod)
|
||||
public function removePaymentMethod($paymentMethod)
|
||||
{
|
||||
parent::removePaymentMethod($paymentMethod);
|
||||
|
||||
@ -173,13 +166,7 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Payment $payment
|
||||
* @param $amount
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function refundDetails(Payment $payment, $amount)
|
||||
protected function refundDetails($payment, $amount)
|
||||
{
|
||||
$data = parent::refundDetails($payment, $amount);
|
||||
|
||||
@ -195,7 +182,7 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function attemptVoidPayment($response, Payment $payment, $amount)
|
||||
protected function attemptVoidPayment($response, $payment, $amount)
|
||||
{
|
||||
if ( ! parent::attemptVoidPayment($response, $payment, $amount)) {
|
||||
return false;
|
||||
@ -237,6 +224,8 @@ class WePayPaymentDriver extends BasePaymentDriver
|
||||
|
||||
if ($source->state == 'deleted') {
|
||||
$paymentMethod->delete();
|
||||
} else {
|
||||
//$this->paymentService->convertPaymentMethodFromWePay($source, null, $paymentMethod)->save();
|
||||
}
|
||||
|
||||
return 'Processed successfully';
|
||||
|
@ -1,27 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
|
||||
/**
|
||||
* Class AccountGatewayRepository
|
||||
*/
|
||||
class AccountGatewayRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\AccountGateway';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accountId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($accountId)
|
||||
{
|
||||
$query = DB::table('account_gateways')
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use Auth;
|
||||
use Request;
|
||||
@ -24,9 +22,6 @@ use App\Models\User;
|
||||
use App\Models\UserAccount;
|
||||
use App\Models\AccountToken;
|
||||
|
||||
/**
|
||||
* Class AccountRepository
|
||||
*/
|
||||
class AccountRepository
|
||||
{
|
||||
public function create($firstName = '', $lastName = '', $email = '', $password = '')
|
||||
@ -643,10 +638,7 @@ class AccountRepository
|
||||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*/
|
||||
public function unlinkAccount(Account $account) {
|
||||
public function unlinkAccount($account) {
|
||||
foreach ($account->users as $user) {
|
||||
if ($userAccount = self::findUserAccounts($user->id)) {
|
||||
$userAccount->removeUserId($user->id);
|
||||
@ -689,11 +681,7 @@ class AccountRepository
|
||||
return $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param $name
|
||||
*/
|
||||
public function createTokens(User $user, $name)
|
||||
public function createTokens($user, $name)
|
||||
{
|
||||
$name = trim($name) ?: 'TOKEN';
|
||||
$users = $this->findUsers($user);
|
||||
@ -710,12 +698,7 @@ class AccountRepository
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
public function getUserAccountId(Account $account)
|
||||
public function getUserAccountId($account)
|
||||
{
|
||||
$user = $account->users()->first();
|
||||
$userAccount = $this->findUserAccounts($user->id);
|
||||
@ -723,11 +706,7 @@ class AccountRepository
|
||||
return $userAccount ? $userAccount->id : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param Account $account
|
||||
*/
|
||||
public function save($data, Account $account)
|
||||
public function save($data, $account)
|
||||
{
|
||||
$account->fill($data);
|
||||
$account->save();
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Auth;
|
||||
@ -10,20 +8,8 @@ use App\Models\Activity;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invitation;
|
||||
|
||||
/**
|
||||
* Class ActivityRepository
|
||||
*/
|
||||
class ActivityRepository
|
||||
{
|
||||
/**
|
||||
* @param $entity
|
||||
* @param $activityTypeId
|
||||
* @param int $balanceChange
|
||||
* @param int $paidToDateChange
|
||||
* @param null $altEntity
|
||||
*
|
||||
* @return Activity|mixed
|
||||
*/
|
||||
public function create($entity, $activityTypeId, $balanceChange = 0, $paidToDateChange = 0, $altEntity = null)
|
||||
{
|
||||
if ($entity instanceof Client) {
|
||||
@ -57,11 +43,6 @@ class ActivityRepository
|
||||
return $activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $entity
|
||||
*
|
||||
* @return Activity
|
||||
*/
|
||||
private function getBlank($entity)
|
||||
{
|
||||
$activity = new Activity();
|
||||
@ -83,11 +64,6 @@ class ActivityRepository
|
||||
return $activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $clientId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function findByClientId($clientId)
|
||||
{
|
||||
return DB::table('activities')
|
||||
|
@ -1,30 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Crypt;
|
||||
use App\Models\BankAccount;
|
||||
use App\Models\BankSubaccount;
|
||||
|
||||
/**
|
||||
* Class BankAccountRepository
|
||||
*/
|
||||
class BankAccountRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\BankAccount';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accountId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($accountId)
|
||||
{
|
||||
return DB::table('bank_accounts')
|
||||
@ -39,11 +26,6 @@ class BankAccountRepository extends BaseRepository
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function save($input)
|
||||
{
|
||||
$bankAccount = BankAccount::createNew();
|
||||
|
@ -1,29 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Cache;
|
||||
use App\Models\Client;
|
||||
use App\Models\Contact;
|
||||
use App\Events\ClientWasCreated;
|
||||
use App\Events\ClientWasUpdated;
|
||||
|
||||
/**
|
||||
* Class ClientRepository
|
||||
*/
|
||||
class ClientRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Client';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return Client::scope()
|
||||
@ -33,12 +23,6 @@ class ClientRepository extends BaseRepository
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $filter
|
||||
* @param bool $userId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($filter = null, $userId = false)
|
||||
{
|
||||
$query = DB::table('clients')
|
||||
@ -84,13 +68,7 @@ class ClientRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param Client|null $client
|
||||
*
|
||||
* @return Client|mixed
|
||||
*/
|
||||
public function save($data, Client $client = null)
|
||||
public function save($data, $client = null)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
@ -117,6 +95,12 @@ class ClientRepository extends BaseRepository
|
||||
$client->fill($data);
|
||||
$client->save();
|
||||
|
||||
/*
|
||||
if ( ! isset($data['contact']) && ! isset($data['contacts'])) {
|
||||
return $client;
|
||||
}
|
||||
*/
|
||||
|
||||
$first = true;
|
||||
$contacts = isset($data['contact']) ? [$data['contact']] : $data['contacts'];
|
||||
$contactIds = [];
|
||||
|
@ -1,19 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use App\Models\Contact;
|
||||
|
||||
/**
|
||||
* Class ContactRepository
|
||||
*/
|
||||
class ContactRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @param $data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function save($data)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
@ -1,31 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Client;
|
||||
|
||||
/**
|
||||
* Class CreditRepository
|
||||
*/
|
||||
class CreditRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Credit';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $clientPublicId
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($clientPublicId = null, $filter = null)
|
||||
{
|
||||
$query = DB::table('credits')
|
||||
@ -72,13 +58,7 @@ class CreditRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $input
|
||||
* @param Credit|null $credit
|
||||
*
|
||||
* @return Credit|mixed
|
||||
*/
|
||||
public function save($input, Credit $credit = null)
|
||||
public function save($input, $credit = null)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
@ -8,22 +6,14 @@ use App\Models\Document;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Form;
|
||||
|
||||
/**
|
||||
* Class DocumentRepository
|
||||
*/
|
||||
class DocumentRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
// Expenses
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Document';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return Document::scope()
|
||||
@ -31,9 +21,6 @@ class DocumentRepository extends BaseRepository
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function find()
|
||||
{
|
||||
$accountid = \Auth::user()->account_id;
|
||||
@ -63,12 +50,6 @@ class DocumentRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param null $doc_array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function upload($data, &$doc_array=null)
|
||||
{
|
||||
$uploaded = $data['file'];
|
||||
@ -196,14 +177,6 @@ class DocumentRepository extends BaseRepository
|
||||
return $document;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $contactId
|
||||
* @param $entityType
|
||||
* @param $search
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getClientDatatable($contactId, $entityType, $search)
|
||||
{
|
||||
|
||||
|
@ -1,26 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
use Auth;
|
||||
use App\Models\ExpenseCategory;
|
||||
|
||||
class ExpenseCategoryRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\ExpenseCategory';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($filter = null)
|
||||
{
|
||||
$query = DB::table('expense_categories')
|
||||
@ -45,14 +36,10 @@ class ExpenseCategoryRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
* @param ExpenseCategory $category
|
||||
*
|
||||
* @return ExpenseCategory|mixed
|
||||
*/
|
||||
public function save(array $input, ExpenseCategory $category = false)
|
||||
public function save($input, $category = false)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
if ( ! $category) {
|
||||
$category = ExpenseCategory::createNew();
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
@ -9,37 +7,21 @@ use App\Models\Expense;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Document;
|
||||
|
||||
/**
|
||||
* Class ExpenseRepository
|
||||
*/
|
||||
class ExpenseRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var DocumentRepository
|
||||
*/
|
||||
protected $documentRepo;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
// Expenses
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Expense';
|
||||
}
|
||||
|
||||
/**
|
||||
* ExpenseRepository constructor.
|
||||
*
|
||||
* @param DocumentRepository $documentRepo
|
||||
*/
|
||||
public function __construct(DocumentRepository $documentRepo)
|
||||
{
|
||||
$this->documentRepo = $documentRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return Expense::scope()
|
||||
@ -49,11 +31,6 @@ class ExpenseRepository extends BaseRepository
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $vendorPublicId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findVendor($vendorPublicId)
|
||||
{
|
||||
$vendorId = Vendor::getPrivateId($vendorPublicId);
|
||||
@ -63,11 +40,6 @@ class ExpenseRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($filter = null)
|
||||
{
|
||||
$accountid = \Auth::user()->account_id;
|
||||
@ -138,13 +110,7 @@ class ExpenseRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
* @param Expense|null $expense
|
||||
*
|
||||
* @return Expense|mixed
|
||||
*/
|
||||
public function save(array $input, Expense $expense = null)
|
||||
public function save($input, $expense = null)
|
||||
{
|
||||
$publicId = isset($input['public_id']) ? $input['public_id'] : false;
|
||||
|
||||
@ -208,12 +174,6 @@ class ExpenseRepository extends BaseRepository
|
||||
return $expense;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ids
|
||||
* @param $action
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function bulk($ids, $action)
|
||||
{
|
||||
$expenses = Expense::withTrashed()->scope($ids)->get();
|
||||
@ -234,6 +194,6 @@ class ExpenseRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
|
||||
return $expenses->count();
|
||||
return count($tasks);
|
||||
}
|
||||
}
|
||||
|
@ -748,7 +748,6 @@ class InvoiceRepository extends BaseRepository
|
||||
|
||||
/**
|
||||
* @param Invoice $recurInvoice
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function createRecurringInvoice(Invoice $recurInvoice)
|
||||
@ -840,7 +839,6 @@ class InvoiceRepository extends BaseRepository
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function findNeedingReminding(Account $account)
|
||||
|
@ -1,20 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
|
||||
/**
|
||||
* Class NinjaRepository
|
||||
*/
|
||||
class NinjaRepository
|
||||
{
|
||||
/**
|
||||
* @param $clientPublicId
|
||||
* @param array $data
|
||||
*/
|
||||
public function updatePlanDetails($clientPublicId, array $data)
|
||||
public function updatePlanDetails($clientPublicId, $data)
|
||||
{
|
||||
$account = Account::whereId($clientPublicId)->first();
|
||||
|
||||
@ -22,7 +12,6 @@ class NinjaRepository
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $account->company;
|
||||
$company->plan = !empty($data['plan']) && $data['plan'] != PLAN_FREE?$data['plan']:null;
|
||||
$company->plan_term = !empty($data['plan_term'])?$data['plan_term']:null;
|
||||
|
@ -1,31 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
use App\Models\Payment;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
|
||||
/**
|
||||
* Class PaymentRepository
|
||||
*/
|
||||
class PaymentRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Payment';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $clientPublicId
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($clientPublicId = null, $filter = null)
|
||||
{
|
||||
$query = DB::table('payments')
|
||||
@ -100,12 +87,6 @@ class PaymentRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $contactId
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function findForContact($contactId = null, $filter = null)
|
||||
{
|
||||
$query = DB::table('payments')
|
||||
@ -161,13 +142,7 @@ class PaymentRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $input
|
||||
* @param Payment|null $payment
|
||||
*
|
||||
* @return Payment|mixed
|
||||
*/
|
||||
public function save(array $input, Payment $payment = null)
|
||||
public function save($input, $payment = null)
|
||||
{
|
||||
$publicId = isset($input['public_id']) ? $input['public_id'] : false;
|
||||
|
||||
@ -226,11 +201,6 @@ class PaymentRepository extends BaseRepository
|
||||
return $payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $payment
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete($payment)
|
||||
{
|
||||
if ($payment->invoice->is_deleted) {
|
||||
@ -240,11 +210,6 @@ class PaymentRepository extends BaseRepository
|
||||
parent::delete($payment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $payment
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function restore($payment)
|
||||
{
|
||||
if ($payment->invoice->is_deleted) {
|
||||
|
@ -1,27 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
|
||||
class PaymentTermRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\PaymentTerm';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $accountId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($accountId = 0)
|
||||
{
|
||||
return DB::table('payment_terms')
|
||||
//->where('payment_terms.account_id', '=', $accountId)
|
||||
->where('payment_terms.deleted_at', '=', null)
|
||||
->select('payment_terms.public_id', 'payment_terms.name', 'payment_terms.num_days', 'payment_terms.deleted_at');
|
||||
}
|
||||
|
@ -1,26 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use App\Models\Product;
|
||||
|
||||
/**
|
||||
* Class ProductRepository
|
||||
*/
|
||||
class ProductRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Product';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return Product::scope()
|
||||
@ -28,11 +17,6 @@ class ProductRepository extends BaseRepository
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accountId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($accountId)
|
||||
{
|
||||
return DB::table('products')
|
||||
@ -53,13 +37,7 @@ class ProductRepository extends BaseRepository
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Product|null $product
|
||||
*
|
||||
* @return Product|mixed
|
||||
*/
|
||||
public function save(array $data, Product $product = null)
|
||||
public function save($data, $product = null)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
|
@ -1,19 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use App\Models\Account;
|
||||
|
||||
/**
|
||||
* Class ReferralRepository
|
||||
*/
|
||||
class ReferralRepository
|
||||
{
|
||||
/**
|
||||
* @param $userId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCounts($userId)
|
||||
{
|
||||
$accounts = Account::where('referral_user_id', $userId)->get();
|
||||
|
@ -1,23 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use Auth;
|
||||
use Session;
|
||||
use App\Models\Client;
|
||||
use App\Models\Task;
|
||||
|
||||
/**
|
||||
* Class TaskRepository
|
||||
*/
|
||||
class TaskRepository
|
||||
{
|
||||
/**
|
||||
* @param null $clientPublicId
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($clientPublicId = null, $filter = null)
|
||||
{
|
||||
$query = \DB::table('tasks')
|
||||
@ -73,14 +62,7 @@ class TaskRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $publicId
|
||||
* @param array $data
|
||||
* @param Task|null $task
|
||||
*
|
||||
* @return Task|mixed
|
||||
*/
|
||||
public function save($publicId, array $data, Task $task = null)
|
||||
public function save($publicId, $data, $task = null)
|
||||
{
|
||||
if ($task) {
|
||||
// do nothing
|
||||
@ -127,12 +109,6 @@ class TaskRepository
|
||||
return $task;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $ids
|
||||
* @param $action
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function bulk($ids, $action)
|
||||
{
|
||||
$tasks = Task::withTrashed()->scope($ids)->get();
|
||||
|
@ -1,28 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Utils;
|
||||
use App\Models\TaxRate;
|
||||
|
||||
/**
|
||||
* Class TaxRateRepository
|
||||
*/
|
||||
class TaxRateRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\TaxRate';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accountId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($accountId)
|
||||
{
|
||||
return DB::table('tax_rates')
|
||||
@ -31,13 +19,7 @@ class TaxRateRepository extends BaseRepository
|
||||
->select('tax_rates.public_id', 'tax_rates.name', 'tax_rates.rate', 'tax_rates.deleted_at');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param TaxRate|null $taxRate
|
||||
*
|
||||
* @return TaxRate|mixed
|
||||
*/
|
||||
public function save(array $data, TaxRate $taxRate = null)
|
||||
public function save($data, $taxRate = null)
|
||||
{
|
||||
if ($taxRate) {
|
||||
// do nothing
|
||||
@ -53,4 +35,41 @@ class TaxRateRepository extends BaseRepository
|
||||
|
||||
return $taxRate;
|
||||
}
|
||||
|
||||
/*
|
||||
public function save($taxRates)
|
||||
{
|
||||
$taxRateIds = [];
|
||||
|
||||
foreach ($taxRates as $record) {
|
||||
if (!isset($record->rate) || (isset($record->is_deleted) && $record->is_deleted)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($record->name) || !trim($record->name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($record->public_id) {
|
||||
$taxRate = TaxRate::scope($record->public_id)->firstOrFail();
|
||||
} else {
|
||||
$taxRate = TaxRate::createNew();
|
||||
}
|
||||
|
||||
$taxRate->rate = Utils::parseFloat($record->rate);
|
||||
$taxRate->name = trim($record->name);
|
||||
$taxRate->save();
|
||||
|
||||
$taxRateIds[] = $taxRate->public_id;
|
||||
}
|
||||
|
||||
$taxRates = TaxRate::scope()->get();
|
||||
|
||||
foreach ($taxRates as $taxRate) {
|
||||
if (!in_array($taxRate->public_id, $taxRateIds)) {
|
||||
$taxRate->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -1,29 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use Session;
|
||||
use App\Models\Token;
|
||||
|
||||
/**
|
||||
* Class TokenRepository
|
||||
*/
|
||||
class TokenRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\AccountToken';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $userId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($userId)
|
||||
{
|
||||
$query = DB::table('account_tokens')
|
||||
|
@ -1,29 +1,16 @@
|
||||
<?php
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
|
||||
use App\Models\User;
|
||||
use DB;
|
||||
use Session;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Class UserRepository
|
||||
*/
|
||||
class UserRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\User';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $accountId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($accountId)
|
||||
{
|
||||
$query = DB::table('users')
|
||||
@ -38,13 +25,7 @@ class UserRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param User $user
|
||||
*
|
||||
* @return User
|
||||
*/
|
||||
public function save(array $data, User $user)
|
||||
public function save($data, $user)
|
||||
{
|
||||
$user->fill($data);
|
||||
$user->save();
|
||||
|
@ -1,25 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
|
||||
/**
|
||||
* Class VendorContactRepository
|
||||
*/
|
||||
// vendor
|
||||
class VendorContactRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function save(array $data)
|
||||
public function save($data)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
if (!$publicId || $publicId == '-1') {
|
||||
/** @var VendorContact $contact */
|
||||
$contact = VendorContact::createNew();
|
||||
//$contact->send_invoice = true;
|
||||
$contact->vendor_id = $data['vendor_id'];
|
||||
$contact->is_primary = VendorContact::scope()->where('vendor_id', '=', $contact->vendor_id)->count() == 0;
|
||||
} else {
|
||||
|
@ -1,26 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Ninja\Repositories;
|
||||
<?php namespace App\Ninja\Repositories;
|
||||
|
||||
use DB;
|
||||
use App\Models\Vendor;
|
||||
|
||||
/**
|
||||
* Class VendorRepository
|
||||
*/
|
||||
// vendor
|
||||
class VendorRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return 'App\Models\Vendor';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return Vendor::scope()
|
||||
@ -30,11 +20,6 @@ class VendorRepository extends BaseRepository
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $filter
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function find($filter = null)
|
||||
{
|
||||
$query = DB::table('vendors')
|
||||
@ -75,13 +60,7 @@ class VendorRepository extends BaseRepository
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
* @param Vendor|null $vendor
|
||||
*
|
||||
* @return Vendor|mixed
|
||||
*/
|
||||
public function save(array $data, Vendor $vendor = null)
|
||||
public function save($data, $vendor = null)
|
||||
{
|
||||
$publicId = isset($data['public_id']) ? $data['public_id'] : false;
|
||||
|
||||
@ -96,7 +75,15 @@ class VendorRepository extends BaseRepository
|
||||
|
||||
$vendor->fill($data);
|
||||
$vendor->save();
|
||||
|
||||
|
||||
$first = true;
|
||||
$vendorcontacts = isset($data['vendor_contact']) ? [$data['vendor_contact']] : $data['vendor_contacts'];
|
||||
|
||||
foreach ($vendorcontacts as $vendorcontact) {
|
||||
$vendorcontact = $vendor->addVendorContact($vendorcontact, $first);
|
||||
$first = false;
|
||||
}
|
||||
|
||||
return $vendor;
|
||||
}
|
||||
}
|
||||
|
@ -29,4 +29,4 @@ class UserTransformer extends EntityTransformer
|
||||
'permissions' => (int) $user->getOriginal('permissions'),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
@ -2,10 +2,4 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
/**
|
||||
* Class ClientPolicy
|
||||
*/
|
||||
class ClientPolicy extends EntityPolicy
|
||||
{
|
||||
|
||||
}
|
||||
class ClientPolicy extends EntityPolicy {}
|
@ -2,10 +2,4 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
/**
|
||||
* Class CreditPolicy
|
||||
*/
|
||||
class CreditPolicy extends EntityPolicy
|
||||
{
|
||||
|
||||
}
|
||||
class CreditPolicy extends EntityPolicy {}
|
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
@ -12,7 +11,6 @@ class DocumentPolicy extends EntityPolicy
|
||||
{
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function create(User $user)
|
||||
@ -22,11 +20,10 @@ class DocumentPolicy extends EntityPolicy
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param $item
|
||||
*
|
||||
* @param Document $document
|
||||
* @return bool
|
||||
*/
|
||||
public static function view(User $user, $item)
|
||||
public static function view(User $user, $document)
|
||||
{
|
||||
if ($user->hasPermission('view_all')) {
|
||||
return true;
|
||||
|
@ -4,9 +4,6 @@ namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Class ExpensePolicy
|
||||
*/
|
||||
class ExpensePolicy extends EntityPolicy
|
||||
{
|
||||
/**
|
||||
|
@ -2,10 +2,4 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
/**
|
||||
* Class InvoicePolicy
|
||||
*/
|
||||
class InvoicePolicy extends EntityPolicy
|
||||
{
|
||||
|
||||
}
|
||||
class InvoicePolicy extends EntityPolicy {}
|
||||
|
@ -2,10 +2,4 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
/**
|
||||
* Class PaymentPolicy
|
||||
*/
|
||||
class PaymentPolicy extends EntityPolicy
|
||||
{
|
||||
|
||||
}
|
||||
class PaymentPolicy extends EntityPolicy {}
|
@ -2,28 +2,12 @@
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Class TokenPolicy
|
||||
*/
|
||||
class TokenPolicy extends EntityPolicy {
|
||||
/**
|
||||
* @param User $user
|
||||
* @param $item
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function edit(User $user, $item) {
|
||||
public static function edit($user, $item) {
|
||||
return $user->hasPermission('admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function create(User $user) {
|
||||
public static function create($user) {
|
||||
return $user->hasPermission('admin');
|
||||
}
|
||||
}
|
@ -4,14 +4,10 @@ namespace App\Policies;
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
* Class VendorPolicy
|
||||
*/
|
||||
class VendorPolicy extends EntityPolicy
|
||||
{
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function create(User $user) {
|
||||
|
@ -17,11 +17,6 @@ class ComposerServiceProvider extends ServiceProvider
|
||||
['accounts.details', 'clients.edit', 'payments.edit', 'invoices.edit', 'accounts.localization'],
|
||||
'App\Http\ViewComposers\TranslationComposer'
|
||||
);
|
||||
|
||||
view()->composer(
|
||||
['header', 'tasks.edit'],
|
||||
'App\Http\ViewComposers\AppLanguageComposer'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,4 +154,4 @@ class PushService
|
||||
else
|
||||
return trans('texts.notification_invoice_viewed_subject', ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->name]);
|
||||
}
|
||||
}
|
||||
}
|
11
bower.json
11
bower.json
@ -3,10 +3,8 @@
|
||||
"version": "0.9.0",
|
||||
"dependencies": {
|
||||
"jquery": "1.11.3",
|
||||
"jquery-ui": "1.11.2",
|
||||
"bootstrap": "3.3.1",
|
||||
"bootstrap-combobox": "1.1.7",
|
||||
"bootstrap-datepicker": "1.4.0",
|
||||
"jquery-ui": "1.11.2",
|
||||
"datatables": "1.10.4",
|
||||
"datatables-bootstrap3": "*",
|
||||
"knockout.js": "3.1.0",
|
||||
@ -15,13 +13,13 @@
|
||||
"font-awesome": "~4.*",
|
||||
"underscore": "1.7.0",
|
||||
"jspdf": "1.0.272",
|
||||
"jsPDF-plugins": "*",
|
||||
"bootstrap-datepicker": "1.4.0",
|
||||
"typeahead.js": "0.11.1",
|
||||
"accounting": "0.3.2",
|
||||
"spectrum": "1.3.4",
|
||||
"d3": "3.4.11",
|
||||
"handsontable": "*",
|
||||
"pdfmake": "0.1.17",
|
||||
"pdfmake": "*",
|
||||
"moment": "*",
|
||||
"jsoneditor": "*",
|
||||
"moment-timezone": "~0.4.0",
|
||||
@ -29,8 +27,7 @@
|
||||
"datetimepicker": "~2.4.5",
|
||||
"stacktrace-js": "~1.0.1",
|
||||
"fuse.js": "~2.0.2",
|
||||
"dropzone": "~4.3.0",
|
||||
"lightbox2": "~2.8.2"
|
||||
"dropzone": "~4.3.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"jquery": "~1.11"
|
||||
|
@ -13,17 +13,13 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"ext-mcrypt": "*",
|
||||
"ext-gmp": "*",
|
||||
"ext-gd": "*",
|
||||
"turbo124/laravel-push-notification": "dev-laravel5",
|
||||
"omnipay/mollie": "dev-master#22956c1a62a9662afa5f5d119723b413770ac525",
|
||||
"omnipay/2checkout": "dev-master#e9c079c2dde0d7ba461903b3b7bd5caf6dee1248",
|
||||
"omnipay/gocardless": "dev-master",
|
||||
"omnipay/stripe": "dev-master",
|
||||
"doctrine/dbal": "2.5.x",
|
||||
"laravelcollective/bus": "5.2.*",
|
||||
"laravelcollective/bus": "5.2.*",
|
||||
"laravel/framework": "5.2.*",
|
||||
"laravelcollective/html": "5.2.*",
|
||||
"symfony/css-selector": "~3.0",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user