Skip to content

Commit

Permalink
add amountChargedBack method to order
Browse files Browse the repository at this point in the history
  • Loading branch information
Naoray committed Nov 16, 2023
1 parent 2b635b1 commit 556e34a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion database/migrations/upgrade_to_cashier_v2.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class UpgradeToCashierV2 extends Migration
{
Schema::table('orders', function (Blueprint $table) {
$table->unsignedInteger('amount_refunded')->after('total_due')->default(0);
$table->unsignedInteger('amount_charged_back')->after('amount_refunded')->default(0);
});

Schema::create('refunds', function (Blueprint $table) {
Expand Down
5 changes: 5 additions & 0 deletions src/Order/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,4 +755,9 @@ public function retryNow()
$this->processPayment();
});
}

public function amountChargedBack(): int
{
return $this->payments()->sum('amount_charged_back');
}
}

0 comments on commit 556e34a

Please sign in to comment.