Magento支付工作流程和事件订单支付 [英] Magento Payment workflow and event order paid

查看:267
本文介绍了Magento支付工作流程和事件订单支付的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,感谢您阅读我。



对于我的Magento模块之一,我需要捕获事件任何订单被定义为付费。
所以我发现关联的事件是sales_order_payment_pay。好的,好像完全符合我的需要。



我是Magento的开发人员,而不是商家,目前来说,我从来没有在网上投放Magento实例在生产中。所以支付工作流程对我来说相当黑暗。我曾经在我的测试中选择支票/汇票作为付款方式。



问题是:我需要抓住这个事件(sales_order_payment_pay),但似乎我可以不要触发它,从不进入我的观察者功能。
我目前有2种付款方式,支票/汇票和信用卡。
对于第一个,商家需要在后台验证付款,而我红色是他创建发票的那一刻。所以我尝试了,但事件永远不会触发。
对于第二个,更困难:因为我在开发模式,我不知道如何通过信用卡验证付款。我在万事达卡上找到了一个允许在Magento进行测试的在线人数,但在后端,总付费仍然等于零。所以在提交订单之后,没有事件触发(似乎很合乎逻辑),当我创建发票时,仍然没有触发任何事件。



你能帮我多了一点付款过程并抓住任何订单支付?我找不到任何有关它的信息或文件。



PS:我的模块的目的是抓住事件地点的订单或支付付款,并生成一个XML文件数据导出。第一个有订单的已经开发了。

解决方案

此主题似乎有点棘手,所以我将分享我的付款方式和订单生命周期的愿景。



艾伦风暴的愿景



首先我邀请你看到这个话题,最着名的是Magento的博客Alan Storm。



这是我认为它的工作原理:



案例1:使用在线付款(PayPal,信用卡等)订单,接受付款



客户端确认的订单 - >由Magento创建的订单 - > status pending_payment

客户在线支付的订单 - >付款服务验证的付款 - >付款确定 - >由Magento创建的发票 - > status pending_payment (不确定这一点)。

商家发货的订单 - >由Magento创建的> shippig优惠券 - >状态完成



案例2:订单与网上支付(Paypal,信用卡等) ...),付款拒绝



客户验证的订单 - >由Magento创建的订单 - > status pending_payment

客户在线支付的订单 - >付款服务拒绝付款 - >由Magento取消订单 - >状态已取消



案例3:使用离线付款订单(支票/汇票,优惠券等) )。发货前的商家发票



由客户 - >由Magento创建的订单确认的订单 - >状态待处理

订单由客户支付 - >付款商家 - >商家订单发票 - >由Magento创建的发票 - >状态处理

商家发货的订单 - >由Magento创建的发货优惠券 - >状态完成



案例4:使用离线付款订单(支票/汇票,优惠券等)。商人在发票前发货



由客户 - >由Magento创建的订单 - >状态待处理

订单由客户 - >订单发货由商家 - >由Magento创建的运送优惠券 - >状态处理

商家发票的订单 - >由Magento创建的发票 - >状态处理



希望这个话题将来会帮助某人。

如果您需要更多信息,请告诉我们。


First of all, thanks for reading me.

For one of my Magento module I need to catch the event "any order is defined as paid". So I found that the associated event is sales_order_payment_pay. Ok seems to fit perfectly with my needs.

I’m a Magento dev, not a merchant and, for the moment, I’ve never put a Magento instance online and in production. So the payment workflow is quite dark to me. I used to select "Check/Money Order" as payment method during my tests.

The problem is : I need to catch this event (sales_order_payment_pay) but it seems I can’t trigger it and never enter in my observer function. I have currently 2 payment method, check/money order and credit card. For the first one, the merchant needs to validate the payment in the backend and I red it’s the moment when he creates the invoice. So I tried it but the event is never triggered. For the second one, it’s more difficult : as I am in dev mode, I don’t know how to validate payment via credit card. I found a number for MasterCard online who allows tests in Magento, but in the back end, the total paid ammound is still equal to zero. So after order submission, no event triggered (seems quite logical) and when I create the invoice, still no event triggered.

Can you help me to understand a little more the payment process and to catch any order paid ? I can’t find any information or documentation about it.

PS : The aim of my module is to catch the event place order or payment paid and generate an XML file for data export. The first one with place order is already developed.

解决方案

This topic seems a little tricky, so I will share my vision of payment methods and order lifecycle.

Alan Storm's vision

First of all I invite you to see this topics by one of the most famous Magento blogger, Alan Storm.

Here is how I think it’s working :

Case 1 : Order with an online payment (Paypal, credit card, etc ...), payment accepted

Order validated by Client -> order created by Magento -> status pending_payment
Order payed online by Client -> payment validated by Payment Service -> payment OK -> invoice created by Magento -> status pending_payment (not sure about this point).
Order shipped by merchant -> shippig coupon created by Magento -> status complete

Case 2 : Order with an online payment (Paypal, credit card, etc ...), payment refused

Order validated by Client -> order created by Magento -> status pending_payment
Order payed online by Client -> payment refused by Payment Service -> Order cancelled by Magento -> status canceled

Case 3 : Order with an offline payment (check/money order, selling coupon, etc ...). The merchant invoices before shipping

Order validated by Client -> order created by Magento -> status pending
Order payed offline by Client -> payment received by Merchant -> order invoiced by Merchant -> invoice created by Magento -> status processing
Order shipped by Merchant -> shipping coupon created by Magento -> status complete

Case 4 : Order with an offline payment (check/money order, selling coupon, etc ...). The merchant ships before invoicing

Order validated by Client -> order created by Magento -> status pending
Order payed offline by Client -> order shipped by Merchant -> shipping coupon created by Magento -> status processing
Order invoiced by Merchant -> invoice created by Magento -> status processing

Hope this topic will help someone in the future.
Let me know if you need some more information after that.

这篇关于Magento支付工作流程和事件订单支付的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