1616use Hyva \Checkout \Model \Magewire \Component \EvaluationInterface ;
1717use Hyva \Checkout \Model \Magewire \Component \EvaluationResultFactory ;
1818use Hyva \Checkout \Model \Magewire \Component \EvaluationResultInterface ;
19+ use Buckaroo \Magento2 \Model \ConfigProvider \Method \CapayableIn3 as MethodConfigProvider ;
1920
2021class In3 extends Component \Form implements EvaluationInterface
2122{
@@ -40,11 +41,13 @@ class In3 extends Component\Form implements EvaluationInterface
4041
4142 protected ScopeConfigInterface $ scopeConfig ;
4243
44+ protected MethodConfigProvider $ methodConfigProvider ;
4345
4446 public function __construct (
4547 Validator $ validator ,
4648 SessionCheckout $ sessionCheckout ,
47- CartRepositoryInterface $ quoteRepository
49+ CartRepositoryInterface $ quoteRepository ,
50+ MethodConfigProvider $ methodConfigProvider
4851 ) {
4952 if ($ validator ->getValidator ("nlBeDePhone " ) === null ) {
5053 $ validator ->addValidator ("nlBeDePhone " , new NlBeDePhone ());
@@ -54,6 +57,7 @@ public function __construct(
5457
5558 $ this ->sessionCheckout = $ sessionCheckout ;
5659 $ this ->quoteRepository = $ quoteRepository ;
60+ $ this ->methodConfigProvider = $ methodConfigProvider ;
5761 }
5862
5963 /**
@@ -99,7 +103,7 @@ private function validateField(
99103
100104 $ this ->validateOnly ([$ name => $ rules ], $ messageArray , [$ name => $ value ]);
101105 }
102-
106+
103107 public function updatedPhone (string $ value ): ?string
104108 {
105109 $ this ->validateField ('phone ' , $ this ->getPhoneRules (), $ value );
@@ -194,6 +198,8 @@ private function getQuote(): ?Quote
194198 } catch (LocalizedException $ exception ) {
195199 $ this ->dispatchErrorMessage ($ exception ->getMessage ());
196200 }
201+
202+ return null ;
197203 }
198204
199205 /**
@@ -281,4 +287,34 @@ public function showPhone(): bool
281287
282288 return $ validation ->fails ();
283289 }
290+
291+ /**
292+ * Show financial warning for Netherlands customers
293+ *
294+ * @return bool
295+ */
296+ public function showFinancialWarning (): bool
297+ {
298+ $ quote = $ this ->getQuote ();
299+
300+ if ($ quote === null ) {
301+ return false ;
302+ }
303+
304+ $ billingAddress = $ quote ->getBillingAddress ();
305+
306+ return $ billingAddress !== null &&
307+ $ billingAddress ->getCountryId () === 'NL ' &&
308+ $ this ->methodConfigProvider ->canShowFinancialWarning ();
309+ }
310+
311+ /**
312+ * Get payment method title
313+ *
314+ * @return string
315+ */
316+ public function getPaymentMethodTitle (): string
317+ {
318+ return $ this ->methodConfigProvider ->getTitle ();
319+ }
284320}
0 commit comments