Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disable place order button for adyen_cc #58

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Magewire/Payment/Method/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Adyen\Hyva\Model\CreditCard\InstallmentsManager;
use Hyva\Checkout\Model\Magewire\Component\Evaluation\EvaluationResult;
use Hyva\Checkout\Model\Magewire\Component\EvaluationResultFactory;

use Magento\Checkout\Model\Session as SessionCheckout;
class CreditCard extends AdyenPaymentComponent
{
const METHOD_CC = 'adyen_cc';
Expand All @@ -19,6 +19,7 @@ public function __construct(
private readonly Context $context,
private readonly BrandsManager $brandsManager,
private readonly InstallmentsManager $installmentsManager,
private readonly SessionCheckout $sessionCheckout

) {
parent::__construct($this->context);
Expand All @@ -37,7 +38,10 @@ public function getMethodCode(): string
*/
public function evaluateCompletion(EvaluationResultFactory $resultFactory): EvaluationResult
{
return $resultFactory->createSuccess();
$payment = $this->sessionCheckout->getQuote()->getPayment();
return $payment->getMethod() === 'adyen_cc' && !$payment->getAdditionalData()
? $resultFactory->createBlocking()
: $resultFactory->createSuccess();
}

public function refreshProperties(): void
Expand Down