Skip to content

Commit

Permalink
unset not releveant actions in direct\offsite factories.
Browse files Browse the repository at this point in the history
  • Loading branch information
makasim committed Nov 27, 2015
1 parent 2e7595d commit b316410
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/OmnipayDirectGatewayFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
<?php
namespace Payum\OmnipayBridge;
use Payum\Core\Bridge\Spl\ArrayObject;

/**
* @deprecated since 1.0.0-BETA1
*/
class OmnipayDirectGatewayFactory extends OmnipayGatewayFactory
{
/**
* {@inheritDoc}
*/
protected function populateConfig(ArrayObject $config)
{
parent::populateConfig($config);

unset($config['payum.action.capture_offsite']);
}
}
10 changes: 10 additions & 0 deletions src/OmnipayOffsiteGatewayFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
<?php
namespace Payum\OmnipayBridge;
use Payum\Core\Bridge\Spl\ArrayObject;

/**
* @deprecated since 1.0.0-BETA1
*/
class OmnipayOffsiteGatewayFactory extends OmnipayGatewayFactory
{
/**
* {@inheritDoc}
*/
protected function populateConfig(ArrayObject $config)
{
parent::populateConfig($config);

unset($config['payum.action.capture']);
}
}
15 changes: 15 additions & 0 deletions tests/OmnipayDirectGatewayFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ public function shouldAllowCreateGatewayConfig()
$this->assertNotEmpty($config);
}

/**
* @test
*/
public function shouldContainCaptureActionAndMissCaptureOffsiteAction()
{
$factory = new OmnipayDirectGatewayFactory();

$config = $factory->createConfig(['type' => 'Dummy']);

$this->assertInternalType('array', $config);

$this->assertArrayHasKey('payum.action.capture', $config);
$this->assertArrayNotHasKey('payum.action.capture_offsite', $config);
}

/**
* @test
*
Expand Down
15 changes: 15 additions & 0 deletions tests/OmnipayOffsiteGatewayFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ public function shouldAllowCreateGatewayConfig()
$this->assertNotEmpty($config);
}

/**
* @test
*/
public function shouldContainCaptureOffsiteActionAndMissCaptureAction()
{
$factory = new OmnipayOffsiteGatewayFactory();

$config = $factory->createConfig(['type' => 'Dummy']);

$this->assertInternalType('array', $config);

$this->assertArrayHasKey('payum.action.capture_offsite', $config);
$this->assertArrayNotHasKey('payum.action.capture', $config);
}

/**
* @test
*
Expand Down

0 comments on commit b316410

Please sign in to comment.