From 36c54d8cc3378692f8ea4d3d48f11935ec0d878c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 28 Aug 2020 11:06:46 +1000 Subject: [PATCH] Working on fees --- app/DataMapper/CompanySettings.php | 5 +++++ app/Http/Controllers/MigrationController.php | 1 - app/Jobs/Util/Import.php | 8 ++++++++ app/Models/CompanyGateway.php | 7 ++++++- ...2020_08_18_140557_add_is_public_to_documents_table.php | 6 +++--- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index a2b8f88469..276cdca50f 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -238,8 +238,13 @@ class CompanySettings extends BaseSettings public $client_portal_terms = ''; public $client_portal_privacy_policy = ''; public $client_portal_enable_uploads = false; + public $client_portal_allow_under_payment = false; + public $client_portal_allow_over_payment = false; + public static $casts = [ + 'client_portal_allow_under_payment' => 'bool', + 'client_portal_allow_over_payment' => 'bool', 'auto_bill' => 'string', 'lock_invoices' => 'string', 'client_portal_terms' => 'string', diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 4b4c755cb3..cf931a1902 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -31,7 +31,6 @@ class MigrationController extends BaseController parent::__construct(); } - /** * * Purge Company diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index f353f22276..34ce39061b 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -227,6 +227,14 @@ class Import implements ShouldQueue unset($data['account_id']); } + if(isset($data['referral_code'])) { + $account = $this->company->account; + $account->referral_code = $data['referral_code']; + $account->save(); + + unset($data['referral_code']); + } + $company_repository = new CompanyRepository(); $company_repository->save($data, $this->company); diff --git a/app/Models/CompanyGateway.php b/app/Models/CompanyGateway.php index ab036a407b..4c05a86bf2 100644 --- a/app/Models/CompanyGateway.php +++ b/app/Models/CompanyGateway.php @@ -201,7 +201,12 @@ class CompanyGateway extends BaseModel return floatval($this->fee_amount) || floatval($this->fee_percent); } - public function isTestMode() + /** + * Returns the current test mode of the gateway + * + * @return boolean whether the gateway is in testmode or not. + */ + public function isTestMode() :bool { $config = $this->getConfig(); diff --git a/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php b/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php index 521a7375a6..b9f3c1d386 100644 --- a/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php +++ b/database/migrations/2020_08_18_140557_add_is_public_to_documents_table.php @@ -47,9 +47,9 @@ class AddIsPublicToDocumentsTable extends Migration $table->string('auto_bill'); }); - Schema::table('recurring_expenses', function ($table) { - $table->table('auto_bill'); - }); + // Schema::table('recurring_expenses', function ($table) { + // $table->string('auto_bill'); + // }); Schema::table('companies', function ($table) { $table->enum('default_auto_bill', ['off', 'always','optin','optout'])->default('off');