File tree 5 files changed +94
-3
lines changed
5 files changed +94
-3
lines changed Original file line number Diff line number Diff line change @@ -516,7 +516,7 @@ public function deletePlan(array $parameters = array())
516
516
*/
517
517
public function listPlans (array $ parameters = array ())
518
518
{
519
- return $ this ->createRequest ('App\Lib \Omnipay\Stripe\Message\ListPlansRequest ' , $ parameters );
519
+ return $ this ->createRequest ('\Omnipay\Stripe\Message\ListPlansRequest ' , $ parameters );
520
520
}
521
521
522
522
/**
Original file line number Diff line number Diff line change 3
3
/**
4
4
* Stripe List Plans Request.
5
5
*/
6
- namespace App \ Lib \ Omnipay \Stripe \Message ;
6
+ namespace Omnipay \Stripe \Message ;
7
7
8
8
// use Omnipay\Common\Message\AbstractRequest;
9
9
13
13
* @see Omnipay\Stripe\Gateway
14
14
* @link https://stripe.com/docs/api/curl#list_plans
15
15
*/
16
- class ListPlansRequest extends \ Omnipay \ Stripe \ Message \ AbstractRequest
16
+ class ListPlansRequest extends AbstractRequest
17
17
{
18
18
public function getData ()
19
19
{
Original file line number Diff line number Diff line change @@ -152,6 +152,13 @@ public function testDeletePlan()
152
152
$ this ->assertSame ('basic ' , $ request ->getId ());
153
153
}
154
154
155
+ public function testListPlans ()
156
+ {
157
+ $ request = $ this ->gateway ->listPlans (array ());
158
+
159
+ $ this ->assertInstanceOf ('Omnipay\Stripe\Message\ListPlansRequest ' , $ request );
160
+ }
161
+
155
162
public function testCreateSubscription ()
156
163
{
157
164
$ request = $ this ->gateway ->createSubscription (array ('plan ' => 'basic ' ));
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Omnipay \Stripe \Message ;
4
+
5
+ use Omnipay \Tests \TestCase ;
6
+
7
+ class ListInvoicesRequestTest extends TestCase
8
+ {
9
+ public function setUp ()
10
+ {
11
+ $ this ->request = new ListPlansRequest ($ this ->getHttpClient (), $ this ->getHttpRequest ());
12
+ }
13
+
14
+ public function testEndpoint ()
15
+ {
16
+ $ this ->assertSame ('https://api.stripe.com/v1/plans ' , $ this ->request ->getEndpoint ());
17
+ }
18
+
19
+ public function testSendSuccess ()
20
+ {
21
+ $ this ->setMockHttpResponse ('ListPlans.txt ' );
22
+ $ response = $ this ->request ->send ();
23
+
24
+ $ this ->assertTrue ($ response ->isSuccessful ());
25
+ $ this ->assertFalse ($ response ->isRedirect ());
26
+ $ this ->assertNotNull ($ response ->getList ());
27
+ $ this ->assertNull ($ response ->getMessage ());
28
+ }
29
+
30
+ /**
31
+ * According to documentation: https://stripe.com/docs/api/php#list_plans
32
+ * This request should never throw an error.
33
+ */
34
+ public function testSendFailure ()
35
+ {
36
+ this ->assertTrue (true );
37
+ }
38
+ }
Original file line number Diff line number Diff line change
1
+ HTTP/1.1 200 OK
2
+ Server: nginx
3
+ Date: Mon, 29 Feb 2016 02:40:46 GMT
4
+ Content-Type: application/json
5
+ Content-Length: 6247
6
+ Connection: keep-alive
7
+ Access-Control-Allow-Credentials: true
8
+ Cache-Control: no-cache, no-store
9
+
10
+ {
11
+ "object" => "list",
12
+ "url" => "/v1/plans",
13
+ "has_more" => false,
14
+ "data" => [
15
+ {
16
+ "id": "test-1",
17
+ "object": "plan",
18
+ "amount": 29995,
19
+ "created": 1483391153,
20
+ "currency": "usd",
21
+ "interval": "year",
22
+ "interval_count": 1,
23
+ "livemode": false,
24
+ "metadata": {
25
+ },
26
+ "name": "Test 1",
27
+ "statement_descriptor": "Test 1",
28
+ "trial_period_days": 14
29
+ },
30
+ {
31
+ "id": "test-2",
32
+ "object": "plan",
33
+ "amount": 29995,
34
+ "created": 1483391153,
35
+ "currency": "usd",
36
+ "interval": "year",
37
+ "interval_count": 1,
38
+ "livemode": false,
39
+ "metadata": {
40
+ },
41
+ "name": "Test 1",
42
+ "statement_descriptor": "Test 2",
43
+ "trial_period_days": 14
44
+ }
45
+ ]
46
+ }
You can’t perform that action at this time.
0 commit comments