Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] NotifyAction should use completePurchase instead of fetchTransaction #29

Merged
merged 2 commits into from
Nov 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.