Considering a custom Payment Method class extending \Magento\Payment\Model\Method\AbstractMethod
: Would somebody kindly explain what do the methods below do?
initialize($paymentAction
, $stateObject
)
validate()
order(\Magento\Payment\Model\InfoInterface $payment
, $amount
)
authorize(\Magento\Payment\Model\InfoInterface $payment
, $amount
)
capture(\Magento\Payment\Model\InfoInterface $payment
, $amount
)
refund(\Magento\Payment\Model\InfoInterface $payment
, $amount
)
cancel(\Magento\Payment\Model\InfoInterface $payment
)
void(\Magento\Payment\Model\InfoInterface $payment
)
Thanks!
Best Answer
initialize: Instantiate state and set it to state object. Method that will be executed instead of authorize or capture if flag isInitializeNeeded set to true.
validate: Validate payment method information that means validate payment method is allowed for billing country or not.
[Update]
Where actually during checkout process does authorize and capture is being called?
Solution:
Open Magento/Sales/Model/Order/Payment.php Check following method.