Skip to content

Commit

Permalink
Allow pass token as param for complete purchase
Browse files Browse the repository at this point in the history
This enables the complete purchase request to accept a parameter `token`. It is useful when we did not receive the notifications from POLi and we can __notify__ by ourself in the crontab.

$proxy->completePurchase(['token' => $token])->send();
  • Loading branch information
chuangbo authored Oct 10, 2016
1 parent b6e4ec9 commit cf64387
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Message/CompletePurchaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ public function getData()
'authenticationCode'
);

$token = $this->httpRequest->query->get('token');
$token = $this->getToken();

if (!$token) {
$token = $this->httpRequest->query->get('token');
}

if (!$token) {
//this may be a POST nudge request, so look for the token there
$token = $this->httpRequest->request->get('Token');
Expand Down Expand Up @@ -52,4 +57,9 @@ public function sendData($data)

return $this->response = new CompletePurchaseResponse($this, $httpResponse->getBody());
}

public function getToken()
{
return $this->getParameter('token');
}
}

0 comments on commit cf64387

Please sign in to comment.