使用 API 创建客户付款方式的正确方法是什么?这也将回答如何使用具有键值对的网格而不是仅将值存储到特定字段中。
该代码已经使用并正常运行了将近一年,然后从本周早些时候开始,它不再有效。
// Connect to Acumatica
context = new acumatica.Screen();
context.CookieContainer = new System.Net.CookieContainer();
context.AllowAutoRedirect = true;
context.EnableDecompression = true;
context.Timeout = 1000000;
context.Url = Properties.Settings.Default.WebServiceURL;
LoginResult result = api.context.Login(Properties.Settings.Default.AcumaticaUserName, Properties.Settings.Default.AcumaticaPassword);
context.AR303010Clear();
AR303010Content AR303010 = context.AR303010GetSchema();
try
{
Debug.WriteLine("--- Payment Method Start ---");
// Create Invoice
AR303010.Actions.Save.Commit = true;
AR303010Content[] AR303010Content = context.AR303010Submit
(
new Command[]
{
new Value { Value = "ABARTENDE", LinkedCommand = AR303010.PaymentMethodSelection.Customer, Commit = true },
AR303010.Actions.Insert,
new Value { Value = "VISA", LinkedCommand = AR303010.PaymentMethodSelection.PaymentMethod, Commit = true },
new Key
{
ObjectName = AR303010.PaymentMethodDetails.Description.ObjectName,
FieldName = AR303010.PaymentMethodDetails.Description.FieldName,
Value = "=[" + AR303010.PaymentMethodDetails.Description.ObjectName + "." + AR303010.PaymentMethodDetails.Description.FieldName + "]"
},
new Value {Value = "Card Number", LinkedCommand = AR303010.PaymentMethodDetails.Description},
new Value {Value = "4000000000003636", LinkedCommand = AR303010.PaymentMethodDetails.Value, Commit = true},
new Key
{
ObjectName = AR303010.PaymentMethodDetails.Description.ObjectName,
FieldName = AR303010.PaymentMethodDetails.Description.FieldName,
Value = "=[" + AR303010.PaymentMethodDetails.Description.ObjectName + "." + AR303010.PaymentMethodDetails.Description.FieldName + "]"
},
new Value {Value = "Card Verification Code", LinkedCommand = AR303010.PaymentMethodDetails.Description},
new Value {Value = "321", LinkedCommand = AR303010.PaymentMethodDetails.Value, Commit = true},
new Key
{
ObjectName = AR303010.PaymentMethodDetails.Description.ObjectName,
FieldName = AR303010.PaymentMethodDetails.Description.FieldName,
Value = "=[" + AR303010.PaymentMethodDetails.Description.ObjectName + "." + AR303010.PaymentMethodDetails.Description.FieldName + "]"
},
new Value {Value = "Expiration Date", LinkedCommand = AR303010.PaymentMethodDetails.Description},
new Value {Value = "012015", LinkedCommand = AR303010.PaymentMethodDetails.Value, Commit = true},
AR303010.Actions.Save
}
);
Debug.WriteLine("--- Payment Method Created ---");
}
catch (Exception ex)
{
Debug.WriteLine(" --- Failed to create Payment Method ---");
Debug.WriteLine(ex.Message);
}
该代码最初是从 Acumatica 论坛中提取的:
• 我们曾尝试在以前的版本上使用该代码,我们知道 100% 可以使用该代码。• 我们已尝试取消发布我们的自定义。• 我们已尝试将数据发送到位于 tryacumatica.com 的 acumatica 演示
我们测试过的每个站点/版本/计算机都会返回相同的错误。
Error #12: Inserting 'Customer Payment Method Detail' record raised one or more errors. Please review. Error: 'Value' may not be empty. ---> PX.Data.PXOuterException: Error #12: Inserting 'Customer Payment Method Detail' record raised one or more errors. Please review.
有人可以指出我正确的方向吗?