如何通过Acumatica API使用付款设置创建销售订单 [英] How Do I Create a Sales Order with Payment Settings through Acumatica API

查看:77
本文介绍了如何通过Acumatica API使用付款设置创建销售订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Acumatica Web服务API创建销售订单。除付款设置外,我已经能够传递所有必填字段。我们的安装使用Authorize.NET(PX.CCProcessing.AuthorizeNetTokenizedProcessing)加载项。通过创建新的付款方式并授权付款,是否可以通过API与Authorize.NET加载项进行交互,以便员工可以在Acumatica内部处理订单并在那里获取付款。

I am trying to create a sales order using the Acumatica Web Service API. I have been able to pass all the required fields except the Payment Settings. Our installation uses the Authorize.NET (PX.CCProcessing.AuthorizeNetTokenizedProcessing) add-in. Is it possible to interact with the Authorize.NET add-in through the API by creating a new payment method and authorizing payment so that the employees can work the order from within Acumatica and capture the payment there.

下面是我用来创建销售订单的代码。我不确定用于通过API本身激活创建新的付款资料ID操作的结构。通过GUI,它会打开一个弹出窗口,将卡复制到Authorize.Net,并在Acumatica中保存付款资料ID记录。

Below is the code I am using to create my sales order. I am not sure the structure to use in order to activate the "Create New Payment Profile ID" action through the API itself. Through the GUI, it opens a popup window that copies the card to Authorize.Net and saves a Payment Profile ID record within Acumatica.

        SO301000Content SO301000 = context.SO301000GetSchema();
        context.SO301000Clear();
        SO301000Content[] SO30100content = context.SO301000Submit
        (
            new Command[]
            {
                //add header info
                new Value { Value = "SO", LinkedCommand = SO301000.OrderSummary.OrderType },
                new Value { Value = "<NEW>", LinkedCommand = SO301000.OrderSummary.OrderNbr },
                new Value { Value = "999999", LinkedCommand = SO301000.OrderSummary.Customer  },

                //add line items
                SO301000.DocumentDetails.ServiceCommands.NewRow,
                new Value { Value = "SS1121", LinkedCommand = SO301000.DocumentDetails.InventoryID },
                new Value { Value = "2", LinkedCommand = SO301000.DocumentDetails.Quantity },
                SO301000.DocumentDetails.ServiceCommands.NewRow,
                new Value { Value = "SS1122", LinkedCommand = SO301000.DocumentDetails.InventoryID },
                new Value { Value = "2", LinkedCommand = SO301000.DocumentDetails.Quantity },
                SO301000.DocumentDetails.ServiceCommands.NewRow,
                new Value { Value = "SS1123", LinkedCommand = SO301000.DocumentDetails.InventoryID },
                new Value { Value = "2", LinkedCommand = SO301000.DocumentDetails.Quantity },

                //add shipping information
                new Value { Value = "True", LinkedCommand = SO301000.ShippingSettingsShipToInfoOverrideContact.OverrideContact },
                new Value { Value = "DEMO CHURCH SHIP", LinkedCommand = SO301000.ShippingSettingsShipToInfoOverrideContact.BusinessName },
                new Value { Value = "True", LinkedCommand = SO301000.ShippingSettingsShipToInfo.OverrideAddress },
                new Value { Value = "123 TEST STREET", LinkedCommand = SO301000.ShippingSettingsShipToInfo.AddressLine1 },
                new Value { Value = "BUFORD", LinkedCommand = SO301000.ShippingSettingsShipToInfo.City },
                new Value { Value = "GA", LinkedCommand = SO301000.ShippingSettingsShipToInfo.State },
                new Value { Value = "30519", LinkedCommand = SO301000.ShippingSettingsShipToInfo.PostalCode },
                new Value { Value = "FREESHIP", LinkedCommand = SO301000.ShippingSettingsShippingInformation.ShipVia },

                //add totals
                new Value { Value = "10.00", LinkedCommand = SO301000.Totals.PremiumFreight },
                new Value { Value = "94.0000", LinkedCommand = SO301000.Totals.PackageWeight },

                //add payment

                SO301000.Actions.Save,
                SO301000.OrderSummary.OrderNbr
            }
        );

