Skip to content

Commit

Permalink
fix price mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jozefbalun authored Oct 4, 2017
1 parent 8811ba5 commit 45df9a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/AdyenCheckoutApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,20 @@ public function verify($payload, $price)
{
$response = $this->makeRequest($this->url . '/verify', ['payload' => $payload]);

if (isset($response['errorMessage'])) {
throw new AdyenResponseException($response['errorMessage'], 400);
}

if (isset($response['authResponse']) && $response['authResponse'] === 'Error') {
throw new VerificationException();
}

$setupPrice = Redis::get($this->getRedisKey($this->redisKey));
$setupPrice = Redis::get($this->getRedisKey($response['merchantReference']));

if (! $setupPrice && $setupPrice != $price) {
if (! $setupPrice && $setupPrice != ($price * 100)) {
throw new PriceMismatchException();
}
Redis::del($this->getRedisKey($this->redisKey));
Redis::del($this->getRedisKey($response['merchantReference']));

return $response;
}
Expand Down

0 comments on commit 45df9a5

Please sign in to comment.