@@ -127,9 +127,9 @@ public function setResponse($relativeUrl)
127
127
return $ this ;
128
128
}
129
129
130
- private function setGetResponse ($ relativeUrl )
130
+ private function setGetResponse ($ relativeUrl, $ body = array () )
131
131
{
132
- $ this ->response = $ this ->client ->get ($ this ->baseUrl . $ relativeUrl , [] );
132
+ $ this ->response = $ this ->client ->get ($ this ->baseUrl . $ relativeUrl , $ body );
133
133
134
134
return $ this ;
135
135
}
@@ -235,7 +235,7 @@ public function getAllCustomers()
235
235
{
236
236
$ this ->setRequestOptions ();
237
237
238
- return $ this ->setGetResponse ("/customer " )->getData ();
238
+ return $ this ->setGetResponse ("/customer " , [] )->getData ();
239
239
}
240
240
241
241
/**
@@ -246,7 +246,7 @@ public function getAllPlans()
246
246
{
247
247
$ this ->setRequestOptions ();
248
248
249
- return $ this ->setGetResponse ("/plan " )->getData ();
249
+ return $ this ->setGetResponse ("/plan " , [] )->getData ();
250
250
}
251
251
252
252
/**
@@ -257,7 +257,7 @@ public function getAllTransactions()
257
257
{
258
258
$ this ->setRequestOptions ();
259
259
260
- return $ this ->setGetResponse ("/transaction " )->getData ();
260
+ return $ this ->setGetResponse ("/transaction " , [] )->getData ();
261
261
}
262
262
263
263
/**
@@ -299,11 +299,7 @@ public function createPlan(){
299
299
300
300
$ this ->setRequestOptions ();
301
301
302
- $ this ->response = $ this ->client ->post ($ this ->baseUrl .'/plan ' , [
303
- 'body ' => json_encode ($ data )
304
- ]);
305
-
306
- return $ this ->response ->getResponse ();
302
+ return $ this ->setGetResponse ("/plan " , $ data )->getResponse ();
307
303
308
304
}
309
305
@@ -316,9 +312,7 @@ public function fetchPlan($plan_code){
316
312
317
313
$ this ->setRequestOptions ();
318
314
319
- $ this ->response = $ this ->client ->post ($ this ->baseUrl .'/plan/ ' . $ plan_code , []);
320
-
321
- return $ this ->response ->getResponse ();
315
+ return $ this ->setGetResponse ('/plan/ ' . $ plan_code , [])->getResponse ();
322
316
323
317
}
324
318
@@ -342,14 +336,12 @@ public function updatePlan($plan_code){
342
336
343
337
$ this ->setRequestOptions ();
344
338
345
- $ this ->response = $ this ->client ->post ($ this ->baseUrl .'/plan/ ' . $ plan_code , [
346
- 'body ' => json_encode ($ data )
347
- ]);
348
-
349
- return $ this ->response ->getResponse ();
339
+ return $ this ->setGetResponse ('/plan/ ' . $ plan_code , $ data )->getResponse ();
350
340
351
341
}
352
342
343
+
344
+
353
345
}
354
346
355
347
0 commit comments