diff --git a/app/PaymentDrivers/Mollie/Bancontact.php b/app/PaymentDrivers/Mollie/Bancontact.php
index 3df988bbb2ef..3a19ac358fb7 100644
--- a/app/PaymentDrivers/Mollie/Bancontact.php
+++ b/app/PaymentDrivers/Mollie/Bancontact.php
@@ -19,13 +19,14 @@ use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\SystemLog;
+use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
-class Bancontact implements MethodInterface
+class Bancontact implements MethodInterface, LivewireMethodInterface
{
protected MolliePaymentDriver $mollie;
@@ -209,4 +210,24 @@ class Bancontact implements MethodInterface
{
return $this->processSuccessfulPayment($payment, 'open');
}
+
+ /**
+ * @inheritDoc
+ */
+ public function livewirePaymentView(array $data): string
+ {
+ // Doesn't support, it's offsite payment method.
+
+ return '';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function paymentData(array $data): array
+ {
+ $this->paymentView($data);
+
+ return $data;
+ }
}
diff --git a/app/PaymentDrivers/Mollie/BankTransfer.php b/app/PaymentDrivers/Mollie/BankTransfer.php
index 7c5872714c06..642d4bfc84c6 100644
--- a/app/PaymentDrivers/Mollie/BankTransfer.php
+++ b/app/PaymentDrivers/Mollie/BankTransfer.php
@@ -19,6 +19,7 @@ use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\SystemLog;
+use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver;
use Exception;
@@ -28,7 +29,7 @@ use Illuminate\Routing\Redirector;
use Illuminate\View\View;
use Mollie\Api\Resources\Payment as ResourcesPayment;
-class BankTransfer implements MethodInterface
+class BankTransfer implements MethodInterface, LivewireMethodInterface
{
protected MolliePaymentDriver $mollie;
@@ -206,4 +207,24 @@ class BankTransfer implements MethodInterface
{
return $this->processSuccessfulPayment($payment, 'open');
}
+
+ /**
+ * @inheritDoc
+ */
+ public function livewirePaymentView(array $data): string
+ {
+ // Doesn't support, it's offsite payment method.
+
+ return '';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function paymentData(array $data): array
+ {
+ $this->paymentView($data);
+
+ return $data;
+ }
}
diff --git a/app/PaymentDrivers/Mollie/CreditCard.php b/app/PaymentDrivers/Mollie/CreditCard.php
index 627605974532..6e712c8f84b6 100644
--- a/app/PaymentDrivers/Mollie/CreditCard.php
+++ b/app/PaymentDrivers/Mollie/CreditCard.php
@@ -10,12 +10,13 @@ use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\SystemLog;
+use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\View\View;
-class CreditCard
+class CreditCard implements LivewireMethodInterface
{
/**
* @var MolliePaymentDriver
@@ -37,7 +38,7 @@ class CreditCard
*/
public function paymentView(array $data)
{
- $data['gateway'] = $this->mollie;
+ $data = $this->paymentData($data);
return render('gateways.mollie.credit_card.pay', $data);
}
@@ -257,4 +258,22 @@ class CreditCard
{
return redirect()->route('client.payment_methods.index');
}
+
+ /**
+ * @inheritDoc
+ */
+ public function livewirePaymentView(array $data): string
+ {
+ return 'gateways.mollie.credit_card.pay_livewire';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function paymentData(array $data): array
+ {
+ $data['gateway'] = $this->mollie;
+
+ return $data;
+ }
}
diff --git a/app/PaymentDrivers/Mollie/IDEAL.php b/app/PaymentDrivers/Mollie/IDEAL.php
index 3b19cad34f11..134853a6fe04 100644
--- a/app/PaymentDrivers/Mollie/IDEAL.php
+++ b/app/PaymentDrivers/Mollie/IDEAL.php
@@ -19,13 +19,14 @@ use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\SystemLog;
+use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
-class IDEAL implements MethodInterface
+class IDEAL implements MethodInterface, LivewireMethodInterface
{
protected MolliePaymentDriver $mollie;
@@ -209,4 +210,24 @@ class IDEAL implements MethodInterface
{
return $this->processSuccessfulPayment($payment, 'open');
}
+
+ /**
+ * @inheritDoc
+ */
+ public function livewirePaymentView(array $data): string
+ {
+ // Doesn't support, it's offsite payment method.
+
+ return '';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function paymentData(array $data): array
+ {
+ $this->paymentView($data);
+
+ return $data;
+ }
}
diff --git a/app/PaymentDrivers/Mollie/KBC.php b/app/PaymentDrivers/Mollie/KBC.php
index 00b87934a92d..0811d7567454 100644
--- a/app/PaymentDrivers/Mollie/KBC.php
+++ b/app/PaymentDrivers/Mollie/KBC.php
@@ -19,13 +19,14 @@ use App\Models\GatewayType;
use App\Models\Payment;
use App\Models\PaymentType;
use App\Models\SystemLog;
+use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\Common\MethodInterface;
use App\PaymentDrivers\MolliePaymentDriver;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
-class KBC implements MethodInterface
+class KBC implements MethodInterface, LivewireMethodInterface
{
protected MolliePaymentDriver $mollie;
@@ -193,4 +194,24 @@ class KBC implements MethodInterface
return redirect()->route('client.payments.show', ['payment' => $this->mollie->encodePrimaryKey($payment_record->id)]);
}
+
+ /**
+ * @inheritDoc
+ */
+ public function livewirePaymentView(array $data): string
+ {
+ // Doesn't support, it's offsite payment method.
+
+ return '';
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function paymentData(array $data): array
+ {
+ $this->paymentView($data);
+
+ return $data;
+ }
}
diff --git a/resources/js/clients/payments/mollie-credit-card.js b/resources/js/clients/payments/mollie-credit-card.js
index c973f1147c58..c88f350494c4 100644
--- a/resources/js/clients/payments/mollie-credit-card.js
+++ b/resources/js/clients/payments/mollie-credit-card.js
@@ -8,6 +8,8 @@
* @license https://www.elastic.co/licensing/elastic-license
*/
+import { wait, instant } from '../wait';
+
class _Mollie {
constructor() {
this.mollie = Mollie(
@@ -166,4 +168,9 @@ class _Mollie {
}
}
-new _Mollie().handle();
+
+function boot() {
+ new _Mollie().handle();
+}
+
+instant() ? boot(): wait('#mollie-credit-card-payment').then(() => boot());
diff --git a/resources/views/portal/ninja2020/gateways/mollie/credit_card/pay.blade.php b/resources/views/portal/ninja2020/gateways/mollie/credit_card/pay.blade.php
index 8939c3b2cdf1..a3809360716e 100644
--- a/resources/views/portal/ninja2020/gateways/mollie/credit_card/pay.blade.php
+++ b/resources/views/portal/ninja2020/gateways/mollie/credit_card/pay.blade.php
@@ -4,6 +4,7 @@ ctrans('texts.credit_card')])
@section('gateway_head')
+