What is the correct way to create a customer payment method using the API? This will also answer how to work with a grid that has a key value pair vs just storing values into a particular field.
This code has been in use and functioning correctly for almost a year now and then starting earlier this week it no longer works.
// 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);
}
The code was originally pulled from the Acumatica forums at:
http://forum.acumatica.com/forum/acumatica-reseller-and-isv-community/development-and-customization/5873-setting-credit-card-fields-though-web-services
http://forum.acumatica.com/forum/acumatica-reseller-and-isv-community/development-and-customization/885-help-on-add-new-payment-method-to-a-given-customer-by-webservice-ar303010
• We have tried using the code on a previous version that we know 100% that it used to work on. • We have tried unpublishing our customizations. • We have tried sending the data over to the acumatica demo located at tryacumatica.com
Every single site/version/computer we have tested it on returns the same error.
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.
Can somebody please point me in the right direction?