Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Commit

Permalink
Allow passing additional data to 3DS2 complete method (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuurbo committed Sep 10, 2020
1 parent f12f9fa commit 2db2e07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions spec/Tuurbo/Spreedly/TransactionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,13 @@ public function it_captures_a_specific_authorized_amount_and_currency($client)

public function it_completes_a_3ds2_transaction($client)
{
$client->post('v1/transactions/'.self::TRANSACTION_TOKEN.'/complete.json')
$data = [];

$client->post('v1/transactions/'.self::TRANSACTION_TOKEN.'/complete.json', $data)
->shouldBeCalled()
->willReturn($client);

$this->complete()->shouldReturnAnInstanceOf('Tuurbo\Spreedly\Client');
$this->complete($data)->shouldReturnAnInstanceOf('Tuurbo\Spreedly\Client');
}

public function it_throws_invalid_method_exception()
Expand Down
6 changes: 3 additions & 3 deletions src/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,21 @@ public function void(array $data = [])
*
* <code>
* // Completes a 3DS 2 transaction in the device fingerprint stage.
* Spreedly::transaction($transactionToken)->complete();
* Spreedly::transaction($transactionToken)->complete($data);
* </code>
*
*
* @return mixed
*
* @throws Exceptions\MissingTransactionTokenException
*/
public function complete()
public function complete(array $data = [])
{
if (!$this->transactionToken) {
throw new Exceptions\MissingTransactionTokenException();
}

return $this->client->post('v1/transactions/'.$this->transactionToken.'/complete.json');
return $this->client->post('v1/transactions/'.$this->transactionToken.'/complete.json', $data);
}

/**
Expand Down

0 comments on commit 2db2e07

Please sign in to comment.