且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Acumatica-使用api创建客户付款方式

更新时间:2023-11-29 23:07:46

好,所以这里是Acumatica提供的工作代码。我仍然不知道为什么旧代码在整个一年中都工作时会中断,但是这里是有效的代码,由于您不必处理键/值,因此它更简洁。

Ok, so here is working code provided from Acumatica. I still have no idea why the old code broke when it has been working this entire year, but here's working code and it's a little cleaner since you do not have to deal with key/value.

        var context = new acumatica.Screen();
        context.CookieContainer = new System.Net.CookieContainer();
        context.AllowAutoRedirect = true;
        context.EnableDecompression = true;
        context.Timeout = 1000000;
        LoginResult result = context.Login("admin", "admin");

        context.AR303010Clear();
        AR303010Content AR303010 = context.AR303010GetSchema();

        try
        {
            var commands = new Command[]
                    {
                        new Value { Value = "ABARTENDE", 
                            LinkedCommand = AR303010.PaymentMethodSelection.Customer},
                        AR303010.Actions.Insert,
                        new Value { Value = "VISA", 
                            LinkedCommand = AR303010.PaymentMethodSelection.PaymentMethod},

                        new Value
                        {
                            Value = "='CCDNUM'",
                            LinkedCommand = AR303010.PaymentMethodDetails.Description
                        },

                        new Value { Value = "41111111111111118",
                                    LinkedCommand = AR303010.PaymentMethodDetails.Value,
                                    Commit = true
                        },

                        new Value
                        {
                            Value = "='CVV'",
                            LinkedCommand = AR303010.PaymentMethodDetails.Description
                        },

                        new Value { Value = "121",
                                    LinkedCommand = AR303010.PaymentMethodDetails.Value,
                                    Commit = true
                        },

                        new Value
                        {
                            Value = "='EXPDATE'",
                            LinkedCommand = AR303010.PaymentMethodDetails.Description
                        },

                        new Value {Value = "01/2019", 
                                   LinkedCommand = AR303010.PaymentMethodDetails.Value,
                                    Commit = true
                        },

                        new Value
                        {
                            Value = "='NAMEONCC'",
                            LinkedCommand = AR303010.PaymentMethodDetails.Description
                        },

                        new Value {Value = "Mr Jon Doe 8", 
                                   LinkedCommand = AR303010.PaymentMethodDetails.Value,
                                    Commit = true
                        },

                        AR303010.Actions.Save};
            AR303010Content[] AR303010Content = context.AR303010Submit(commands.ToArray());

        }
        catch (Exception ex)
        {
        }