Skip to content
Merged
Show file tree
Hide file tree
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
107 changes: 107 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Validate and package

on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
lint:
name: PHP ${{ matrix.php }} lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["7.4", "8.1", "8.2", "8.3"]

steps:
- name: Check out source
uses: actions/checkout@v7

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json, zip
coverage: none

- name: Lint module PHP files
shell: bash
run: |
set -euo pipefail
find modules -type f -name '*.php' -print0 \
| xargs -0 -n1 php -l

package:
name: Build release archive
needs: lint
runs-on: ubuntu-latest

steps:
- name: Check out source
uses: actions/checkout@v7

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: zip
coverage: none

- name: Build archive
shell: bash
run: |
set -euo pipefail
version="$(php -r '$manifest = json_decode(file_get_contents("modules/gateways/sslcommerz/whmcs.json"), true); echo $manifest["version"];')"
archive="dist/SSLCommerz-WHMCS-Module-${version}.zip"
mkdir -p dist
zip -q -r "$archive" modules README.md CHANGELOG.md LICENSE
unzip -t "$archive"

- name: Upload archive
uses: actions/upload-artifact@v7
with:
name: SSLCommerz-WHMCS-Module
path: dist/*.zip
if-no-files-found: error

release:
name: Publish tagged release
if: startsWith(github.ref, 'refs/tags/v')
needs: package
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Check out source
uses: actions/checkout@v7

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
extensions: zip
coverage: none

- name: Build release archive
shell: bash
run: |
set -euo pipefail
version="$(php -r '$manifest = json_decode(file_get_contents("modules/gateways/sslcommerz/whmcs.json"), true); echo $manifest["version"];')"
archive="dist/SSLCommerz-WHMCS-Module-${version}.zip"
mkdir -p dist
zip -q -r "$archive" modules README.md CHANGELOG.md LICENSE
unzip -t "$archive"

- name: Publish tagged release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" dist/*.zip --title "$GITHUB_REF_NAME" --generate-notes
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/dist/
/.idea/
/.vscode/
*.log
*.tmp
*.zip
.DS_Store
Thumbs.db
24 changes: 24 additions & 0 deletions ACKNOWLEDGEMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Acknowledgements

SSLCommerz for WHMCS 1.0.0 was built and verified with the following platforms, technologies, tools, and community references.

## Project and platform

- **[Extent Technologies Limited](https://extentit.com/)** - project author and maintainer.
- **[SSLCommerz](https://sslcommerz.com/)** - payment gateway and v4 API integrated by this module. SSLCommerz and related marks belong to their respective owners.
- **[WHMCS](https://www.whmcs.com/)** - billing and automation platform, module APIs, gateway callbacks, administrator authentication, and database integration surface.
- **[PHP](https://www.php.net/)** - runtime language, including the cURL and JSON extensions used for API communication and payload handling.

## Development and release tooling

- **[Git](https://git-scm.com/)** and **[GitHub](https://github.com/)** - source control, collaboration, issue tracking, and public release hosting.
- **[GitHub Actions](https://github.com/features/actions)** - automated multi-version PHP syntax validation, packaging, and tagged releases.
- **[Setup PHP](https://github.com/shivammathur/setup-php)** by Shivam Mathur and contributors - PHP runtime provisioning in GitHub Actions.
- **[`zip` and `unzip`](https://infozip.sourceforge.net/)** - command-line release packaging and archive integrity validation.

## Community references

- **[rtraselbd/SSLCommerzWHMCS](https://github.com/rtraselbd/SSLCommerzWHMCS)** - earlier open-source WHMCS integration reviewed as a compatibility and API reference.
- **[Pull request #3](https://github.com/rtraselbd/SSLCommerzWHMCS/pull/3)** and its contributors - community discussion used to review refund and integration edge cases.

This acknowledgement does not imply endorsement by or affiliation with the named vendors or projects. Their respective licenses and terms continue to apply.
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

All notable public changes are documented here.

## 1.0.0 - 2026-09-14

First public production release.

### Added

- EasyCheckout popup, Legacy Hosted, and New Hosted checkout modes.
- Secure server-side invoice reload and signed checkout requests.
- Shared browser callback and IPN validation with idempotent settlement.
- Customer-currency and settled-BDT reconciliation.
- Full and partial refunds based on the captured exchange rate.
- Durable refund reservations and cumulative captured-balance limits.
- Administrator transaction lookup, recent-transaction selector, focused detail views, refund-status queries, and CSV export.
- Redacted diagnostic logging for session and provider failures.
- Multi-version PHP syntax checks, release packaging, and GitHub Release workflow.

### Security

- Restricted gateway redirects to documented exact SSLCommerz HTTPS hosts.
- Added strict signature, transaction identity, amount, currency, status, and risk checks.
- Prevented callback requests from replacing the customer's WHMCS session cookie.
- Added atomic settlement claims and duplicate WHMCS transaction guards.
- Masked card data, redacted credentials, and neutralized spreadsheet formulas in exports.

### Fixed

- Accepted SSLCommerz's live EasyCheckout `cart_json` callback wrapper.
- Correctly routed the live New Hosted checkout while retaining Legacy Hosted behavior.
- Avoided rejecting empty optional customer address fields before the provider can evaluate a session.
- Corrected foreign-currency records so BDT settlements are never displayed as the invoice currency.
- Recovered invoice identity from legacy merchant transaction IDs when possible.
- Replaced custom lookup token rotation with WHMCS native administrator CSRF validation.
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Contributing

Thank you for helping improve SSLCommerz for WHMCS.

## Before starting

- Search existing issues and pull requests for related work.
- Open an issue for a significant behavior or API-contract change before investing in a large implementation.
- Report security problems privately according to [SECURITY.md](SECURITY.md).
- Never post real store credentials, customer data, session cookies, full card details, or unredacted production logs.

## Development setup

1. Fork the repository and create a focused branch.
2. Install PHP 7.4 or a supported PHP 8.x version with cURL and JSON, plus the command-line `zip` and `unzip` tools for release packaging.
3. Lint the published module files with `find modules -type f -name '*.php' -print0 | xargs -0 -n1 php -l`.
4. Make the smallest compatible implementation and verify the affected WHMCS behavior.
5. Build the distributable archive with the same `zip` command used by GitHub Actions.

Keep production code compatible with PHP 7.4. Do not commit live WHMCS data, credentials, or production logs.

## Code and verification expectations

- Follow the existing plain-PHP style and preserve WHMCS module entry-point contracts.
- Treat callback, IPN, currency, refund, and idempotency logic as security-sensitive.
- Validate provider data before changing invoice or transaction state.
- Keep diagnostics actionable but redact credentials and personal data.
- Document behavior-focused verification for fixes, including failure and retry paths where relevant.
- Keep the release ZIP installable at the WHMCS root and free of tests, scripts, and development files.

## Pull requests

A pull request should:

- Explain the problem and the resulting behavior
- Reference the related issue when one exists
- Include verification evidence for functional changes
- Update README or CHANGELOG when operators need to act differently
- Pass the multi-version PHP syntax and packaging workflow
- Avoid unrelated formatting or refactoring

By contributing, you agree that your contribution is licensed under the repository's [MIT License](LICENSE).

Please be respectful, specific, and constructive in all project interactions.
30 changes: 30 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
MIT License

Copyright (c) 2026 Extent Technologies Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

NOTICE

This software integrates with the SSLCommerz payment gateway API. SSLCommerz
and related marks belong to their respective owners. This project is not
endorsed by or affiliated with SSL Wireless/SSLCommerz or WHMCS.

Users must obtain their own API credentials and comply with the applicable
SSLCommerz and WHMCS terms.
Loading