Remove OmnipayBundle from project & make it standalone deprecated bundle.

This commit is contained in:
Joseph Bielawski 2014-04-15 22:17:31 +02:00
parent 6476bdef07
commit c9da6364e2
14 changed files with 0 additions and 591 deletions

View file

@ -6,7 +6,6 @@ suites:
Installer : { namespace: Sylius, spec_path: src/Sylius/Component/Installer }
Inventory : { namespace: Sylius, spec_path: src/Sylius/Component/Inventory }
Money : { namespace: Sylius, spec_path: src/Sylius/Component/Money }
Omnipay : { namespace: Sylius, spec_path: src/Sylius/Component/Omnipay }
Order : { namespace: Sylius, spec_path: src/Sylius/Component/Order }
Payment : { namespace: Sylius, spec_path: src/Sylius/Component/Payment }
Payum : { namespace: Sylius, spec_path: src/Sylius/Component/Payum }
@ -26,7 +25,6 @@ suites:
InstallerBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/InstallerBundle }
InventoryBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/InventoryBundle }
MoneyBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/MoneyBundle }
OmnipayBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/OmnipayBundle }
OrderBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/OrderBundle }
PaymentBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/PaymentBundle }
PayumBundle : { namespace: Sylius, spec_path: src/Sylius/Bundle/PayumBundle }

View file

@ -1,5 +0,0 @@
vendor/
bin/
composer.phar
composer.lock

View file

@ -1,14 +0,0 @@
language: php
php:
- 5.3
- 5.4
- 5.5
before_script: composer install --prefer-source --no-interaction
script: bin/phpspec run -fpretty --verbose
notifications:
email: "travis-ci@sylius.org"
irc: "irc.freenode.org#sylius-dev"

View file

@ -1,93 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\OmnipayBundle\DependencyInjection;
use Omnipay\Common\CreditCard;
use Omnipay\Common\GatewayFactory;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle.
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Dylan Johnson <eponymi.dev@gmail.com>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$builder = new TreeBuilder();
$rootNode = $builder->root('sylius_omnipay');
$gateways = GatewayFactory::find();
$omnipayCc = new CreditCard();
$ccTypes = array_keys($omnipayCc->getSupportedBrands());
$rootNode
->children()
->arrayNode('gateways')
->useAttributeAsKey('name')
->prototype('array')
->children()
->scalarNode('type')
->validate()
->ifTrue(function ($type) use ($gateways) {
if (empty($type)) {
return true;
}
if (!in_array($type, $gateways)) {
return true;
}
return false;
})
->thenInvalid(sprintf('Unknown payment gateway selected. Valid gateways are: %s.', implode(", ", $gateways)))
->end()
->end()
->scalarNode('label')->cannotBeEmpty()->end()
->booleanNode('mode')->defaultFalse()->end()
->booleanNode('active')->defaultTrue()->end()
->arrayNode('cc_types')
->prototype('scalar')
->validate()
->ifTrue(function ($ccType) use ($ccTypes) {
if (empty($ccType)) {
return true;
}
if (!in_array($ccType, $ccTypes)) {
return true;
}
return false;
})
->thenInvalid(sprintf('Unknown credit card type selected. Valid credit card types are: %s.', implode(", ",$ccTypes)))
->end()
->end()
->end()
->arrayNode('options')
->prototype('scalar')
->end()
->end()
->end()
->end()
->end()
;
return $builder;
}
}

View file

