diff --git a/app/PaymentDrivers/Eway/CreditCard.php b/app/PaymentDrivers/Eway/CreditCard.php
index e7f97124566d..a3fbb56d5fd3 100644
--- a/app/PaymentDrivers/Eway/CreditCard.php
+++ b/app/PaymentDrivers/Eway/CreditCard.php
@@ -17,10 +17,11 @@ use App\Jobs\Util\SystemLogger;
use App\Models\GatewayType;
use App\Models\PaymentType;
use App\Models\SystemLog;
+use App\PaymentDrivers\Common\LivewireMethodInterface;
use App\PaymentDrivers\EwayPaymentDriver;
use App\Utils\Traits\MakesHash;
-class CreditCard
+class CreditCard implements LivewireMethodInterface
{
use MakesHash;
@@ -102,11 +103,18 @@ class CreditCard
return $token;
}
- public function paymentView($data)
+ public function paymentData(array $data): array
{
$data['gateway'] = $this->eway_driver;
$data['public_api_key'] = $this->eway_driver->company_gateway->getConfigField('publicApiKey');
+ return $data;
+ }
+
+ public function paymentView($data)
+ {
+ $data = $this->paymentData($data);
+
return render('gateways.eway.pay', $data);
}
@@ -276,4 +284,8 @@ class CreditCard
return $payment;
}
+ public function livewirePaymentView(array $data): string
+ {
+ return 'gateways.eway.pay_livewire';
+ }
}
diff --git a/resources/js/clients/payments/eway-credit-card.js b/resources/js/clients/payments/eway-credit-card.js
index 3d4f99297e70..d27632b30ec8 100644
--- a/resources/js/clients/payments/eway-credit-card.js
+++ b/resources/js/clients/payments/eway-credit-card.js
@@ -8,6 +8,8 @@
* @license https://www.elastic.co/licensing/elastic-license
*/
+import { wait, instant } from '../wait';
+
class EwayRapid {
constructor() {
this.cardStyles =
@@ -510,4 +512,8 @@ class EwayRapid {
}
}
-new EwayRapid().handle();
+function boot() {
+ new EwayRapid().handle();
+}
+
+instant() ? boot() : wait('#eway-credit-card-payment').then(() => boot());
diff --git a/resources/views/portal/ninja2020/gateways/eway/pay.blade.php b/resources/views/portal/ninja2020/gateways/eway/pay.blade.php
index 3f0cc9c788a1..98c7805b886c 100644
--- a/resources/views/portal/ninja2020/gateways/eway/pay.blade.php
+++ b/resources/views/portal/ninja2020/gateways/eway/pay.blade.php
@@ -7,6 +7,7 @@ ctrans('texts.credit_card')])
+
@endsection
@section('gateway_content')