当商店升级到Magento 1.5时,由于以下更改,它可能会失去在线退款的能力

if ($this->getCreditmemo()->canRefund()) {
    if ($this->getCreditmemo()->getInvoice()) {

vs.新

if ($this->getCreditmemo()->canRefund()) {
    if ($this->getCreditmemo()->getInvoice() && $this->getCreditmemo()->getInvoice()->getTransactionId()) {

不幸的是,没有多少付款方式看到了这种变化的到来,因此没有发票上存在的Transaction_ID。

现在,一些付款方式已通过使用/覆盖实现了Transaction_ID的节省

mage_payment_model_method_abstract

public function processInvoice($invoice, $payment)
{
    $invoice->setTransactionId($payment->getLastTransId());
    return $this;
}

包括Magento自己的授权.net实施

/**
 * Mock capture transaction id in invoice
 *
 * @param Mage_Sales_Model_Order_Invoice $invoice
 * @param Mage_Sales_Model_Order_Payment $payment
 * @return Mage_Payment_Model_Method_Abstract
 */
public function processInvoice($invoice, $payment)
{
    $invoice->setTransactionId(1);
    return $this;
}

但是,在唯一地点processInvoice中的评论称为mage_sales_model_order_payment

$this->getMethodInstance()->processInvoice($invoice, $this); // should be deprecated

让我认为这不是最好的方法。

  • 在您的付款方式中实施发票上的TransAction_ID节省的最佳方法是什么?
  • 处理旧发票的好选择是什么?
有帮助吗?

解决方案

正确设置事务ID

至于映射发票。由于Magento 1.4被引入交易,因此当发票创建发票时,它会自动设置事务ID capture() 或者 registerCaptureNotification() 订单支付实体的方法。只是看 _addTransaction()Mage_Sales_Model_Order_Payment 班级。因此,您实际上不应该在乎手动设置此交易ID。也可能会被 $this->getTransactionId() 方法调用,但实际上不需要您设置它,因为Magento通过调用内部生成事务ID _generateTransactionId() 在捕获或注册捕获通知中。

Magento 1.4

自Magento 1.4.X以来,所有升级都是安全的,因为此逻辑一直存在,因为订单支付交易实体的介绍。 1.4之前的所有Magento版本都具有这种巨大的升级性疼痛,甚至核心授权。NET(请检查我的答案: https://stackoverflow.com/questions/14207721/why-isnt-payment-method-information-information-information-available-in-orders-roders-after-prading-from-ma/14270191#14270191)。如果您使用此方法在发票上设置事务ID,那么您应该安全,因为如果您删除,Magento会自动生成此事务ID processInvoice() 呼叫和您所设置的原始价值也将用于旧交易。

结论

当然,在这种情况下,我可能是错误的,因为它没有以这种方式进行测试,因此在依靠我的答案之前将其设置和测试非常好。至少我的付款扩展名是在使用此 processInvoice() Magento与我的CreditMemos正确处理了方法和退款。

更新

至于付款方式的交易信息,您需要进行 $this->getInfoInstance()->setTransactionId('your_txn_id') 打电话给你 authorize() 或者,如果未经授权是直接付款, capture() 明确的方法交易,让Magento为您创建事务记录。对于旧记录,我的回答是这样。

许可以下: CC-BY-SA归因
scroll top