2017 © Pedro Peláez
 

symfony-bundle ogone-bundle

Ogone wrapper for Symfony2

image

snowcap/ogone-bundle

Ogone wrapper for Symfony2

  • Friday, December 18, 2015
  • by Snowcap
  • Repository
  • 4 Watchers
  • 5 Stars
  • 4,659 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 2 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

Introduction

This bundle introduces the Ogone payment process gateway into a Symfony project It uses the marlon-ogone Bundle, and adds a different integration approach, (*1)

More info about Ogone can be found here: http://www.ogone.com, (*2)

WARNING: THIS BUNDLE IS IN BETA STAGE, USE AT YOUR OWN RISKS !, (*3)

Prerequisites

  • Symfony 2.1>=
  • You must have a valid Ogone account, configured with SHA-IN and SHA-OUT security activated

Installation

Download the bundle:, (*4)

{
"require": {
    "snowcap/ogone-bundle": "dev-master"
}
$ php composer.phar update snowcap/ogone-bundle

Add it to your application's kernel:, (*5)

// app/ApplicationKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Snowcap\OgoneBundle\SnowcapOgoneBundle(),
        // ...
    );
}

Configuration

Put the following configuration options in your config file:, (*6)

snowcap_ogone:
    pspid: [your_ogone_pspid]
    environment: [test|prod]
    sha_in: [your_ogone_sha_in_passhprase]
    sha_out: [your_ogone_sha_out_passhprase]
    options:
        # any option you may want to pass to Ogone, as key: value pairs

Usage

Getting the Ogone form to use in your view

A service 'snowcap_ogone.manager' allows you to get the ogone form rendering, whereby you can also define the acceptUrl, and any other option you want to send to Ogone An example could be:, (*7)

/** @var $ogone \Snowcap\OgoneBundle\Manager */
$ogone = $this->get('snowcap_ogone');

$ogoneForm = $ogone->getRequestForm($locale, $orderId, $customerName, $amount, $currency, array(
    'acceptUrl' => $this->generateUrl('your_success_page_route_name', array(), true),
    // and any other option your may want to pass to Ogone
));

return array(
    'ogone_form' => $ogoneForm,
);

Pay attention, this is not a Symfony form, just a simple rendered form provided by the Ogone library., (*8)

...
{{ ogone_form|raw }}

Getting Ogone result

First you need to add a route in your routing.yml, (*9)

snowcap_ogone:
    resource: "@SnowcapOgoneBundle/Controller"
    type: annotation

To catch Ogone's result, you have to create a service and tag it as an event subscriber (or an event listener): For example:, (*10)

my_company_bundle.ogone_subscriber:
    class: MyCompany\MyBundle\Ogone\OgoneSubscriber
    tags:
        - { name: kernel.event_subscriber }

That service has to implement the EventSubscriberInterface, like the following:, (*11)

<?php
namespace MyCompany\MyBundle\Ogone;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

use Snowcap\OgoneBundle\Event\OgoneEvent;
use Snowcap\OgoneBundle\OgoneEvents;

class OgoneSubscriber implements EventSubscriberInterface
{
    /**
     * @param \Snowcap\OgoneBundle\Event\OgoneEvent $event
     */
    public function onOgoneSuccess(OgoneEvent $event)
    {

    }

    /**
     * @param \Snowcap\OgoneBundle\Event\OgoneEvent $event
     */
    public function onOgoneError(OgoneEvent $event)
    {

    }

    /**
     * @return array
     */
    public static function getSubscribedEvents()
    {
        return array(
            OgoneEvents::SUCCESS => 'onOgoneSuccess',
            OgoneEvents::ERROR => 'onOgoneError'
        );
    }
}

You now have two methods inside your bundle to operate all the business logic you need, enjoy !, (*12)

The Versions

18/12 2015

dev-master

9999999-dev https://github.com/snowcap/SnowcapOgoneBundle

Ogone wrapper for Symfony2

  Sources   Download

MIT

The Requires

 

by Jérôme Poskin
by Pierre Vanliefland
by Edwin Hermans

symfony e-commerce ogone

18/12 2015

v1.0.1

1.0.1.0 https://github.com/snowcap/SnowcapOgoneBundle

Ogone wrapper for Symfony2

  Sources   Download

MIT

The Requires

 

by Jérôme Poskin
by Pierre Vanliefland
by Edwin Hermans

symfony e-commerce ogone

18/12 2015

v1.0.0

1.0.0.0 https://github.com/snowcap/SnowcapOgoneBundle

Ogone wrapper for Symfony2

  Sources   Download

MIT

The Requires

 

by Jérôme Poskin
by Pierre Vanliefland
by Edwin Hermans

symfony e-commerce ogone

03/07 2013

2.1.x-dev

2.1.9999999.9999999-dev https://github.com/snowcap/SnowcapOgoneBundle

Ogone wrapper for Symfony2

  Sources   Download

MIT

The Requires

 

by Jérôme Poskin
by Pierre Vanliefland
by Edwin Hermans

symfony e-commerce ogone

17/05 2013

2.2.x-dev

2.2.9999999.9999999-dev https://github.com/snowcap/SnowcapOgoneBundle

Ogone wrapper for Symfony2

  Sources   Download

MIT

The Requires

 

by Jérôme Poskin
by Pierre Vanliefland
by Edwin Hermans

symfony e-commerce ogone