新代码错误-
我现在可以插入客户付款记录,但收到

New Code Error - I am now able to insert the customer payment record but receive an error when trying to insert that card into an existing sales order.

这是我的代码:

        SO301000Content SO301000 = context.SO301000GetSchema();
        context.SO301000Clear();
        SO301000Content[] SO30100content = context.SO301000Submit
        (
            new Command[]
                {
                    //add header info
                    new Value { Value = "SO", LinkedCommand = SO301000.OrderSummary.OrderType },
                    new Value { Value = "000129", LinkedCommand = SO301000.OrderSummary.OrderNbr },
                    //add payment
                    new Value { Value = "VISA", LinkedCommand = SO301000.PaymentSettings.PaymentMethod },
                    new Value { Value = "VISA:****-****-****-7261", LinkedCommand = SO301000.PaymentSettings.CardAccountNo },

                    SO301000.Actions.Save
                }
        );

如果有人有任何想法,我将不胜感激。谢谢。

If anybody has any ideas, I would greatly appreciate it. Thanks.

推荐答案

您不能使用创建新的付款资料ID,因为它依赖于实际的用户Web浏览器(我们仅在IFRAME中显示Authorize.net新的配置文件页面)。我们这样做是为了将应用程序暴露在PCI法规遵从性之下,这样就不会有信用卡号或敏感信息触及Acumatica服务器。您应该直接通过Authorize.net CIM站点或CIM API添加付款资料,并将该资料ID传递给Acumatica。

You can't use the "Create New Payment Profile ID", because it relies on an actual user in the web browser (we simply show the Authorize.net new profile page in an IFRAME). We do this to limit the exposure of the application to PCI Compliance, and this way no credit card number or sensitive information ever touches the Acumatica server. You should add the payment profile directly through the Authorize.net CIM site or CIM APIs, and pass the profile ID to Acumatica.

不幸的是,您无法将客户资料ID直接传递给订单,只有付款资料值被接受为输入,因此,您首先需要添加条目

Unfortunately you can't pass the customer profile ID directly to the order, only the payment profile value is accepted as input, so you'll first need to add the entry using the Customer Payment Methods screen API.

        AR303010Content AR301000 = context.AR303010GetSchema();
        context.AR303010Clear();
        AR303010Content[] AR303010content = context.AR303010Submit(
            new Command[]
            {
                new Value { Value = "999999", LinkedCommand = AR301000.PaymentMethodSelection.Customer },
                new Value { Value = "VISATOK", LinkedCommand = AR301000.PaymentMethodSelection.PaymentMethod },
                new Value { Value = "AUTHTOK", LinkedCommand = AR301000.PaymentMethodSelection.ProcCenterID },
                new Value { Value = "102000", LinkedCommand = AR301000.PaymentMethodSelection.CashAccount },
                new Value { Value = "23640304", LinkedCommand = AR301000.PaymentMethodSelection.CustomerProfileID },
                new Value { Value = "27187006",  FieldName = "Value", ObjectName = "ccpIdDet"}, //Payment Profile ID, going directly to internal ccpIdDet view to bypass validation error when using AR301000.PaymentMethodDetails.Value
                AR301000.Actions.Save,
                AR301000.PaymentMethodSelection.CardAccountNo
            });

        string cardAccountNo = AR303010content[0].PaymentMethodSelection.CardAccountNo.Value;

然后,在创建销售订单时,只需指定要使用的卡即可由AR301000在创建过程之后输入:

Then when you create the sales order, you just need to specify which card to be used, as returned by AR301000 after the creation process:

         //add payment
         new Value { Value = "VISATOK", LinkedCommand = SO301000.PaymentSettings.PaymentMethod },
         new Value { Value = cardAccountNo, LinkedCommand = SO301000.PaymentSettings.CardAccountNoCardAccountNo }, //Use card account number returned earlier, like "VISATOK:****-****-****-1111"

这篇关于如何通过Acumatica API使用付款设置创建销售订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