1

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.

1 Answer 1

1

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;
}
4
  • ah i see so the dispatch event name use dynamic value on the edge of string variable.. that why I cannot find it everywhere when search by full event name. thank you very much
    – mrfizh
    Oct 11, 2018 at 11:27
  • you most welcome Oct 11, 2018 at 11:28
  • Accept answer if its helps you Oct 11, 2018 at 11:28
  • need waiting 3 minutes to accept the answer :p
    – mrfizh
    Oct 11, 2018 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.