Download the PHP package konekt/payum-otp-hungary without Composer
On this page you can find all versions of the php package konekt/payum-otp-hungary. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package payum-otp-hungary
Payum Gateway for SimplePay Hungary via the Legacy OTP Integration
The OTP based payment method has been deprecated by the bank, use SimplePay instead!
It works with OTP SDK v5 despite the names and references to v4.
Consists of a standard payum gateway library with which you can make online payments through OTP Bank Hungary. It also provides basic integration with Symfony and Sylius.
Disclaimer: the library for now provides only simple offsite (haromszereplos) payment for a single shop (no multishop support). Feel free to contribute or ask for support if you need further functionality.
Architecture
The library builds on top of OTP's official SDK. It hides some of the library's inconveniences, like having to edit a configuration file, no autoloading, messy warnings/notices and no support for PHP7. The official SDK's logging features work as they provide it.
You will have to download the SDK from OTP's site in order to be able to use the library.
SDK
After you downloaded the SDK (currently a ZIP file named Webshop_4.0) you will find the needed php library in the zip on the following path: . This is the library that is used and you have to put it in a place accessible to your web server. From now on we will call the full path where you have the library .
Because the SDK has no proper versioning, to check if it is the same code that this library is building on you will have to generate the checksum of the library like this (assuming you're on Unix):
The tested library has a checksum of 5a57d623e8da3541c8b8d6fd3848862c. If you have another one it means the SDK code has changed. If something is not working as expected this can be a reason for that.
Using the standalone library
You will have to implement actions as described in the Payum documentation. In the folder you will find working scripts which can help you.
Configuration
You will find the parameters you will have to configure in .
- sdk_dir: The full path to the SDK (as described above). Mandatory.
- sandbox: Can be true or false, if it is true, you don't need to provide the secret_key and pos_id. Default: true.
- pos_id: Your shop ID given to you by OTP. Mandatory when not in sandbox mode.
- secret_key: The full path to the secret key file belonging to the shop id given to you by OTP. Mandatory when not in sandbox mode.
- transactionid_prefix: For each payment the library generates a unique ID, you can specify any prefix to it here. It should be no more than 10 characters and should be alphanumeric.
In addition you can configure the log dirs where the SDK will log the transactions. You will find the details in the SDK official documentation about each directory.
Using the library with Sylius
You will have to register the action which converts the Sylius models into the gateway's data as a service.
You also can define another service where you can control the payment note (shopMegjegyzes) sent to OTP. If you do this you have to implement \Konekt\PayumOtp\Bridge\Sylius\PaymentNoteProviderInterface in your app and define it as a service, then inject it to the converter. In this case the above definition looks like:
To register the custom payum library into your app, you should add the following to your AppBundle:
Then you will have to configure the payum bundle to know about the new custom library like this:
You can define the parameters in your (recommended). For the meaning of the parameters see the Configuration section above. Note: even if you are in sandbox mode you will have to provide a value for secret_key and pos_id, but in this case it doesn't matter what you provide there (this is a technical depth for now).
Error handling
You also have the possibility to handle the transaction errors in a decoupled way. For example you want to get an email if any transaction fails by reasons such as wrong amount sent or the private key was rejected etc. In this case you will have to register the library's event notifier extension class as a service:
Then you will have to write a listener in your app and define it as a service. Implement which sends an email if an error occurs:
Then register it as a service:
In the method you will get a event, which contains the array of occured errors and other details of the transaction. You can write your handling logic as you need.
FINAL NOTES
If you have any questions feel free to open an issue. Any improvements or further functionality is very welcomed, feel free to make a pull request.