From 8251ef3bb75f3555c3a80b6fef6cf240eae82929 Mon Sep 17 00:00:00 2001 From: Chimezie Enyinnaya Date: Tue, 3 Jan 2017 21:52:02 +0100 Subject: [PATCH 1/3] add method to get all subscriptions made --- src/Paystack.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Paystack.php b/src/Paystack.php index 3220ea5..e8433d4 100644 --- a/src/Paystack.php +++ b/src/Paystack.php @@ -127,7 +127,7 @@ public function makePaymentRequest() * * ] */ - 'metadata' => request()->metadata + 'metadata' => request()->metadata ]; // Remove the fields which were not sent (value would be null) @@ -319,7 +319,6 @@ public function createPlan() $this->setRequestOptions(); $this->setHttpResponse("/plan", 'POST', $data); - } /** @@ -434,6 +433,18 @@ public function createSubscription() $this->setHttpResponse('/subscription', 'POST', $data); } + /** + * Get all the subscriptions made on Paystack. + * + * @return array + */ + public function getAllSubscriptions() + { + $this->setRequestOptions(); + + return $this->setHttpResponse("/subscription", 'GET', [])->getData(); + } + /** * Enable a subscription using the subscription code and token * @return array From 56e8fc69cb406d2fb6d0e655eeddf492a24412e0 Mon Sep 17 00:00:00 2001 From: Chimezie Enyinnaya Date: Tue, 3 Jan 2017 22:10:05 +0100 Subject: [PATCH 2/3] add method to get subscriptions of a customer --- src/Paystack.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Paystack.php b/src/Paystack.php index e8433d4..7d6e202 100644 --- a/src/Paystack.php +++ b/src/Paystack.php @@ -445,6 +445,19 @@ public function getAllSubscriptions() return $this->setHttpResponse("/subscription", 'GET', [])->getData(); } + /** + * Get customer subscriptions + * + * @param integer $customer_id + * @return array + */ + public function getCustomerSubscriptions($customer_id) + { + $this->setRequestOptions(); + + return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); + } + /** * Enable a subscription using the subscription code and token * @return array From d35b9c0c6d69ecfe037994355f10d5c63e46f653 Mon Sep 17 00:00:00 2001 From: Chimezie Enyinnaya Date: Tue, 3 Jan 2017 22:16:11 +0100 Subject: [PATCH 3/3] add method to get all subscriptions to a plan --- src/Paystack.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Paystack.php b/src/Paystack.php index 7d6e202..2208a39 100644 --- a/src/Paystack.php +++ b/src/Paystack.php @@ -458,6 +458,19 @@ public function getCustomerSubscriptions($customer_id) return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData(); } + /** + * Get plan subscriptions + * + * @param integer $plan_id + * @return array + */ + public function getPlanSubscriptions($plan_id) + { + $this->setRequestOptions(); + + return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData(); + } + /** * Enable a subscription using the subscription code and token * @return array