-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d7c718c
Showing
27 changed files
with
1,323 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.github export-ignore | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/art export-ignore | ||
/docs export-ignore | ||
/tests export-ignore | ||
/workbench export-ignore | ||
/.editorconfig export-ignore | ||
/.php_cs.dist.php export-ignore | ||
/psalm.xml export-ignore | ||
/psalm.xml.dist export-ignore | ||
/testbench.yaml export-ignore | ||
/UPGRADING.md export-ignore | ||
/phpstan.neon.dist export-ignore | ||
/phpstan-baseline.neon export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: raziul |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Bug Report | ||
description: Report an Issue or Bug with the Package | ||
title: "[Bug]: " | ||
labels: ["bug"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: | | ||
We're sorry to hear you have a problem. Can you help us solve it by providing the following details. | ||
- type: textarea | ||
id: what-happened | ||
attributes: | ||
label: What happened? | ||
description: What did you expect to happen? | ||
placeholder: I cannot currently do X thing because when I do, it breaks X thing. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: how-to-reproduce | ||
attributes: | ||
label: How to reproduce the bug | ||
description: How did this occur, please add any config values used and provide a set of reliable steps if possible. | ||
placeholder: When I do X I see Y. | ||
validations: | ||
required: true | ||
- type: input | ||
id: package-version | ||
attributes: | ||
label: Package Version | ||
description: What version of our Package are you running? Please be as specific as possible | ||
placeholder: 2.0.0 | ||
validations: | ||
required: true | ||
- type: input | ||
id: php-version | ||
attributes: | ||
label: PHP Version | ||
description: What version of PHP are you running? Please be as specific as possible | ||
placeholder: 8.2.0 | ||
validations: | ||
required: true | ||
- type: input | ||
id: laravel-version | ||
attributes: | ||
label: Laravel Version | ||
description: What version of Laravel are you running? Please be as specific as possible | ||
placeholder: 9.0.0 | ||
validations: | ||
required: true | ||
- type: dropdown | ||
id: operating-systems | ||
attributes: | ||
label: Which operating systems does with happen with? | ||
description: You may select more than one. | ||
multiple: true | ||
options: | ||
- macOS | ||
- Windows | ||
- Linux | ||
- type: textarea | ||
id: notes | ||
attributes: | ||
label: Notes | ||
description: Use this field to provide any other notes that you feel might be relevant to the issue. | ||
validations: | ||
required: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
blank_issues_enabled: false | ||
contact_links: | ||
- name: Ask a question | ||
url: https://github.com/raziul/sslcommerz-laravel/discussions/new?category=q-a | ||
about: Ask the community for help | ||
- name: Request a feature | ||
url: https://github.com/raziul/sslcommerz-laravel/discussions/new?category=ideas | ||
about: Share ideas for new features | ||
- name: Report a security issue | ||
url: https://github.com/raziul/sslcommerz-laravel/security/policy | ||
about: Learn how to notify us for sensitive bugs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Fix PHP code style issues | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.php' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
php-code-styling: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Fix PHP code style issues | ||
uses: aglipanci/[email protected] | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: Fix styling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: run-tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.php' | ||
- '.github/workflows/run-tests.yml' | ||
- 'phpunit.xml.dist' | ||
- 'composer.json' | ||
- 'composer.lock' | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 5 | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
php: [8.3, 8.2] | ||
laravel: [10.*] | ||
stability: [prefer-lowest, prefer-stable] | ||
include: | ||
- laravel: 10.* | ||
testbench: 8.* | ||
carbon: ^2.63 | ||
|
||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo | ||
coverage: none | ||
|
||
- name: Setup problem matchers | ||
run: | | ||
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | ||
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
- name: Install dependencies | ||
run: | | ||
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update | ||
composer update --${{ matrix.stability }} --prefer-dist --no-interaction | ||
- name: List Installed Dependencies | ||
run: composer show -D | ||
|
||
- name: Execute tests | ||
run: vendor/bin/pest --ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "Update Changelog" | ||
|
||
on: | ||
release: | ||
types: [released] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
|
||
- name: Update Changelog | ||
uses: stefanzweifel/changelog-updater-action@v1 | ||
with: | ||
latest-version: ${{ github.event.release.name }} | ||
release-notes: ${{ github.event.release.body }} | ||
|
||
- name: Commit updated CHANGELOG | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
branch: main | ||
commit_message: Update CHANGELOG | ||
file_pattern: CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.idea | ||
.phpunit.cache | ||
build | ||
composer.lock | ||
coverage | ||
docs | ||
phpunit.xml | ||
phpstan.neon | ||
testbench.yaml | ||
vendor | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Changelog | ||
|
||
All notable changes to `sslcommerz-laravel` will be documented in this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) raziul <[email protected]> | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# Sslcommerz Laravel Package | ||
|
||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/iraziul/sslcommerz-laravel.svg?style=flat-square)](https://packagist.org/packages/iraziul/sslcommerz-laravel) | ||
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/iraziul/sslcommerz-laravel/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/iraziul/sslcommerz-laravel/actions?query=workflow%3Arun-tests+branch%3Amain) | ||
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/iraziul/sslcommerz-laravel/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/iraziul/sslcommerz-laravel/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/iraziul/sslcommerz-laravel.svg?style=flat-square)](https://packagist.org/packages/iraziul/sslcommerz-laravel) | ||
|
||
The `sslcommerz-laravel` package integrates SSLCommerz payment gateway into your Laravel application. It provides a simple and fluent API for processing payments, refunds, and validating transactions. | ||
|
||
## Requirements | ||
|
||
- PHP 8.2 or above | ||
- Laravel 10.0 or above | ||
|
||
## Installation | ||
|
||
You can install the package via composer: | ||
|
||
```bash | ||
composer require raziul/sslcommerz-laravel | ||
``` | ||
|
||
After installation, the service provider will automatically be registered. The package will also register a facade named `Sslcommerz` for easy access. | ||
|
||
## Configuration | ||
|
||
To configure the package, add the following environment variables to your `.env` file: | ||
|
||
```bash | ||
SSLC_SANDBOX=true # or false | ||
SSLC_STORE_ID= | ||
SSLC_STORE_PASSWORD= | ||
SSLC_STORE_CURRENCY='BDT' | ||
|
||
# SSLCommerz route names | ||
SSLC_ROUTE_SUCCESS='sslc.success' | ||
SSLC_ROUTE_FAILURE='sslc.failure' | ||
SSLC_ROUTE_CANCEL='sslc.cancel' | ||
SSLC_ROUTE_IPN='sslc.ipn' | ||
``` | ||
|
||
These variables will be automatically used by the package. | ||
|
||
Optionally, You can publish the config file with: | ||
|
||
```bash | ||
php artisan sslcommerz:install" | ||
``` | ||
## Usage | ||
### Initiating a Payment | ||
To create a new payment, you can use the Sslcommerz facade: | ||
```php | ||
use \Raziul\Sslcommerz\Facades\Sslcommerz; | ||
$response = Sslcommerz::setOrder( | ||
$amount, | ||
$invoiceId, | ||
$productName, | ||
)->setCustomer( | ||
$customerName, | ||
$customerEmail, | ||
$customerPhone, | ||
)->setShippingInfo( | ||
$itemsQuantity, | ||
$address, | ||
)->makePayment(); | ||
if ($response->success()) { | ||
// payment initiated, redirect to payment page | ||
return redirect($response->gatewayPageURL()); | ||
} else { | ||
// Handle payment failure | ||
} | ||
``` | ||
### Validating a Payment | ||
To validate a payment after a successful transaction: | ||
```php | ||
use \Raziul\Sslcommerz\Facades\Sslcommerz; | ||
$isValid = Sslcommerz::validatePayment( | ||
request()->all(), | ||
$transactionId, | ||
$amount, | ||
); | ||
if ($isValid) { | ||
// Payment is valid | ||
} else { | ||
// Payment is invalid | ||
} | ||
``` | ||
You can find more details on the [Wiki](https://github.com/iraziul/sslcommerz-laravel/wiki). | ||
## Changelog | ||
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. | ||
## Contributing | ||
Please see [CONTRIBUTING](CONTRIBUTING.md) for details. | ||
## Security Vulnerabilities | ||
Please review [our security policy](../../security/policy) on how to report security vulnerabilities. | ||
## Credits | ||
- [Raziul Islam](https://github.com/iRaziul) | ||
- [All Contributors](../../contributors) | ||
## License | ||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
Oops, something went wrong.