Skip to content

Commit

Permalink
Merge pull request #214 from TransbankDevelopers/feat/add-token-valid…
Browse files Browse the repository at this point in the history
…ation-web-pay

Feat/add token validation web pay
  • Loading branch information
mvarlic authored Jul 1, 2021
2 parents 8201fa4 + 4c292e4 commit cd5aa51
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Webpay/WebpayPlus/MallTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ public function create($buyOrder, $sessionId, $returnUrl, $details)
*/
public function commit($token)
{
if (!is_string($token)) {
throw new InvalidArgumentException('Token parameter given is not string.');
}
if (!isset($token) || trim($token) === '') {
throw new InvalidArgumentException('Token parameter given is empty.');
}

try {
$response = $this->sendRequest(
'PUT',
Expand Down
7 changes: 7 additions & 0 deletions src/Webpay/WebpayPlus/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ public function create($buyOrder, $sessionId, $amount, $returnUrl)
*/
public function commit($token)
{
if (!is_string($token)) {
throw new InvalidArgumentException('Token parameter given is not string.');
}
if (!isset($token) || trim($token) === '') {
throw new InvalidArgumentException('Token parameter given is empty.');
}

try {
$response = $this->sendRequest(
'PUT',
Expand Down

0 comments on commit cd5aa51

Please sign in to comment.