2017-07-25 60 views
0

我正在通过SOAP API发布Acumatica付款,详见I210合同基础Web服务指南here的第117页。我已经实现了代码手动规范但是当我发布一个支付我得到这个错误:Acumatica SOAP API发布付款状态错误

TX Error #3: Document Status is invalid for processing. at PX.Objects.AR.ARPaymentEntry.Release

当我看到新创建的付款状态,它有一个平衡的状态,我相信应该能够被释放。是否还有其他需要付款的状态才能发布?

我的代码:

//creates the order to attach the payment to 
SalesOrder newOrder = (SalesOrder)await client.PutAsync(orderToBeCreated); 

var wooPaymentRef = "Test"; 
//Create a payment for the order 
Payment paymentToBeCreated = new Payment() 
{ 
    Type = new StringValue { Value = "Prepayment" }, 
    Status = new StringValue { Value = "Open" }, 
    PaymentMethod = new StringValue { Value = store.AcumaticaPaymentMethod }, 
    PaymentAmount = new DecimalValue { Value = Convert.ToDecimal(wooOrder.order.total) }, 
    CustomerID = newOrder.CustomerID, 
    OrdersToApply = new PaymentOrder[] { 
    new PaymentOrder() 
    { 
     OrderType = new StringValue { Value = "SO"}, 
     OrderNbr = newOrder.OrderNbr, 
     AppliedToOrder = newOrder.OrderTotal 
    } 
    }, 
    CashAccount = new StringValue { Value = store.AcumaticaPaymentMethod }, 
    PaymentRef = new StringValue { Value = wooPaymentRef }, 
    Hold = new BooleanValue { Value = false} 
}; 

Payment newPayment = (Payment)await client.PutAsync(paymentToBeCreated); 

//Extra step to get the newly created payment just to make sure it's the most recent 
Payment paymentToBeFound = new Payment 
{ 
    Type = new StringSearch { Value = newPayment.Type.Value }, 
    ReferenceNbr = new StringSearch { Value = newPayment.ReferenceNbr.Value } 
}; 

Payment currentPayment = (Payment)await client.GetAsync(paymentToBeFound); 

//Release the payment 
InvokeResult invokeResult = await client.InvokeAsync(currentPayment, new ReleasePayment()); 
//Monitor the process 
ProcessResult processResult = await LongProcessRunner.GetProcessResult(client, invokeResult); 

在InvokeResult线出现的错误。

+0

您将“状态”设置为“打开”而不是将其设置为“平衡” –

+0

您正在尝试使用此代码的Acumatica版本是什么? – samol518

+0

@SamvelPetrosov,无论我在创建预付款时设置的状态如何,当我将payement对象作为“paymentToBeFound”取回时,它会以“平衡”形式返回。为了释放它应该是什么状态? –

回答

1

你写的代码没有问题。

我在评论中询问了你要问什么版本,因为在新版本中我无法重现这个问题。 您的版本是2017年2月初,我确实发现了一个问题报告,提到这个问题已得到解决。 虽然这个版本优于5.30.3715或6.10.0680,大约在2017年6月初。

如果您在这些版本或更新的版本中尝试您的代码,它应该工作。

+0

谢谢,一旦我们完成升级到版本6,我们会再试一次。有没有更好的使用REST API在第6版中执行此操作的方式? –

+0

对于那些偶然发现这一点的人,我确实证实了这一点,因为@ samol518说,它在更高版本中有效。 –