Skip to content

Commit

Permalink
Merge pull request #29 from steffenbrem/bugfix/notify-action
Browse files Browse the repository at this point in the history
[BugFix] NotifyAction should use completePurchase instead of fetchTransaction
  • Loading branch information
makasim authored Nov 7, 2016
2 parents 85f22db + 2b43a55 commit 6d3dc4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 29 deletions.
6 changes: 3 additions & 3 deletions src/Action/NotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function execute($request)

$details = ArrayObject::ensureArrayObject($request->getModel());

if (method_exists($this->api, 'fetchTransaction')) {
$response = $this->api->fetchTransaction($details->toUnsafeArray())->send();
if (method_exists($this->api, 'completePurchase')) {
$response = $this->api->completePurchase($details->toUnsafeArray())->send();
} else if (method_exists($this->api, 'acceptNotification')) {
$response = $this->api->acceptNotification($details->toUnsafeArray())->send();
}
Expand All @@ -55,7 +55,7 @@ public function supports($request)
return
$request instanceof Notify &&
$request->getModel() instanceof \ArrayAccess && (
method_exists($this->api, 'fetchTransaction') ||
method_exists($this->api, 'completePurchase') ||
method_exists($this->api, 'acceptNotification')
)
;
Expand Down
12 changes: 6 additions & 6 deletions tests/Action/NotifyActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Payum\Core\Request\Notify;
use Payum\Core\Tests\GenericActionTest;
use Payum\OmnipayBridge\Action\NotifyAction;
use Payum\OmnipayBridge\Tests\MollieGateway;
use Payum\OmnipayBridge\Tests\OffsiteGateway;

/**
* @author Steffen Brem <steffenbrem@gmail.com>
Expand All @@ -23,7 +23,7 @@ class NotifyActionTest extends GenericActionTest
protected function setUp()
{
$this->action = new $this->actionClass();
$this->action->setApi(new MollieGateway());
$this->action->setApi(new OffsiteGateway());
}

/**
Expand All @@ -48,8 +48,8 @@ public function shouldSetStatusCapturedWhenSuccessful()

$action = new NotifyAction();

$gateway = new MollieGateway();
$gateway->returnFetchTransaction = $requestMock;
$gateway = new OffsiteGateway();
$gateway->returnOnCompletePurchase = $requestMock;
$action->setApi($gateway);

try {
Expand Down Expand Up @@ -85,8 +85,8 @@ public function shouldSetStatusFailedWhenNotSuccessful()

$action = new NotifyAction();

$gateway = new MollieGateway();
$gateway->returnFetchTransaction = $requestMock;
$gateway = new OffsiteGateway();
$gateway->returnOnCompletePurchase = $requestMock;
$action->setApi($gateway);

try {
Expand Down
20 changes: 0 additions & 20 deletions tests/MollieGateway.php

This file was deleted.

0 comments on commit 6d3dc4c

Please sign in to comment.