Odol - Design Decisions
Here are the design decisions made for Obol.
Standalone library
I decided to make this a standalone library so that it could be used by itself. It aims to provide extremely useful functionality which should be able to be useful in any PHP application handling payments.
Models aren't final
The reason Models aren't final classes is that they should be extendable to add extra fields if needed. If extra fields are added custom data mappers would also be required.
Not to use offical SDKs
In an attempt to make the library easier to extend, more lightweight, and consistent the idea is to not use offical SDKs and to make the API requests via PSR7 clients.
Validation
There wasn't a validation library used to keep the library lightweight. It's also possible to add one in later without breaking BC. So it's possible to change this decsison later.
Throw exceptions for request failures
The idea is that if Obol throws exceptions for request failures but specific failures such as InvalidFieldsRequestException and BadAuthRequestException then it can make it easier to figure out and handle how to deal with each one. Whereas, if it was in the response model it would be harder.