You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Magento中Adyen模块如何仅阻止银行票据支付通知?

How to Block Only Bank Bill Notifications in Adyen Magento Module

Got it, let's fix this precise blocking requirement. You don't want to stop all Adyen notifications—just the ones coming from bank bill payments. Here's how to tweak the ProcessNotification.php file to make that happen:

Step 1: Locate the core notification processing method

Open app/code/community/Adyen/Payment/Model/ProcessNotification.php. Look for the main method that handles incoming notifications—this is usually something like process() or handleNotification(). You'll want to add your check at the very start of this method, before any order updates or other logic runs.

Step 2: Extract the payment method from the notification

Adyen's notification payload includes details about the payment method used. We need to pull that value to identify bank bill transactions. Add this code to grab the payment method:

// Fetch the full notification data
$notificationData = $this->getRequest()->getPost();

// Extract the payment method code (adjust if your notification uses additionalData instead)
$paymentMethod = isset($notificationData['paymentMethod']) ? $notificationData['paymentMethod'] : '';

// If payment method is stored in additionalData, use this instead:
// $additionalData = isset($notificationData['additionalData']) ? $notificationData['additionalData'] : [];
// $paymentMethod = isset($additionalData['paymentMethod']) ? $additionalData['paymentMethod'] : '';

Step 3: Add the conditional block for bank bill notifications

Define which payment method codes correspond to bank bills (these vary by region—adjust the array to match your use case), then skip processing for those:

// List of bank bill payment methods to block (update these codes to match your Adyen setup)
$blockedPaymentMethods = ['boletobancario', 'banktransfer', 'giropay'];

// Check if the notification is from a blocked payment method
if (in_array($paymentMethod, $blockedPaymentMethods)) {
    // Optional: Log the blocked notification for debugging
    Mage::log(
        sprintf('Blocked Adyen notification for bank bill method: %s (PSP Reference: %s)', 
            $paymentMethod, 
            $notificationData['pspReference'] ?? 'N/A'
        ), 
        null, 
        'adyen_blocked_notifications.log'
    );
    
    // Send a success response to Adyen so they don't retry the notification
    $this->getResponse()->setBody('[accepted]');
    return; // Exit the method to skip further processing
}

Key Notes to Remember:

  • Verify payment method codes: Log a few notifications first to confirm exactly what codes Adyen sends for your bank bill payments. You can add a temporary log line to capture all payment methods: Mage::log('Received notification for payment method: ' . $paymentMethod, null, 'adyen_payment_methods.log');
  • Don't skip the [accepted] response: Adyen will keep retrying notifications if they don't get this response, even if you're blocking processing.
  • Test thoroughly: Run a test transaction with a bank bill payment to confirm notifications are blocked, and another with a non-blocked method (like credit card) to ensure normal processing still works.

内容的提问来源于stack exchange,提问作者Matheus Portela

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 08:08:53