チェックを行うと、次のエラーが表示されます。
金額または請求可能な $$customer$$ のいずれかを使用して、分割明細ごとに製品/サービスまたはアカウントを選択する必要があります。
これが私のコードです:
public void BuildCheckAddRq(Order order)
{
if (_qboSettings.MerchantPercent > 0 || _qboSettings.MerchantFee > 0)
{
Check newCheck = new Check(); // TODO: Initialize to an appropriate value
var total = (order.OrderTotal * _qboSettings.MerchantPercent) + _qboSettings.MerchantFee;
newCheck.Header = new CheckHeader();
newCheck.Header.TotalAmt = total;
newCheck.Header.TotalAmtSpecified = true;
newCheck.Header.TxnDate = System.DateTime.Now;
newCheck.Header.Note = "Merchant Account Fees";
newCheck.Header.BankAccountName = _qboSettings.DefaultAccount;
newCheck.Header.DocNumber = order.Id.ToString();
newCheck.Header.BankAccountId = new IdType { idDomain = idDomainEnum.QBO, Value = GetAccountId(_qboSettings.DefaultAccount) };
newCheck.Header.EntityName = _qboSettings.MerchantVendorAcct;
newCheck.Header.EntityType = EntityTypeEnum.Vendor;
//newCheck.Header.PayeeAddr = headerEntity.Address[0];
newCheck.Header.ToBePrinted = _qboSettings.ToBePrinted;
//ItemService ItemServ = new ItemService();
//List<Item> findItems = ItemServ.FindAll(Initializer.sessionContext, Initializer.realmId);
CheckLine checkedLine = new CheckLine();
checkedLine.Amount = total;
checkedLine.AmountSpecified = true;
checkedLine.Desc = "Merchant Account Fees";
decimal qty = 1;
checkedLine.ItemsElementName = new ItemsChoiceType1[] { ItemsChoiceType1.ItemId, ItemsChoiceType1.Qty};
checkedLine.Items = new object[] { new IdType() { idDomain = idDomainEnum.QBO, Value = GetAccountId("Merchant Account Fees")}, qty };
newCheck.Line = new CheckLine[] { checkedLine };
try
{
Check actualCheck = dataServices.Add<Check>(newCheck);
ErrorMessageDataSource.Insert(new ErrorMessage(MessageSeverity.Info, "QBO", "Check # " + actualCheck.Header.DocNumber + " synced successfully!"));
}
catch (Exception ex)
{
ErrorMessageDataSource.Insert(new ErrorMessage(MessageSeverity.Error, "QBO", ex.ToString()));
}
}
}