我们使用IPP服务在QuickBooks联机中推送/获取数据。我们在创建BillPayment时遇到了问题。在提供的示例中没有“添加BillPayment”(/docs/partner_platform/示例_app_ipp_v3)。
除了Line对象之外,我们已经成功地使所有变量都正确了。这有点让人困惑,因为有一个Payment对象。
你是怎么进行的?是否存在这类事务的现有工作/完整示例?
我们尝试了以下代码(复制了Payment示例代码)来添加Line对象:
$Line = new QuickBooks_IPP_Object_Line();
$Line->setAmount(10);
$LinkedTxn = new QuickBooks_IPP_Object_LinkedTxn();
$LinkedTxn->setTxnId('{-84}'); //Is this the Bill Ref ID?
$LinkedTxn->setTxnType('Bill');
$Line->setLinkedTxn($LinkedTxn);
$BillPaymentObject->addLine($Line);Payment对象变量:
生成的错误意味着应该提供一个帐户。文档中有APAccountRef和CCAccountRef,但是我们尝试了应用它们,但是失败了。错误没有提供关于处于错误状态的是Line对象还是Payment对象的信息。
6000: [A business validation error has occurred while processing your request, Business Validation Error: Vous devez sélectionner un compte pour cette opération.] (您必须为此操作选择一个帐户)
最后一次请求XML:
<billpayment xmlns="http://schema.intuit.com/finance/v3"> <docnumber>11</docnumber> <txndate>2014-06-14</txndate> <vendorref>8</vendorref> <paytype>CreditCardPayment=10</paytype> <creditcardpayment>1111222233334444</creditcardpayment> <ccaccountref>15</ccaccountref> <totalamt>1.50</totalamt> <line xmlns="http://schema.intuit.com/finance/v3"> <amount>10</amount> <linkedtxn xmlns="http://schema.intuit.com/finance/v3"> <txnid>11</txnid> <txntype>Bill</txntype> </linkedtxn> </line> </billpayment>
完整的PHP代码示例不包含8月部分(请参阅):
$str_service = 'QuickBooks_IPP_Service_'.$_REQUEST['type'];
$str_object = 'QuickBooks_IPP_Object_'.$_REQUEST['type'];
//Création d'un item
$Service = new $str_service();
$Object = new $str_object();
$arr_excluded_key = array('token', 'type', 'arr_item', 'billAddrLine1', 'billAddrLine2', 'billAddrCity', 'billAddrCountrySubDivisionCode', 'billAddrPostalCode', 'primaryPhone', 'fax', 'mobile');
//Boucle pour les set
foreach($_REQUEST as $key => $value){
if(!in_array($key, $arr_excluded_key)){
$str_method = 'set'.ucfirst($key);
$Object->$str_method($value);
}
}
switch($_REQUEST['type']){
case 'BillPayment':
foreach($_REQUEST['arr_item'] as $item){
$Line = new QuickBooks_IPP_Object_Line();
$Line->setAmount(10); //Static for testing purposes
// The line has a LinkedTxn node which links to the actual bill
$LinkedTxn = new QuickBooks_IPP_Object_LinkedTxn();
$LinkedTxn->setTxnId('{-11}'); //Static for testing purposes
$LinkedTxn->setTxnType('Bill');
$Line->setLinkedTxn($LinkedTxn);
$Object->addLine($Line);
}
break;
}
//Response
#$Service->add($Context, $realm, $Object);
#echo $Service->lastRequest($Context);exit;
if ($resp = $Service->add($Context, $realm, $Object)){
print($resp);
}
else{
print($Service->lastError($Context));
}这是发送的查询(它是真正的URL,它应该用于测试目的):http://dev.magikweb.ca/magik-net/quickbooks/save.php?token=aaabbbcccddd1234&type=BillPayment&docNumber=11&txnDate=2014-06-14&vendorRef=8&payType=CreditCardPayment=10&CreditCardPayment=1111222233334444&CCAccountRef=15&totalAmt=1.50&arr_item[0][amount]=0.75&arr_item[0][txnId]=11&arr_item[0][amount]=0.75&arr_item[0][txnId]=11
发布于 2014-10-16 13:26:30
如果错误提示您指定了一个帐户:
(您必须为此操作选择一个帐户)
我要做的第一件事就是指定一个帐户。参考Intuit的文档:
您将看到有一个APAccountRef节点,它允许您为整个账单支付指定一个帐户。
所有QuickBooks_IPP_Object_*类都有精确反映Intuit文档/XML节点名称的方法。
因此,如果您看到一个名为APAccountRef的XML节点,将会有相应的方法:
->setAPAccountRef($ref);->getAPAccountRef();您试过指定APAccountRef了吗?
关于这一点:
支付对象变量:* docNumber * txnDate * vendorRef .
我不知道你从哪里弄来的-它们是不正确的。正确的节点名称是:
XML区分大小写,所以请确保使用正确的大小写,否则会出现错误。
关于这一点:
文档中有APAccountRef和CCAccountRef,但是我们尝试了应用它们,但是失败了。
你到底是怎么“失败”的?你的代码是什么样子的?发送给Intuit的XML是什么样子的?你是得到了同样的错误,还是不同的错误?
我们真的需要更多的细节来帮助。
关于这一点:
你是怎么进行的?
解决疑难解答的最佳方法总是:
->add(...)方法之后调用->add(...)来获得这个结果。https://stackoverflow.com/questions/26389363
复制相似问题