Question

I got this event observer code in the stripe payment module

<event name="payment_method_assign_data_stripecreditcards">
        <observer name="stripecreditcards_payment_gateway_data_assign" instance="Stripeofficial\CreditCards\Observer\DataAssignObserver" />
    </event> 

I looking for dispatch event for payment_method_assign_data_stripecreditcards but I'm not found it on the vendor folder, my goals is get know when and from what class file that make this event name triggered.

Was it helpful?

Solution

You can find event in this file

vendor/magento/module-payment/Model/Method/AbstractMethod.php

and function name is assignData()

  public function assignData(\Magento\Framework\DataObject $data) {
    $this->_eventManager->dispatch(
        'payment_method_assign_data_' . $this->getCode(),
        [
            AbstractDataAssignObserver::METHOD_CODE => $this,
            AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(),
            AbstractDataAssignObserver::DATA_CODE => $data,
        ]
    );

    $this->_eventManager->dispatch(
        'payment_method_assign_data',
        [
            AbstractDataAssignObserver::METHOD_CODE => $this,
            AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(),
            AbstractDataAssignObserver::DATA_CODE => $data,
        ]
    );

    return $this;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top