Skip to content

Commit

Permalink
Merge pull request #215 from Naoray/feature/212-make-amount-charged-b…
Browse files Browse the repository at this point in the history
…ack-available

add amountChargedBack method to order
  • Loading branch information
Naoray authored Nov 16, 2023
2 parents 92a6610 + 556e34a commit fa73d71
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 @@ -765,4 +765,9 @@ public function retryNow()
$this->processPayment();
});
}

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

0 comments on commit fa73d71

Please sign in to comment.