【问题标题】:How Do I Create a Sales Order with Payment Settings through Acumatica API如何通过 Acumatica API 创建带有付款设置的销售订单
【发布时间】:2014-10-31 00:09:12
【问题描述】:

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

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


        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
            }
        );

新代码错误 - 我现在可以插入客户付款记录,但在尝试将该卡插入现有销售订单时收到错误消息。

这是我的代码:

        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
                }
        );

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

【问题讨论】:

  • 您能否提供示例源代码来说明您在做什么,并详细说明您遇到的错误?
  • 我已编辑我的帖子以包含我当前用于创建新销售订单的代码。我还没有真正收到错误,因为我不确定添加卡和通过 Authorize.NET 插件连接它的步骤。
  • 谢谢,我正在努力:)
  • Josh:我遇到了类似的问题。在你的案子中你最终做了什么?

标签: acumatica


【解决方案1】:

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

很遗憾,您不能将客户资料 ID 直接传递给订单,只能接受付款资料值作为输入,因此您首先需要使用客户付款方式屏幕 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返回:

         //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"

【讨论】:

  • 谢谢加布里埃尔。这正是我想要的。
  • 我快到了。我能够创建客户付款记录,但是当我尝试将新创建的卡插入现有销售订单时,我收到一个错误,表明卡/帐户号不能为空。我会将我的代码插入到我原来的问题中。
  • 这在过去对我来说非常有效,但是,从 2017 R2 开始,我收到一个错误:“值”不能为空。通过正常的用户界面,我也收到此错误,但再次按保存就可以了。有什么想法或建议吗?谢谢,科林
  • @CollinAnderson 最好在 Acumatica 支持门户中报告这一点。如果 UI 行为发生变化,那么它将影响 Web 服务……您可能会忽略异常并使用 Save 命令再次调用 submit,但这不是很干净。
  • 我认为此代码在选中 Allow Direct Input 时有效,但现在 Allow Direct Input 已在较新版本的 Acumatica 中删除,我又回到了 Error: 'Value' cannot be empty. 有没有人看到任何更新到这个代码?
【解决方案2】:

以下示例展示了如何通过基于屏幕的 API 在销售订单中设置卡号:

Content orderSchema = context.GetSchema();

orderSchema.PaymentSettings.CardAccountNo.FieldName += "!Descr";

var commands = new Command[]
{
   new Value
   {
       Value = "SO",
       LinkedCommand = orderSchema.OrderSummary.OrderType,
       Commit = true
   },
   orderSchema.Actions.Insert,

   new Value
   {
       Value = "ABARTENDE",
       LinkedCommand = orderSchema.OrderSummary.Customer,
       Commit = true
   },

   new Value
   {
       Value = "VISA",
       LinkedCommand = orderSchema.PaymentSettings.PaymentMethod
   },
   new Value
   {
       Value = "VISA:****-****-****-7630",
       LinkedCommand = orderSchema.PaymentSettings.CardAccountNo,
       Commit = true
   },    

   orderSchema.Actions.Save
};
context.Submit(commands);

对于在 Aspx 中设置了 TextField 属性的每个选择器都需要此模式。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 2022-06-15
    • 2014-12-13
    • 2020-06-15
    • 2017-08-03
    • 1970-01-01
    相关资源
    最近更新 更多