-
Notifications
You must be signed in to change notification settings - Fork 5
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 cacb926
Showing
34 changed files
with
1,548 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,6 @@ | ||
/vendor | ||
composer.lock | ||
/phpunit.xml | ||
.phpunit.result.cache | ||
.idea | ||
.env |
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,4 @@ | ||
php: | ||
preset: laravel | ||
js: true | ||
css: true |
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 @@ | ||
language: php | ||
|
||
sudo: false | ||
|
||
php: | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
|
||
env: | ||
matrix: | ||
- LARAVEL=5.8.* | ||
- LARAVEL=^6.0 | ||
- LARAVEL=^7.0 | ||
|
||
matrix: | ||
fast_finish: true | ||
exclude: | ||
- php: 7.1 | ||
env: LARAVEL=^6.0 | ||
- php: 7.1 | ||
env: LARAVEL=^7.0 | ||
allow_failures: | ||
- env: LARAVEL=^7.0 | ||
|
||
before_install: | ||
- phpenv config-rm xdebug.ini || true | ||
|
||
install: | ||
- travis_retry composer require "illuminate/contracts=${LARAVEL}" --prefer-dist --no-interaction --no-suggest | ||
|
||
script: vendor/bin/phpunit --verbose |
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 @@ | ||
# knet | ||
|
||
General information about this package. | ||
|
||
## Installation | ||
|
||
Information about the installation procedure for this package. | ||
|
||
## Using this package | ||
|
||
Information about using this package | ||
|
||
## Contributing | ||
|
||
Information about contributing to this package. |
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,53 @@ | ||
{ | ||
"name": "asciisd/knet", | ||
"description": "Knet package is provides an expressive, fluent interface to Knet's payment services.", | ||
"keywords": [ | ||
"Laravel", | ||
"billing", | ||
"Knet", | ||
"Knet Payment" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Amr Ahmed", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"homepage": "https://github.com/asciisd/knet", | ||
"require": { | ||
"php": "^7.1.3", | ||
"laravel/framework": "5.8.*", | ||
"dompdf/dompdf": "^0.8.0", | ||
"ext-openssl": "*", | ||
"ext-json": "*" | ||
}, | ||
"require-dev": { | ||
"mockery/mockery": "^1.0", | ||
"orchestra/testbench": "^3.8|^4.0|^5.0", | ||
"phpunit/phpunit": "^7.5|^8.0" | ||
}, | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"Asciisd\\Knet\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Asciisd\\Knet\\Tests\\": "tests/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Asciisd\\Knet\\Providers\\KnetServiceProvider" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"test": "vendor/bin/phpunit -c ./phpunit.xml --colors=always", | ||
"analysis": "vendor/bin/phpstan analyse" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
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,136 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| KNet production and development urls | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The KNet production url and development url give you access to Knet's | ||
| API. The "production" url is typically used when interacting with | ||
| production Api while the "development" url accesses testing API endpoints. | ||
| | ||
*/ | ||
'production_url' => env('KENT_PRODUCTION_URL', 'https://kpay.com.kw/kpg/PaymentHTTP.htm'), | ||
'development_url' => env('KENT_PRODUCTION_URL', 'https://kpaytest.com.kw/kpg/PaymentHTTP.htm'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Knet Credentials | ||
|-------------------------------------------------------------------------- | ||
| | ||
| TranPortal Identification Number: The Payment Gateway Bank administrator | ||
| issues the TranPortal ID to identify the merchant and terminal for transaction | ||
| processing. | ||
| | ||
| TranPortal Password: The Payment Gateway Bank administrator issues the | ||
| TranPortal password to authenticate the merchant and terminal. Merchant data | ||
| will be encrypted and password securely hidden as long as the merchant is issuing | ||
| an https post for transmitting the data to Payment Gateway. | ||
| | ||
*/ | ||
'transport' => [ | ||
'id' => env('KENT_TRANSPORT_ID'), | ||
'password' => env('KENT_TRANSPORT_PASSWORD'), | ||
], | ||
|
||
'resource_key' => env('KENT_RESOURCE_KEY'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Knet Response url | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The merchant URL where Payment Gateway send the authorization response | ||
| | ||
*/ | ||
'response_url' => env('KENT_RESPONSE_URL', '/knet/response'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Knet Error url | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The merchant URL where Payment Gateway send the response in case any | ||
| error while processing the transaction. | ||
| | ||
*/ | ||
'error_url' => env('KENT_ERROR_URL', '/knet/error'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Transaction Action Code | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Transaction Action Type, "1" for Purchase. | ||
| Transaction Action Type, "2" for Refund. | ||
| Transaction Action Type, "3" for Void. | ||
| Transaction Action Type, "8" for Inquiry. | ||
| | ||
*/ | ||
'action_code' => env('KENT_ACTION_CODE', 1), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Language | ||
|-------------------------------------------------------------------------- | ||
| | ||
| The language in which Payment Page has to be presented. | ||
| | ||
| Supported languages: 'AR', 'EN' | ||
| | ||
*/ | ||
'language' => env('KENT_LANGUAGE', 'EN'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Knet Path | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This is the base URI path where Knet's views, such as the payment | ||
| verification screen, will be available from. You're free to tweak | ||
| this path according to your preferences and application design. | ||
| | ||
*/ | ||
'path' => env('KNET_PATH', 'knet'), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Knet Model | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This is the model in your application that implements the HasKnet trait | ||
| provided by Knet. It will serve as the primary model you use while | ||
| interacting with Knet related methods, and so on. | ||
| | ||
*/ | ||
'model' => env('KNET_MODEL', App\User::class), | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Currency | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This is the default currency that will be used when generating charges | ||
| from your application. Of course, you are welcome to use any of the | ||
| various world currencies that are currently supported via Knet. | ||
| | ||
*/ | ||
'currency' => env('KENT_CURRENCY', 414), | ||
'decimals' => '3', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Invoice Paper Size | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This option is the default paper size for all invoices generated using | ||
| Knet. You are free to customize this settings based on the usual | ||
| paper size used by the customers using your Laravel applications. | ||
| | ||
| Supported sizes: 'letter', 'legal', 'A4' | ||
| | ||
*/ | ||
'paper' => env('KNET_PAPER', 'letter'), | ||
]; |
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,2 @@ | ||
* | ||
!.gitignore |
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,5 @@ | ||
parameters: | ||
level: 5 | ||
paths: | ||
- src | ||
- tests |
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,2 @@ | ||
* | ||
!.gitignore |
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,2 @@ | ||
* | ||
!.gitignore |
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,2 @@ | ||
* | ||
!.gitignore |
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,22 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| knet Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register routes for your package. | ||
| | ||
*/ | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::prefix('knet')->group(function () { | ||
Route::post('/response', 'KnetController@response')->name('knet.response'); | ||
|
||
Route::middleware('auth')->group(function() { | ||
Route::get('/', 'KnetController@index')->name('knet'); | ||
Route::post('/', 'KnetController@charge')->name('knet.charge'); | ||
Route::post('/error', 'KnetController@error')->name('knet.error'); | ||
}); | ||
}); |
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,42 @@ | ||
<?php | ||
|
||
namespace Asciisd\Knet\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
class KnetCommand extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'knet:command'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command description'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
// | ||
} | ||
} |
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 @@ | ||
<?php | ||
|
||
namespace Asciisd\Knet\Events; | ||
|
||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class KnetResponseHandled | ||
{ | ||
use Dispatchable, SerializesModels; | ||
/** | ||
* The response payload. | ||
* | ||
* @var array | ||
*/ | ||
public $payload; | ||
|
||
/** | ||
* Create a new event instance. | ||
* | ||
* @param array $payload | ||
* @return void | ||
*/ | ||
public function __construct(array $payload) | ||
{ | ||
$this->payload = $payload; | ||
} | ||
} |
Oops, something went wrong.