我需要设置一个集成测试以直接从Acumatica销售订单中调用CC Capture功能,如该图所示。
我想在I210课程的示例中引用与付款和应用程序记录有关的Capture进行建模。我希望可以使用Contract API来完成。
这是I210课程中使用的内容。它只是稍作修改即可使用
//Capturing a payment
public static Payment CapturePayment(DefaultSoapClient soapClient, string paymentNbr)
{
Console.WriteLine("Capturing a credit card payment...");
string paymentType = "Payment";
Payment soPaymentToBeCaptured = new Payment
{
Type = new StringSearch { Value = paymentType },
ReferenceNbr = new StringSearch { Value = paymentNbr },
Hold = new BooleanValue { Value = false }
};
Payment payment = (Payment)soapClient.Put(soPaymentToBeCaptured);
InvokeResult invokeResult = soapClient.Invoke(payment, new CaptureCreditCardPayment());
ProcessResult processResult = LongRunProcessor.GetProcessResult(soapClient, invokeResult);
payment = (Payment)soapClient.Get(new Payment { ID = processResult.EntityId });
Console.WriteLine("Payment type: {0}",payment?.Type?.Value);
Console.WriteLine("Payment number: {0}", payment?.ReferenceNbr?.Value);
Console.WriteLine("Payment status: {0}", payment?.Status?.Value);
Console.WriteLine();
return payment;
}
///这是我没有成功的尝试。
internal static Payment CapturePaymentFromSO(DefaultSoapClient soapClient, SalesOrder salesOrder)
{
//salesOrder is fully instantiated from a previous integration call
InvokeResult invokeResult = soapClient.Invoke(salesOrder, new CaptureCreditCardPayment());
//InvokeResult invokeResult = soapClient.Invoke(salesOrder, new CaptureCreditCardPayment());
ProcessResult processResult = LongRunProcessor.GetProcessResult(soapClient, invokeResult);
Payment payment = (Payment)soapClient.Get(new Payment { ID = processResult.EntityId });
Console.WriteLine("Payment type: {0}", payment?.Type?.Value);
Console.WriteLine("Payment number: {0}", payment?.ReferenceNbr?.Value);
Console.WriteLine("Payment status: {0}", payment?.Status?.Value);
Console.WriteLine();
return payment;
}
预先感谢您的帮助 罗伯特