26 Commits

Author SHA1 Message Date
aeb84dcb60 Switch to PHPunit 12 and adjust code accordingly 2026-01-13 18:26:16 +09:00
b0d8c55536 Add phive tools folder, Switch to tabs for indent and add phpcs.xml 2026-01-13 11:06:11 +09:00
33a48f47de Update unit tests to allow skip if AWS API flood
on Github a lot of API tests will fail with "T001" flooding, so we just skip them
2025-01-21 11:11:56 +09:00
28a9e390cc Code clean up with declare strict and php stan level 9 checks
add "declare(strict_types=1);" to all pages

Add a json handler class to handle that json_decode always returns array<mixed> and throws error otherwise
On failure these will throw the normal JSON encoded error was FAILURE with code "J-" and the number is the json error
If 0 then the return was null or some other problem that did not return an array

amount is float and not string and checks are done that the returned value is a float

various updates for phpdoc array delcarations
- curl header is array<int, string>
- the log array is proper declared as array with string key and a list of mixed arrays
2025-01-21 10:48:41 +09:00
e9a6332ad0 Add skip on error for funds test 2024-05-22 18:26:46 +09:00
04aa9fa019 Github actions add 2024-05-22 17:27:20 +09:00
d86ad8c051 Switch to PSR12 with spaces instead of tabs 2023-01-19 12:51:12 +09:00
422fc66137 phpUnit tests updates and fixes
All gift card id checks are against string and not numeric.

Add missing checks for card status, card amount value, card amount
currency in any buy card checks.

Add epiration date regex check for buy card

Add request cancled card check.
2022-06-14 06:55:38 +09:00
2bcd42f4a5 Add phpUnit testing for Amazon Incentives class 2022-06-13 18:09:52 +09:00
fd5477269b Turn on mock tests on AWS side in normal test file 2022-06-10 14:49:32 +09:00
7cb5e00a5f Add base phpUnit file 2022-06-09 09:26:42 +09:00
a51f4df53e Update core git config files, vendor installs for unit testing
Update .gitattributes with more files to ignore
Add .gitignore for php unit test cache
Install dotenv file parser for unit testing
Update current test pages with dotenv file parser (replaces function
call)

Documentation PHPdoc update for checkMe method call
2022-06-09 09:25:08 +09:00
5b99da616b Just rename the readEnvFile function for testing
Until I find out how I can exclude folders from beeing deployed
Update composer ingore list
Add .gitattributes for ignore list
2022-03-18 09:24:27 +09:00
b041720a18 phpstan config updates, test code update 2021-11-25 17:44:04 +09:00
4f90f2d916 Update test with simpl .env variables and include example file 2021-10-21 15:00:45 +09:00
d0b676f8ce Add phan checks at max level 2021-10-21 13:37:59 +09:00
c2721cb8d4 Add PHPstan and fix all checks for max level 2021-10-21 13:31:18 +09:00
3b7f644ae9 Update readme file, Update composer.json file, Exception updates
Alle exceptions thrown in Response are now general AmazonError with json
return string for full compability
2021-10-21 10:22:17 +09:00
6f9bf781f2 Rewrite to composer package
composer require gullevek/amazon-incentives
2021-10-21 09:55:32 +09:00
94ea118731 Documentation update 2021-10-20 16:18:18 +09:00
a56f33c81c Debug log updates, error message updates on curl failure
Config setup works with null data if no data is set.

Debugger is now launched in the AamzonIncentive class at the beginning
Debugger id/debug flag set is now one static call
Debugger methods all have proper PHPdoc documentationn added

Fixed Client/Curl error messages to include the original error message
too. Also made sure that a possible null endpoint is not throwing errors
2021-10-20 09:39:26 +09:00
f3b17bbf4c Update tests script with logging, etc 2021-10-19 11:46:52 +09:00
f8c9d82f4c Just minor fixes in the test script 2021-10-19 11:14:55 +09:00
7b90cd862d Update decodeErrorMessage, Client error exception
If the exception json is not a json, return the array with message set
to the original string.

Updated the Client error result:
If Rate Exceeded error, set special T001 with RESEND status
Else set normal and ifn othing set to E999 with FAILURE
2021-10-19 10:52:04 +09:00
71abd4d06e Add README file, add status to exception return
Because status RESEND/FAILURE has to be checked we also add this to the
Exception return json string.
Also handle unset errors (eg when we get an Rate Limit error)

Move the _ENV check into mtheod

test now has some basic mock tests
2021-10-19 09:39:14 +09:00
b00d545a10 Amazon Gift Card on Demand Incentives stand alone class 2021-10-18 18:24:38 +09:00