Skip to content

Release v2.0.0 - Major Refactor with New Services and Improved API Client #199

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

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
23848fb
Rewrote and restructure files for SRP
an-nur-info-tech Aug 2, 2025
4d5849d
Add Unit test
an-nur-info-tech Aug 2, 2025
a7cdd3e
Remove irrelevant files
an-nur-info-tech Aug 2, 2025
30c843b
Ignore PHPUnit result cache file
an-nur-info-tech Aug 3, 2025
7678df3
Modify ignore, setups file, and tests
an-nur-info-tech Aug 3, 2025
c71577a
Add request exception
an-nur-info-tech Aug 3, 2025
839ecaa
Add installation setup file
an-nur-info-tech Aug 3, 2025
aa2040d
Add Docblock
an-nur-info-tech Aug 3, 2025
f1b4b6c
Add what changed
an-nur-info-tech Aug 3, 2025
002aa30
Modify ignore file
an-nur-info-tech Aug 3, 2025
c345323
Add Integration test
an-nur-info-tech Aug 3, 2025
c81b915
Modify helper file
an-nur-info-tech Aug 3, 2025
2b94a1b
Install php-cs-fixer
an-nur-info-tech Aug 3, 2025
d8e0cb3
Enforce PSR compliance
an-nur-info-tech Aug 3, 2025
84d8204
Modify setup file
an-nur-info-tech Aug 3, 2025
a87c159
Fix for PSR Compliance
an-nur-info-tech Aug 3, 2025
17a6fa6
Modify gitignore file
Bello-Ibrahm Aug 3, 2025
08813b0
Modify PR template
Bello-Ibrahm Aug 3, 2025
898771c
Add document file
Bello-Ibrahm Aug 3, 2025
a7bf8a9
Implement Built-in retry logic for the PaystackClient
Bello-Ibrahm Aug 3, 2025
299d1da
Add README.md doc
Bello-Ibrahm Aug 3, 2025
c6ddaf6
Modify git ignore
an-nur-info-tech Aug 8, 2025
b0025df
Modify PR file
an-nur-info-tech Aug 8, 2025
8c2e178
Modify Changelog file
an-nur-info-tech Aug 8, 2025
f0dae1b
Improves codes for optimization and documentation
an-nur-info-tech Aug 8, 2025
561a68e
Add README doc for Dev
an-nur-info-tech Aug 8, 2025
b473e2b
Add PHPstan for running static analysis
an-nur-info-tech Aug 8, 2025
2b7d75e
Add Page, Plan, and customer integration tests
an-nur-info-tech Aug 8, 2025
7186cbe
Modify some changes
an-nur-info-tech Aug 8, 2025
579d22e
Modify README.md file
Bello-Ibrahm Aug 8, 2025
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
10 changes: 10 additions & 0 deletions .env.testing.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Rename this file to .env.testing and suppliy necessary value for integration testing
PAYSTACK_PUBLIC_KEY=
PAYSTACK_SECRET_KEY=
PAYSTACK_PAYMENT_URL=https://api.paystack.co
PAYSTACK_CALLBACK_URL=
MERCHANT_EMAIL=''

# Optional retry settings
PAYSTACK_RETRY_ATTEMPTS=3
PAYSTACK_RETRY_DELAY=150
73 changes: 73 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Pull Request

## Summary

<!-- Describe the change you're introducing -->
Refactor to enforce Single Responsibility Principle (SRP) in `PaystackClient`. Extracted responsibilities into dedicated service classes.

---

## Related Issues

<!-- e.g., Fixes #12, Closes #45 -->
Fixes #<!-- issue number -->

---

## Changes Made

- [x] Extracted HTTP logic into `PaystackClient`
- [x] Created `TransactionService`, `CustomerService`, etc.
- [x] Applied PSR-4 autoloading structure
- [x] Added docblocks for IDE
- [x] Improved test folder and structure
- [x] Configurable retry logic to `PaystackClient` via `retry_attempts` and `retry_delay` in `config/paystack.php`.
---

## Motivation

<!-- Why is this change needed? -->
Improving maintainability, testability, and adherence to clean architecture (SRP/SOLID principles).

---

## Tests

