Midrub Payments Structure
The new Midrub Payments is interesting, smart and useful. I've got as idea the Midrub's Apps concept to develop the structure of the new Midrub Payments system and this means it will be for quality at same level like on middle companies.
The structure was developed to support MVC and each gateway could have both views files and simple redirects to the gateway service. New structure will allow to make simple payments and subscriptions. For this reason will be multiuse.
The payments folder has the location in application/base because it will be used for both user's sections and frontend's section. The gateways are located in the folder application/base/payments/collection.
Each Payments's gateway should follow this interface:
interface Payments { /** * The public method check_availability checks if the gateway is available * * @return boolean true or false */ public function check_availability(); /** * The public method connect redirects user to the gateway's page * * @since 0.0.8.0 * * @return void */ public function connect(); /** * The public method save saves saves returned user's data * * @since 0.0.8.0 * * @return void */ public function save(); /** * The public method pay makes a payment * * @param array $args contains the payment details * * @since 0.0.8.0 * * @return void */ public function pay($args); /** * The public method ajax processes the ajax's requests * * @since 0.0.8.0 * * @return void */ public function ajax(); /** * The public method cron_jobs loads the cron jobs commands * * @since 0.0.8.0 * * @return void */ public function cron_jobs(); /** * The public method hooks contains the gateway's hooks * * @param string $category contains the hooks category * * @since 0.0.8.0 * * @return void */ public function load_hooks($category); /** * The public method guest contains the gateway's access for guests * * @since 0.0.8.0 * * @return void */ public function guest(); /** * The public method delete_subscription deletes subscribtions * * @param array $subscribtion contains the subscribtion's data * * @since 0.0.8.0 * * @return void */ public function delete_subscription($subscribtion); /** * The public method gateway_info contains the gateway's info * * @since 0.0.8.0 * * @return array with gateway's info */ public function gateway_info(); }
The method gateway_info has an important role here because it don't provides only the gateway informations but even informations about how the gateway should be used based on it's features(For example not all payment supports subscriptions or generation of token).
In the Development's category i will explain how to create a new payment system.
Suggested Articles
- How works the plans subscriptions in Midrub
- How to create new placeholders for an invoice's template
- Please don't ask me to add new payments gateways
- How works the fields and options in the Midrub Payments system
- How to custom or change the payments gateway's icon
- How and where to use a payments gateway library
- Add a view file to your Payments gateway
- set_js_urls - add js links for payment gateways
- set_css_urls - add styles links in a payment gateway
- set_the_title for payments gateway