1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Fixes for EPS

This commit is contained in:
David Bomba 2023-02-23 13:38:58 +11:00
parent 976110e8f3
commit 6496b99379
16 changed files with 46 additions and 27 deletions

View File

@ -55,7 +55,7 @@ class BECS
'payment_method_types' => ['au_becs_debit'],
'setup_future_usage' => 'off_session',
'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::BECS,

View File

@ -5,7 +5,7 @@
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
@ -51,7 +51,7 @@ class Bancontact
'currency' => 'eur',
'payment_method_types' => ['bancontact'],
'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::BANCONTACT,

View File

@ -70,7 +70,7 @@ class BrowserPay implements MethodInterface
'amount' => $this->stripe->convertToStripeAmount($data['total']['amount_with_fee'], $this->stripe->client->currency()->precision, $this->stripe->client->currency()),
'currency' => $this->stripe->client->getCurrencyCode(),
'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::APPLE_PAY,

View File

@ -51,7 +51,7 @@ class EPS
'currency' => 'eur',
'payment_method_types' => ['eps'],
'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::EPS,

View File

@ -52,7 +52,7 @@ class FPX
'currency' => $this->stripe->client->getCurrencyCode(),
'payment_method_types' => ['fpx'],
'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::FPX,

View File

@ -51,7 +51,7 @@ class GIROPAY
'currency' => 'eur',
'payment_method_types' => ['giropay'],
'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::GIROPAY,

View File

@ -47,15 +47,7 @@ class Klarna
$data['customer'] = $this->stripe->findOrCreateCustomer()->id;
$data['country'] = $this->stripe->client->country->iso_3166_2;
$amount = $data['total']['amount_with_fee'];
$invoice_numbers = collect($data['invoices'])->pluck('invoice_number');
if ($invoice_numbers->count() > 0) {
$description = ctrans('texts.stripe_payment_text', ['invoicenumber' => $invoice_numbers->implode(', '), 'amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()], $this->stripe->client->company->locale());
} else {
$description = ctrans('texts.stripe_payment_text_without_invoice', ['amount' => Number::formatMoney($amount, $this->stripe->client), 'client' => $this->stripe->client->present()->name()], $this->stripe->client->company->locale());
}
$description = $this->stripe->getDescription(false);
$intent = \Stripe\PaymentIntent::create([
'amount' => $data['stripe_amount'],

View File

@ -51,7 +51,7 @@ class PRZELEWY24
'currency' => 'eur',
'payment_method_types' => ['p24'],
'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::PRZELEWY24,

View File

@ -60,7 +60,7 @@ class SEPA
'payment_method_types' => ['sepa_debit'],
'setup_future_usage' => 'off_session',
'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::SEPA,

View File

@ -51,7 +51,7 @@ class SOFORT
'currency' => 'eur',
'payment_method_types' => ['sofort'],
'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::SOFORT,

View File

@ -51,7 +51,7 @@ class iDeal
'currency' => 'eur',
'payment_method_types' => ['ideal'],
'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::IDEAL,

View File

@ -65,7 +65,6 @@ var ProcessEPSPay = /*#__PURE__*/_createClass(function ProcessEPSPay(key, stripe
if (!document.getElementById('eps-name').value) {
errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
errors.hidden = false;
console.log("name");
return;
}
@ -77,7 +76,7 @@ var ProcessEPSPay = /*#__PURE__*/_createClass(function ProcessEPSPay(key, stripe
payment_method: {
eps: _this.eps,
billing_details: {
name: document.getElementById("ideal-name").value
name: document.getElementById("eps-name").value
}
},
return_url: document.querySelector('meta[name="return-url"]').content

View File

@ -102,6 +102,20 @@ var ProcessPRZELEWY24 = /*#__PURE__*/_createClass(function ProcessPRZELEWY24(key
}
},
return_url: document.querySelector('meta[name="return-url"]').content
}).then(function (result) {
if (result.error) {
// Show error to your customer
errors.textContent = result.error.message;
errors.hidden = false;
document.getElementById('pay-now').disabled = false;
document.querySelector('#pay-now > svg').classList.add('hidden');
document.querySelector('#pay-now > span').classList.remove('hidden');
} else {
// The payment has been processed!
if (result.paymentIntent.status === 'succeeded') {
window.location = document.querySelector('meta[name="return-url"]').content;
}
}
});
});
});

View File

@ -38,9 +38,9 @@
"/js/clients/payments/stripe-acss.js": "/js/clients/payments/stripe-acss.js?id=447c587a5eeb0c1de3091c8358db7ad7",
"/js/clients/payments/stripe-bancontact.js": "/js/clients/payments/stripe-bancontact.js?id=f694d3f9f01e4550cb5a3eb6cb43c12d",
"/js/clients/payments/stripe-becs.js": "/js/clients/payments/stripe-becs.js?id=97ea3555a8504662eda5fce9c9115e5a",
"/js/clients/payments/stripe-eps.js": "/js/clients/payments/stripe-eps.js?id=749cba1332a29baa444b37cee2ade2d7",
"/js/clients/payments/stripe-eps.js": "/js/clients/payments/stripe-eps.js?id=146d48d03f5fc4b1cf122189119e2877",
"/js/clients/payments/stripe-ideal.js": "/js/clients/payments/stripe-ideal.js?id=34cf4ee3f189427fb69d0df8f5a4b766",
"/js/clients/payments/stripe-przelewy24.js": "/js/clients/payments/stripe-przelewy24.js?id=448b197a1d94b4408e130b5b8b1c2e53",
"/js/clients/payments/stripe-przelewy24.js": "/js/clients/payments/stripe-przelewy24.js?id=cfdcc5bf20d6bfa09700708dfdd943e2",
"/js/clients/payments/stripe-browserpay.js": "/js/clients/payments/stripe-browserpay.js?id=7015e43eb5f9f9f2f45f54b41b5780a0",
"/js/clients/payments/stripe-fpx.js": "/js/clients/payments/stripe-fpx.js?id=243c2929386b10c6a0c49ca3bcabfb2d",
"/css/app.css": "/css/app.css?id=0cb847167b91d8db2ca50d30e0d691ae",

View File

@ -56,7 +56,6 @@ class ProcessEPSPay {
if (!document.getElementById('eps-name').value) {
errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
errors.hidden = false;
console.log("name");
return ;
}
document.getElementById('pay-now').disabled = true;
@ -69,7 +68,7 @@ class ProcessEPSPay {
payment_method: {
eps: this.eps,
billing_details: {
name: document.getElementById("ideal-name").value,
name: document.getElementById("eps-name").value,
},
},
return_url: document.querySelector(

View File

@ -93,7 +93,22 @@ class ProcessPRZELEWY24 {
},
return_url: document.querySelector('meta[name="return-url"]').content,
}
);
).then(function (result) {
if (result.error) {
// Show error to your customer
errors.textContent = result.error.message;
errors.hidden = false;
document.getElementById('pay-now').disabled = false;
document.querySelector('#pay-now > svg').classList.add('hidden');
document.querySelector('#pay-now > span').classList.remove('hidden');
} else {
// The payment has been processed!
if (result.paymentIntent.status === 'succeeded') {
window.location = document.querySelector('meta[name="return-url"]').content;
}
}
});
});
};
}