# give/4.17.0/src/PaymentGateways/Gateways/Stripe/Actions/UpdateStripeAccountStatementDescriptor.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.17.0. 42 lines.

- Page: https://pluginprobe.com/plugins/give/4.17.0/code/src/PaymentGateways/Gateways/Stripe/Actions/UpdateStripeAccountStatementDescriptor.php
- Raw: https://pluginprobe.com/plugins/give/4.17.0/raw/src/PaymentGateways/Gateways/Stripe/Actions/UpdateStripeAccountStatementDescriptor.php
- Modified: 2022-02-25T01:33:58+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.17.0/code/src/PaymentGateways/Gateways/Stripe/Actions/UpdateStripeAccountStatementDescriptor.php#L10-L20`.

```php
<?php

namespace Give\PaymentGateways\Gateways\Stripe\Actions;

use Give\Framework\Exceptions\Primitives\InvalidArgumentException;
use Give\PaymentGateways\Exceptions\InvalidPropertyName;
use Give\PaymentGateways\Stripe\Models\AccountDetail;
use Give\PaymentGateways\Stripe\Repositories\Settings;

/**
 * @since 2.19.0
 */
class UpdateStripeAccountStatementDescriptor
{
    /**
     *
     * @param string $stripeAccountId
     * @param string $stripeStatementDescriptorText
     *
     * @return bool
     * @throws InvalidArgumentException|InvalidPropertyName
     */
    public function __invoke($stripeAccountId, $stripeStatementDescriptorText)
    {
        $settingRepository = give(Settings::class);
        $stripeAccount = $settingRepository->getStripeAccountById($stripeAccountId);

        if ($stripeStatementDescriptorText === $stripeAccount->statementDescriptor) {
            return true;
        }

        $newStripeAccount = AccountDetail::fromArray(
            array_merge(
                $stripeAccount->toArray(),
                ['statement_descriptor' => $stripeStatementDescriptorText]
            )
        );

        return $settingRepository->updateStripeAccount($newStripeAccount);
    }
}

```
