Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add method to get all subscriptions made #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions src/Paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function makePaymentRequest()
*
* ]
*/
'metadata' => request()->metadata
'metadata' => request()->metadata
];

// Remove the fields which were not sent (value would be null)
Expand Down Expand Up @@ -319,7 +319,6 @@ public function createPlan()
$this->setRequestOptions();

$this->setHttpResponse("/plan", 'POST', $data);

}

/**
Expand Down Expand Up @@ -434,6 +433,44 @@ 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();
}

/**
* 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();
}

/**
* 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
Expand Down