diff --git a/app/PaymentDrivers/Stripe/ACH.php b/app/PaymentDrivers/Stripe/ACH.php index cc25056ca673..26481b8a64c3 100644 --- a/app/PaymentDrivers/Stripe/ACH.php +++ b/app/PaymentDrivers/Stripe/ACH.php @@ -36,6 +36,7 @@ use Stripe\Exception\CardException; use Stripe\Exception\InvalidRequestException; use Stripe\Exception\RateLimitException; use Stripe\PaymentIntent; +use App\Utils\Number; class ACH { @@ -172,9 +173,9 @@ class ACH ->first(); if ($invoice) { - $description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } else { - $description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } @@ -210,9 +211,9 @@ class ACH ->first(); if ($invoice) { - $description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } else { - $description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } if (substr($cgt->token, 0, 2) === 'pm') { @@ -454,9 +455,9 @@ class ACH ->first(); if ($invoice) { - $description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } else { - $description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } if (substr($source->token, 0, 2) === 'pm') { diff --git a/app/PaymentDrivers/Stripe/Charge.php b/app/PaymentDrivers/Stripe/Charge.php index 7dbd60c07f57..f9660170834e 100644 --- a/app/PaymentDrivers/Stripe/Charge.php +++ b/app/PaymentDrivers/Stripe/Charge.php @@ -32,6 +32,7 @@ use Stripe\Exception\CardException; use Stripe\Exception\InvalidRequestException; use Stripe\Exception\RateLimitException; use Stripe\StripeClient; +use App\Utils\Number; class Charge { @@ -62,9 +63,9 @@ class Charge $invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->first(); if ($invoice) { - $description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext', ['invoicenumber' => $invoice->number, 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } else { - $description = "Payment with no invoice for amount {$amount} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); } $this->stripe->init(); diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php index 838af9c2328c..5fb8bd2e2d6a 100644 --- a/app/PaymentDrivers/Stripe/CreditCard.php +++ b/app/PaymentDrivers/Stripe/CreditCard.php @@ -23,6 +23,7 @@ use App\PaymentDrivers\StripePaymentDriver; use App\PaymentDrivers\Stripe\Jobs\UpdateCustomer; use Stripe\PaymentIntent; use Stripe\PaymentMethod; +use App\Utils\Number; class CreditCard { @@ -62,7 +63,7 @@ class CreditCard // $description = $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')) . " for client {$this->stripe->client->present()->name()}"; $invoice_numbers = collect($data['invoices'])->pluck('invoice_number')->implode(','); - $description = "Invoices: {$invoice_numbers} for {$data['total']['amount_with_fee']} for client {$this->stripe->client->present()->name()}"; + $description = ctrans('text.stripe_paymenttext', ['invoicenumber' => $invoice_numbers, 'amount' => Number::formatMoney($data['total']['amount_with_fee'], $this->stripe->client), 'client' => $this->stripe->client->present()->name()]); $payment_intent_data = [ 'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()), diff --git a/lang/en/texts.php b/lang/en/texts.php index 1bc294749e4a..ce33ae3b3693 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -254,6 +254,8 @@ $LANG = array( 'notification_invoice_paid' => 'A payment of :amount was made by client :client towards Invoice :invoice.', 'notification_invoice_sent' => 'The following client :client was emailed Invoice :invoice for :amount.', 'notification_invoice_viewed' => 'The following client :client viewed Invoice :invoice for :amount.', + 'stripe_paymenttext' => 'Invoice :invoicenumber for :amount for client :client', + 'stripe_paymenttext_without_invoice' => 'Payment with no invoice for amount :amount for client :client', 'reset_password' => 'You can reset your account password by clicking the following button:', 'secure_payment' => 'Secure Payment', 'card_number' => 'Card Number',