-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5452040
commit ff82a3f
Showing
6 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Stripe; | ||
|
||
/** | ||
* Class Review | ||
* | ||
* @property string $id | ||
* @property string $object | ||
* @property string $charge | ||
* @property int $created | ||
* @property bool $livemode | ||
* @property bool $open | ||
* @property sring $payment_intent | ||
* @property string $reason | ||
* | ||
* @package Stripe | ||
*/ | ||
class Review extends \Stripe\ApiResource | ||
{ | ||
const OBJECT_NAME = "review"; | ||
|
||
use \Stripe\ApiOperations\All; | ||
use \Stripe\ApiOperations\Retrieve; | ||
|
||
/** | ||
* @param array|string|null $options | ||
* | ||
* @return Review The approved review. | ||
*/ | ||
public function approve($params = null, $options = null) | ||
{ | ||
$url = $this->instanceUrl() . '/approve'; | ||
list($response, $opts) = $this->_request('post', $url, $params, $options); | ||
$this->refreshFrom($response, $opts); | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Stripe; | ||
|
||
class ReviewTest extends \Stripe\TestCase | ||
{ | ||
const TEST_RESOURCE_ID = 'prv_123'; | ||
|
||
public function testIsApprovable() | ||
{ | ||
$resource = Review::retrieve(self::TEST_RESOURCE_ID); | ||
$this->expectsRequest( | ||
'post', | ||
'/v1/reviews/' . self::TEST_RESOURCE_ID . '/approve' | ||
); | ||
$resource->approve(); | ||
$this->assertInstanceOf("Stripe\\Review", $resource); | ||
} | ||
|
||
public function testIsListable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/reviews' | ||
); | ||
$resources = Review::all(); | ||
$this->assertTrue(is_array($resources->data)); | ||
$this->assertInstanceOf("Stripe\\Review", $resources->data[0]); | ||
} | ||
|
||
public function testIsRetrievable() | ||
{ | ||
$this->expectsRequest( | ||
'get', | ||
'/v1/reviews/' . self::TEST_RESOURCE_ID | ||
); | ||
$resource = Review::retrieve(self::TEST_RESOURCE_ID); | ||
$this->assertInstanceOf("Stripe\\Review", $resource); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters