Xero api XERO PHP SDK createPayment验证异常

Xero api XERO PHP SDK createPayment验证异常,xero-api,Xero Api,在沙箱中使用以下代码使用新SDK: $payment = new \XeroAPI\XeroPHP\Models\Accounting\Payment([ 'code' => '001', 'invoice_number' => $inv_num, 'amount' => $amount ]); $this->accounting_api->createPayment($this->get

在沙箱中使用以下代码使用新SDK:

$payment = new \XeroAPI\XeroPHP\Models\Accounting\Payment([
        'code' => '001',
        'invoice_number' => $inv_num,
        'amount' => $amount
            ]);
$this->accounting_api->createPayment($this->getSingleTenant(), $payment);
我得到以下例外

“ErrorNumber”:10,
“类型”:“ValidationException”,
“消息”:“发生验证异常”,
“要素”:[
{
“日期”:“\/日期(160488000000+0000)\/”,
“金额”:1.74,
“状态”:“授权”,
“HasAccount”:错误,
“HasValidationErrors”:正确,
“验证错误”:[
{
“消息”:“您必须为付款指定发票ID或发票编号或贷方票据ID或贷方票据编号或预付款ID或多付款ID”
},
{
“消息”:“您必须指定付款的帐户代码或帐户ID”
},
{
“消息”:“您必须为付款指定多付的ID”
}
]
}

]
最后,答案是忽略account\u number和code属性及其getter和setter,而只使用设置了code和Invoice\u number属性的空Invoice和account对象:

    public function RegisterPayment($amount, $inv_num, $account_code){
    $payment = new \XeroAPI\XeroPHP\Models\Accounting\Payment([
        'account' => new \XeroAPI\XeroPHP\Models\Accounting\Account(['code' => $account_code]),
        'invoice' => new \XeroAPI\XeroPHP\Models\Accounting\Invoice(['invoice_number' => $inv_num]),
        'amount' => $amount,
        'date' => date('Y-m-d')
            ]);
    try{
        $this->accounting_api->createPayment($this->getSingleTenant(), $payment);
    } catch (\XeroAPI\XeroPHP\ApiException $ex) {
        //var_dump($ex->getResponseBody());
    }
}