mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 19:14:40 -04:00
Fixes for Klarna
This commit is contained in:
parent
f57c7425b4
commit
8ee33e827e
@ -50,7 +50,7 @@ class Klarna
|
|||||||
|
|
||||||
$invoice_numbers = collect($data['invoices'])->pluck('invoice_number');
|
$invoice_numbers = collect($data['invoices'])->pluck('invoice_number');
|
||||||
|
|
||||||
if ($invoice_numbers.length > 0) {
|
if ($invoice_numbers > 0) {
|
||||||
$description = ctrans('texts.payment_provider_paymenttext', ['invoicenumber' => $invoice_numbers->implode(', '), 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
$description = ctrans('texts.payment_provider_paymenttext', ['invoicenumber' => $invoice_numbers->implode(', '), 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
||||||
} else {
|
} else {
|
||||||
$description = ctrans('texts.payment_prvoder_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
$description = ctrans('texts.payment_prvoder_paymenttext_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()]);
|
||||||
@ -58,15 +58,15 @@ class Klarna
|
|||||||
|
|
||||||
$intent = \Stripe\PaymentIntent::create([
|
$intent = \Stripe\PaymentIntent::create([
|
||||||
'amount' => $data['stripe_amount'],
|
'amount' => $data['stripe_amount'],
|
||||||
'currency' => 'eur',
|
'currency' => $this->stripe->client->getCurrencyCode(),
|
||||||
'payment_method_types' => ['klarna'],
|
'payment_method_types' => ['klarna'],
|
||||||
'customer' => $this->stripe->findOrCreateCustomer(),
|
'customer' => $this->stripe->findOrCreateCustomer(),
|
||||||
'description' => $description,
|
'description' => $description,
|
||||||
'metadata' => [
|
'metadata' => [
|
||||||
'payment_hash' => $this->stripe->payment_hash->hash,
|
'payment_hash' => $this->stripe->payment_hash->hash,
|
||||||
'gateway_type_id' => GatewayType::GIROPAY,
|
'gateway_type_id' => GatewayType::KLARNA,
|
||||||
],
|
],
|
||||||
], $this->stripe->stripe_connect_auth);
|
], array_merge($this->stripe->stripe_connect_auth, ['idempotency_key' => uniqid("st",true)]));
|
||||||
|
|
||||||
$data['pi_client_secret'] = $intent->client_secret;
|
$data['pi_client_secret'] = $intent->client_secret;
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ class Klarna
|
|||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'payment_method' => $payment_intent,
|
'payment_method' => $payment_intent,
|
||||||
'payment_type' => PaymentType::GIROPAY,
|
'payment_type' => PaymentType::KLARNA,
|
||||||
'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->stripe_amount, $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
|
||||||
'transaction_reference' => $payment_intent,
|
'transaction_reference' => $payment_intent,
|
||||||
'gateway_type_id' => GatewayType::KLARNA,
|
'gateway_type_id' => GatewayType::KLARNA,
|
||||||
|
@ -237,9 +237,9 @@ class StripePaymentDriver extends BaseDriver
|
|||||||
}
|
}
|
||||||
if ($this->client
|
if ($this->client
|
||||||
&& $this->client->currency()
|
&& $this->client->currency()
|
||||||
&& in_array($this->client->currency()->code, ['EUR', 'USD', 'GBP', 'DKK', 'SEK', 'NOK'])
|
&& in_array($this->client->currency()->code, ['EUR', 'DKK', 'GBP', 'NOK', 'SEK', 'USD', 'AUD', 'NZD', 'CAD', 'PLN', 'CHF'])
|
||||||
&& isset($this->client->country)
|
&& isset($this->client->country)
|
||||||
&& in_array($this->client->country->iso_3166_3, ['DE', 'AT', 'BE'])) {
|
&& in_array($this->client->country->iso_3166_3, ['AUT','BEL','DNK','FIN','FRA','DEU','IRL','ITA','NLD','NOR','ESP','SWE','GBR','USA'])) {
|
||||||
$types[] = GatewayType::KLARNA;
|
$types[] = GatewayType::KLARNA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user