diff --git a/Magewire/Payment/Method/Giropay.php b/Magewire/Payment/Method/Giropay.php deleted file mode 100644 index 47106eb..0000000 --- a/Magewire/Payment/Method/Giropay.php +++ /dev/null @@ -1,85 +0,0 @@ - 'required|bic' - ]; - - protected $messages = [ - 'bic:required' => 'This field is required' - ]; - - protected SessionCheckout $sessionCheckout; - - protected CartRepositoryInterface $quoteRepository; - - public function __construct( - Validator $validator, - SessionCheckout $sessionCheckout, - CartRepositoryInterface $quoteRepository - ) { - if($validator->getValidator("bic") === null) { - $validator->addValidator("bic", new Bic()); - } - parent::__construct($validator); - - $this->sessionCheckout = $sessionCheckout; - $this->quoteRepository = $quoteRepository; - } - - /** - * @throws LocalizedException - * @throws NoSuchEntityException - */ - public function mount(): void - { - $this->bic = $this->sessionCheckout - ->getQuote() - ->getPayment() - ->getAdditionalInformation('customer_bic'); - } - - public function updatedBic(string $value): ?string - { - $this->validate(); - $value = empty($value) ? null : $value; - try { - $quote = $this->sessionCheckout->getQuote(); - $quote->getPayment()->setAdditionalInformation('customer_bic', $value); - - $this->quoteRepository->save($quote); - } catch (LocalizedException $exception) { - $this->dispatchErrorMessage($exception->getMessage()); - } - - return $value; - } - public function evaluateCompletion(EvaluationResultFactory $resultFactory): EvaluationResultInterface - { - if ($this->bic === null) { - return $resultFactory->createErrorMessageEvent() - ->withCustomEvent('payment:method:error') - ->withMessage('Please fill all required payment fields'); - } - - return $resultFactory->createSuccess(); - } -} diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index b8d65da..1cb36dc 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -27,7 +27,6 @@ \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService - \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService \Buckaroo\HyvaCheckout\Model\Magewire\Payment\PlaceOrderService