Authorize.net CIM重复事务窗口


Authorize.net CIM Duplicate Transaction Window

我正在与Authorize.net的客户信息管理器API(CIM)合作。我的测试用例集中在一个用户在结账时给出了错误的地址。

每次用户提交表单时,我的应用程序都会尝试创建一个客户档案:

$txrq = new AuthorizeNetCIM;
$txrsp = $txrq->createCustomerProfileTransaction("AuthCapture", $transaction, 'x_duplicate_window=0');

我已经尝试将传递x_duplicate_window设置为"额外选项",正如您在上面看到的那样,在SDK中,这是请求的以下部分:

<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>

无论我对x_duplicate_window使用什么值,authorize.net都将始终返回一个错误,直到默认时间过去。

AuthorizeNet Error: Response Code: 3 Response Subcode: 1 Response Reason Code: 11 Response Reason Text: A duplicate transaction has been submitted.

我担心,如果我们的一个(潜在)用户试图提交错误的地址,意识到自己的错误,然后在交易超时时又收到3分钟的错误。

Authorize.net SDK代码中存在错误:

~ CIM.php's method _setPostString() 中的360-364线

if ($this->_extraOptions) {
    $this->_xml->addChild("extraOptions");
    $this->_post_string = str_replace("<extraOptions></extraOptions>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML());
    $this->_extraOptions = false;
}

$this->_xml->addChild("extraOptions");导致节点与str_replace调用不匹配:<extraOptions/>

修改str_replace将纠正这种情况,它将通过x_duplicate_window参数:

if ($this->_extraOptions) {
    $this->_xml->addChild("extraOptions");
    $this->_post_string = str_replace("<extraOptions/>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML());
    $this->_extraOptions = false;
}