<!-- What did you test or automate? -->
- [x] Unit tests for all new service classes
- [x] Integration tests using live API keys
- [x] Fallbacks to HTTP fake/mocks planned

---

## Checklist

- [x] Code builds without errors
- [x] All PHPUnit tests pass
- [x] Linted with `php-cs-fixer` or similar
- [x] Documentation updated (if applicable)
- [x] SRP principles respected across all services
- [x] PR title and description are clear

---

## Screenshots (UI-related changes only)

<!-- Add before/after screenshots if applicable -->

---

## Breaking Changes?

- [ ] Yes
- [x] No

<!-- If yes, describe what's breaking and how to migrate -->

---

## Additional Notes

<!-- Anything else the reviewers should know? -->

> _Please review this PR and provide feedback if needed._
71 changes: 67 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,68 @@
build
vendor
.DS_Store
# Laravel
/vendor
/node_modules
/public/storage
/storage/*.key
.env
.env.*.backup
.phpunit.result.cache
Homestead.yaml
Homestead.json
/.vagrant
/storage/logs/*.log
/storage/framework/cache/data/*
/storage/framework/sessions/*
/storage/framework/testing/*
/storage/framework/views/*.php
/public/hot
/public/storage
/storage/debugbar
npm-debug.log
yarn-error.log

# Composer
composer.lock
.idea

# IDEs
.idea/
*.sublime-project
*.sublime-workspace
.vscode/

# OS files
.DS_Store
Thumbs.db

# PHPStorm specific
/.phpstorm.meta.php

# phpDocumentor output
/output/

# Coverage/Test
coverage/
clover.xml
.junit.xml
build/
teamcity.txt
.env.testing
.phpunit.cache
.phpunit.result.cache
phpunit.xml.dist.bak
.php-cs-fixer.cache

laravel-paystack-app/
myNote.md
routes/
resources/
Documentation.md
database/
src/Http/
src/Models/
tests/Feature/
src/Exceptions/TransactionDashboardException.php
src/TransRef.php
tests/TestCaseBackup.php
tests/Integration/auth_reference.json


1 change: 0 additions & 1 deletion .phpunit.result.cache

This file was deleted.

53 changes: 50 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,59 @@

All Notable changes to `laravel-paystack` will be documented in this file

## 2015-11-04
- Initial release
The format is inspired by [Keep a Changelog](https://keepachangelog.com) and this project adheres to [Semantic Versioning](https://semver.org).

---

## [Unreleased]

### Added
- Introduced `PaystackClient` class to abstract Guzzle HTTP requests.
- Configurable retry logic to `PaystackClient` via `retry_attempts` and `retry_delay` in `config/paystack.php`.
- Added service classes for clear separation of concerns:
- `TransactionService`
- `CustomerService`
- `PlanService`
- `SubscriptionService`
- `PageService`
- `SubAccountService`
- `BankService`
- Implemented `TransRef` helper for generating transaction references (`Paystack::transRef()`).
- Wrote unit and integration tests for services using PHPUnit.
- Added `setup.sh` for bootstrapping the package setup.
- Added PHPDoc blocks to all service classes and methods to enhance developer experience and IDE support.

### Changed
- Refactored core `Paystack.php` class to follow SRP and delegate responsibilities to dedicated service classes.
- Centralized API logic through `PaystackClient` to improve testability and HTTP abstraction.
- Improved autoload structure for PSR-4 compliance.
- Restructured folders (`resources/config/paystack.php` → `config/paystack.php`).
- Enhanced PHPUnit configuration and improved test folder layout.
- Enhanced exception handling and removed reliance on global helpers like `request()` or `config()` in services.

### Removed
- Deprecated or unused logic from the core `Paystack` class.
- Obsolete configuration entries.
- Old and redundant test code.

### Fixed
- Resolved PSR-4 autoload warnings for tests.
- Fixed XML validation issue in `phpunit.xml` caused by invalid `<log>` structure.

---

## 2020-05-23

### Added
- Support for Laravel 7
- Support for splitting payments into subaccounts
- Support for more than one currency. Now you can use USD!
- Support for multiple quantities
- Support for helpers
- Support for helpers

---

## 2015-11-04

### Added
- Initial release
Loading