如何通过Acumatica API创建带有付款设置的销售订单

如何通过Acumatica API创建带有付款设置的销售订单,acumatica,Acumatica,我正在尝试使用Acumatica Web服务API创建销售订单。我已经能够通过除支付设置以外的所有必填字段。我们的安装使用Authorize.NET(PX.CCProcessing.AuthorizeNetTokenizedProcessing)加载项。是否可以通过API与Authorize.NET加载项交互,方法是创建新的付款方式并授权付款,以便员工可以在Acumatica内处理订单并在那里捕获付款 下面是我用来创建销售订单的代码。我不确定通过API本身激活“创建新支付配置文件ID”操作所使用

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

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


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

您不能使用“创建新的支付配置文件ID”,因为它依赖于web浏览器中的实际用户(我们只是在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"

下面是如何通过基于屏幕的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属性的每个选择器都是必需的。

您能否提供示例源代码来说明您正在执行的操作,以及详细说明您遇到的错误?我已编辑了我的帖子,以包含创建新销售订单的当前代码。我还没有真正收到错误,因为我不确定添加卡和通过Authorize.NET addin.Thx连接卡的步骤,我正在处理:)Josh:我遇到了类似的问题。你在你的案子里做了什么?谢谢加布里埃尔。这正是我想要的,我就快到了。我能够创建客户付款记录,但当我尝试将新创建的卡插入现有销售订单时,我收到一个错误,指示卡/账号不能为空。我将在我的原始问题中插入我的代码。这在过去对我来说非常有效,但是,从2017 R2开始,我得到一个错误:“Value”不能为空。通过正常的用户界面,我也会遇到这个错误,但是再次按save也可以。有什么想法或建议吗?谢谢Collin@CollinAnderson最好在Acumatica支持门户中报告。如果UI行为发生了变化,那么它将影响web服务。。。您可能可以忽略此异常并使用Save命令再次调用submit,但这不是很干净。我认为当选中
Allow Direct Input
时,此代码可以工作,但现在在较新版本的Acumatica中,
Allow Direct Input
已被删除,我又返回到获取
错误:“Value”不能为空。
有人看到过此代码的任何更新吗?
         //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"
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);