Skip to content

Commit

Permalink
✨ Introduced new exception for 3rd party orders
Browse files Browse the repository at this point in the history
  • Loading branch information
zwaans committed Apr 16, 2024
1 parent bea1d98 commit 6896839
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Shipment/Exception/OrderHandledBy3rdPartyException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace MyParcelCom\Integration\Shipment\Exception;

use Exception;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class OrderHandledBy3rdPartyException extends Exception
{
protected $code = 409;

public function __construct($message = null, private string $platform = '')
{
parent::__construct($message);
}

public function render(): JsonResponse
{
return response()->json([
'error' => [
'code' => 'order_handled_by_3rd_party',
'message' => $this->getMessage(),
'meta' => [
'3rd_party' => $this->platform
]
]
], $this->code);
}
}

0 comments on commit 6896839

Please sign in to comment.