-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dedfffa
commit 5c16d0e
Showing
8 changed files
with
132 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Jasara\AmznSPA\Constants; | ||
|
||
/** | ||
* A list of developer notes related to unusual or confusing errors. | ||
*/ | ||
class JasaraNotes | ||
{ | ||
const NOTES_MAP = [ | ||
'The application isn\'t configured with roles.' => 'Your developer application listing on Seller Central has been approved but not published yet. It takes up to 10 days for an application to fully publish after approval. This applies to listing revisions as well. See this Github issue for more details: https://github.com/amzn/selling-partner-api-docs/issues/347#issuecomment-855153228', | ||
]; | ||
|
||
public static function findNote(string $error_message): string | null | ||
{ | ||
$error_message = json_decode('"' . $error_message . '"'); // Decode Unicode | ||
|
||
if (array_key_exists($error_message, self::NOTES_MAP)) { | ||
return self::NOTES_MAP[$error_message]; | ||
} | ||
|
||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Jasara\AmznSPA\DataTransferObjects\Schemas; | ||
|
||
use Spatie\DataTransferObject\DataTransferObject; | ||
|
||
class MetadataSchema extends DataTransferObject | ||
{ | ||
// Developer notes to provide additional context for unusual or | ||
// confusing error messages | ||
public ?string $jasara_notes; | ||
|
||
public ?string $amzn_request_id; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Jasara\AmznSPA\Unit\Constants; | ||
|
||
use Illuminate\Support\Str; | ||
use Jasara\AmznSPA\Constants\JasaraNotes; | ||
use Jasara\AmznSPA\Tests\Unit\UnitTestCase; | ||
|
||
/** | ||
* @covers \Jasara\AmznSPA\Constants\JasaraNotes | ||
*/ | ||
class JasaraNotesTest extends UnitTestCase | ||
{ | ||
public function testGetNote() | ||
{ | ||
$error = 'The application isn\u0027t configured with roles.'; | ||
$result = JasaraNotes::findNote($error); | ||
|
||
$this->assertIsString($result); | ||
$this->assertStringContainsString('approved but not published', $result); | ||
|
||
$error = 'The application isn\'t configured with roles.'; | ||
$result = JasaraNotes::findNote($error); | ||
|
||
$this->assertIsString($result); | ||
$this->assertStringContainsString('approved but not published', $result); | ||
} | ||
|
||
public function testGetNull() | ||
{ | ||
$error = Str::random(); | ||
$result = JasaraNotes::findNote($error); | ||
|
||
$this->assertNull($result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"code": "InvalidInput", | ||
"message": "The application isn\\u0027t configured with roles.", | ||
"details": "" | ||
} | ||
] | ||
} |