From 76232464246f08b7ce285bce3623f1d3eeaa09a1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 18 Jun 2024 11:33:56 +1000 Subject: [PATCH] Add limiting exception --- app/Exceptions/DuplicatePaymentException.php | 44 ++++++++++++++++++++ tests/Feature/PaymentTest.php | 2 - tests/Feature/PurchaseOrderTest.php | 4 +- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 app/Exceptions/DuplicatePaymentException.php diff --git a/app/Exceptions/DuplicatePaymentException.php b/app/Exceptions/DuplicatePaymentException.php new file mode 100644 index 000000000000..ba4f33ab2bdf --- /dev/null +++ b/app/Exceptions/DuplicatePaymentException.php @@ -0,0 +1,44 @@ +json([ + 'message' => 'Duplicate request', + ], 400); + + } +} diff --git a/tests/Feature/PaymentTest.php b/tests/Feature/PaymentTest.php index 513a331df231..655fb0dd795e 100644 --- a/tests/Feature/PaymentTest.php +++ b/tests/Feature/PaymentTest.php @@ -1880,8 +1880,6 @@ class PaymentTest extends TestCase $response->assertStatus(200); -sleep(1); - $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/PurchaseOrderTest.php b/tests/Feature/PurchaseOrderTest.php index 7b48a45c64e4..fc6d44dce848 100644 --- a/tests/Feature/PurchaseOrderTest.php +++ b/tests/Feature/PurchaseOrderTest.php @@ -97,7 +97,9 @@ class PurchaseOrderTest extends TestCase public function testPurchaseOrderBulkActions() { - $i = $this->purchase_order->invitations->first(); + $this->purchase_order->service()->createInvitations()->save(); + + $i = $this->purchase_order->fresh()->invitations->first(); $data = [ 'ids' =>[$this->purchase_order->hashed_id],