2017 © Pedro Peláez
 

symfony-bundle dotpay-bundle

Symfony payment bundle for Dotpay

image

cogitech/dotpay-bundle

Symfony payment bundle for Dotpay

  • Friday, March 18, 2016
  • by karasq
  • Repository
  • 3 Watchers
  • 2 Stars
  • 91 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

DotpayBundle

DotpayBundle provides basic functionality to create online payments for dotpay.pl, (*1)

Installation

The recommended way to install this bundle is to rely on Composer:, (*2)

"require" : {
    // ...
    "cogitech/dotpay-bundle": "dev-master"
}

The second step is to register this bundle in the AppKernel class:, (*3)

public function registerBundles()
{
    $bundles = array(
       // ...
       new Cogitech\DotpayBundle\CogitechDotpayBundle(),
    );
}

Configuration

Add following section in your config.yml file:, (*4)

cogitech_dotpay:
    production: true
    login: 'login'
    password: 'password'
    shop_id: '123456'

Parameters description:, (*5)

  • production - false value idicates test mode, true value indicates production mode. This parameter is required., (*6)

  • login - Login to your dotpay account. This parameter is required., (*7)

  • password - Password to your dotpay account. This parameter is required., (*8)

  • shop_id - This is your shop id. This parameter is required., (*9)

  • 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 or false to disable firewall (not recommended)., (*10)

  • 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., (*11)

Basic usage

Render payment button in twig template by calling dotpay_button function:, (*12)

{{ 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., (*13)

Events

Register event listeners to process DotpayBundle events:, (*14)

Services file services.yml:, (*15)

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:, (*16)

<?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...
    }
}

The Versions

18/03 2016

dev-master

9999999-dev

Symfony payment bundle for Dotpay

  Sources   Download

MIT

The Requires

 

by Krystian Karaś
by Dawid Skowron

payment symfony dotpay cogitech