Skip to content

Commit

Permalink
feat: add create endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
nonz250 committed Nov 8, 2024
1 parent f661da1 commit b4194ef
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/ThreeDSecureRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ public static function all($params = null, $opts = null)
{
return self::_all($params, $opts);
}

/**
* @param array|null $params
* @param array|string|null $opts
*
* @return ThreeDSecureRequest The created three d secure request.
*/
public static function create($params = null, $opts = null)
{
return self::_create($params, $opts);
}
}
13 changes: 13 additions & 0 deletions tests/ThreeDSecureRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,17 @@ public function testAll()
$this->assertSame($expectedThreeDSecureRequestIds[0], $threeDSecureRequests['data'][0]->id);
$this->assertSame($expectedThreeDSecureRequestIds[1], $threeDSecureRequests['data'][1]->id);
}

public function testCreate()
{
$expectedThreeDSecureRequestId = 'tdsr_125192559c91c4011c1ff56f50a';
$expectedCustomerCardId = 'car_xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$params = [
'resource_id' => $expectedCustomerCardId
];
$this->mockRequest('POST', '/v1/three_d_secure_requests', $params, $this->managedThreeDSecureRequestResource($expectedThreeDSecureRequestId));
$threeDSecureRequest = ThreeDSecureRequest::create($params);
$this->assertSame($expectedThreeDSecureRequestId, $threeDSecureRequest->id);
$this->assertSame($expectedCustomerCardId, $threeDSecureRequest->resource_id);
}
}

0 comments on commit b4194ef

Please sign in to comment.