diff --git a/app/DataMapper/Transactions/MarkPaidTransaction.php b/app/DataMapper/Transactions/MarkPaidTransaction.php new file mode 100644 index 000000000000..8e97cca00808 --- /dev/null +++ b/app/DataMapper/Transactions/MarkPaidTransaction.php @@ -0,0 +1,49 @@ +db = $db; + + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + if(!Ninja::isHosted()) + return; + + + } + + + private function persist() + { + MultiDB::setDB($this->db); + + TransactionEvent::create($this->payload); + } +} diff --git a/app/Models/TransactionEvent.php b/app/Models/TransactionEvent.php new file mode 100644 index 000000000000..2ef5a971d8f1 --- /dev/null +++ b/app/Models/TransactionEvent.php @@ -0,0 +1,30 @@ + 'object', + 'payment_request' => 'array', + 'paymentables' => 'array', + ]; + +} diff --git a/database/migrations/2022_03_09_053508_transaction_events.php b/database/migrations/2022_03_09_053508_transaction_events.php new file mode 100644 index 000000000000..5e2dddecf72d --- /dev/null +++ b/database/migrations/2022_03_09_053508_transaction_events.php @@ -0,0 +1,58 @@ +increments('id'); + $table->unsignedInteger('client_id')->index(); + $table->unsignedInteger('invoice_id'); + $table->unsignedInteger('payment_id'); + $table->unsignedInteger('credit_id'); + $table->decimal('client_balance', 16, 4)->default(0); + $table->decimal('client_paid_to_date', 16, 4)->default(0); + $table->decimal('client_credit_balance', 16, 4)->default(0); + $table->decimal('invoice_balance', 16, 4)->default(0); + $table->decimal('invoice_amount', 16, 4)->default(0); + $table->decimal('invoice_partial', 16, 4)->default(0); + $table->decimal('invoice_paid_to_date', 16, 4)->default(0); + $table->unsignedInteger('invoice_status')->nullable(); + $table->decimal('payment_amount', 16, 4)->default(0); + $table->decimal('payment_applied', 16, 4)->default(0); + $table->decimal('payment_refunded', 16, 4)->default(0); + $table->unsignedInteger('payment_status')->nullable(); + $table->mediumText('paymentables')->nullable(); + $table->unsignedInteger('event_id'); + $table->unsignedInteger('timestamp'); + $table->mediumText('payment_request')->nullable(); + $table->mediumText('metadata')->nullable(); + $table->decimal('credit_balance', 16, 4)->default(0); + $table->decimal('credit_amount', 16, 4)->default(0); + $table->unsignedInteger('credit_status')->nullable(); + + $table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade')->onUpdate('cascade'); + + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + } +} +