Skip to content

Commit

Permalink
Merge pull request #2 from PlumTreeSystems/1-fix
Browse files Browse the repository at this point in the history
thrown OK response everytime notifyAction gets a response from paysera
  • Loading branch information
MykolasVitkus authored May 12, 2020
2 parents 579b040 + 41c51ab commit ee82fc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Action/NotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,22 @@ public function execute($request)

$response = $this->api->doNotify($httpRequest->query);

if (!$response) {
throw new \WebToPayException('Wrong parameters');
}

switch ($response['status']) {
case '0':
$model['status'] = 'FAILED';
break;
case '1':
$model['status'] = 'COMPLETED';
throw new HttpResponse('OK');
break;
case '2':
$model['status'] = 'NOT_EXECUTED';
break;
}

throw new HttpResponse('OK');
}

/**
Expand Down
1 change: 1 addition & 0 deletions Tests/Action/NotifyActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function shouldBeSubClassOfGatewayAwareAction()
*/
public function shouldThrowExceptionWithWrongParams()
{
$this->expectException(\WebToPayException::class);
$expectedModel = array('foo' => 'fooVal');

$apiMock = $this->createMock(Api::class);
Expand Down

0 comments on commit ee82fc5

Please sign in to comment.