Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Larabookir\Gateway\PortAbstract;
use Larabookir\Gateway\GatewayResolver;
use Illuminate\Support\Facades\Schema;
use Larabookir\Gateway\Enum;

class CreateGatewayTransactionsTable extends Migration
Expand All @@ -25,6 +24,7 @@ public function up()
Schema::create($this->getTable(), function (Blueprint $table) {
$table->engine = "innoDB";
$table->unsignedBigInteger('id', true);
$table->unsignedBigInteger('wallet_id');
$table->enum('port', (array) Enum::getIPGs());
$table->decimal('price', 15, 2);
$table->string('ref_id', 100)->nullable();
Expand All @@ -36,6 +36,7 @@ public function up()
Enum::TRANSACTION_FAILED,
])->default(Enum::TRANSACTION_INIT);
$table->string('ip', 20)->nullable();
$table->text('description')->nullable();
$table->timestamp('payment_date')->nullable();
$table->nullableTimestamps();
$table->softDeletes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;

class CreateGatewayStatusLogTable extends Migration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterIdInTransactionsTable extends Migration
Expand Down

This file was deleted.

10 changes: 10 additions & 0 deletions src/Mellat/Mellat.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ public function set($amount)
return $this;
}

/**
* {@inheritdoc}
*/
public function setWallet($id)
{
$this->walletId = $id;

return $this;
}

/**
* {@inheritdoc}
*/
Expand Down
14 changes: 14 additions & 0 deletions src/PortAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ abstract class PortAbstract
*/
protected $refId;

/**
* wallet id
*
* @var string
*/
protected $walletId;

/**
* Amount in Rial
*
Expand Down Expand Up @@ -228,6 +235,11 @@ function price($price)
return $this->set($price);
}

function wallet($id)
{
return $this->setWallet($id);
}

/**
* get price
*/
Expand All @@ -250,6 +262,7 @@ function verify($transaction)
{
$this->transaction = $transaction;
$this->transactionId = $transaction->id;
$this->walletId = $transaction->walletId;
$this->amount = intval($transaction->price);
$this->refId = $transaction->ref_id;
}
Expand All @@ -276,6 +289,7 @@ protected function newTransaction()

$this->transactionId = $this->getTable()->insert([
'id' => $uid,
'wallet_id' => $this->walletId,
'port' => $this->getPortName(),
'price' => $this->amount,
'status' => Enum::TRANSACTION_INIT,
Expand Down