diff --git a/app/Console/Commands/CreateTestData.php b/app/Console/Commands/CreateTestData.php index 0045796945..84400d1a46 100644 --- a/app/Console/Commands/CreateTestData.php +++ b/app/Console/Commands/CreateTestData.php @@ -332,7 +332,7 @@ class CreateTestData extends Command $this->info('Creating '.$this->count. ' clients'); - for ($x=0; $x<$this->count*1000; $x++) { + for ($x=0; $x<$this->count*500; $x++) { $z = $x+1; $this->info("Creating client # ".$z); diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 65c98a14a3..2ee72347d7 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -25,7 +25,6 @@ class CompanySettings extends BaseSettings /*Invoice*/ public $auto_archive_invoice = false; - public $lock_sent_invoices = false; public $lock_invoices = 'off'; //off,when_sent,when_paid @@ -391,7 +390,6 @@ class CompanySettings extends BaseSettings 'show_currency_code' => 'bool', 'send_reminders' => 'bool', 'enable_client_portal_tasks' => 'bool', - 'lock_sent_invoices' => 'bool', 'auto_archive_invoice' => 'bool', 'auto_archive_quote' => 'bool', 'auto_convert_quote' => 'bool', diff --git a/app/DataMapper/EmailTemplateDefaults.php b/app/DataMapper/EmailTemplateDefaults.php index eb831a516f..e92fda3da9 100644 --- a/app/DataMapper/EmailTemplateDefaults.php +++ b/app/DataMapper/EmailTemplateDefaults.php @@ -121,7 +121,6 @@ class EmailTemplateDefaults return $converter->convertToHtml(self::transformText('invoice_message')); - //return Parsedown::instance()->line(self::transformText('invoice_message')); } public static function emailQuoteSubject() diff --git a/app/Filters/InvoiceFilters.php b/app/Filters/InvoiceFilters.php index 35766435dd..9b6aabd97a 100644 --- a/app/Filters/InvoiceFilters.php +++ b/app/Filters/InvoiceFilters.php @@ -70,9 +70,9 @@ class InvoiceFilters extends QueryFilters return $this->builder; } - public function invoice_number(string $invoice_number):Builder + public function number(string $number) :Builder { - return $this->builder->where('number', $invoice_number); + return $this->builder->where('number', $number); } /** diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index cac67e2c27..066be576d1 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -72,7 +72,7 @@ class AccountController extends BaseController * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), * @OA\Parameter( * name="token_name", - * in="path", + * in="query", * description="A custom name for the user company token", * example="Daves iOS Device", * required=true, diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index ccf9ee51c4..bd25d2e80c 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -186,6 +186,10 @@ class BaseController extends Controller $transformer = new $this->entity_transformer($this->serializer); $updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0; + + if(auth()->user()->getCompany()->is_large && !request()->has('updated_at')) + return response()->json(['message' => 'Cannot load a large account without a updated_at parameter','errors' =>[]],401); + $updated_at = date('Y-m-d H:i:s', $updated_at); $query->with( @@ -202,8 +206,8 @@ class BaseController extends Controller 'company.groups' => function ($query) use($updated_at){ $query->where('updated_at', '>=', $updated_at); }, - 'company.company_gateways' => function ($query) use($updated_at){ - $query->where('updated_at', '>=', $updated_at)->with('gateway'); + 'company.company_gateways' => function ($query){ + $query->whereNotNull('updated_at'); }, 'company.products' => function ($query) use($updated_at){ $query->where('updated_at', '>=', $updated_at); diff --git a/app/Http/Controllers/CompanyUserController.php b/app/Http/Controllers/CompanyUserController.php index fa6d5ccfb9..50412f4a75 100644 --- a/app/Http/Controllers/CompanyUserController.php +++ b/app/Http/Controllers/CompanyUserController.php @@ -87,17 +87,6 @@ class CompanyUserController extends BaseController * description="Attempts to update a company user record. A company user can modify only their settings fields. Full access for Admin users", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter( - * name="id", - * in="path", - * description="The Invoice Hashed ID", - * example="D2J234DFA", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), * @OA\Response( * response=200, * description="The Company User response", diff --git a/app/Http/Controllers/GroupSettingController.php b/app/Http/Controllers/GroupSettingController.php index 99a2ba5599..a69fc61b2e 100644 --- a/app/Http/Controllers/GroupSettingController.php +++ b/app/Http/Controllers/GroupSettingController.php @@ -21,6 +21,7 @@ use App\Http\Requests\GroupSetting\UpdateGroupSettingRequest; use App\Models\GroupSetting; use App\Repositories\GroupSettingRepository; use App\Transformers\GroupSettingTransformer; +use App\Utils\Traits\MakesHash; use App\Utils\Traits\Uploadable; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Http\Request; @@ -29,7 +30,8 @@ class GroupSettingController extends BaseController { use DispatchesJobs; use Uploadable; - + use MakesHash; + protected $entity_type = GroupSetting::class; protected $entity_transformer = GroupSettingTransformer::class; diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 8033d1ad19..e9e3cf6bcb 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -392,6 +392,9 @@ class InvoiceController extends BaseController return $request->disallowUpdate(); } + if($invoice->isLocked()) + return response()->json(['message' => 'Invoice is locked, no modifications allowed']); + $invoice = $this->invoice_repo->save($request->all(), $invoice); event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars())); diff --git a/app/Http/Controllers/LicenseController.php b/app/Http/Controllers/LicenseController.php index 7c80e8faad..090bdbd7ed 100644 --- a/app/Http/Controllers/LicenseController.php +++ b/app/Http/Controllers/LicenseController.php @@ -39,7 +39,7 @@ class LicenseController extends BaseController * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), * @OA\Parameter( * name="license_key", - * in="path", + * in="query", * description="The license hash", * example="d87sh-s755s-s7d76-sdsd8", * required=true, @@ -50,7 +50,7 @@ class LicenseController extends BaseController * ), * @OA\Parameter( * name="product_id", - * in="path", + * in="query", * description="The ID of the product purchased.", * example="1", * required=true, diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index b2369aa84a..86eb1e343e 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -162,7 +162,7 @@ class MigrationController extends BaseController * @OA\Parameter(ref="#/components/parameters/X-Api-Password"), * @OA\Parameter( * name="migration", - * in="path", + * in="query", * description="The migraton file", * example="migration.zip", * required=true, diff --git a/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php b/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php index 893c6cb745..fe19347cc0 100644 --- a/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php +++ b/app/Http/Controllers/OpenAPI/CompanySettingsSchema.php @@ -30,7 +30,7 @@ * @OA\Property(property="custom_message_unpaid_invoice", type="string", example="Please pay invoices immediately", description="____________"), * @OA\Property(property="custom_message_paid_invoice", type="string", example="Thanks for paying this invoice!", description="____________"), * @OA\Property(property="custom_message_unapproved_quote", type="string", example="Please approve quote", description="____________"), - * @OA\Property(property="lock_sent_invoices", type="boolean", example=true, description="____________"), + * @OA\Property(property="lock_invoices", type="boolean", example=true, description="____________"), * @OA\Property(property="auto_archive_invoice", type="boolean", example=true, description="____________"), * @OA\Property(property="auto_archive_quote", type="boolean", example=true, description="____________"), * @OA\Property(property="auto_convert_quote", type="boolean", example=true, description="____________"), diff --git a/app/Http/Controllers/OpenAPI/Parameters.php b/app/Http/Controllers/OpenAPI/Parameters.php index 783cd1f267..6cce817069 100644 --- a/app/Http/Controllers/OpenAPI/Parameters.php +++ b/app/Http/Controllers/OpenAPI/Parameters.php @@ -85,7 +85,7 @@ * ), * * @OA\Parameter( - * name="", + * name="api_version", * in="query", * description="The API version", * @OA\Schema( diff --git a/app/Http/Controllers/PingController.php b/app/Http/Controllers/PingController.php index a3db94d940..cd827e0ddd 100644 --- a/app/Http/Controllers/PingController.php +++ b/app/Http/Controllers/PingController.php @@ -11,15 +11,34 @@ namespace App\Http\Controllers; +use App\Utils\Ninja; +use App\Utils\SystemHealth; use Illuminate\Http\Request; class PingController extends BaseController { /** - * Display a listing of the resource. + * Get a ping response from the system. * * @return \Illuminate\Http\Response + * + * @OA\Get( + * path="/api/v1/ping", + * operationId="getPing", + * tags={"ping"}, + * summary="Attempts to ping the API", + * description="Attempts to ping the API", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Response( + * response=200, + * description="The company and user name", + * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ) + * ) */ public function index() { @@ -28,4 +47,34 @@ class PingController extends BaseController 'user_name' => auth()->user()->present()->name(), ], 200); } + + /** + * Get a health check of the system + * + * @return \Illuminate\Http\Response + * + * @OA\Get( + * path="/api/v1/health_check", + * operationId="getHealthCheck", + * tags={"health_check"}, + * summary="Attempts to get a health check from the API", + * description="Attempts to get a health check from the API", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Response( + * response=200, + * description="A key/value map of the system health", + * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * ) + * ) + */ + public function health() + { + if(Ninja::isNinja()) + return response()->json(['message' => 'Route not available', 'errors'=>[]], 403); + + return response()->json(SystemHealth::check(),200); + } } diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index af98d00b76..c9aeca9c75 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -45,28 +45,6 @@ class PreviewController extends BaseController * description="Returns a pdf preview.", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter( - * name="entity", - * in="path", - * description="The PDF", - * example="invoice", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Parameter( - * name="entity_id", - * in="path", - * description="The Entity ID", - * example="X9f87dkf", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), * @OA\Response( * response=200, * description="The pdf response", diff --git a/app/Http/Controllers/TemplateController.php b/app/Http/Controllers/TemplateController.php index d463e175e8..35aae2320e 100644 --- a/app/Http/Controllers/TemplateController.php +++ b/app/Http/Controllers/TemplateController.php @@ -42,28 +42,6 @@ class TemplateController extends BaseController * description="Returns a entity template with the template variables replaced with the Entities", * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), - * @OA\Parameter( - * name="entity", - * in="path", - * description="The Entity (invoice,quote,recurring_invoice)", - * example="invoice", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), - * @OA\Parameter( - * name="entity_id", - * in="path", - * description="The Entity ID", - * example="X9f87dkf", - * required=true, - * @OA\Schema( - * type="string", - * format="string", - * ), - * ), * @OA\RequestBody( * description="The template subject and body", * required=true, diff --git a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php index 7dba25743d..01f2cbedc5 100644 --- a/app/Http/Requests/Invoice/UpdateInvoiceRequest.php +++ b/app/Http/Requests/Invoice/UpdateInvoiceRequest.php @@ -94,4 +94,11 @@ class UpdateInvoiceRequest extends Request $this->replace($input); } + + public function messages() + { + return [ + 'id' => ctrans('text.locked_invoice'), + ]; + } } diff --git a/app/Mail/BouncedEmail.php b/app/Mail/BouncedEmail.php index 7886967cb6..68876078cc 100644 --- a/app/Mail/BouncedEmail.php +++ b/app/Mail/BouncedEmail.php @@ -59,7 +59,7 @@ class BouncedEmail extends Mailable implements ShouldQueue //->bcc('') ->queue(new BouncedEmail($invitation)); - return $this->from('turbo124@gmail.com') //todo + return $this->from('x@gmail.com') //todo ->subject(ctrans('texts.confirmation_subject')) ->markdown('email.auth.verify', ['user' => $this->user]) ->text('email.auth.verify_text'); diff --git a/app/Mail/VerifyUser.php b/app/Mail/VerifyUser.php index 13d4587736..9ef44712b4 100644 --- a/app/Mail/VerifyUser.php +++ b/app/Mail/VerifyUser.php @@ -39,7 +39,7 @@ class VerifyUser extends Mailable implements ShouldQueue */ public function build() { - return $this->from('turbo124@gmail.com') //todo + return $this->from('x@gmail.com') //todo ->subject(ctrans('texts.confirmation_subject')) ->markdown('email.auth.verify', ['user' => $this->user]) ->text('email.auth.verify_text'); diff --git a/app/Models/Client.php b/app/Models/Client.php index 574571c2fe..3f8f9db09f 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -460,10 +460,10 @@ class Client extends BaseModel implements HasLocalePreference else return true; - if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $amount < $fees_and_limits->min_limit) + if ((property_exists($fees_and_limits, 'min_limit')) && $fees_and_limits->min_limit !== null && $fees_and_limits->min_limit != -1 && $amount < $fees_and_limits->min_limit) return false; - if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $amount > $fees_and_limits->max_limit) + if ((property_exists($fees_and_limits, 'max_limit')) && $fees_and_limits->max_limit !== null && $fees_and_limits->max_limit != -1 && $amount > $fees_and_limits->max_limit) return false; return true; diff --git a/app/Models/Company.php b/app/Models/Company.php index 2dc887c1f1..a8c3fa440f 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -109,6 +109,7 @@ class Company extends BaseModel 'slack_webhook_url', 'google_analytics_key', 'client_can_register', + 'enable_shop_api', ]; diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 4006e4a1f8..590bd9fcff 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -266,17 +266,6 @@ class Invoice extends BaseModel } } - /** - * If True, prevents an invoice from being - * modified once it has been marked as sent - * - * @return boolean isLocked - */ - public function isLocked(): bool - { - return $this->client->getSetting('lock_sent_invoices'); - } - public function isPayable(): bool { if($this->status_id == Invoice::STATUS_DRAFT && $this->is_deleted == false){ @@ -437,6 +426,32 @@ class Invoice extends BaseModel }); } + /** + * Filtering logic to determine + * whether an invoice is locked + * based on the current status of the invoice + * @return boolean [description] + */ + public function isLocked() :bool + { + $locked_status = $this->client->getSetting('lock_invoices'); + + switch ($locked_status) { + case 'off': + return false; + break; + case 'when_sent': + return $this->status_id == self::STATUS_DRAFT; + break; + case 'when_paid': + return $this->status_id == self::STATUS_PAID || $this->status_id == self::STATUS_PARTIAL; + break; + default: + return false; + break; + } + } + /* Graveyard */ // /** diff --git a/app/Notifications/BaseNotification.php b/app/Notifications/BaseNotification.php index 5b9d71b768..293cc145c8 100644 --- a/app/Notifications/BaseNotification.php +++ b/app/Notifications/BaseNotification.php @@ -103,7 +103,7 @@ class BaseNotification extends Notification implements ShouldQueue $email_style_custom = $this->settings->email_style_custom; $body = strtr($email_style_custom, "$body", $body); } - + $data = [ 'body' => $body, 'design' => $design_style, @@ -120,4 +120,22 @@ class BaseNotification extends Notification implements ShouldQueue return $data; } + + public function getTemplateView() + { + + switch ($this->settings->email_style) { + case 'plain': + return 'email.template.plain'; + break; + case 'custom': + return 'email.template.custom'; + break; + default: + return 'email.admin.generic_email'; + break; + } + + } + } \ No newline at end of file diff --git a/app/Notifications/SendGenericNotification.php b/app/Notifications/SendGenericNotification.php index fa1395900d..097047c023 100644 --- a/app/Notifications/SendGenericNotification.php +++ b/app/Notifications/SendGenericNotification.php @@ -73,14 +73,17 @@ class SendGenericNotification extends BaseNotification implements ShouldQueue */ public function toMail($notifiable) { + $mail_message = (new MailMessage) ->withSwiftMessage(function ($message) { $message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key); - })->markdown('email.admin.generic_email', $this->buildMailMessageData()); + //})->markdown($this->getTemplateView(), $this->buildMailMessageData()); + })->markdown('email.template.plain', $this->buildMailMessageData()); $mail_message = $this->buildMailMessageSettings($mail_message); return $mail_message; + } /** diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index 0ef048db94..ac67a055e8 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -70,6 +70,9 @@ class ClientContactRepository extends BaseRepository }); + //need to reload here to shake off stale contacts + $client->load('contacts'); + //always made sure we have one blank contact to maintain state if ($client->contacts->count() == 0) { diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index 76591becad..be9c38d562 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -56,6 +56,7 @@ class MarkPaid extends AbstractService $payment->client_id = $this->invoice->client_id; $payment->transaction_reference = ctrans('texts.manual_entry'); $payment->currency_id = $this->invoice->client->getSetting('currency_id'); + $payment->is_manual = true; /* Create a payment relationship to the invoice entity */ $payment->save(); diff --git a/app/Transformers/CompanyTransformer.php b/app/Transformers/CompanyTransformer.php index 6a31e1d616..a4709aa506 100644 --- a/app/Transformers/CompanyTransformer.php +++ b/app/Transformers/CompanyTransformer.php @@ -132,6 +132,7 @@ class CompanyTransformer extends EntityTransformer 'enabled_item_tax_rates' => (int) $company->enabled_item_tax_rates, 'client_can_register' => (bool) $company->client_can_register, 'is_large' => (bool) $company->is_large, + 'enable_shop_api' => (bool) $company->enable_shop_api, ]; } diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index fc922bc5f3..3a5152d279 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -84,22 +84,10 @@ class HtmlEngine - - - - - - - - - - - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - private function buildEntityDataArray() :array + public function buildEntityDataArray() :array { if (!$this->client->currency()) { throw new \Exception(debug_backtrace()[1]['function'], 1); @@ -132,21 +120,24 @@ class HtmlEngine $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; $data['$terms'] = &$data['$entity.terms']; - } + $data['$view_link'] = ['value' => ''. ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; + } if ($this->entity_string == 'quote') { $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.quote')]; $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.quote_number')]; $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; $data['$terms'] = &$data['$entity.terms']; - } + $data['$view_link'] = ['value' => ''. ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; + } if ($this->entity_string == 'credit') { $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')]; $data['$number'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.credit_number')]; $data['$entity.terms'] = ['value' => $this->entity->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; $data['$terms'] = &$data['$entity.terms']; - } + $data['$view_link'] = ['value' => ''. ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; + } $data['$entity_number'] = &$data['$number']; diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index 626241f578..e5d573c544 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -187,6 +187,7 @@ trait MakesInvoiceValues } $calc = $this->calc(); + $invitation = $this->invitations->where('client_contact_id', $contact->id)->first(); $data = []; $data['$tax'] = ['value' => '', 'label' => ctrans('texts.tax')]; @@ -214,6 +215,7 @@ trait MakesInvoiceValues $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''. ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; } if ($this instanceof Quote) { @@ -221,13 +223,15 @@ trait MakesInvoiceValues $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; $data['$terms'] = &$data['$entity.terms']; - } + $data['$view_link'] = ['value' => ''. ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; + } if ($this instanceof Credit) { $data['$entity_label'] = ['value' => '', 'label' => ctrans('texts.credit')]; $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; $data['$terms'] = &$data['$entity.terms']; + $data['$view_link'] = ['value' => ''. ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; } $data['$entity_number'] = &$data['$number']; diff --git a/composer.lock b/composer.lock index d001e3a708..ca74f4fa42 100644 --- a/composer.lock +++ b/composer.lock @@ -107,16 +107,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.147.2", + "version": "3.147.8", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "c58688f53c730b74cec1b6cfee8d9ed5bb40d946" + "reference": "b121ee1d69d3a1200ebc22d937cd40043b96a940" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c58688f53c730b74cec1b6cfee8d9ed5bb40d946", - "reference": "c58688f53c730b74cec1b6cfee8d9ed5bb40d946", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b121ee1d69d3a1200ebc22d937cd40043b96a940", + "reference": "b121ee1d69d3a1200ebc22d937cd40043b96a940", "shasum": "" }, "require": { @@ -188,7 +188,7 @@ "s3", "sdk" ], - "time": "2020-07-21T18:11:40+00:00" + "time": "2020-07-29T18:16:33+00:00" }, { "name": "checkout/checkout-sdk-php", @@ -1103,6 +1103,20 @@ "sqlserver", "sqlsrv" ], + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal", + "type": "tidelift" + } + ], "time": "2020-04-20T17:19:26+00:00" }, { @@ -1671,16 +1685,16 @@ }, { "name": "google/apiclient", - "version": "v2.6.0", + "version": "v2.7.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client.git", - "reference": "326e37fde5145079b74f1ce7249d242739d53cbc" + "reference": "48ec94577b51bde415270116118b07a294e07c43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/326e37fde5145079b74f1ce7249d242739d53cbc", - "reference": "326e37fde5145079b74f1ce7249d242739d53cbc", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/48ec94577b51bde415270116118b07a294e07c43", + "reference": "48ec94577b51bde415270116118b07a294e07c43", "shasum": "" }, "require": { @@ -1695,6 +1709,7 @@ }, "require-dev": { "cache/filesystem-adapter": "^0.3.2", + "composer/composer": "^1.10", "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", "phpcompatibility/php-compatibility": "^9.2", "phpunit/phpunit": "^4.8.36|^5.0", @@ -1728,20 +1743,20 @@ "keywords": [ "google" ], - "time": "2020-07-10T17:05:22+00:00" + "time": "2020-07-23T21:37:43+00:00" }, { "name": "google/apiclient-services", - "version": "v0.139", + "version": "v0.141", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "84e99f792cae7bd92b8b54c75b0ad3502d628db6" + "reference": "4ba7279b0a56366e4f19b9d1a1b5456f99353b6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/84e99f792cae7bd92b8b54c75b0ad3502d628db6", - "reference": "84e99f792cae7bd92b8b54c75b0ad3502d628db6", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/4ba7279b0a56366e4f19b9d1a1b5456f99353b6f", + "reference": "4ba7279b0a56366e4f19b9d1a1b5456f99353b6f", "shasum": "" }, "require": { @@ -1765,20 +1780,20 @@ "keywords": [ "google" ], - "time": "2020-06-08T00:24:31+00:00" + "time": "2020-07-27T00:25:27+00:00" }, { "name": "google/auth", - "version": "v1.10.0", + "version": "v1.11.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "077d6ae98d550161d3b2a0ba283bdce785c74d85" + "reference": "bb959e91bd8ffbd352ab76cbf11d656ce6435088" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/077d6ae98d550161d3b2a0ba283bdce785c74d85", - "reference": "077d6ae98d550161d3b2a0ba283bdce785c74d85", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/bb959e91bd8ffbd352ab76cbf11d656ce6435088", + "reference": "bb959e91bd8ffbd352ab76cbf11d656ce6435088", "shasum": "" }, "require": { @@ -1817,7 +1832,7 @@ "google", "oauth2" ], - "time": "2020-07-08T19:11:36+00:00" + "time": "2020-07-27T18:33:35+00:00" }, { "name": "guzzlehttp/guzzle", @@ -2449,16 +2464,16 @@ }, { "name": "laravel/framework", - "version": "v6.18.26", + "version": "v6.18.31", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "d11b6168c65251ffa81ae0dfaf017ad2f30013da" + "reference": "a731824421f9ebc586728ea9c7cff231a249aaa9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/d11b6168c65251ffa81ae0dfaf017ad2f30013da", - "reference": "d11b6168c65251ffa81ae0dfaf017ad2f30013da", + "url": "https://api.github.com/repos/laravel/framework/zipball/a731824421f9ebc586728ea9c7cff231a249aaa9", + "reference": "a731824421f9ebc586728ea9c7cff231a249aaa9", "shasum": "" }, "require": { @@ -2593,7 +2608,7 @@ "framework", "laravel" ], - "time": "2020-07-21T14:25:39+00:00" + "time": "2020-07-27T18:23:18+00:00" }, { "name": "laravel/slack-notification-channel", @@ -2877,16 +2892,16 @@ }, { "name": "league/flysystem", - "version": "1.0.69", + "version": "1.0.70", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "7106f78428a344bc4f643c233a94e48795f10967" + "reference": "585824702f534f8d3cf7fab7225e8466cc4b7493" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/7106f78428a344bc4f643c233a94e48795f10967", - "reference": "7106f78428a344bc4f643c233a94e48795f10967", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/585824702f534f8d3cf7fab7225e8466cc4b7493", + "reference": "585824702f534f8d3cf7fab7225e8466cc4b7493", "shasum": "" }, "require": { @@ -2897,7 +2912,7 @@ "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "phpspec/phpspec": "^3.4", + "phpspec/phpspec": "^3.4 || ^4.0 || ^5.0 || ^6.0", "phpunit/phpunit": "^5.7.26" }, "suggest": { @@ -2963,7 +2978,7 @@ "type": "other" } ], - "time": "2020-05-18T15:13:39+00:00" + "time": "2020-07-26T07:20:36+00:00" }, { "name": "league/flysystem-aws-s3-v3", @@ -3014,16 +3029,16 @@ }, { "name": "league/flysystem-cached-adapter", - "version": "1.0.9", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem-cached-adapter.git", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f" + "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f", - "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f", + "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/d1925efb2207ac4be3ad0c40b8277175f99ffaff", + "reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff", "shasum": "" }, "require": { @@ -3057,7 +3072,7 @@ } ], "description": "An adapter decorator to enable meta-data caching.", - "time": "2018-07-09T20:51:04+00:00" + "time": "2020-07-25T15:56:04+00:00" }, { "name": "league/fractal", @@ -3507,16 +3522,16 @@ }, { "name": "monolog/monolog", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "38914429aac460e8e4616c8cb486ecb40ec90bb1" + "reference": "f9eee5cec93dfb313a38b6b288741e84e53f02d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/38914429aac460e8e4616c8cb486ecb40ec90bb1", - "reference": "38914429aac460e8e4616c8cb486ecb40ec90bb1", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f9eee5cec93dfb313a38b6b288741e84e53f02d5", + "reference": "f9eee5cec93dfb313a38b6b288741e84e53f02d5", "shasum": "" }, "require": { @@ -3594,7 +3609,7 @@ "type": "tidelift" } ], - "time": "2020-05-22T08:12:19+00:00" + "time": "2020-07-23T08:41:23+00:00" }, { "name": "mtdowling/jmespath.php", @@ -3701,16 +3716,16 @@ }, { "name": "nesbot/carbon", - "version": "2.36.1", + "version": "2.37.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "ee7378a36cc62952100e718bcc58be4c7210e55f" + "reference": "1f61206de973d67f36ce50f041c792ddac663c3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ee7378a36cc62952100e718bcc58be4c7210e55f", - "reference": "ee7378a36cc62952100e718bcc58be4c7210e55f", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/1f61206de973d67f36ce50f041c792ddac663c3e", + "reference": "1f61206de973d67f36ce50f041c792ddac663c3e", "shasum": "" }, "require": { @@ -3786,20 +3801,20 @@ "type": "tidelift" } ], - "time": "2020-07-04T12:29:56+00:00" + "time": "2020-07-28T06:04:54+00:00" }, { "name": "nikic/php-parser", - "version": "v4.6.0", + "version": "v4.7.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c346bbfafe2ff60680258b631afb730d186ed864" + "reference": "21dce06dfbf0365c6a7cc8fdbdc995926c6a9300" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c346bbfafe2ff60680258b631afb730d186ed864", - "reference": "c346bbfafe2ff60680258b631afb730d186ed864", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/21dce06dfbf0365c6a7cc8fdbdc995926c6a9300", + "reference": "21dce06dfbf0365c6a7cc8fdbdc995926c6a9300", "shasum": "" }, "require": { @@ -3816,7 +3831,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.7-dev" } }, "autoload": { @@ -3838,7 +3853,7 @@ "parser", "php" ], - "time": "2020-07-02T17:12:47+00:00" + "time": "2020-07-25T13:18:53+00:00" }, { "name": "nwidart/laravel-modules", @@ -5665,16 +5680,16 @@ }, { "name": "sentry/sentry", - "version": "2.4.1", + "version": "2.4.2", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "407573e22e6cc46b72cff07c117eeb16bf3a17de" + "reference": "b3b4f4a08b184c3f22b208f357e8720ef42938b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/407573e22e6cc46b72cff07c117eeb16bf3a17de", - "reference": "407573e22e6cc46b72cff07c117eeb16bf3a17de", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/b3b4f4a08b184c3f22b208f357e8720ef42938b0", + "reference": "b3b4f4a08b184c3f22b208f357e8720ef42938b0", "shasum": "" }, "require": { @@ -5758,7 +5773,7 @@ "type": "custom" } ], - "time": "2020-07-03T09:58:40+00:00" + "time": "2020-07-24T07:02:19+00:00" }, { "name": "sentry/sentry-laravel", @@ -6096,16 +6111,16 @@ }, { "name": "stripe/stripe-php", - "version": "v7.44.0", + "version": "v7.45.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "b39ccc77358fbe0d462e6cc89ac01b7a0c896f35" + "reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/b39ccc77358fbe0d462e6cc89ac01b7a0c896f35", - "reference": "b39ccc77358fbe0d462e6cc89ac01b7a0c896f35", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/21e5001f5e0d787e4755c8bfc00e578dce9ae058", + "reference": "21e5001f5e0d787e4755c8bfc00e578dce9ae058", "shasum": "" }, "require": { @@ -6149,7 +6164,7 @@ "payment processing", "stripe" ], - "time": "2020-07-20T21:25:50+00:00" + "time": "2020-07-29T04:29:52+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -6215,16 +6230,16 @@ }, { "name": "symfony/console", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "326b064d804043005526f5a0494cfb49edb59bb0" + "reference": "55d07021da933dd0d633ffdab6f45d5b230c7e02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/326b064d804043005526f5a0494cfb49edb59bb0", - "reference": "326b064d804043005526f5a0494cfb49edb59bb0", + "url": "https://api.github.com/repos/symfony/console/zipball/55d07021da933dd0d633ffdab6f45d5b230c7e02", + "reference": "55d07021da933dd0d633ffdab6f45d5b230c7e02", "shasum": "" }, "require": { @@ -6302,11 +6317,11 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:06:45+00:00" + "time": "2020-07-06T13:18:39+00:00" }, { "name": "symfony/css-selector", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -6373,16 +6388,16 @@ }, { "name": "symfony/debug", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "28f92d08bb6d1fddf8158e02c194ad43870007e6" + "reference": "47aa9064d75db36389692dd4d39895a0820f00f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/28f92d08bb6d1fddf8158e02c194ad43870007e6", - "reference": "28f92d08bb6d1fddf8158e02c194ad43870007e6", + "url": "https://api.github.com/repos/symfony/debug/zipball/47aa9064d75db36389692dd4d39895a0820f00f2", + "reference": "47aa9064d75db36389692dd4d39895a0820f00f2", "shasum": "" }, "require": { @@ -6440,7 +6455,7 @@ "type": "tidelift" } ], - "time": "2020-05-24T08:33:35+00:00" + "time": "2020-07-23T08:31:43+00:00" }, { "name": "symfony/deprecation-contracts", @@ -6508,16 +6523,16 @@ }, { "name": "symfony/error-handler", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "0df9a23c0f9eddbb6682479fee6fd58b88add75b" + "reference": "66f151360550ec2b3273b3746febb12e6ba0348b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/0df9a23c0f9eddbb6682479fee6fd58b88add75b", - "reference": "0df9a23c0f9eddbb6682479fee6fd58b88add75b", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/66f151360550ec2b3273b3746febb12e6ba0348b", + "reference": "66f151360550ec2b3273b3746febb12e6ba0348b", "shasum": "" }, "require": { @@ -6575,20 +6590,20 @@ "type": "tidelift" } ], - "time": "2020-05-28T10:39:14+00:00" + "time": "2020-07-23T08:35:20+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a5370aaa7807c7a439b21386661ffccf3dff2866" + "reference": "6140fc7047dafc5abbe84ba16a34a86c0b0229b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a5370aaa7807c7a439b21386661ffccf3dff2866", - "reference": "a5370aaa7807c7a439b21386661ffccf3dff2866", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/6140fc7047dafc5abbe84ba16a34a86c0b0229b8", + "reference": "6140fc7047dafc5abbe84ba16a34a86c0b0229b8", "shasum": "" }, "require": { @@ -6659,7 +6674,7 @@ "type": "tidelift" } ], - "time": "2020-05-20T08:37:50+00:00" + "time": "2020-06-18T17:59:13+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -6739,7 +6754,7 @@ }, { "name": "symfony/filesystem", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -6803,20 +6818,20 @@ }, { "name": "symfony/finder", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "5729f943f9854c5781984ed4907bbb817735776b" + "reference": "2727aa35fddfada1dd37599948528e9b152eb742" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5729f943f9854c5781984ed4907bbb817735776b", - "reference": "5729f943f9854c5781984ed4907bbb817735776b", + "url": "https://api.github.com/repos/symfony/finder/zipball/2727aa35fddfada1dd37599948528e9b152eb742", + "reference": "2727aa35fddfada1dd37599948528e9b152eb742", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.1.3" }, "type": "library", "extra": { @@ -6862,20 +6877,20 @@ "type": "tidelift" } ], - "time": "2020-03-27T16:54:36+00:00" + "time": "2020-07-05T09:39:30+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "3adfbd7098c850b02d107330b7b9deacf2581578" + "reference": "3675676b6a47f3e71d3ab10bcf53fb9239eb77e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3adfbd7098c850b02d107330b7b9deacf2581578", - "reference": "3adfbd7098c850b02d107330b7b9deacf2581578", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3675676b6a47f3e71d3ab10bcf53fb9239eb77e6", + "reference": "3675676b6a47f3e71d3ab10bcf53fb9239eb77e6", "shasum": "" }, "require": { @@ -6931,20 +6946,20 @@ "type": "tidelift" } ], - "time": "2020-05-23T09:11:46+00:00" + "time": "2020-07-23T09:48:09+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "81d42148474e1852a333ed7a732f2a014af75430" + "reference": "a675d2bf04a9328f164910cae6e3918b295151f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/81d42148474e1852a333ed7a732f2a014af75430", - "reference": "81d42148474e1852a333ed7a732f2a014af75430", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a675d2bf04a9328f164910cae6e3918b295151f3", + "reference": "a675d2bf04a9328f164910cae6e3918b295151f3", "shasum": "" }, "require": { @@ -7036,20 +7051,20 @@ "type": "tidelift" } ], - "time": "2020-06-12T11:15:37+00:00" + "time": "2020-07-24T04:10:09+00:00" }, { "name": "symfony/mime", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "c0c418f05e727606e85b482a8591519c4712cf45" + "reference": "149fb0ad35aae3c7637b496b38478797fa6a7ea6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/c0c418f05e727606e85b482a8591519c4712cf45", - "reference": "c0c418f05e727606e85b482a8591519c4712cf45", + "url": "https://api.github.com/repos/symfony/mime/zipball/149fb0ad35aae3c7637b496b38478797fa6a7ea6", + "reference": "149fb0ad35aae3c7637b496b38478797fa6a7ea6", "shasum": "" }, "require": { @@ -7113,20 +7128,20 @@ "type": "tidelift" } ], - "time": "2020-06-09T15:07:35+00:00" + "time": "2020-07-23T10:04:31+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.1.2", + "version": "v5.1.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "663f5dd5e14057d1954fe721f9709d35837f2447" + "reference": "9ff59517938f88d90b6e65311fef08faa640f681" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/663f5dd5e14057d1954fe721f9709d35837f2447", - "reference": "663f5dd5e14057d1954fe721f9709d35837f2447", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/9ff59517938f88d90b6e65311fef08faa640f681", + "reference": "9ff59517938f88d90b6e65311fef08faa640f681", "shasum": "" }, "require": { @@ -7183,7 +7198,7 @@ "type": "tidelift" } ], - "time": "2020-05-23T13:08:13+00:00" + "time": "2020-07-12T12:58:00+00:00" }, { "name": "symfony/polyfill-ctype", @@ -7966,20 +7981,20 @@ }, { "name": "symfony/process", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "c714958428a85c86ab97e3a0c96db4c4f381b7f5" + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/c714958428a85c86ab97e3a0c96db4c4f381b7f5", - "reference": "c714958428a85c86ab97e3a0c96db4c4f381b7f5", + "url": "https://api.github.com/repos/symfony/process/zipball/65e70bab62f3da7089a8d4591fb23fbacacb3479", + "reference": "65e70bab62f3da7089a8d4591fb23fbacacb3479", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.1.3" }, "type": "library", "extra": { @@ -8025,24 +8040,24 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:06:45+00:00" + "time": "2020-07-23T08:31:43+00:00" }, { "name": "symfony/routing", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "0f557911dde75c2a9652b8097bd7c9f54507f646" + "reference": "e103381a4c2f0731c14589041852bf979e97c7af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/0f557911dde75c2a9652b8097bd7c9f54507f646", - "reference": "0f557911dde75c2a9652b8097bd7c9f54507f646", + "url": "https://api.github.com/repos/symfony/routing/zipball/e103381a4c2f0731c14589041852bf979e97c7af", + "reference": "e103381a4c2f0731c14589041852bf979e97c7af", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": ">=7.1.3" }, "conflict": { "symfony/config": "<4.2", @@ -8115,7 +8130,7 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:07:26+00:00" + "time": "2020-07-05T09:39:30+00:00" }, { "name": "symfony/service-contracts", @@ -8195,16 +8210,16 @@ }, { "name": "symfony/translation", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "79d3ef9096a6a6047dbc69218b68c7b7f63193af" + "reference": "a8ea9d97353294eb6783f2894ef8cee99a045822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/79d3ef9096a6a6047dbc69218b68c7b7f63193af", - "reference": "79d3ef9096a6a6047dbc69218b68c7b7f63193af", + "url": "https://api.github.com/repos/symfony/translation/zipball/a8ea9d97353294eb6783f2894ef8cee99a045822", + "reference": "a8ea9d97353294eb6783f2894ef8cee99a045822", "shasum": "" }, "require": { @@ -8281,7 +8296,7 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:06:45+00:00" + "time": "2020-07-23T08:31:43+00:00" }, { "name": "symfony/translation-contracts", @@ -8360,16 +8375,16 @@ }, { "name": "symfony/var-dumper", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "56b3aa5eab0ac6720dcd559fd1d590ce301594ac" + "reference": "2125805a1a4e57f2340bc566c3013ca94d2722dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/56b3aa5eab0ac6720dcd559fd1d590ce301594ac", - "reference": "56b3aa5eab0ac6720dcd559fd1d590ce301594ac", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/2125805a1a4e57f2340bc566c3013ca94d2722dc", + "reference": "2125805a1a4e57f2340bc566c3013ca94d2722dc", "shasum": "" }, "require": { @@ -8447,7 +8462,7 @@ "type": "tidelift" } ], - "time": "2020-05-30T20:06:45+00:00" + "time": "2020-06-24T13:34:53+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -10922,16 +10937,16 @@ }, { "name": "swagger-api/swagger-ui", - "version": "v3.30.1", + "version": "v3.30.2", "source": { "type": "git", "url": "https://github.com/swagger-api/swagger-ui.git", - "reference": "c654d08af86f1eb54b80f16d7ab0087170d56a67" + "reference": "d8521c1bc067cfa57108ecf8f1a513db039ff1da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/c654d08af86f1eb54b80f16d7ab0087170d56a67", - "reference": "c654d08af86f1eb54b80f16d7ab0087170d56a67", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/d8521c1bc067cfa57108ecf8f1a513db039ff1da", + "reference": "d8521c1bc067cfa57108ecf8f1a513db039ff1da", "shasum": "" }, "type": "library", @@ -10975,11 +10990,11 @@ "swagger", "ui" ], - "time": "2020-07-21T19:36:10+00:00" + "time": "2020-07-22T20:37:48+00:00" }, { "name": "symfony/yaml", - "version": "v4.4.10", + "version": "v4.4.11", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/config/auth.php b/config/auth.php index 75a46ab805..dc92eeb0c3 100644 --- a/config/auth.php +++ b/config/auth.php @@ -78,7 +78,6 @@ return [ ], 'contacts' => [ 'driver' => 'eloquent', - 'model' => App\Models\ClientContact::class, ], diff --git a/routes/api.php b/routes/api.php index 1db2f96a6b..2d05c759fe 100644 --- a/routes/api.php +++ b/routes/api.php @@ -24,7 +24,8 @@ Route::group(['api_secret_check', 'email_db'], function () { Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'api/v1', 'as' => 'api.'], function () { Route::get('ping', 'PingController@index')->name('ping'); - + Route::get('health_check', 'PingController@health')->name('health_check'); + Route::resource('activities', 'ActivityController');// name = (clients. index / create / show / update / destroy / edit Route::resource('clients', 'ClientController');// name = (clients. index / create / show / update / destroy / edit diff --git a/tests/Feature/GroupSettingTest.php b/tests/Feature/GroupSettingTest.php new file mode 100644 index 0000000000..d720bd8234 --- /dev/null +++ b/tests/Feature/GroupSettingTest.php @@ -0,0 +1,95 @@ +faker = \Faker\Factory::create(); + + Model::reguard(); + + $this->makeTestData(); + } + + public function testAddGroupSettings() + { + $settings = new \stdClass; + $settings->currency_id = 1; + + $data = [ + 'name' => 'test', + 'settings' => $settings + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/group_settings', $data); + + $response->assertStatus(200); + + $arr = $response->json(); + + $this->assertEquals('test', $arr['data']['name']); + $this->assertEquals(0, $arr['data']['archived_at']); + + } + + + public function testArchiveGroupSettings() + { + $settings = new \stdClass; + $settings->currency_id = 1; + + $data = [ + 'name' => 'test', + 'settings' => $settings + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/group_settings', $data); + + $response->assertStatus(200); + + $arr = $response->json(); + + $data = [ + 'action' => 'archive', + 'ids' => [$arr['data']['id']] + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token, + ])->post('/api/v1/group_settings/bulk', $data); + + $response->assertStatus(200); + + $arr = $response->json(); + + $this->assertNotNull($arr['data']['archived_at']); + } + +} diff --git a/tests/Feature/Shop/ShopInvoiceTest.php b/tests/Feature/Shop/ShopInvoiceTest.php index e921185ff1..e661c9e358 100644 --- a/tests/Feature/Shop/ShopInvoiceTest.php +++ b/tests/Feature/Shop/ShopInvoiceTest.php @@ -7,6 +7,7 @@ use App\Models\CompanyToken; use App\Utils\Traits\MakesHash; use Illuminate\Database\Eloquent\Model; use Illuminate\Routing\Middleware\ThrottleRequests; +use Illuminate\Validation\ValidationException; use Tests\MockAccountData; use Tests\TestCase; @@ -37,21 +38,34 @@ class ShopInvoiceTest extends TestCase $this->withoutExceptionHandling(); } - public function testTokenFailure() + public function testTokenSuccess() { + $this->company->enable_shop_api = true; + $this->company->save(); + $response = null; + + try { + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-COMPANY-KEY' => $this->company->company_key - ])->get('/api/v1/shop/products'); + ])->get('api/v1/shop/products'); + } + catch (ValidationException $e) { + $this->assertNotNull($message); + } $response->assertStatus(200); } - public function testTokenSuccess() + public function testTokenFailure() { + $this->company->enable_shop_api = true; + $this->company->save(); + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-COMPANY-KEY' => $this->company->company_key @@ -63,8 +77,29 @@ class ShopInvoiceTest extends TestCase $arr = $response->json(); } + public function testCompanyEnableShopApiBooleanWorks() + { + try { + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-COMPANY-KEY' => $this->company->company_key + ])->get('api/v1/shop/products'); + } + + catch (ValidationException $e) { + $this->assertNotNull($message); + } + + $response->assertStatus(403); + } + public function testGetByProductKey() { + + $this->company->enable_shop_api = true; + $this->company->save(); + $product = factory(\App\Models\Product::class)->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, @@ -86,6 +121,9 @@ class ShopInvoiceTest extends TestCase public function testGetByClientByContactKey() { + $this->company->enable_shop_api = true; + $this->company->save(); + $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-COMPANY-KEY' => $this->company->company_key @@ -98,4 +136,69 @@ class ShopInvoiceTest extends TestCase $this->assertEquals($this->client->hashed_id, $arr['data']['id']); } + + public function testCreateClientOnShopRoute() + { + + $this->company->enable_shop_api = true; + $this->company->save(); + + + $data = [ + 'name' => 'ShopClient', + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-COMPANY-KEY' => $this->company->company_key + ])->post('/api/v1/shop/clients/', $data); + + + $response->assertStatus(200); + $arr = $response->json(); + + $this->assertEquals('ShopClient', $arr['data']['name']); + + } + + public function testCreateInvoiceOnShopRoute() + { + + $this->company->enable_shop_api = true; + $this->company->save(); + + $data = [ + 'name' => 'ShopClient', + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-COMPANY-KEY' => $this->company->company_key + ])->post('/api/v1/shop/clients/', $data); + + + $response->assertStatus(200); + $arr = $response->json(); + + $client_hashed_id = $arr['data']['id']; + + $invoice_data = [ + 'client_id' => $client_hashed_id, + 'po_number' => 'shop_order' + ]; + + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-COMPANY-KEY' => $this->company->company_key + ])->post('/api/v1/shop/invoices/', $invoice_data); + + + $response->assertStatus(200); + $arr = $response->json(); + + $this->assertEquals('shop_order', $arr['data']['po_number']); + + + } + } diff --git a/tests/Integration/DesignTest.php b/tests/Integration/DesignTest.php index b311d5a1a6..1a4fdd71d6 100644 --- a/tests/Integration/DesignTest.php +++ b/tests/Integration/DesignTest.php @@ -92,7 +92,6 @@ class DesignTest extends TestCase $this->assertNotNull($html); - $this->quote = factory(\App\Models\Invoice::class)->create([ 'user_id' => $this->user->id, 'client_id' => $this->client->id, diff --git a/tests/Integration/SystemHealthTest.php b/tests/Integration/SystemHealthTest.php new file mode 100644 index 0000000000..64b4e4822f --- /dev/null +++ b/tests/Integration/SystemHealthTest.php @@ -0,0 +1,38 @@ +makeTestData(); + } + + public function testSystemHealthRouteAvailable() + { + $response = $this->withHeaders([ + 'X-API-SECRET' => config('ninja.api_secret'), + 'X-API-TOKEN' => $this->token + ])->get('/api/v1/health_check'); + + + $response->assertStatus(200); + } + + +} diff --git a/tests/MockAccountData.php b/tests/MockAccountData.php index 18c02ecc30..35096ddc2f 100644 --- a/tests/MockAccountData.php +++ b/tests/MockAccountData.php @@ -225,6 +225,7 @@ trait MockAccountData $this->quote = $this->quote_calc->getQuote(); $this->quote->number = $this->getNextQuoteNumber($this->client); + $this->quote->service()->createInvitations()->markSent(); $this->quote->setRelation('client', $this->client); $this->quote->setRelation('company', $this->company); @@ -242,6 +243,7 @@ trait MockAccountData $this->credit->save(); + $this->credit->service()->createInvitations()->markSent(); $this->credit_calc = new InvoiceSum($this->credit); $this->credit_calc->build();