我正在尝试进行集成测试,该测试将自动使付款无效。尝试调用VoidCheck或Void Payment操作后出现以下错误。 “在系统中找不到参考编号'001605'。”当该ReferenceNbr的付款确实存在时。
在考虑使用Selenium之前,我想看看是否能获得解决此问题的建议。
预先感谢
罗伯特
这是逐步解决问题的截屏视频。 https://www.dropbox.com/s/l4d2soq0dx75xye/Issue%20with%20not%20being%20able%20to%20invoke%20VoidCheck%202019-01-25_12-02-17.mp4?dl=0
try
{
Invoice invoice = new Invoice
{
ReferenceNbr = new StringSearch {Value = InvoiceReferenceNbr},
ReturnBehavior = ReturnBehavior.All
};
invoice = SoapClient.Get(invoice) as Invoice;
var paymentRef = invoice?.ApplicationsDefault.FirstOrDefault()?.ReferenceNbr.Value;
Payment payment = (Payment) SoapClient.Get(new Payment
{
ReferenceNbr = new StringSearch {Value = paymentRef},
ReturnBehavior = ReturnBehavior.All
});
Log($"Invoking Void Check for Payment {payment.ReferenceNbr.Value}");
/*
This raises the following Error: Reference Nbr. '001605' cannot be found in the system.
Using VoidPayment raises the same error.
*/
InvokeResult invokeResult =
SoapClient.Invoke(payment, new VoidCheck());
ProcessResult processResult = LongRunProcessor.GetProcessResult(SoapClient, invokeResult);
}
catch (Exception e)
{
Log(new MessageToLog
{
Assertion = false,
PassMessage = "Will Not Pass",
FailMessage = $"An Error occured while trying to void Payment for invoice {InvoiceReferenceNbr} \r\n" +
$"Message:{e.Message}"
});
}