The class OystApiClientFactory
is used to get the right client to communicate with the API.
Note: It would be interesting to process it the right way with an abstract method called by the parent like process() which is called by a public method access such as exec() or start() for example.
/** @var AbstractOystApiClient $apiWrapper */
$apiWrapper = OystApiClientFactory::getClient($entityName, $apiKey, $userAgent, $url);
This method take several parameters as:
-
entityName (constants available in
OystApiClientFactory
), could be:- catalog
- order
- payment
- oneclick
-
apiKey
- The API key is the key that was given to you by Oyst (if you don't have one you can go to the FreePay BackOffice and create an account).
-
userAgent
- To know the origin of the request (PrestaShop vX.X.X / Magento vX.X.X / Elsewhere)
-
env (constants available in
OystApiClientFactory
), takes 2 values as:- prod
- preprod
-
url (default values can be found in parameters.yml), the URL of the API for three environments:
- prod
- preprod
- test (for unit test)
To run unit tests:
vendor/bin/phpunit -c phpunit.xml.dist --testsuite unitary
See the content of the description_[entityName].json files to know in details the payload for each API.