@ -1,104 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\OmnipayBundle\DependencyInjection;
use Omnipay\Common\Helper;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* Payments dependency injection extension.
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class SyliusOmnipayExtension extends Extension
{
/**
* Registered gateways with name and label.
*
* @var array
*/
private $gateways;
/**
* Constructor.
*/
public function __construct()
{
$this->gateways = array();
}
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$processor = new Processor();
$config = $processor->processConfiguration(new Configuration(), $configs);
$container->setDefinition('sylius.omnipay.gateway_factory', new Definition('Omnipay\\Common\\GatewayFactory'));
foreach ($config['gateways'] as $name => $parameters) {
$this->createGatewayService($container, $name, $parameters);
}
$container->setParameter('sylius.omnipay.gateways', $this->gateways);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
}
/**
* Create gateway service.
*
* @param ContainerBuilder $container
* @param string $name
* @param array $parameters
*/
public function createGatewayService(ContainerBuilder $container, $name, array $parameters)
{
$type = $parameters['type'];
$class = trim(Helper::getGatewayClassName($type), "\\");
$definition = new Definition($class);
$definition
->setFactoryService('sylius.omnipay.gateway_factory')
->setFactoryMethod('create')
->setArguments(array($type))
;
$reflection = new \ReflectionClass($class);
foreach ($parameters['options'] as $optionName => $value) {
$method = 'set' . ucfirst($optionName);
if ($reflection->hasMethod($method)) {
$definition->addMethodCall($method, array($value));
}
}
$container->setDefinition(sprintf('sylius.omnipay.gateway.%s', $name), $definition);
$this->gateways[$name] = isset($parameters['label']) ? $parameters['label'] : $name;
}
/**
* {@inheritdoc}
*/
public function getAlias()
{
return 'sylius_omnipay';
}
}

View file

@ -1,68 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\OmnipayBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* Omnipay gateway choice type.
*
* @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
*/
class GatewayChoiceType extends AbstractType
{
/**
* Gateways.
*
* @var array
*/
protected $gateways;
/**
* Constructor.
*
* @param array $gateways
*/
public function __construct($gateways)
{
$this->gateways = $gateways;
}
/**
* {@inheritdoc}
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver
->setDefaults(array(
'choices' => $this->gateways
))
;
}
/**
* {@inheritdoc}
*/
public function getParent()
{
return 'choice';
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'sylius_omnipay_gateway_choice';
}
}

View file

@ -1,30 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\OmnipayBundle\Model;
/**
* Credit Card interface.
*
* @author Dylan Johnson <eponymi.dev@gmail.com>
*/
interface CreditCardInterface
{
/**
* Transform any credit card model into an array matching Omnipay
* format and naming conventions.
*
* @param array $map
*
* @return array
*/
public function transformToOmnipay(array $map);
}

View file

