2014-10-31 81 views
1

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

以下是我用来创建我的销售订单的代码。我不确定要通过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 
       } 
     ); 

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

+0

您能否提供示例源代码来显示您正在做什么,以及详细描述您遇到的错误? – Gabriel 2014-10-31 01:21:17

+0

我已编辑我的帖子以包含当前的代码以创建新的销售订单。我并没有真正遇到错误,因为我不确定添加卡并通过Authorize.NET插件连接它的步骤。 – 2014-10-31 03:44:16

+0

Thx,我正在努力:) – Gabriel 2014-10-31 15:34:03

回答

2

您不能使用“创建新的付款配置文件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" 
+0

谢谢加布里埃尔。那正是我所期待的。 – 2014-10-31 17:36:08

+0

我快到了。我能够创建客户付款记录,但是当我尝试将新创建的卡插入现有销售订单时,出现错误,表明卡/帐户号不能为空。我会将我的代码插入我的原始问题中。 – 2014-11-20 15:22:01

0

下面是示例演示如何设置在销售订单卡号通过基于屏幕的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的设置每一个选择。

相关问题