如何调试magento支付网关
我只是有点好奇。我可以做些什么来让我的支付网关调试体验变得更容易一些。签出时,它总是执行 ajax 调用。所以我无法通过 print_r() 或 echo 来查看进度。有没有更简单的方法来做到这一点而不破坏任何东西。是否可以禁用 ajax 调用并定期发帖。
I am just a little curious. What can I do to make my debugging experience with payment gateways a little easier. On check out, it always does the ajax calls. So there is no way I can print_r() or echo to see the progression. Is there a easier way to do it without destroying nothing. Is it possible to disable the ajax calls and make a regular post.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简短的回答是:这样做是为了进行非破坏性调试。
长答案如下。
我没有进行大量的支付网关调试,但许多支付网关在
检查authorize.net 选项组中都有“调试”设置以获取相关示例。如果将其翻转到“是”位置,调试信息将开始涌入日志文件。这假设您已打开登录功能,
您可能需要在
确保这些文件可由您的 Web 服务器写入中自行创建日志文件。
您还可以使用静态方法调用自行记录这些文件
。
最后,如果您的支付网关没有调试设置,您总是可以伪造它。所有支付模型(应该)继承自以下类
该类有一个方法可以确定调试是打开还是关闭
如果没有可用的调试配置标志,您可以暂时更改此方法以始终返回 true
但是,我不是确定基类做了多少调试(意味着如果配置中没有调试标志,那可能是因为支付网关模型本身没有进行调试)。不过值得探索。
祝你好运!
Short answer is: Do this for non-destructive debugging.
Long answer follows.
I haven't done a ton of payement gateway debugging, but many of the payment gateways have a "debug" setting in
Check the authorize.net option group for an example of this. If you flip this to the "yes" position debug information will start spewing to the log file. This assumes you've turned logging on in
You may need to create the log files yourself in
Make sure these files are writable by your web server.
You can also log to these files yourself with the static
method call.
Finally, if your payment gateway doesn't have a debug setting, you could always fake it. All Payment Model (are supposed to) inherit from the following class
This class has a method that determines if debugging is on or off
If there's no debug config flag available, you could temporarily change this method to always return true
However, I'm not sure how much debugging the base classes do (meaning if there's no debug flag in the config, that may be because there's no debugging going on in the payment gateway model itself). Worth exploring though.
Good luck!
对于 AJAX,您可能会发现 FirePHP for Magento 很有帮助。
对于所有情况,您都可以使用
Mage::log()
,只要您记得首先在系统 > 中将其打开即可。配置>开发人员。它的工作方式很像print_r
,只不过它输出到/var/log/system.log
。我经常
tailf
该文件,并且在很多地方都有这样的代码:For AJAX you might find FirePHP for Magento helpful.
For all situations you can use
Mage::log()
as long as you remember to turn it on first in System > Configuration > Developer. It works a lot likeprint_r
except it outputs to/var/log/system.log
.I often
tailf
that file and have code like this in lots of places: