mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	Merge pull request #7317 from turbo124/v5-develop
Fixes for queues trying to call SQS
This commit is contained in:
		
						commit
						13a506b306
					
				@ -43,7 +43,6 @@ class S3Cleanup extends Command
 | 
				
			|||||||
    public function handle()
 | 
					    public function handle()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if(!Ninja::isHosted())
 | 
					        if(!Ninja::isHosted())
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,7 @@ class Kernel extends ConsoleKernel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if(config('queue.default') == 'database' && Ninja::isSelfHost() && config('ninja.internal_queue_enabled') && !config('ninja.is_docker')) {
 | 
					        if(config('queue.default') == 'database' && Ninja::isSelfHost() && config('ninja.internal_queue_enabled') && !config('ninja.is_docker')) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $schedule->command('queue:work')->everyMinute()->withoutOverlapping();
 | 
					            $schedule->command('queue:work database --stop-when-empty')->everyMinute()->withoutOverlapping();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping(); 
 | 
					            $schedule->command('queue:restart')->everyFiveMinutes()->withoutOverlapping(); 
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
				
			|||||||
@ -18,12 +18,15 @@ use App\Http\Requests\ClientPortal\RegisterRequest;
 | 
				
			|||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
 | 
					use App\Utils\Traits\GeneratesCounter;
 | 
				
			||||||
use Illuminate\Support\Facades\Auth;
 | 
					use Illuminate\Support\Facades\Auth;
 | 
				
			||||||
use Illuminate\Support\Facades\Hash;
 | 
					use Illuminate\Support\Facades\Hash;
 | 
				
			||||||
use Illuminate\Support\Facades\App;
 | 
					use Illuminate\Support\Facades\App;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ContactRegisterController extends Controller
 | 
					class ContactRegisterController extends Controller
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    use GeneratesCounter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function __construct()
 | 
					    public function __construct()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->middleware(['guest']);
 | 
					        $this->middleware(['guest']);
 | 
				
			||||||
@ -61,6 +64,16 @@ class ContactRegisterController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $client->fill($data);
 | 
					        $client->fill($data);
 | 
				
			||||||
        $client->save();
 | 
					        $client->save();
 | 
				
			||||||
 | 
					        $client->number = $this->getNextClientNumber($client);
 | 
				
			||||||
 | 
					        $client->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if(!$client->country_id && strlen($client->company->settings->country_id) > 1){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $client->update(['country_id' => $client->company->settings->country_id]);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->getClientContact($data, $client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $client;
 | 
					        return $client;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -141,7 +141,7 @@ class SelfUpdateController extends BaseController
 | 
				
			|||||||
            if(strpos($file->getPathname(), '.git') !== false)
 | 
					            if(strpos($file->getPathname(), '.git') !== false)
 | 
				
			||||||
                continue;
 | 
					                continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // nlog($file->getPathname());
 | 
					            //nlog($file->getPathname());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($file->isFile() && ! $file->isWritable()) {
 | 
					            if ($file->isFile() && ! $file->isWritable()) {
 | 
				
			||||||
                // throw new FilePermissionsFailure($file);
 | 
					                // throw new FilePermissionsFailure($file);
 | 
				
			||||||
 | 
				
			|||||||
@ -44,30 +44,36 @@ class ContactRegister
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $query = [
 | 
					        if(Ninja::isHosted())
 | 
				
			||||||
            'portal_domain' => $request->getSchemeAndHttpHost(),
 | 
					 | 
				
			||||||
            'portal_mode' => 'domain',
 | 
					 | 
				
			||||||
        ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if($company = Company::where($query)->first())
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            $query = [
 | 
				
			||||||
 | 
					                'portal_domain' => $request->getSchemeAndHttpHost(),
 | 
				
			||||||
 | 
					                'portal_mode' => 'domain',
 | 
				
			||||||
 | 
					            ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(! $company->client_can_register)
 | 
					            if($company = Company::where($query)->first())
 | 
				
			||||||
                abort(400, 'Registration disabled');
 | 
					            {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
           // $request->merge(['key' => $company->company_key]);
 | 
					                if(! $company->client_can_register)
 | 
				
			||||||
            session()->put('company_key', $company->company_key);
 | 
					                    abort(400, 'Registration disabled');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					               // $request->merge(['key' => $company->company_key]);
 | 
				
			||||||
 | 
					                session()->put('company_key', $company->company_key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return $next($request);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return $next($request);
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // For self-hosted platforms with multiple companies, resolving is done using company key
 | 
					        // For self-hosted platforms with multiple companies, resolving is done using company key
 | 
				
			||||||
        // if it doesn't resolve using a domain.
 | 
					        // if it doesn't resolve using a domain.
 | 
				
			||||||
        if ($request->route()->parameter('company_key') && Ninja::isSelfHost()) {
 | 
					
 | 
				
			||||||
 | 
					        if ($request->company_key && Ninja::isSelfHost()) {
 | 
				
			||||||
 | 
					         
 | 
				
			||||||
            $company = Company::where('company_key', $request->company_key)->firstOrFail();
 | 
					            $company = Company::where('company_key', $request->company_key)->firstOrFail();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(! (bool)$company->client_can_register);
 | 
					            if(! (bool)$company->client_can_register)
 | 
				
			||||||
                abort(400, 'Registration disabled');
 | 
					                abort(400, 'Registration disabled');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //$request->merge(['key' => $company->company_key]);
 | 
					            //$request->merge(['key' => $company->company_key]);
 | 
				
			||||||
 | 
				
			|||||||
@ -153,7 +153,7 @@ class GoCardlessPaymentDriver extends BaseDriver
 | 
				
			|||||||
                    'gateway_type_id' => GatewayType::BANK_TRANSFER,
 | 
					                    'gateway_type_id' => GatewayType::BANK_TRANSFER,
 | 
				
			||||||
                ];
 | 
					                ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
 | 
					                $payment = $this->createPayment($data, Payment::STATUS_PENDING);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                SystemLogger::dispatch(
 | 
					                SystemLogger::dispatch(
 | 
				
			||||||
                    ['response' => $payment, 'data' => $data],
 | 
					                    ['response' => $payment, 'data' => $data],
 | 
				
			||||||
@ -242,7 +242,6 @@ class GoCardlessPaymentDriver extends BaseDriver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        foreach ($request->events as $event) {
 | 
					        foreach ($request->events as $event) {
 | 
				
			||||||
            if ($event['action'] === 'confirmed') {
 | 
					            if ($event['action'] === 'confirmed') {
 | 
				
			||||||
                $payment = Payment::query()
 | 
					                $payment = Payment::query()
 | 
				
			||||||
@ -254,10 +253,13 @@ class GoCardlessPaymentDriver extends BaseDriver
 | 
				
			|||||||
                    $payment->status_id = Payment::STATUS_COMPLETED;
 | 
					                    $payment->status_id = Payment::STATUS_COMPLETED;
 | 
				
			||||||
                    $payment->save();
 | 
					                    $payment->save();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                //finalize payments on invoices here.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ($event['action'] === 'failed') {
 | 
					            if ($event['action'] === 'failed') {
 | 
				
			||||||
                // Update invoices, etc?
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $payment = Payment::query()
 | 
					                $payment = Payment::query()
 | 
				
			||||||
                    ->where('transaction_reference', $event['links']['payment'])
 | 
					                    ->where('transaction_reference', $event['links']['payment'])
 | 
				
			||||||
 | 
				
			|||||||
@ -170,33 +170,4 @@ class PaymentIntentWebhook implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //charge # optional($this->stripe_request['object']['charges']['data'][0])['id']
 | 
					 | 
				
			||||||
        //metadata # optional($this->stripe_request['object']['charges']['data'][0]['metadata']['gateway_type_id']
 | 
					 | 
				
			||||||
        //metadata # optional($this->stripe_request['object']['charges']['data'][0]['metadata']['payment_hash']
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
                * $intent = \Stripe\PaymentIntent::retrieve('{{PAYMENT_INTENT_ID}}');
 | 
					 | 
				
			||||||
                $charges = $intent->charges->data;
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 * 
 | 
					 | 
				
			||||||
 *                      $payment = Payment::query()
 | 
					 | 
				
			||||||
                        ->where('company_id', $request->getCompany()->id)
 | 
					 | 
				
			||||||
                        ->where('transaction_reference', $transaction['id'])
 | 
					 | 
				
			||||||
                        ->first();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if ($payment) {
 | 
					 | 
				
			||||||
                    $payment->status_id = Payment::STATUS_COMPLETED;
 | 
					 | 
				
			||||||
                    $payment->save();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 * */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										1157
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1157
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -4,7 +4,7 @@
 | 
				
			|||||||
    <!-- Source: https://github.com/invoiceninja/invoiceninja -->
 | 
					    <!-- Source: https://github.com/invoiceninja/invoiceninja -->
 | 
				
			||||||
    <!-- Version: {{ config('ninja.app_version') }} -->
 | 
					    <!-- Version: {{ config('ninja.app_version') }} -->
 | 
				
			||||||
  <meta charset="UTF-8">
 | 
					  <meta charset="UTF-8">
 | 
				
			||||||
  <title>Invoice Ninja</title>
 | 
					  <title>{{config('ninja.app_name')}}</title>
 | 
				
			||||||
  <meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
 | 
					  <meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
 | 
				
			||||||
  <link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}">
 | 
					  <link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}">
 | 
				
			||||||
  <script src="{{ asset('js/pdf.min.js') }}"></script>
 | 
					  <script src="{{ asset('js/pdf.min.js') }}"></script>
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@
 | 
				
			|||||||
                                        class="input w-full" 
 | 
					                                        class="input w-full" 
 | 
				
			||||||
                                        type="email"
 | 
					                                        type="email"
 | 
				
			||||||
                                        name="{{ $field['key'] }}"
 | 
					                                        name="{{ $field['key'] }}"
 | 
				
			||||||
                                        value="{{ old($field['key']) }}"
 | 
					                                        value=""
 | 
				
			||||||
                                        {{ $field['required'] ? 'required' : '' }} />
 | 
					                                        {{ $field['required'] ? 'required' : '' }} />
 | 
				
			||||||
                                @elseif($field['key'] === 'password')
 | 
					                                @elseif($field['key'] === 'password')
 | 
				
			||||||
                                    <input 
 | 
					                                    <input 
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@section('body')
 | 
					@section('body')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @if(!$invoice->isPayable() && $client->getSetting('custom_message_paid_invoice'))
 | 
					    @if($invoice->isPayable() && $client->getSetting('custom_message_unpaid_invoice'))
 | 
				
			||||||
 | 
					        @component('portal.ninja2020.components.message')
 | 
				
			||||||
 | 
					            {{ $client->getSetting('custom_message_unpaid_invoice') }}
 | 
				
			||||||
 | 
					        @endcomponent
 | 
				
			||||||
 | 
					    @elseif($invoice->status_id === 4 && $client->getSetting('custom_message_paid_invoice'))
 | 
				
			||||||
        @component('portal.ninja2020.components.message')
 | 
					        @component('portal.ninja2020.components.message')
 | 
				
			||||||
            {{ $client->getSetting('custom_message_paid_invoice') }}
 | 
					            {{ $client->getSetting('custom_message_paid_invoice') }}
 | 
				
			||||||
        @endcomponent
 | 
					        @endcomponent
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@section('body')
 | 
					@section('body')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @if(!$quote->isApproved() && $client->getSetting('custom_message_unpaid_invoice'))
 | 
					    @if(!$quote->isApproved() && $client->getSetting('custom_message_unapproved_quote'))
 | 
				
			||||||
        @component('portal.ninja2020.components.message')
 | 
					        @component('portal.ninja2020.components.message')
 | 
				
			||||||
            {{ $client->getSetting('custom_message_unpaid_invoice') }}
 | 
					            {{ $client->getSetting('custom_message_unapproved_quote') }}
 | 
				
			||||||
        @endcomponent
 | 
					        @endcomponent
 | 
				
			||||||
    @endif
 | 
					    @endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user