mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Make storing card summary locally part of payments changes
This commit is contained in:
parent
cc5cb091d7
commit
0ca073291e
@ -22,6 +22,37 @@ class PaymentsChanges extends Migration
|
||||
|
||||
(new \PaymentStatusSeeder())->run();
|
||||
|
||||
Schema::dropIfExists('payment_methods');
|
||||
|
||||
Schema::create('payment_methods', function($table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('account_id');
|
||||
$table->unsignedInteger('contact_id')->nullable();
|
||||
$table->unsignedInteger('account_gateway_token_id');
|
||||
$table->unsignedInteger('payment_type_id');
|
||||
$table->string('source_reference');
|
||||
|
||||
$table->unsignedInteger('routing_number')->nullable();
|
||||
$table->smallInteger('last4')->unsigned()->nullable();
|
||||
$table->date('expiration')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->unsignedInteger('currency_id')->nullable();
|
||||
$table->string('status')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||
$table->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
|
||||
$table->foreign('account_gateway_token_id')->references('id')->on('account_gateway_tokens');
|
||||
$table->foreign('payment_type_id')->references('id')->on('payment_types');
|
||||
$table->foreign('currency_id')->references('id')->on('currencies');
|
||||
|
||||
$table->unsignedInteger('public_id')->index();
|
||||
$table->unique( array('account_id','public_id') );
|
||||
});
|
||||
|
||||
Schema::table('payments', function($table)
|
||||
{
|
||||
$table->decimal('refunded', 13, 2);
|
||||
@ -33,6 +64,9 @@ class PaymentsChanges extends Migration
|
||||
$table->date('expiration')->nullable();
|
||||
$table->text('gateway_error')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
|
||||
$table->unsignedInteger('payment_method_id')->nullable();
|
||||
$table->foreign('payment_method_id')->references('id')->on('payment_methods');
|
||||
});
|
||||
|
||||
Schema::table('invoices', function($table)
|
||||
@ -43,6 +77,17 @@ class PaymentsChanges extends Migration
|
||||
\DB::table('invoices')
|
||||
->where('auto_bill', '=', 1)
|
||||
->update(array('client_enable_auto_bill' => 1, 'auto_bill' => AUTO_BILL_OPT_OUT));
|
||||
|
||||
|
||||
Schema::table('account_gateway_tokens', function($table)
|
||||
{
|
||||
$table->unsignedInteger('default_payment_method_id')->nullable();
|
||||
$table->foreign('default_payment_method_id')->references('id')->on('payment_methods');
|
||||
|
||||
$table->boolean('uses_local_payment_methods')->defalut(true);
|
||||
});
|
||||
|
||||
\DB::table('account_gateway_tokens')->update(array('uses_local_payment_methods' => false));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,6 +108,9 @@ class PaymentsChanges extends Migration
|
||||
$table->dropColumn('expiration');
|
||||
$table->dropColumn('gateway_error');
|
||||
$table->dropColumn('email');
|
||||
|
||||
$table->dropForeign('payments_payment_method_id_foreign');
|
||||
$table->dropColumn('payment_method_id');
|
||||
});
|
||||
|
||||
\DB::table('invoices')
|
||||
@ -84,5 +132,14 @@ class PaymentsChanges extends Migration
|
||||
});
|
||||
|
||||
Schema::dropIfExists('payment_statuses');
|
||||
|
||||
Schema::table('account_gateway_tokens', function($table)
|
||||
{
|
||||
$table->dropForeign('account_gateway_tokens_default_payment_method_id_foreign');
|
||||
$table->dropColumn('default_payment_method_id');
|
||||
$table->dropColumn('uses_local_payment_methods');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('payment_methods');
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class WePayIntegration extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('payment_methods', function($table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('account_id');
|
||||
$table->unsignedInteger('contact_id')->nullable();
|
||||
$table->unsignedInteger('account_gateway_token_id');
|
||||
$table->unsignedInteger('payment_type_id');
|
||||
$table->string('source_reference');
|
||||
|
||||
$table->unsignedInteger('routing_number')->nullable();
|
||||
$table->smallInteger('last4')->unsigned()->nullable();
|
||||
$table->date('expiration')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->unsignedInteger('currency_id')->nullable();
|
||||
$table->string('status')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||
$table->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
|
||||
$table->foreign('account_gateway_token_id')->references('id')->on('account_gateway_tokens');
|
||||
$table->foreign('payment_type_id')->references('id')->on('payment_types');
|
||||
$table->foreign('currency_id')->references('id')->on('currencies');
|
||||
|
||||
$table->unsignedInteger('public_id')->index();
|
||||
$table->unique( array('account_id','public_id') );
|
||||
});
|
||||
|
||||
Schema::table('payments', function($table)
|
||||
{
|
||||
$table->unsignedInteger('payment_method_id')->nullable();
|
||||
$table->foreign('payment_method_id')->references('id')->on('payment_methods');
|
||||
});
|
||||
|
||||
Schema::table('account_gateway_tokens', function($table)
|
||||
{
|
||||
$table->unsignedInteger('default_payment_method_id')->nullable();
|
||||
$table->foreign('default_payment_method_id')->references('id')->on('payment_methods');
|
||||
|
||||
$table->boolean('uses_local_payment_methods')->defalut(true);
|
||||
});
|
||||
|
||||
\DB::table('account_gateway_tokens')->update(array('uses_local_payment_methods' => false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('payments', function($table)
|
||||
{
|
||||
$table->dropForeign('payments_payment_method_id_foreign');
|
||||
$table->dropColumn('payment_method_id');
|
||||
});
|
||||
|
||||
Schema::table('account_gateway_tokens', function($table)
|
||||
{
|
||||
$table->dropForeign('account_gateway_tokens_default_payment_method_id_foreign');
|
||||
$table->dropColumn('default_payment_method_id');
|
||||
$table->dropColumn('uses_local_payment_methods');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('payment_methods');
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user