diff --git a/migrations/2016_05_02_193213_create_gateway_transactions_table.php b/migrations/2016_05_02_193213_create_gateway_transactions_table.php index f87a50d6..e7998a52 100644 --- a/migrations/2016_05_02_193213_create_gateway_transactions_table.php +++ b/migrations/2016_05_02_193213_create_gateway_transactions_table.php @@ -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 @@ -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(); @@ -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(); diff --git a/migrations/2016_05_02_193229_create_gateway_status_log_table.php b/migrations/2016_05_02_193229_create_gateway_status_log_table.php index 0607bca1..c26c5f59 100644 --- a/migrations/2016_05_02_193229_create_gateway_status_log_table.php +++ b/migrations/2016_05_02_193229_create_gateway_status_log_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; +use Illuminate\Support\Facades\Schema; class CreateGatewayStatusLogTable extends Migration { diff --git a/migrations/2017_04_05_103357_alter_id_in_transactions_table.php b/migrations/2017_04_05_103357_alter_id_in_transactions_table.php index 7928593b..3ceb0fa8 100644 --- a/migrations/2017_04_05_103357_alter_id_in_transactions_table.php +++ b/migrations/2017_04_05_103357_alter_id_in_transactions_table.php @@ -1,8 +1,6 @@ getTable(), function (Blueprint $table) { - $table->text('description')->after('ip')->nullable(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table($this->getTable(), function (Blueprint $table) { - $table->dropColumn('description'); - }); - } -} diff --git a/src/Mellat/Mellat.php b/src/Mellat/Mellat.php index 341c534b..50b8e06d 100644 --- a/src/Mellat/Mellat.php +++ b/src/Mellat/Mellat.php @@ -28,6 +28,16 @@ public function set($amount) return $this; } + /** + * {@inheritdoc} + */ + public function setWallet($id) + { + $this->walletId = $id; + + return $this; + } + /** * {@inheritdoc} */ diff --git a/src/PortAbstract.php b/src/PortAbstract.php index bccbf060..62db661d 100644 --- a/src/PortAbstract.php +++ b/src/PortAbstract.php @@ -45,6 +45,13 @@ abstract class PortAbstract */ protected $refId; + /** + * wallet id + * + * @var string + */ + protected $walletId; + /** * Amount in Rial * @@ -228,6 +235,11 @@ function price($price) return $this->set($price); } + function wallet($id) + { + return $this->setWallet($id); + } + /** * get price */ @@ -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; } @@ -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,