# give/4.18.0/src/EventTickets/Actions/UpdateDonationConfirmationPageReceiptDonationAmount.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.18.0. 29 lines.

- Page: https://pluginprobe.com/plugins/give/4.18.0/code/src/EventTickets/Actions/UpdateDonationConfirmationPageReceiptDonationAmount.php
- Raw: https://pluginprobe.com/plugins/give/4.18.0/raw/src/EventTickets/Actions/UpdateDonationConfirmationPageReceiptDonationAmount.php
- Modified: 2024-03-13T21:54:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.18.0/code/src/EventTickets/Actions/UpdateDonationConfirmationPageReceiptDonationAmount.php#L10-L20`.

```php
<?php

namespace Give\EventTickets\Actions;

use Give\EventTickets\Repositories\EventTicketRepository;
use Give\Framework\Receipts\DonationReceipt;
use Give\Framework\Support\ValueObjects\Money;

/**
 * @since 3.6.0
 */
class UpdateDonationConfirmationPageReceiptDonationAmount
{
    /**
     * Subtract event tickets total from donation amount line item
     *
     * @since 3.6.0
     */
    public function __invoke(string $amount, DonationReceipt $receipt): string
    {
        $totalTicketAmount = give(EventTicketRepository::class)->getTotalByDonation($receipt->donation);

        return Money::fromDecimal($amount, $receipt->donation->amount->getCurrency())->subtract(
            $totalTicketAmount
        )->formatToDecimal();
    }

}

```