@ -1,79 +0,0 @@
SyliusOmnipayBundle [![Build status...](https://secure.travis-ci.org/Sylius/SyliusOmnipayBundle.png?branch=master)](http://travis-ci.org/Sylius/SyliusOmnipayBundle)
===================
[**Symfony2**](http://symfony.com) integration for [Omnipay](https://github.com/omnipay/omnipay) library, PHP abstraction for payment gateways.
Sylius
------
**Sylius** - Modern ecommerce for Symfony2. Visit [Sylius.org](http://sylius.org).
[phpspec](http://phpspec.net) examples
---------------------------------------
```bash
$ composer install --dev --prefer-dist
$ bin/phpspec run -f pretty
```
Documentation
-------------
Documentation is available on [**readthedocs.org**](http://sylius.readthedocs.org/en/latest/bundles/SyliusOmnipayBundle/index.html).
Code examples
-------------
If you want to see working implementation, try out the [Sylius sandbox application](http://github.com/Sylius/Sylius-Sandbox).
Contributing
------------
All informations about contributing to Sylius can be found on [this page](http://docs.sylius.org/en/latest/contributing/index.html).
Mailing lists
-------------
### Users
Questions? Feel free to ask on [users mailing list](http://groups.google.com/group/sylius).
### Developers
To contribute and develop this bundle, use the [developers mailing list](http://groups.google.com/group/sylius-dev).
Sylius twitter account
----------------------
If you want to keep up with updates, [follow the official Sylius account on twitter](http://twitter.com/Sylius).
Bug tracking
------------
This bundle uses [GitHub issues](https://github.com/Sylius/SyliusOmnipayBundle/issues).
If you have found bug, please create an issue.
Versioning
----------
Releases will be numbered with the format `major.minor.patch`.
And constructed with the following guidelines.
* Breaking backwards compatibility bumps the major.
* New additions without breaking backwards compatibility bumps the minor.
* Bug fixes and misc changes bump the patch.
For more information on SemVer, please visit [semver.org website](http://semver.org/).
This versioning method is same for all **Sylius** bundles and applications.
MIT License
-----------
License can be found [here](https://github.com/Sylius/SyliusOmnipayBundle/blob/master/Resources/meta/LICENSE).
Authors
-------
The bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).
See the list of [contributors](https://github.com/Sylius/SyliusOmnipayBundle/contributors).

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sylius.form.type.omnipay.gateway_choice.class">Sylius\Bundle\OmnipayBundle\Form\Type\GatewayChoiceType</parameter>
</parameters>
<services>
<service id="sylius.form.type.omnipay.gateway_choice" class="%sylius.form.type.omnipay.gateway_choice.class%">
<argument>%sylius.omnipay.gateways%</argument>
<tag name="form.type" alias="sylius_omnipay_gateway_choice" />
</service>
</services>
</container>

View file

@ -1,24 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\OmnipayBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Symfony2 integration with Omnipay payment processing library.
*
* @author Joseph Bielawski <stloyd@gmail.com>
* @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
*/
class SyliusOmnipayBundle extends Bundle
{
}

View file

@ -1,43 +0,0 @@
{
"name": "sylius/omnipay-bundle",
"type": "symfony-bundle",
"description": "Symfony2 integration with Omnipay - multi-gateway, payment processing library.",
"keywords": ["shop", "ecommerce", "sylius", "payment", "merchant", "gateway", "paypal", "authorize.net", "dps", "paymentexpress", "omnipay"],
"homepage": "http://sylius.org",
"license": "MIT",
"authors": [
{
"name": "Paweł Jędrzejewski",
"email": "pjedrzejewski@diweb.pl",
"homepage": "http://pjedrzejewski.com"
},
{
"name": "Community contributions",
"homepage": "https://github.com/Sylius/SyliusOmnipayBundle/contributors"
}
],
"require": {
"php": ">=5.3.3",
"symfony/framework-bundle": "~2.1",
"omnipay/omnipay": "1.0.*"
},
"require-dev": {
"phpspec/phpspec2": "~2.0",
"symfony/form": "~2.1"
},
"config": {
"bin-dir": "bin"
},
"autoload": {
"psr-4": { "Sylius\\Bundle\\OmnipayBundle\\": "" }
},
"autoload-dev": {
"psr-4": { "Sylius\\Bundle\\OmnipayBundle\\spec\\": "spec/" }
},
"extra": {
"branch-alias": {
"dev-master": "0.10-dev"
}
}
}

View file

@ -1,32 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Bundle\OmnipayBundle\DependencyInjection;
use PHPSpec2\ObjectBehavior;
/**
* Sylius cart extension.
*
* @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
*/
class SyliusOmnipayExtension extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType('Sylius\Bundle\OmnipayBundle\DependencyInjection\SyliusOmnipayExtension');
}
function it_is_a_container_extension()
{
$this->shouldHaveType('Symfony\Component\HttpKernel\DependencyInjection\Extension');
}
}

View file

@ -1,40 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Bundle\OmnipayBundle\Form\Type;
use PHPSpec2\ObjectBehavior;
class GatewayChoiceType extends ObjectBehavior
{
/**
* @param array $gateways
*/
function let(array $gateways)
{
$this->beConstructedWith($gateways);
}
function it_should_be_a_form_type()
{
$this->shouldHaveType('Symfony\Component\Form\AbstractType');
}
function it_should_have_custom_field_name()
{
$this->getName()->shouldReturn('sylius_omnipay_gateway_choice');
}
function its_getParent_should_return_choice()
{
$this->getParent()->shouldReturn('choice');
}
}

View file

@ -1,27 +0,0 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Bundle\OmnipayBundle;
use PHPSpec2\ObjectBehavior;
class SyliusOmnipayBundle extends ObjectBehavior
{
public function it_should_be_initializable()
{
$this->shouldHaveType('Sylius\Bundle\OmnipayBundle\SyliusOmnipayBundle');
}
public function it_should_be_a_bundle()
{
$this->shouldHaveType('Symfony\Component\HttpKernel\Bundle\Bundle');
}
}