A WordPress plugin that adds Piraeus Bank paycenter as a payment gateway for WooCommerce.
The code was based on code from two existing plugins [https://wordpress.org/plugins/woo-payment-gateway-for-piraeus-bank/ , https://wordpress.org/plugins/woo-payment-gateway-piraeus-bank-greece/]. However, it has been rewritten and altered significantly to implement an object oriented approach and rich commenting has been added.
The goal was to make it compatible with Polylang plugin and so that it integrates smoothly with multilingual websites. The challenge here was that the bank requires the declaration of a specific URL from which request will be sent to it’s website while Polylang plugin creates different URLs for each translated version of the website (e.g. www.example.com/gr/index.php, www.example.com/en/index.php).
In order to solve this, the plugin generates the ‘wc-piraeusbank-common-checkout’ page. Then, after the visitor has completed the checkout form translated on any language, he/she is redirected to this common page, sending all the necessary information from the checkout process and from there the request is sent to the bank’s website. This allows the declaration of a single URL (/wc-piraeusbank-common-checkout/).
After every transaction the website receives a response from the bank’s website with useful information to the administrator. For example, in case of a failure an error code is sent and the administrator can use it to contact the bank and learn why the failure occurred. The existing plugins stored the information somewhere in the database without providing access to them from the dashboard. This meant that had the administrator no direct access to the database, it would be impossible to learn the failure cause. That is why, a custom post type was created that stores the information of each transaction in such a way that it is easily available from the back-end.
Finally, the existing code was improved by using cookies instead of storing some information to the server’s database and eventually burden it with useless data such as the message that was broadcast to each customer.