diff --git a/app/PaymentDrivers/Stripe/ACSS.php b/app/PaymentDrivers/Stripe/ACSS.php index fb364ce25dab..0cfa8f0812f4 100644 --- a/app/PaymentDrivers/Stripe/ACSS.php +++ b/app/PaymentDrivers/Stripe/ACSS.php @@ -143,7 +143,7 @@ class ACSS 'setup_future_usage' => 'off_session', 'payment_method_types' => ['acss_debit'], 'customer' => $this->stripe->findOrCreateCustomer(), - 'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices').': '.collect($data['invoices'])->pluck('invoice_number')), + 'description' => $this->stripe->getDescription(false), 'metadata' => [ 'payment_hash' => $this->stripe->payment_hash->hash, 'gateway_type_id' => GatewayType::ACSS, @@ -185,7 +185,7 @@ class ACSS $this->stripe->payment_hash->save(); if (property_exists($gateway_response, 'status') && $gateway_response->status == 'processing') { - // $this->storePaymentMethod($gateway_response); + return $this->processSuccessfulPayment($gateway_response->id); } diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php index fadce23f6ac7..e53ffe3da27f 100644 --- a/app/PaymentDrivers/Stripe/CreditCard.php +++ b/app/PaymentDrivers/Stripe/CreditCard.php @@ -60,9 +60,8 @@ class CreditCard public function paymentView(array $data) { - $invoice_numbers = collect($data['invoices'])->pluck('invoice_number')->implode(','); - $description = ctrans('texts.stripe_payment_text', ['invoicenumber' => $invoice_numbers, 'amount' => Number::formatMoney($data['total']['amount_with_fee'], $this->stripe->client), 'client' => $this->stripe->client->present()->name()], $this->stripe->client->company->locale()); - + $description = $this->stripe->getDescription(false); + $payment_intent_data = [ 'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()), 'currency' => $this->stripe->client->getCurrencyCode(), @@ -81,19 +80,6 @@ class CreditCard return render('gateways.stripe.credit_card.pay', $data); } - private function decodeUnicodeString($string) - { - return html_entity_decode($string, ENT_QUOTES, 'UTF-8'); - // return iconv("UTF-8", "ISO-8859-1//TRANSLIT", $this->decode_encoded_utf8($string)); - } - - private function decode_encoded_utf8($string) - { - return preg_replace_callback('#\\\\u([0-9a-f]{4})#ism', function ($matches) { - return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UCS-2BE'); - }, $string); - } - public function paymentResponse(PaymentResponseRequest $request) { $this->stripe->init(); @@ -166,8 +152,6 @@ class CreditCard $this->stripe->client->company, ); - //If the user has come from a subscription double check here if we need to redirect. - //08-08-2022 if ($payment->invoices()->whereHas('subscription')->exists()) { $subscription = $payment->invoices()->first()->subscription; @@ -175,7 +159,6 @@ class CreditCard return redirect($subscription->webhook_configuration['return_url']); } } - //08-08-2022 return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]); } diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index e0070d981dee..cb40857bcabb 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -121,7 +121,7 @@ class AutoBillInvoice extends AbstractService $payment_hash = PaymentHash::create([ 'hash' => Str::random(64), - 'data' => ['invoices' => [['invoice_id' => $this->invoice->hashed_id, 'amount' => $amount, 'invoice_number' => $this->invoice->number]]], + 'data' => ['amount_with_fee' => $amount + $fee, 'invoices' => [['invoice_id' => $this->invoice->hashed_id, 'amount' => $amount, 'invoice_number' => $this->invoice->number]]], 'fee_total' => $fee, 'fee_invoice_id' => $this->invoice->id, ]);