omise / omise-magento

Omise Magento Plugin
https://docs.opn.ooo/magento-plugin
MIT License
34 stars 19 forks source link

Wrong approach while letting `initialize` command creating transaction #373

Open tuyennn opened 2 years ago

tuyennn commented 2 years ago

See https://github.com/omise/omise-magento/blob/v2.27.0/etc/di.xml#L967 https://github.com/omise/omise-magento/blob/v2.27.0/etc/di.xml#L973-L981 https://github.com/omise/omise-magento/blob/v2.27.0/etc/di.xml#L996-L1004

And how the Payment Handle Detail writing a transaction before order was created https://github.com/omise/omise-magento/blob/v2.27.0/Gateway/Response/PaymentDetailsHandler.php#L67-L82

because

initialize: Instantiate state and set it to state object. writing a new payment transaction might lead Integrity constraint violation foreign key constraint fails in sales_payment_transaction while model order be saved, it could create(insert) another row to sales_payment_transaction literally this action should be performed after order be saved which is authorize or capture

aashishgurung commented 1 year ago

@tuyennn Thank you raising this issue with initialize command. We will look into it.