diff --git a/lib/ThreeDSecureRequest.php b/lib/ThreeDSecureRequest.php index 7fed79f..36f7475 100644 --- a/lib/ThreeDSecureRequest.php +++ b/lib/ThreeDSecureRequest.php @@ -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); + } } \ No newline at end of file diff --git a/tests/ThreeDSecureRequestTest.php b/tests/ThreeDSecureRequestTest.php index b7d89da..27efc5b 100644 --- a/tests/ThreeDSecureRequestTest.php +++ b/tests/ThreeDSecureRequestTest.php @@ -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); + } }