cogitech / dotpay-bundle
Symfony payment bundle for Dotpay
Installs: 1 348
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 2
Open Issues: 0
Type:symfony-bundle
Requires
- symfony/form: ~2.5|~3.0
- symfony/framework-bundle: ~2.5|~3.0
- symfony/twig-bundle: ~2.5|~3.0
This package is not auto-updated.
Last update: 2025-02-07 20:43:08 UTC
README
DotpayBundle provides basic functionality to create online payments for dotpay.pl
Installation
The recommended way to install this bundle is to rely on Composer:
"require" : { // ... "cogitech/dotpay-bundle": "dev-master" }
The second step is to register this bundle in the AppKernel
class:
public function registerBundles() { $bundles = array( // ... new Cogitech\DotpayBundle\CogitechDotpayBundle(), ); }
Configuration
Add following section in your config.yml
file:
cogitech_dotpay: production: true login: 'login' password: 'password' shop_id: '123456'
Parameters description:
-
production -
false
value idicates test mode,true
value indicates production mode. This parameter is required. -
login - Login to your dotpay account. This parameter is required.
-
password - Password to your dotpay account. This parameter is required.
-
shop_id - This is your shop id. This parameter is required.
-
firewall - This parameter is not required. By default payment confirmation can be done from Dotpay IP servers only (
195.150.9.37
). You can pass here array of valid IP addresses orfalse
to disable firewall (not recommended). -
route_complete - This is the symfony2 route where youser will be redirected from Dotpay website. This parameter is optional and default value is
cg_dotpay_thanks
.
Basic usage
Render payment button in twig template by calling dotpay_button
function:
{{ dotpay_button({ title: 'Dotpay - 1.23 zł', class: 'btn btn-success', email: 'test@example.com', price: 1.23, first_name: 'Lorem', last_name: 'Ipsum', street: 'Lorem street', building_number: '1', postcode: '60-001', city: 'Lorem', description: 'Lorem Product', params: { custom_parameter: '123' } }) }}
Key params
is optional. You can pass custom parameters to event this way.
Events
Register event listeners to process DotpayBundle events:
Services file services.yml
:
services: cg.dotpay.listeners: class: AppBundle\EventListener\cgDotpayEventListener tags: - { name: kernel.event_listener, event: cg.dotpay.create, method: create } - { name: kernel.event_listener, event: cg.dotpay.change_status, method: change_status } - { name: kernel.event_listener, event: cg.dotpay.confirm, method: confirm } - { name: kernel.event_listener, event: cg.dotpay.cancel, method: cancel }
Event listener class cgDotpayEventListener
:
<?php namespace AppBundle\EventListener; use Cogitech\DotpayBundle\Event\cgDotpayEvent; class cgDotpayEventListener { public function create(cgDotpayEvent $e){ // handle payment create here... } public function confirm(cgDotpayEvent $e){ // handle confirmation here... } public function cancel(cgDotpayEvent $e){ // handle payment cancellation here... } public function change_status(cgDotpayEvent $e){ // handle any status changes here... } }