forked from larabook/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
7 changed files
with
267 additions
and
37 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,72 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
//------------------------------- | ||
// Timezone for insert dates in database | ||
// If you want Gateway not set timezone, just leave it empty | ||
//-------------------------------- | ||
'timezone' => 'Asia/Tehran', | ||
|
||
//-------------------------------- | ||
// Zarinpal gateway | ||
//-------------------------------- | ||
'zarinpal' => [ | ||
'merchant-id' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', | ||
'type' => 'zarin-gate', // Types: [zarin-gate || normal] | ||
'callback-url' => '/', | ||
'server' => 'germany', // Servers: [germany || iran] | ||
'email' => '[email protected]', | ||
'mobile' => '09xxxxxxxxx', | ||
'description' => 'description', | ||
], | ||
|
||
//-------------------------------- | ||
// Mellat gateway | ||
//-------------------------------- | ||
'mellat' => [ | ||
'username' => '', | ||
'password' => '', | ||
'terminalId' => 0000000, | ||
'callback-url' => '/' | ||
], | ||
|
||
//-------------------------------- | ||
// Payline gateway | ||
//-------------------------------- | ||
'payline' => [ | ||
'api' => 'xxxxx-xxxxx-xxxxx-xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxx', | ||
'callback-url' => '/' | ||
], | ||
|
||
//-------------------------------- | ||
// Sadad gateway | ||
//-------------------------------- | ||
'sadad' => [ | ||
'merchant' => '', | ||
'transactionKey'=> '', | ||
'terminalId' => 000000000, | ||
'callback-url' => '/' | ||
], | ||
|
||
//-------------------------------- | ||
// JahanPay gateway | ||
//-------------------------------- | ||
'jahanpay' => [ | ||
'api' => 'xxxxxxxxxxx', | ||
'callback-url' => '/' | ||
], | ||
|
||
//-------------------------------- | ||
// Parsian gateway | ||
//-------------------------------- | ||
'parsian' => [ | ||
'pin' => 'xxxxxxxxxxxxxxxxxxxx', | ||
'callback-url' => '/' | ||
], | ||
|
||
//------------------------------- | ||
// Tables names | ||
//-------------------------------- | ||
'table'=>=> 'gateway_transactions', | ||
]; |
58 changes: 58 additions & 0 deletions
58
migrations/2016_05_02_193213_create_gateway_transactions_table.php
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,58 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
use Larabookir\Gateway\PortAbstract; | ||
use Larabookir\Gateway\GatewayResolver; | ||
use Larabookir\Gateway\Enum; | ||
|
||
class CreateGatewayTransactionsTable extends Migration | ||
{ | ||
function getTable() | ||
{ | ||
return config('gateway.table', 'gateway_transactions'); | ||
} | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create($this->getTable(), function (Blueprint $table) { | ||
$table->engine = "innoDB"; | ||
$table->increments('id'); | ||
$table->enum('port', [ | ||
Enum::MELLAT, | ||
Enum::JAHANPAY, | ||
Enum::PARSIAN, | ||
Enum::PAYLINE, | ||
Enum::SADAD, | ||
Enum::ZARINPAL, | ||
]); | ||
$table->decimal('price', 15, 2); | ||
$table->string('ref_id', 100); | ||
$table->string('tracking_code', 50)->nullable(); | ||
$table->string('card_number', 50)->nullable(); | ||
$table->enum('status', [ | ||
Enum::TRANSACTION_INIT, | ||
Enum::TRANSACTION_SUCCEED, | ||
Enum::TRANSACTION_FAILED, | ||
])->default(Enum::TRANSACTION_INIT); | ||
$table->string('ip', 20)->nullable(); | ||
$table->timestamp('payment_date')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop($this->getTable()); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
migrations/2016_05_02_193229_create_gateway_status_log_table.php
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,50 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateGatewayStatusLogTable extends Migration | ||
{ | ||
|
||
function getTable() | ||
{ | ||
return config('gateway.table','gateway_transactions'); | ||
} | ||
|
||
function getLogTable() | ||
{ | ||
return $this->getTable().'_logs'; | ||
} | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create($this->getLogTable(), function (Blueprint $table) { | ||
$table->engine="innoDB"; | ||
$table->increments('id'); | ||
$table->unsignedInteger('transaction_id'); | ||
$table->string('result_code', 10)->nullable(); | ||
$table->string('result_message', 255)->nullable(); | ||
$table->timestamp('log_date')->nullable(); | ||
|
||
$table | ||
->foreign('transaction_id') | ||
->references('id') | ||
->on($this->getTable()) | ||
->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::drop($this->getLogTable()); | ||
} | ||
} |
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
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 @@ | ||
<html> | ||
<body> | ||
<script> | ||
var form = document.createElement("form"); | ||
form.setAttribute("method", "POST"); | ||
form.setAttribute("action", "https://bpm.shaparak.ir/pgwchannel/startpay.mellat"); | ||
form.setAttribute("target", "_self"); | ||
var hiddenField = document.createElement("input"); | ||
hiddenField.setAttribute("name", "RefId"); | ||
hiddenField.setAttribute("value", "{{$refId}}"); | ||
form.appendChild(hiddenField); | ||
document.body.appendChild(form); | ||
form.submit(); | ||
document.body.removeChild(form); | ||
</script> | ||
</body> | ||
</html> |
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 @@ | ||
<form action="{!! $url !!}" method="post" id="parsian_gateway"></form> | ||
|
||
<script type="text/javascript"> | ||
var f=document.getElementById('parsian_gateway'); | ||
f.submit(); | ||
</script> |
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,10 @@ | ||
<html> | ||
<body> | ||
{!! $form !!} | ||
<br /> | ||
<script type="text/javascript"> | ||
document.getElementById('paymentUTLfrm').submit(); | ||
</script> | ||
</form> | ||
</body> | ||
</html> |