【问题标题】:Issue creating or retrieving Customer Payment Method with Acumatica Rest API使用 Acumatica Rest API 创建或检索客户付款方式的问题
【发布时间】:2021-02-17 10:20:04
【问题描述】:

更新:--- 提供的代码修复了图表上阻止 API 允许我创建的问题。

public class CustomerPaymentMethodMaint_Extension:PXGraphExtension<CustomerPaymentMethodMaint>
{

    #region Event Handlers

    protected virtual void CustomerPaymentMethodDetail_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
    {
        if (del != null)
        {
            del(cache, e);
        }
        if (Base.IsContractBasedAPI)
        {
            CustomerPaymentMethodDetail row = (CustomerPaymentMethodDetail)e.Row;
            PXDefaultAttribute.SetPersistingCheck<CustomerPaymentMethodDetail.value>(cache, row, PXPersistingCheck.Nothing);
        }
    }

    #endregion

}

在我的一生中,我无法弄清楚 Acumatica 期望我向它发送什么以使用 Rest API 检索或创建客户付款方式。如果您能指出正确的方向,将不胜感激。我们给出的例子非常基础,似乎没有涵盖任何这样的场景。

我假设它将使用帮助部分中描述的标准“按关键字段检索记录”来检索。

我已尝试使用以下所有 url 结构,但它要么给我一个“由于对象的当前状态,操作不被重视”错误,要么是“多个实体满足条件”。

/entity/Default/6.00.001/CustomerPaymentMethod/{BAccountID}/{PMInstanceID}
/entity/Default/6.00.001/CustomerPaymentMethod/{AcctCD}/{PMInstanceID}
/entity/Default/6.00.001/CustomerPaymentMethod/{BAccountID}
/entity/Default/6.00.001/CustomerPaymentMethod/{PMInstanceID}
/entity/Default/6.00.001/CustomerPaymentMethod/{AcctCD}

在尝试创建付款方式时,我尝试使用带有以下 json 正文的 CustomerPaymentMethod 端点的“PUT”(我还尝试使用这些字段的肥皂友好名称而不是 UI“CCDNUM”中的标签, “CVV”、“EXPDATE”、“NAMEONCC”)。返回给我的错误是“值”不能为空。

{
    "CustomerID" : { value: "0000467" },
    "PaymentMethod" : { value: "CC" },
    "CustomerPaymentMethodDetail" : [
        {
            "Description" : { value : "Card Number" },
            "Value" : { value : "4111111111111111" },
        },
        {
            "Description" : { value : "Expiration Date" },
            "Value" : { value : "102020" },
        },
        {
            "Description" : { value : "Name on the Card" },
            "Value" : { value : "Test API" },
        }
    ]
}

【问题讨论】:

  • 您好 Chris,您如何使用 RestAPI 解决此问题?我收到同样的错误“PX.Data.PXException:错误:‘值’不能为空。”请指导我解决这个问题。快速帮助将不胜感激。提前谢谢你。
  • 克里斯,如果您从 Acumatica 得到答案而不是提出问题,您应该回答自己的问题并接受答案。

标签: acumatica


【解决方案1】:

以下内容适用于我使用 APS(美国支付解决方案)作为处理中心的项目。

使用GET 检索特定客户的客户付款方式集合:

/entity/Default/6.00.001/CustomerPaymentMethod/?$filter=CustomerID+eq+'000000'

使用 GET 按 ID 返回单个客户付款方式:(您可以从上述调用返回的记录中找到 ID。)

/entity/Default/6.00.001/CustomerPaymentMethod/guid-from-record?$expand=Details

我认为不可能使用带有 Acumatica API 的全新卡创建客户付款方式。我认为您首先必须使用处理中心的 API 创建付款记录。 (在我的情况下是 APS,但我假设 Authorize.net 以类似的方式工作。)然后,一旦处理器中存在付款记录,您可以使用 PUT 在 Acumatica 中添加客户付款记录以填充付款配置文件 ID ,这是对标记化卡的引用。从那里,您可以使用上面的 GET 调用返回您需要的内容,以便验证/捕获销售订单。

我现在正在处理这个问题,一旦我了解更多信息,我会更新我的评论。

【讨论】:

  • 感谢您的回复。我们没有开启集成处理,所以信用卡实际上存储在我们的系统中,因此使用 3rd 方 api 外出并不适用于我们。我用 Acumatica 开了一张票,他们提供了一个“修复”来解决我遇到的问题。 - 我将它添加到原始问题中
【解决方案2】:

对我来说,以下工作

/entity/Default/{version}/CustomerPaymentMethod/{customerID}/{customerPaymentMethodId}

现在要获取customerPaymentMethodId,这可以在扩展PaymentInstructions 时通过客户端点完成。

不过很遗憾,PaymentInstructions 只返回客户的默认付款方式。

【讨论】:

    猜你喜欢
    • 2014-12-28
    • 1970-01-01
    • 2017-11-20
    • 2014-05-24
    • 2019-11-22
    • 2013-09-03
    • 2015-07-26
    • 1970-01-01
    • 2018-03-05
    相关资源
    最近更新 更多