Merge pull request #6692 from turbo124/v5-develop

Fixes for SOFORT
This commit is contained in:
David Bomba 2021-09-21 21:42:08 +10:00 committed by GitHub
commit ceaa45f9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class CreditCard
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()), 'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'currency' => $this->stripe->client->getCurrencyCode(), 'currency' => $this->stripe->client->getCurrencyCode(),
'customer' => $this->stripe->findOrCreateCustomer(), 'customer' => $this->stripe->findOrCreateCustomer(),
'description' => $this->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')), 'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')),
]; ];
$payment_intent_data['setup_future_usage'] = 'off_session'; $payment_intent_data['setup_future_usage'] = 'off_session';

View File

@ -48,7 +48,10 @@ class SOFORT
$intent = \Stripe\PaymentIntent::create([ $intent = \Stripe\PaymentIntent::create([
'amount' => $data['stripe_amount'], 'amount' => $data['stripe_amount'],
'currency' => 'eur', 'currency' => 'eur',
'payment_method_types' => ['sofort'] 'payment_method_types' => ['sofort'],
'customer' => $this->stripe->findOrCreateCustomer(),
'description' => $this->stripe->decodeUnicodeString(ctrans('texts.invoices') . ': ' . collect($data['invoices'])->pluck('invoice_number')),
]); ]);
$data['pi_client_secret'] = $intent->client_secret; $data['pi_client_secret'] = $intent->client_secret;

View File

@ -634,4 +634,14 @@ class StripePaymentDriver extends BaseDriver
return response()->json(['message' => 'success'], 200); return response()->json(['message' => 'success'], 200);
} }
public 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));
}
public 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);
}
} }