Skip to content

Up-to-date new functions for laravel-paystack #4

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 28 commits into from
May 24, 2016
Merged

Up-to-date new functions for laravel-paystack #4

merged 28 commits into from
May 24, 2016

Conversation

devfunsho
Copy link
Contributor

I have fully implemented plans, customers, export transactions, subscriptions and pages. Also, i modified setGetResponse() function to be more useful.

Once you have reviewed and it is ok, we will work on the README.md file to reflect the changes.

Gracias.

Okubanjo Oluwafunsho added 18 commits May 22, 2016 16:29
This was implemented based on the PayStack documentation
Now, you can fetch the details of any plan based on its id or code
Now, you can update any plan’s details based on its id or code
Updated the setGetResponse function to accept an array of data to sent,
as a second parameter
You can now create customers using the laravel package
You can now fetch all customers
You can fetch a customer’s details using its id or code
You can now update customer’s details based on their id or code
You can export all transactions, transactions between a certain period
and export only settled or pending transactions
You can now create subscription now, yaay!
With this two functions, you can now disable a certain subscription and
enable it later if needed.
Fetch the details of any subscription using the subscription id
You can now create pages that can be shared among users using its slug
Fetches all the pages the merchant has
You can fetch the details of a page using it slug or id
Update the details about a particular page using its page slug or id
//Edits by Funsho http://devfunsho.com | @iamfusnho - 22/05/2016

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessary. Please remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do that in the next commit

@devfunsho
Copy link
Contributor Author

I have made all the necessary changes.

@@ -127,9 +127,9 @@ public function setResponse($relativeUrl)
return $this;
}

private function setGetResponse($relativeUrl)
private function setGetResponse($relativeUrl, $body = array())
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the array short-form here like so: $body = []

]);

return $this->response->getResponse();
return $this->setGetResponse("/plan", $data)->getResponse();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setGetResponse method uses the get method. How come you are using it here?...shouldn't this be a post request?

Created setPostResponse and setPutResponse to handle POST and PUT
request respectively

$this->response = $this->setGetResponse('/customer', $data);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain how you are using a get method. Since you are trying to create a customer. shouldn't it be a post method?

$this->setRequestOptions();

return $this->setGetResponse('/page/'.$page_id, $data)->getResponse();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be a post method?

$this->setRequestOptions();

$this->response = $this->setGetResponse('/subscription', $data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be a post method?

@devfunsho
Copy link
Contributor Author

Oga, I have updated the code to use appropriate set response functions, I totally forgot to change them


private function setPutResponse($relativeUrl, $body = [])
{
$this->response = $this->client->put($this->baseUrl . $relativeUrl, $body);
Copy link
Owner

@unicodeveloper unicodeveloper May 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now all these 3 can be just one method. Right now, the three methods just makes it redundant. It can be like so:

 private function setHttpResponse($relativeUrl, $method = null, $body = [])
 { 
  if (is_null($method) {
     // throw the isNull exception
  }

  $this->response = $this->client->{strtolower($method)}($this->baseUrl . $relativeUrl, $body);

  return $this;
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then replace the entire code base with the setHttpResponse and pass in the relevant get or post or put or delete methods.

@devfunsho
Copy link
Contributor Author

Hope i'm not missing anything else


return $this;
}
throw new isNullException("Empty method not allowed");

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you including all these extra spaces?..Please remove them. All the other parts of the codebase dont have unnecessary space like this


use Exception;

class isNullException extends Exception {
Copy link
Owner

@unicodeveloper unicodeveloper May 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't create a class with a small letter. Please start with capital letter and also replace the change everywhere you have used this exception

@devfunsho
Copy link
Contributor Author

Oya boss, updated.

When are we going to implement that stuff I shared with you on twitter for paystack.

Gracias.

@unicodeveloper
Copy link
Owner

Which stuff?

@unicodeveloper unicodeveloper merged commit e9df56b into unicodeveloper:master May 24, 2016
@devfunsho
Copy link
Contributor Author

"It will be lovely if you can add a limit to the number of times an amount is deducted per interval in a plan. For example, Ayo wants to pay N10,000 every month for six months."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants