mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:47:32 -05:00 
			
		
		
		
	Update v5-dev branch
This commit is contained in:
		
						commit
						25bfe755c4
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -35,3 +35,4 @@ nbproject
 | 
			
		||||
public/test.pdf
 | 
			
		||||
public/storage/test.pdf
 | 
			
		||||
/Modules
 | 
			
		||||
_ide_helper_models.php
 | 
			
		||||
@ -114,12 +114,33 @@ class CreateSingleAccount extends Command
 | 
			
		||||
            'portal_domain' => 'http://ninja.test:8000',
 | 
			
		||||
            'track_inventory' => true
 | 
			
		||||
        ]);
 | 
			
		||||
        $faker = \Faker\Factory::create();
 | 
			
		||||
 | 
			
		||||
        $settings = $company->settings;
 | 
			
		||||
        $settings->invoice_terms = 'Default company invoice terms';
 | 
			
		||||
        $settings->quote_terms = 'Default company quote terms';
 | 
			
		||||
        $settings->invoice_footer = 'Default invoice footer';
 | 
			
		||||
 | 
			
		||||
        $settings->company_logo = 'https://pdf.invoicing.co/favicon-v2.png';
 | 
			
		||||
        $settings->name = $faker->name();
 | 
			
		||||
        $settings->email = $faker->safeEmail();
 | 
			
		||||
        $settings->phone = $faker->phoneNumber();
 | 
			
		||||
        $settings->website = $faker->url();
 | 
			
		||||
 | 
			
		||||
        $settings->address1 = $faker->streetName();
 | 
			
		||||
        $settings->address2 = $faker->streetAddress();
 | 
			
		||||
        $settings->city = $faker->city();
 | 
			
		||||
        $settings->state = $faker->state();
 | 
			
		||||
        $settings->postal_code = $faker->postcode();
 | 
			
		||||
 | 
			
		||||
        $settings->country_id = '840';
 | 
			
		||||
        $settings->vat_number = 'vat number';
 | 
			
		||||
        $settings->id_number = 'id number';
 | 
			
		||||
        $settings->use_credits_payment = 'always';
 | 
			
		||||
        $settings->timezone_id = '1';
 | 
			
		||||
        $settings->entity_send_time = 0;
 | 
			
		||||
        $settings->name = $faker->name();
 | 
			
		||||
 | 
			
		||||
        $company->settings = $settings;
 | 
			
		||||
        $company->client_registration_fields = ClientRegistrationFields::generate();
 | 
			
		||||
        $company->save();
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										65
									
								
								app/Filters/SchedulerFilters.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								app/Filters/SchedulerFilters.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,65 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * Invoice Ninja (https://invoiceninja.com).
 | 
			
		||||
 *
 | 
			
		||||
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
 | 
			
		||||
 *
 | 
			
		||||
 * @license https://www.elastic.co/licensing/elastic-license
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace App\Filters;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Database\Eloquent\Builder;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * SchedulerFilters.
 | 
			
		||||
 */
 | 
			
		||||
class SchedulerFilters extends QueryFilters
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Filter based on search text.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string query filter
 | 
			
		||||
     * @return Builder
 | 
			
		||||
     * @deprecated
 | 
			
		||||
     */
 | 
			
		||||
    public function filter(string $filter = ''): Builder
 | 
			
		||||
    {
 | 
			
		||||
        if (strlen($filter) == 0) {
 | 
			
		||||
            return $this->builder;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return  $this->builder->where(function ($query) use ($filter) {
 | 
			
		||||
            $query->where('name', 'like', '%'.$filter.'%');
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Sorts the list based on $sort.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string sort formatted as column|asc
 | 
			
		||||
     * @return Builder
 | 
			
		||||
     */
 | 
			
		||||
    public function sort(string $sort = ''): Builder
 | 
			
		||||
    {
 | 
			
		||||
        $sort_col = explode('|', $sort);
 | 
			
		||||
 | 
			
		||||
        if (!is_array($sort_col) || count($sort_col) != 2) {
 | 
			
		||||
            return $this->builder;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->builder->orderBy($sort_col[0], $sort_col[1]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Filters the query by the users company ID.
 | 
			
		||||
     *
 | 
			
		||||
     * @return Builder
 | 
			
		||||
     */
 | 
			
		||||
    public function entityFilter(): Builder
 | 
			
		||||
    {
 | 
			
		||||
        return $this->builder->company();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -12,21 +12,24 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Http\Controllers\ClientPortal;
 | 
			
		||||
 | 
			
		||||
use App\Factory\PaymentFactory;
 | 
			
		||||
use App\Http\Controllers\Controller;
 | 
			
		||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
 | 
			
		||||
use App\Models\CompanyGateway;
 | 
			
		||||
use App\Models\Invoice;
 | 
			
		||||
use App\Models\Payment;
 | 
			
		||||
use Illuminate\View\View;
 | 
			
		||||
use App\Models\GatewayType;
 | 
			
		||||
use App\Models\PaymentHash;
 | 
			
		||||
use App\Models\PaymentType;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
use App\Models\CompanyGateway;
 | 
			
		||||
use App\Factory\PaymentFactory;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
use App\Utils\Traits\MakesDates;
 | 
			
		||||
use App\Http\Controllers\Controller;
 | 
			
		||||
use Illuminate\Http\RedirectResponse;
 | 
			
		||||
use Illuminate\Contracts\View\Factory;
 | 
			
		||||
use App\PaymentDrivers\Stripe\BankTransfer;
 | 
			
		||||
use App\Services\ClientPortal\InstantPayment;
 | 
			
		||||
use App\Services\Subscription\SubscriptionService;
 | 
			
		||||
use App\Utils\Traits\MakesDates;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
use Illuminate\Contracts\View\Factory;
 | 
			
		||||
use Illuminate\Http\RedirectResponse;
 | 
			
		||||
use Illuminate\Http\Request;
 | 
			
		||||
use Illuminate\View\View;
 | 
			
		||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class PaymentController.
 | 
			
		||||
@ -56,9 +59,35 @@ class PaymentController extends Controller
 | 
			
		||||
    public function show(Request $request, Payment $payment)
 | 
			
		||||
    {
 | 
			
		||||
        $payment->load('invoices');
 | 
			
		||||
        $bank_details = false;
 | 
			
		||||
        $payment_intent = false;
 | 
			
		||||
        $data = false;
 | 
			
		||||
        $gateway = false;
 | 
			
		||||
 | 
			
		||||
        if($payment->gateway_type_id == GatewayType::DIRECT_DEBIT && $payment->type_id == PaymentType::DIRECT_DEBIT){
 | 
			
		||||
           
 | 
			
		||||
            if (method_exists($payment->company_gateway->driver($payment->client), 'getPaymentIntent')) {
 | 
			
		||||
                $stripe = $payment->company_gateway->driver($payment->client);
 | 
			
		||||
                $payment_intent = $stripe->getPaymentIntent($payment->transaction_reference);
 | 
			
		||||
 | 
			
		||||
                $bt = new BankTransfer($stripe);
 | 
			
		||||
 | 
			
		||||
                match($payment->currency->code){
 | 
			
		||||
                    'MXN' => $data = $bt->formatDataforMx($payment_intent),
 | 
			
		||||
                    'EUR' => $data = $bt->formatDataforEur($payment_intent),
 | 
			
		||||
                    'JPY' => $data = $bt->formatDataforJp($payment_intent),
 | 
			
		||||
                    'GBP' => $data = $bt->formatDataforUk($payment_intent),
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                $gateway = $stripe;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        return $this->render('payments.show', [
 | 
			
		||||
            'payment' => $payment,
 | 
			
		||||
            'bank_details' => $payment_intent ? $data : false,
 | 
			
		||||
            'currency' => strtolower($payment->currency->code),
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,7 +12,8 @@
 | 
			
		||||
namespace App\Http\Controllers;
 | 
			
		||||
 | 
			
		||||
use App\Factory\SchedulerFactory;
 | 
			
		||||
use App\Http\Requests\Task\DestroySchedulerRequest;
 | 
			
		||||
use App\Filters\SchedulerFilters;
 | 
			
		||||
use App\Http\Requests\TaskScheduler\DestroySchedulerRequest;
 | 
			
		||||
use App\Http\Requests\TaskScheduler\CreateSchedulerRequest;
 | 
			
		||||
use App\Http\Requests\TaskScheduler\ShowSchedulerRequest;
 | 
			
		||||
use App\Http\Requests\TaskScheduler\StoreSchedulerRequest;
 | 
			
		||||
@ -58,9 +59,9 @@ class TaskSchedulerController extends BaseController
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     */
 | 
			
		||||
    public function index()
 | 
			
		||||
    public function index(SchedulerFilters $filters)
 | 
			
		||||
    {
 | 
			
		||||
        $schedulers = Scheduler::where('company_id', auth()->user()->company()->id);
 | 
			
		||||
        $schedulers = Scheduler::filter($filters);
 | 
			
		||||
 | 
			
		||||
        return $this->listResponse($schedulers);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadBankIntegrationRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadBankTransactionRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -38,14 +38,15 @@ class StoreClientRequest extends Request
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (isset($this->number)) {
 | 
			
		||||
 | 
			
		||||
@ -38,14 +38,15 @@ class UpdateClientRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        /* Ensure we have a client name, and that all emails are unique*/
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['company_logo'] = 'mimes:jpeg,jpg,png,gif|max:10000';
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadClientRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadCompanyRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -43,14 +43,15 @@ class StoreCreditRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
 | 
			
		||||
 | 
			
		||||
@ -42,14 +42,15 @@ class UpdateCreditRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
        
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->number) {
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadCreditRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -46,6 +46,9 @@ class UpdateExpenseRequest extends Request
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['category_id'] = 'bail|sometimes|nullable|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
 | 
			
		||||
        $rules['transaction_id'] = 'bail|sometimes|nullable|exists:bank_transactions,id,company_id,'.auth()->user()->company()->id;
 | 
			
		||||
        $rules['invoice_id'] = 'bail|sometimes|nullable|exists:invoices,id,company_id,'.auth()->user()->company()->id;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadExpenseRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadGroupSettingRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -37,24 +37,15 @@ class StoreInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->input('file') && is_array($this->input('file'))) {
 | 
			
		||||
            $documents = count($this->input('file'));
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['file.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('file')) {
 | 
			
		||||
            $rules['file'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['client_id'] = 'bail|required|exists:clients,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
 | 
			
		||||
 | 
			
		||||
@ -39,14 +39,15 @@ class UpdateInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['id'] = new LockedInvoiceRule($this->invoice);
 | 
			
		||||
 | 
			
		||||
@ -29,14 +29,22 @@ class UploadInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        }
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->input('file')) {
 | 
			
		||||
            $rules['file'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function prepareForValidation()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -113,14 +113,15 @@ class StorePaymentRequest extends Request
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -38,21 +38,21 @@ class UpdatePaymentRequest extends Request
 | 
			
		||||
        $rules = [
 | 
			
		||||
            'invoices' => ['array', new PaymentAppliedValidAmount, new ValidCreditsPresentRule($this->all())],
 | 
			
		||||
            'invoices.*.invoice_id' => 'distinct',
 | 
			
		||||
            'documents' => 'mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx',
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        if ($this->number) {
 | 
			
		||||
            $rules['number'] = Rule::unique('payments')->where('company_id', auth()->user()->company()->id)->ignore($this->payment->id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadPaymentRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -28,14 +28,15 @@ class StoreProductRequest extends Request
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['cost'] = 'sometimes|numeric';
 | 
			
		||||
 | 
			
		||||
@ -31,14 +31,15 @@ class UpdateProductRequest extends Request
 | 
			
		||||
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        $rules['cost'] = 'numeric';
 | 
			
		||||
 | 
			
		||||
@ -28,9 +28,15 @@ class UploadProductRequest extends Request
 | 
			
		||||
    public function rules()
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,7 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Http\Requests\Project;
 | 
			
		||||
 | 
			
		||||
use App\Models\Project;
 | 
			
		||||
use App\Http\Requests\Request;
 | 
			
		||||
 | 
			
		||||
class CreateProjectRequest extends Request
 | 
			
		||||
@ -22,6 +23,7 @@ class CreateProjectRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize() : bool
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->user()->isAdmin();
 | 
			
		||||
        return auth()->user()->can('create', Project::class);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,6 @@ class DestroyProjectRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize() : bool
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->user()->isAdmin();
 | 
			
		||||
        return auth()->user()->can('edit', $this->project);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ class EditProjectRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize() : bool
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->user()->isAdmin();
 | 
			
		||||
        return auth()->user()->can('edit', $this->project);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,9 @@ class ShowProjectRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize() : bool
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->user()->isAdmin();
 | 
			
		||||
        // return auth()->user()->isAdmin();
 | 
			
		||||
        return auth()->user()->can('view', $this->project);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -42,6 +42,17 @@ class StoreProjectRequest extends Request
 | 
			
		||||
            $rules['number'] = Rule::unique('projects')->where('company_id', auth()->user()->company()->id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,17 @@ class UpdateProjectRequest extends Request
 | 
			
		||||
            $rules['number'] = Rule::unique('projects')->where('company_id', auth()->user()->company()->id)->ignore($this->project->id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadProjectRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,17 @@ class StorePurchaseOrderRequest extends Request
 | 
			
		||||
        $rules['is_amount_discount'] = ['boolean'];
 | 
			
		||||
        $rules['line_items'] = 'array';
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -50,6 +50,17 @@ class UpdatePurchaseOrderRequest extends Request
 | 
			
		||||
        $rules['discount'] = 'sometimes|numeric';
 | 
			
		||||
        $rules['is_amount_discount'] = ['boolean'];
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadPurchaseOrderRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -39,14 +39,15 @@ class StoreQuoteRequest extends Request
 | 
			
		||||
 | 
			
		||||
        $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        $rules['number'] = ['nullable', Rule::unique('quotes')->where('company_id', auth()->user()->company()->id)];
 | 
			
		||||
 | 
			
		||||
@ -37,16 +37,18 @@ class UpdateQuoteRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        if ($this->number) {
 | 
			
		||||
            $rules['number'] = Rule::unique('quotes')->where('company_id', auth()->user()->company()->id)->ignore($this->quote->id);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadQuoteRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
        
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -48,6 +48,17 @@ class StoreRecurringExpenseRequest extends Request
 | 
			
		||||
        $rules['tax_amount2'] = 'numeric';
 | 
			
		||||
        $rules['tax_amount3'] = 'numeric';
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -48,6 +48,17 @@ class UpdateRecurringExpenseRequest extends Request
 | 
			
		||||
        $rules['tax_amount3'] = 'numeric';
 | 
			
		||||
        $rules['category_id'] = 'bail|nullable|sometimes|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadRecurringExpenseRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -38,14 +38,15 @@ class StoreRecurringInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
 | 
			
		||||
 | 
			
		||||
@ -38,14 +38,15 @@ class UpdateRecurringInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($this->number) {
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadRecurringInvoiceRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -37,14 +37,15 @@ class StoreRecurringQuoteRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
        
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
 | 
			
		||||
 | 
			
		||||
@ -37,14 +37,15 @@ class UpdateRecurringQuoteRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents') && is_array($this->input('documents'))) {
 | 
			
		||||
            $documents = count($this->input('documents'));
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
            foreach (range(0, $documents) as $index) {
 | 
			
		||||
                $rules['documents.'.$index] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
            }
 | 
			
		||||
        } elseif ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if ($this->number) {
 | 
			
		||||
 | 
			
		||||
@ -29,8 +29,15 @@ class UploadRecurringQuoteRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ class Request extends FormRequest
 | 
			
		||||
    use MakesHash;
 | 
			
		||||
    use RuntimeFormRequest;
 | 
			
		||||
 | 
			
		||||
    protected $file_validation = 'sometimes|file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:20000';
 | 
			
		||||
    /**
 | 
			
		||||
     * Get the validation rules that apply to the request.
 | 
			
		||||
     *
 | 
			
		||||
@ -124,6 +125,10 @@ class Request extends FormRequest
 | 
			
		||||
            $input['company_gateway_id'] = $this->decodePrimaryKey($input['company_gateway_id']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (array_key_exists('transaction_id', $input) && is_string($input['transaction_id'])) {
 | 
			
		||||
            $input['transaction_id'] = $this->decodePrimaryKey($input['transaction_id']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (array_key_exists('category_id', $input) && is_string($input['category_id'])) {
 | 
			
		||||
            $input['category_id'] = $this->decodePrimaryKey($input['category_id']);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -59,6 +59,17 @@ class StoreTaskRequest extends Request
 | 
			
		||||
            }
 | 
			
		||||
        }];
 | 
			
		||||
        
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,6 @@ class UpdateTaskRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize() : bool
 | 
			
		||||
    {
 | 
			
		||||
        nlog("oioi");
 | 
			
		||||
        //prevent locked tasks from updating
 | 
			
		||||
        if ($this->task->invoice_id && $this->task->company->invoice_task_lock) {
 | 
			
		||||
            return false;
 | 
			
		||||
@ -67,6 +66,17 @@ class UpdateTaskRequest extends Request
 | 
			
		||||
            }
 | 
			
		||||
        }];
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this->globalRules($rules);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,6 @@ class DestroySchedulerRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize() : bool
 | 
			
		||||
    {
 | 
			
		||||
        return auth()->user()->isAdmin();
 | 
			
		||||
        return auth()->user()->isAdmin() && $this->task_scheduler->company_id == auth()->user()->company()->id;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								app/Http/Requests/Vendor/StoreVendorRequest.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								app/Http/Requests/Vendor/StoreVendorRequest.php
									
									
									
									
										vendored
									
									
								
							@ -47,6 +47,16 @@ class StoreVendorRequest extends Request
 | 
			
		||||
        
 | 
			
		||||
        $rules['currency_id'] = 'bail|required|exists:currencies,id';
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								app/Http/Requests/Vendor/UpdateVendorRequest.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								app/Http/Requests/Vendor/UpdateVendorRequest.php
									
									
									
									
										vendored
									
									
								
							@ -44,6 +44,17 @@ class UpdateVendorRequest extends Request
 | 
			
		||||
        $rules['contacts.*.email'] = 'nullable|distinct';
 | 
			
		||||
        $rules['currency_id'] = 'bail|sometimes|exists:currencies,id';
 | 
			
		||||
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								app/Http/Requests/Vendor/UploadVendorRequest.php
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								app/Http/Requests/Vendor/UploadVendorRequest.php
									
									
									
									
										vendored
									
									
								
							@ -29,8 +29,15 @@ class UploadVendorRequest extends Request
 | 
			
		||||
    {
 | 
			
		||||
        $rules = [];
 | 
			
		||||
 | 
			
		||||
        if ($this->input('documents')) {
 | 
			
		||||
            $rules['documents'] = 'file|mimes:csv,png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx|max:2000000';
 | 
			
		||||
        if($this->file('documents') && is_array($this->file('documents')))
 | 
			
		||||
            $rules['documents.*'] = $this->file_validation;
 | 
			
		||||
        elseif($this->file('documents'))
 | 
			
		||||
            $rules['documents'] = $this->file_validation;
 | 
			
		||||
 | 
			
		||||
        if ($this->file('file') && is_array($this->file('file'))) {
 | 
			
		||||
            $rules['file.*'] = $this->file_validation;
 | 
			
		||||
        } elseif ($this->file('file')) {
 | 
			
		||||
            $rules['file'] = $this->file_validation;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $rules;
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
 | 
			
		||||
class Scheduler extends BaseModel
 | 
			
		||||
{
 | 
			
		||||
    use SoftDeletes;
 | 
			
		||||
    use Filterable;
 | 
			
		||||
    
 | 
			
		||||
    protected $fillable = [
 | 
			
		||||
        'name',
 | 
			
		||||
 | 
			
		||||
@ -12,16 +12,17 @@
 | 
			
		||||
 | 
			
		||||
namespace App\PaymentDrivers\Stripe;
 | 
			
		||||
 | 
			
		||||
use App\Models\Payment;
 | 
			
		||||
use App\Models\SystemLog;
 | 
			
		||||
use Stripe\PaymentIntent;
 | 
			
		||||
use App\Models\GatewayType;
 | 
			
		||||
use App\Models\PaymentType;
 | 
			
		||||
use App\Jobs\Util\SystemLogger;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
use App\Exceptions\PaymentFailed;
 | 
			
		||||
use App\PaymentDrivers\StripePaymentDriver;
 | 
			
		||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
 | 
			
		||||
use App\Jobs\Util\SystemLogger;
 | 
			
		||||
use App\Models\GatewayType;
 | 
			
		||||
use App\Models\Payment;
 | 
			
		||||
use App\Models\PaymentType;
 | 
			
		||||
use App\Models\SystemLog;
 | 
			
		||||
use App\PaymentDrivers\StripePaymentDriver;
 | 
			
		||||
use App\Utils\Number;
 | 
			
		||||
use App\Utils\Traits\MakesHash;
 | 
			
		||||
use Stripe\PaymentIntent;
 | 
			
		||||
 | 
			
		||||
class BankTransfer
 | 
			
		||||
{
 | 
			
		||||
@ -79,14 +80,12 @@ class BankTransfer
 | 
			
		||||
     */
 | 
			
		||||
    private function resolveBankType()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        return match($this->stripe->client->currency()->code){
 | 
			
		||||
        return match ($this->stripe->client->currency()->code) {
 | 
			
		||||
            'GBP' =>  ['type' => 'gb_bank_transfer'],
 | 
			
		||||
            'EUR' => ['type' => 'eu_bank_transfer', 'eu_bank_transfer' => ['country' => $this->stripe->client->country->iso_3166_2]],
 | 
			
		||||
            'JPY' => ['type' => 'jp_bank_transfer'],
 | 
			
		||||
            'MXN' => ['type' =>'mx_bank_transfer'],
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
@ -104,58 +103,144 @@ class BankTransfer
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * paymentResponse
 | 
			
		||||
     *
 | 
			
		||||
     * @param  mixed $request
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function paymentResponse(PaymentResponseRequest $request)
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        $this->stripe->init();
 | 
			
		||||
 | 
			
		||||
        $this->stripe->setPaymentHash($request->getPaymentHash());
 | 
			
		||||
        $this->stripe->client = $this->stripe->payment_hash->fee_invoice->client;
 | 
			
		||||
 | 
			
		||||
        if($request->payment_intent){
 | 
			
		||||
 | 
			
		||||
        if ($request->payment_intent) {
 | 
			
		||||
            $pi = \Stripe\PaymentIntent::retrieve(
 | 
			
		||||
                $request->payment_intent,
 | 
			
		||||
                $this->stripe->stripe_connect_auth
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            if (in_array($pi->status, ['succeeded', 'processing'])) {
 | 
			
		||||
                return $this->processSuccesfulRedirect($pi);
 | 
			
		||||
                $payment = $this->processSuccesfulRedirect($pi);
 | 
			
		||||
                redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            /*  Create a pending payment */
 | 
			
		||||
            if($pi->status == 'requires_action') {
 | 
			
		||||
            if ($pi->status == 'requires_action' && $pi->next_action->type == 'display_bank_transfer_instructions') {
 | 
			
		||||
                match ($pi->next_action->display_bank_transfer_instructions->currency) {
 | 
			
		||||
                    'mxn' => $data['bank_details'] = $this->formatDataforMx($pi),
 | 
			
		||||
                    'gbp' => $data['bank_details'] = $this->formatDataforUk($pi),
 | 
			
		||||
                    'eur' => $data['bank_details'] = $this->formatDataforEur($pi),
 | 
			
		||||
                    'jpy' => $data['bank_details'] = $this->formatDataforJp($pi),
 | 
			
		||||
                };
 | 
			
		||||
                
 | 
			
		||||
                $data = [
 | 
			
		||||
                    'payment_method' => $pi->payment_method,
 | 
			
		||||
                    'payment_type' => PaymentType::DIRECT_DEBIT,
 | 
			
		||||
                    'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
 | 
			
		||||
                    'transaction_reference' => $pi->id,
 | 
			
		||||
                    'gateway_type_id' => GatewayType::DIRECT_DEBIT,
 | 
			
		||||
 | 
			
		||||
                ];
 | 
			
		||||
 | 
			
		||||
                $payment = $this->stripe->createPayment($data, Payment::STATUS_PENDING);
 | 
			
		||||
 | 
			
		||||
                SystemLogger::dispatch(
 | 
			
		||||
                    ['response' => $this->stripe->payment_hash->data, 'data' => $data],
 | 
			
		||||
                    SystemLog::CATEGORY_GATEWAY_RESPONSE,
 | 
			
		||||
                    SystemLog::EVENT_GATEWAY_SUCCESS,
 | 
			
		||||
                    SystemLog::TYPE_STRIPE,
 | 
			
		||||
                    $this->stripe->client,
 | 
			
		||||
                    $this->stripe->client->company,
 | 
			
		||||
                );
 | 
			
		||||
 | 
			
		||||
                return redirect($pi->next_action->display_bank_transfer_instructions->hosted_instructions_url);
 | 
			
		||||
                $payment = $this->processSuccesfulRedirect($pi);
 | 
			
		||||
 | 
			
		||||
                return render('gateways.stripe.bank_transfer.bank_details_container', $data);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return $this->processUnsuccesfulRedirect();
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public function processSuccesfulRedirect($payment_intent)
 | 
			
		||||
    /**
 | 
			
		||||
     * formatDataForUk
 | 
			
		||||
     *
 | 
			
		||||
     * @param  PaymentIntent $pi
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function formatDataForUk(PaymentIntent $pi): array
 | 
			
		||||
    {
 | 
			
		||||
        return  [
 | 
			
		||||
                    'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
 | 
			
		||||
                    'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_holder_name,
 | 
			
		||||
                    'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->account_number,
 | 
			
		||||
                    'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->sort_code->sort_code,
 | 
			
		||||
                    'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
 | 
			
		||||
                    'description' => $pi->description,
 | 
			
		||||
                    'gateway'   => $this->stripe->company_gateway,
 | 
			
		||||
                    'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
 | 
			
		||||
 | 
			
		||||
                ];
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * formatDataforMx
 | 
			
		||||
     *
 | 
			
		||||
     * @param  PaymentIntent $pi
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function formatDataforMx(PaymentIntent $pi): array
 | 
			
		||||
    {
 | 
			
		||||
        return  [
 | 
			
		||||
                    'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
 | 
			
		||||
                    'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->spei->bank_name,
 | 
			
		||||
                    'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->spei->bank_code,
 | 
			
		||||
                    'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->spei->clabe,
 | 
			
		||||
                    'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
 | 
			
		||||
                    'description' => $pi->description,
 | 
			
		||||
                    'gateway'   => $this->stripe->company_gateway,
 | 
			
		||||
                    'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
 | 
			
		||||
 | 
			
		||||
                ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * formatDataforEur
 | 
			
		||||
     *
 | 
			
		||||
     * @param  mixed $pi
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function formatDataforEur(PaymentIntent $pi): array
 | 
			
		||||
    {
 | 
			
		||||
        return  [
 | 
			
		||||
                    'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
 | 
			
		||||
                    'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->iban->account_holder_name,
 | 
			
		||||
                    'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->iban->iban,
 | 
			
		||||
                    'sort_code' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->iban->bic,
 | 
			
		||||
                    'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
 | 
			
		||||
                    'description' => $pi->description,
 | 
			
		||||
                    'gateway'   => $this->stripe->company_gateway,
 | 
			
		||||
                    'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
 | 
			
		||||
 | 
			
		||||
                ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param PaymentIntent $pi
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function formatDataforJp(PaymentIntent $pi): array
 | 
			
		||||
    {
 | 
			
		||||
        return  [
 | 
			
		||||
                    'amount' => Number::formatMoney($this->stripe->convertFromStripeAmount($pi->next_action->display_bank_transfer_instructions->amount_remaining, $this->stripe->client->currency()->precision, $this->stripe->client->currency()), $this->stripe->client),
 | 
			
		||||
                    'account_holder_name' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->account_holder_name,
 | 
			
		||||
                    'account_number' => $pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->account_number,
 | 
			
		||||
                    'account_type' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->account_type,
 | 
			
		||||
                    'bank_code' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->bank_code,
 | 
			
		||||
                    'bank_name' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->bank_name,
 | 
			
		||||
                    'branch_code' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->branch_code,
 | 
			
		||||
                    'branch_name' =>$pi->next_action->display_bank_transfer_instructions->financial_addresses[0]->zengin->branch_name,
 | 
			
		||||
                    'reference' => $pi->next_action->display_bank_transfer_instructions->reference,
 | 
			
		||||
                    'description' => $pi->description,
 | 
			
		||||
                    'gateway'   => $this->stripe->company_gateway,
 | 
			
		||||
                    'currency' => $pi->next_action->display_bank_transfer_instructions->currency,
 | 
			
		||||
 | 
			
		||||
                ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * processSuccesfulRedirect
 | 
			
		||||
     *
 | 
			
		||||
     * @param  PaymentIntent $payment_intent
 | 
			
		||||
     * @return Payment
 | 
			
		||||
     */
 | 
			
		||||
    public function processSuccesfulRedirect(PaymentIntent $payment_intent): Payment
 | 
			
		||||
    {
 | 
			
		||||
        $this->stripe->init();
 | 
			
		||||
 | 
			
		||||
@ -168,7 +253,7 @@ class BankTransfer
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        $payment = $this->stripe->createPayment($data, $payment_intent->status == 'processing' ? Payment::STATUS_PENDING : Payment::STATUS_COMPLETED);
 | 
			
		||||
        $payment = $this->stripe->createPayment($data, $payment_intent->status == 'succeeded' ?  Payment::STATUS_COMPLETED : Payment::STATUS_PENDING);
 | 
			
		||||
 | 
			
		||||
        SystemLogger::dispatch(
 | 
			
		||||
            ['response' => $this->stripe->payment_hash->data, 'data' => $data],
 | 
			
		||||
@ -179,9 +264,14 @@ class BankTransfer
 | 
			
		||||
            $this->stripe->client->company,
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
 | 
			
		||||
        return  $payment;
 | 
			
		||||
    }
 | 
			
		||||
            
 | 
			
		||||
    /**
 | 
			
		||||
     * processUnsuccesfulRedirect
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function processUnsuccesfulRedirect()
 | 
			
		||||
    {
 | 
			
		||||
        $server_response = $this->stripe->payment_hash->data;
 | 
			
		||||
@ -204,6 +294,4 @@ class BankTransfer
 | 
			
		||||
 | 
			
		||||
        throw new PaymentFailed('Failed to process the payment.', 500);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -52,7 +52,6 @@ use App\PaymentDrivers\Stripe\PRZELEWY24;
 | 
			
		||||
use App\PaymentDrivers\Stripe\BankTransfer;
 | 
			
		||||
use App\PaymentDrivers\Stripe\Connect\Verify;
 | 
			
		||||
use App\PaymentDrivers\Stripe\ImportCustomers;
 | 
			
		||||
use App\PaymentDrivers\Stripe\UpdatePaymentMethods;
 | 
			
		||||
use App\Http\Requests\Payments\PaymentWebhookRequest;
 | 
			
		||||
use Laracasts\Presenter\Exceptions\PresenterException;
 | 
			
		||||
use App\PaymentDrivers\Stripe\Jobs\PaymentIntentWebhook;
 | 
			
		||||
@ -155,7 +154,7 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
 | 
			
		||||
        if ($this->client
 | 
			
		||||
            && isset($this->client->country)
 | 
			
		||||
            && in_array($this->client->country->iso_3166_3, ['USA'])
 | 
			
		||||
            && (in_array($this->client->country->iso_3166_3, ['USA']) || ($this->client->gateway_tokens()->where('gateway_type_id', GatewayType::BANK_TRANSFER)->exists()))
 | 
			
		||||
        ) {
 | 
			
		||||
            $types[] = GatewayType::BANK_TRANSFER;
 | 
			
		||||
        }
 | 
			
		||||
@ -261,7 +260,12 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
        if (
 | 
			
		||||
            $this->client
 | 
			
		||||
            && isset($this->client->country)
 | 
			
		||||
            && in_array($this->client->country->iso_3166_2, ['FR', 'IE', 'NL', 'GB', 'DE', 'ES', 'JP', 'MX'])
 | 
			
		||||
            && (
 | 
			
		||||
                (in_array($this->client->country->iso_3166_2, ['FR', 'IE', 'NL', 'DE', 'ES']) && $this->client->currency()->code == 'EUR') ||
 | 
			
		||||
                ($this->client->country->iso_3166_2 == 'JP' && $this->client->currency()->code == 'JPY') ||
 | 
			
		||||
                ($this->client->country->iso_3166_2 == 'MX' && $this->client->currency()->code == 'MXN') ||
 | 
			
		||||
                ($this->client->country->iso_3166_2 == 'GB' && $this->client->currency()->code == 'GBP')
 | 
			
		||||
            )
 | 
			
		||||
        ) {
 | 
			
		||||
            $types[] = GatewayType::DIRECT_DEBIT;
 | 
			
		||||
        }
 | 
			
		||||
@ -434,6 +438,17 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
        return PaymentIntent::create($data, array_merge($meta, ['idempotency_key' => uniqid("st", true)]));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getPaymentIntent($payment_intent_id): ?PaymentIntent
 | 
			
		||||
    {
 | 
			
		||||
        $this->init();
 | 
			
		||||
 | 
			
		||||
         return PaymentIntent::retrieve(
 | 
			
		||||
                $payment_intent_id,
 | 
			
		||||
                $this->stripe_connect_auth
 | 
			
		||||
            );
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns a setup intent that allows the user
 | 
			
		||||
     * to enter card details without initiating a transaction.
 | 
			
		||||
@ -843,15 +858,6 @@ class StripePaymentDriver extends BaseDriver
 | 
			
		||||
        $this->client = ClientGatewayToken::where('gateway_customer_reference', $customer)->client;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Pull all client payment methods and update
 | 
			
		||||
     * the respective tokens in the system.
 | 
			
		||||
     */
 | 
			
		||||
    public function updateAllPaymentMethods()
 | 
			
		||||
    {
 | 
			
		||||
        return (new UpdatePaymentMethods($this))->run();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Imports stripe customers and their payment methods
 | 
			
		||||
     * Matches users in the system based on the $match_on_record
 | 
			
		||||
 | 
			
		||||
@ -840,8 +840,8 @@ class Design extends BaseDesign
 | 
			
		||||
                    ['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']],
 | 
			
		||||
                ]],
 | 
			
		||||
                ['element' => 'img', 'properties' => ['style' => 'max-width: 50%; height: auto;', 'src' => '$contact.signature', 'id' => 'contact-signature']],
 | 
			
		||||
                ['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start; page-break-inside: auto;'], 'elements' => [
 | 
			
		||||
                    ['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
 | 
			
		||||
                ['element' => 'div', 'properties' => ['style' => 'display: flex; align-items: flex-start; page-break-inside: auto;'], 'elements' => [
 | 
			
		||||
                    ['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'height: 2.5rem; margin-top: 1.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
 | 
			
		||||
                ]],
 | 
			
		||||
            ]],
 | 
			
		||||
            ['element' => 'div', 'properties' => ['class' => 'totals-table-right-side', 'dir' => '$dir'], 'elements' => []],
 | 
			
		||||
 | 
			
		||||
@ -152,7 +152,7 @@ class HtmlEngine
 | 
			
		||||
        $data['$payment_button'] = ['value' => $this->buildViewButton($this->invitation->getPaymentLink(), ctrans('texts.pay_now')), 'label' => ctrans('texts.pay_now')];
 | 
			
		||||
        $data['$payment_link'] = ['value' => $this->invitation->getPaymentLink(), 'label' => ctrans('texts.pay_now')];
 | 
			
		||||
        $data['$payment_qrcode'] = ['value' => $this->invitation->getPaymentQrCode(), 'label' => ctrans('texts.pay_now')];
 | 
			
		||||
 | 
			
		||||
        $data['$exchange_rate'] = ['value' => $this->entity->exchange_rate ?: ' ', 'label' => ctrans('texts.exchange_rate')];
 | 
			
		||||
 | 
			
		||||
        if ($this->entity_string == 'invoice' || $this->entity_string == 'recurring_invoice') {
 | 
			
		||||
            $data['$entity'] = ['value' => '', 'label' => ctrans('texts.invoice')];
 | 
			
		||||
 | 
			
		||||
@ -32,6 +32,7 @@ class SystemHealth
 | 
			
		||||
        'mbstring',
 | 
			
		||||
        'xml',
 | 
			
		||||
        'bcmath',
 | 
			
		||||
        'iconv',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    private static $php_version = 8.1;
 | 
			
		||||
 | 
			
		||||
@ -117,6 +117,62 @@ class RandomDataSeeder extends Seeder
 | 
			
		||||
            'settings' => null,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $user = User::firstOrNew([
 | 
			
		||||
            'email' => 'user@example.com',
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $user->password = Hash::make('password');
 | 
			
		||||
        $user->account_id = $account->id;
 | 
			
		||||
        $user->email_verified_at = now();
 | 
			
		||||
        $user->save();
 | 
			
		||||
 | 
			
		||||
        $user->companies()->attach($company->id, [
 | 
			
		||||
            'account_id' => $account->id,
 | 
			
		||||
            'is_owner' => 1,
 | 
			
		||||
            'is_admin' => 1,
 | 
			
		||||
            'is_locked' => 0,
 | 
			
		||||
            'notifications' => CompanySettings::notificationDefaults(),
 | 
			
		||||
            'permissions' => '',
 | 
			
		||||
            'settings' => null,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $company_token = CompanyToken::create([
 | 
			
		||||
            'user_id' => $user->id,
 | 
			
		||||
            'company_id' => $company->id,
 | 
			
		||||
            'account_id' => $account->id,
 | 
			
		||||
            'name' => 'test token',
 | 
			
		||||
            'token' => \Illuminate\Support\Str::random(64),
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $user = User::firstOrNew([
 | 
			
		||||
            'email' => 'permissions@example.com',
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $user->password = Hash::make('password');
 | 
			
		||||
        $user->account_id = $account->id;
 | 
			
		||||
        $user->email_verified_at = now();
 | 
			
		||||
        $user->save();
 | 
			
		||||
 | 
			
		||||
        $company_token = CompanyToken::create([
 | 
			
		||||
            'user_id' => $user->id,
 | 
			
		||||
            'company_id' => $company->id,
 | 
			
		||||
            'account_id' => $account->id,
 | 
			
		||||
            'name' => 'test token',
 | 
			
		||||
            'token' => \Illuminate\Support\Str::random(64),
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        $user->companies()->attach($company->id, [
 | 
			
		||||
            'account_id' => $account->id,
 | 
			
		||||
            'is_owner' => 0,
 | 
			
		||||
            'is_admin' => 0,
 | 
			
		||||
            'is_locked' => 0,
 | 
			
		||||
            'notifications' => CompanySettings::notificationDefaults(),
 | 
			
		||||
            'permissions' => '',
 | 
			
		||||
            'settings' => null,
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $client = Client::factory()->create([
 | 
			
		||||
                'user_id' => $user->id,
 | 
			
		||||
                'company_id' => $company->id,
 | 
			
		||||
 | 
			
		||||
@ -5001,6 +5001,13 @@ $LANG = array(
 | 
			
		||||
    'gateway_payment_text_no_invoice' => 'Payment with no invoice for amount :amount for client :client',
 | 
			
		||||
    'click_to_variables' => 'Client here to see all variables.',
 | 
			
		||||
    'ship_to' => 'Ship to',
 | 
			
		||||
    'stripe_direct_debit_details' => 'Please transfer into the nominated bank account above.',
 | 
			
		||||
    'branch_name' => 'Branch Name',
 | 
			
		||||
    'branch_code' => 'Branch Code',
 | 
			
		||||
    'bank_name' => 'Bank Name',
 | 
			
		||||
    'bank_code' => 'Bank Code',
 | 
			
		||||
    'bic' => 'BIC',
 | 
			
		||||
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										4
									
								
								public/flutter_service_worker.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								public/flutter_service_worker.js
									
									
									
									
										vendored
									
									
								
							@ -298,8 +298,8 @@ const RESOURCES = {
 | 
			
		||||
"assets/NOTICES": "1a34e70168d56fad075adfb4bdbb20eb",
 | 
			
		||||
"assets/fonts/MaterialIcons-Regular.otf": "95db9098c58fd6db106f1116bae85a0b",
 | 
			
		||||
"assets/AssetManifest.json": "759f9ef9973f7e26c2a51450b55bb9fa",
 | 
			
		||||
"/": "384d4eeaffc3b89569c9be891a7fb2fd",
 | 
			
		||||
"main.dart.js": "13599a5a8e48bf01695e00ebafc2bbd1",
 | 
			
		||||
"/": "f935af908f5ebe2ec18aef350de81f6c",
 | 
			
		||||
"main.dart.js": "92c2392e1b819b43c76072ddda82f371",
 | 
			
		||||
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
 | 
			
		||||
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										287841
									
								
								public/main.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										287841
									
								
								public/main.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										277037
									
								
								public/main.foss.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										277037
									
								
								public/main.foss.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										21500
									
								
								public/main.profile.dart.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21500
									
								
								public/main.profile.dart.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -0,0 +1,221 @@
 | 
			
		||||
 | 
			
		||||
<div class="mt-4 overflow-hidden bg-white shadow sm:rounded-lg">
 | 
			
		||||
    <div class="px-4 py-5 border-b border-gray-200 sm:px-6">
 | 
			
		||||
        <h3 class="text-lg font-medium leading-6 text-gray-900">
 | 
			
		||||
            {{ ctrans('texts.bank_transfer') }}
 | 
			
		||||
        </h3>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="container mx-auto">
 | 
			
		||||
        <div class="px-4 py-5 bg-white sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
 | 
			
		||||
 | 
			
		||||
        @if($bank_details['currency'] == 'gbp')
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.sort') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['sort_code'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
            
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_number') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_number'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_name') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_holder_name'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.reference') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['reference'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.balance_due') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['amount'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ ctrans('texts.stripe_direct_debit_details') }}
 | 
			
		||||
            </dd>
 | 
			
		||||
            
 | 
			
		||||
            @elseif($bank_details['currency'] == 'mxn')
 | 
			
		||||
            
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                Clabe
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['sort_code'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_number') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_number'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_name') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_holder_name'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.reference') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['reference'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.balance_due') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['amount'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ ctrans('texts.stripe_direct_debit_details') }}
 | 
			
		||||
            </dd>
 | 
			
		||||
            
 | 
			
		||||
            @elseif($bank_details['currency'] == 'jpy')
 | 
			
		||||
            
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_number') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_number'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_name') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_holder_name'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.account_type') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['account_type'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.bank_name') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['bank_name'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.bank_code') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['bank_code'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.branch_name') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['branch_name'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.branch_code') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['branch_code'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.reference') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['reference'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                {{ ctrans('texts.balance_due') }}
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ $bank_details['amount'] }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
            </dt>
 | 
			
		||||
            <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                {{ ctrans('texts.stripe_direct_debit_details') }}
 | 
			
		||||
            </dd>
 | 
			
		||||
 | 
			
		||||
        @elseif($bank_details['currency'] == 'eur')
 | 
			
		||||
 | 
			
		||||
            <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                    {{ ctrans('texts.account_name') }}
 | 
			
		||||
                </dt>
 | 
			
		||||
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                    {{ $bank_details['account_holder_name'] }}
 | 
			
		||||
                </dd>
 | 
			
		||||
 | 
			
		||||
                <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                    {{ ctrans('texts.account_number') }}
 | 
			
		||||
                </dt>
 | 
			
		||||
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                    {{ $bank_details['account_number'] }}
 | 
			
		||||
                </dd>
 | 
			
		||||
 | 
			
		||||
                <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                    {{ ctrans('texts.bic') }}
 | 
			
		||||
                </dt>
 | 
			
		||||
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                    {{ $bank_details['sort_code'] }}
 | 
			
		||||
                </dd>
 | 
			
		||||
 | 
			
		||||
                <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                    {{ ctrans('texts.reference') }}
 | 
			
		||||
                </dt>
 | 
			
		||||
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                    {{ $bank_details['reference'] }}
 | 
			
		||||
                </dd>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                    {{ ctrans('texts.balance_due') }}
 | 
			
		||||
                </dt>
 | 
			
		||||
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                    {{ $bank_details['amount'] }}
 | 
			
		||||
                </dd>
 | 
			
		||||
 | 
			
		||||
                <dt class="text-sm font-medium leading-5 text-gray-500">
 | 
			
		||||
                </dt>
 | 
			
		||||
                <dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
 | 
			
		||||
                    {{ ctrans('texts.stripe_direct_debit_details') }}
 | 
			
		||||
                </dd>
 | 
			
		||||
 | 
			
		||||
            @endif
 | 
			
		||||
                
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
</div>
 | 
			
		||||
@ -0,0 +1,5 @@
 | 
			
		||||
@extends('portal.ninja2020.layout.app')
 | 
			
		||||
 | 
			
		||||
@section('meta_title', ctrans('texts.bank_transfer'))
 | 
			
		||||
 | 
			
		||||
@include('portal.ninja2020.gateways.stripe.bank_transfer.bank_details')
 | 
			
		||||
@ -17,7 +17,7 @@
 | 
			
		||||
    <form action="{{ route('client.payments.response') }}" method="post" id="payment-form">
 | 
			
		||||
        @csrf
 | 
			
		||||
    
 | 
			
		||||
    <div id="payment-element">
 | 
			
		||||
    <div id="payment-element" style="padding:40px;">
 | 
			
		||||
        <!-- Elements will create form elements here -->
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
@ -46,16 +46,19 @@
 | 
			
		||||
<script>
 | 
			
		||||
    const options = {
 | 
			
		||||
        clientSecret: '{{ $client_secret }}',
 | 
			
		||||
            style: {
 | 
			
		||||
                base: {
 | 
			
		||||
                    padding: '10px 12px',
 | 
			
		||||
                    color: '#32325d',
 | 
			
		||||
                    fontSize: '16px',
 | 
			
		||||
                    '::placeholder': {
 | 
			
		||||
                        color: '#aab7c4'
 | 
			
		||||
                    },
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
        appearance : {
 | 
			
		||||
            theme: 'stripe',
 | 
			
		||||
            variables: {
 | 
			
		||||
                colorPrimary: '#0570de',
 | 
			
		||||
                colorBackground: '#ffffff',
 | 
			
		||||
                colorText: '#30313d',
 | 
			
		||||
                colorDanger: '#df1b41',
 | 
			
		||||
                fontFamily: 'Ideal Sans, system-ui, sans-serif',
 | 
			
		||||
                spacingUnit: '2px',
 | 
			
		||||
                borderRadius: '4px',
 | 
			
		||||
                // See all possible variables below
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,6 @@
 | 
			
		||||
        $token_billing_string = 'false';
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
@endphp
 | 
			
		||||
 | 
			
		||||
@section('gateway_head')
 | 
			
		||||
 | 
			
		||||
@ -122,6 +122,12 @@
 | 
			
		||||
                    @endforeach
 | 
			
		||||
                </dl>
 | 
			
		||||
            </div>
 | 
			
		||||
            
 | 
			
		||||
                <!-- if this is a stripe bank transfer - show the required details here: -->
 | 
			
		||||
        </div>
 | 
			
		||||
            @if($bank_details)
 | 
			
		||||
                    @include('portal.ninja2020.gateways.stripe.bank_transfer.bank_details')
 | 
			
		||||
                @endif
 | 
			
		||||
            
 | 
			
		||||
    </div>
 | 
			
		||||
@endsection
 | 
			
		||||
 | 
			
		||||
@ -54,7 +54,31 @@ class SchedulerTest extends TestCase
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testSchedulerGet3()
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        $scheduler = SchedulerFactory::create($this->company->id, $this->user->id);
 | 
			
		||||
        $scheduler->name = "hello";
 | 
			
		||||
        $scheduler->save();
 | 
			
		||||
 | 
			
		||||
        $scheduler = SchedulerFactory::create($this->company->id, $this->user->id);
 | 
			
		||||
        $scheduler->name = "goodbye";
 | 
			
		||||
        $scheduler->save();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        $response = $this->withHeaders([
 | 
			
		||||
            'X-API-SECRET' => config('ninja.api_secret'),
 | 
			
		||||
            'X-API-TOKEN' => $this->token,
 | 
			
		||||
        ])->get('/api/v1/task_schedulers?filter=hello');
 | 
			
		||||
 | 
			
		||||
        $response->assertStatus(200);
 | 
			
		||||
 | 
			
		||||
        $arr = $response->json();
 | 
			
		||||
 | 
			
		||||
        $this->assertEquals('hello', $arr['data'][0]['name']);
 | 
			
		||||
        $this->assertCount(1, $arr['data']);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function testSchedulerGet2()
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user