mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 05:17:31 -05:00 
			
		
		
		
	Add limiting exception
This commit is contained in:
		
							parent
							
								
									24a662f920
								
							
						
					
					
						commit
						7623246424
					
				
							
								
								
									
										44
									
								
								app/Exceptions/DuplicatePaymentException.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								app/Exceptions/DuplicatePaymentException.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Exception;
 | 
				
			||||||
 | 
					use Illuminate\Http\JsonResponse;
 | 
				
			||||||
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class DuplicatePaymentException extends Exception
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Report the exception.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return void
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function report()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        //
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Render the exception into an HTTP response.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param  Request  $request
 | 
				
			||||||
 | 
					     * @return JsonResponse
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public function render($request)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return response()->json([
 | 
				
			||||||
 | 
					            'message' => 'Duplicate request',
 | 
				
			||||||
 | 
					        ], 400);
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1880,8 +1880,6 @@ class PaymentTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $response->assertStatus(200);
 | 
					        $response->assertStatus(200);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sleep(1);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $response = $this->withHeaders([
 | 
					        $response = $this->withHeaders([
 | 
				
			||||||
            'X-API-SECRET' => config('ninja.api_secret'),
 | 
					            'X-API-SECRET' => config('ninja.api_secret'),
 | 
				
			||||||
            'X-API-TOKEN' => $this->token,
 | 
					            'X-API-TOKEN' => $this->token,
 | 
				
			||||||
 | 
				
			|||||||
@ -97,7 +97,9 @@ class PurchaseOrderTest extends TestCase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function testPurchaseOrderBulkActions()
 | 
					    public function testPurchaseOrderBulkActions()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $i = $this->purchase_order->invitations->first();
 | 
					        $this->purchase_order->service()->createInvitations()->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $i = $this->purchase_order->fresh()->invitations->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $data = [
 | 
					        $data = [
 | 
				
			||||||
            'ids' =>[$this->purchase_order->hashed_id],
 | 
					            'ids' =>[$this->purchase_order->hashed_id],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user