【问题标题】:Create Non-posting (Unapproved payment) record by SOAP API in NetSuite在 NetSuite 中通过 SOAP API 创建非过帐(未批准的付款)记录
【发布时间】:2021-04-23 05:47:58
【问题描述】:

当 Braintree 交易因 SOAP API 失败时,我正在尝试在 Netsuite 中创建未经批准的付款记录。我通过 API 传递了帐户内部 ID(未经批准的客户付款)。但是 API 返回的内部 ID 是无效的,即使它显示在科目表列表下。

帮助通过 SOAP API 在 Netsuite 中创建此非过帐类型的付款记录。我在这里附上了一些截图供参考。

public async Task<WriteResponse> updateInvoiceTranscation(Invoice invoiceRecord, Braintree.Transaction transaction)
        {
            bool isTransactionSuccess = BraintreeService.IsTransactionSuccess(transaction.Status);
            WriteResponse customerPaymentResult = null;
            InitializeRecord initRec = new InitializeRecord();
            initRec.type = InitializeType.customerPayment;
            InitializeRef initRef = new InitializeRef();
            initRef.typeSpecified = true;
            initRef.type = InitializeRefType.invoice;
            initRef.internalId = invoiceRecord.internalId;
            initRec.reference = initRef;

            this.SecureAuthService();
            initializeResponse response = await SuiteTalkClient.initializeAsync(null, CreateTokenPassport(), null, null, null, initRec);
            ReadResponse result = response.readResponse;

            if (result.status.isSuccess)
            {
                Record rec = result.record;
                CustomerPayment customerPayment = (CustomerPayment)rec;
                CustomerPaymentApply scustomerPayment = customerPayment.applyList.apply.Single(r => r.doc == long.Parse(invoiceRecord.internalId));
                customerPayment.totalSpecified = false;
                customerPayment.appliedSpecified = false;
                customerPayment.unappliedSpecified = false;
                customerPayment.balanceSpecified = false;
                customerPayment.pendingSpecified = false;                

                if (!isTransactionSuccess)
                {

                    RecordRef acccountRef = new RecordRef();
                    acccountRef.type = RecordType.account;
                    acccountRef.internalId = ((int)NetSuiteInternalIdEnum.UnApprovedPayment).ToString();
                    acccountRef.typeSpecified = true;
                    customerPayment.account = acccountRef;
                    customerPayment.undepFunds = false;
                    
                } else
                {
                    //acccountRef.internalId = ((int)NetSuiteInternalIdEnum.UndepositAccount).ToString();
                    customerPayment.undepFunds = true;
                }
                customerPayment.undepFundsSpecified = true;   

                
                scustomerPayment.totalSpecified = false;
                scustomerPayment.dueSpecified = false;
                scustomerPayment.discSpecified = false;

                scustomerPayment.amount = invoiceRecord.total;
                scustomerPayment.amountSpecified = true;            

                List<CustomFieldRef> paymentCustomFields = new List<CustomFieldRef>();
                StringCustomFieldRef custbodyBraintreeId = new StringCustomFieldRef();
                custbodyBraintreeId.scriptId = Enum.GetName(typeof(CustomScriptIdEnum), CustomScriptIdEnum.custbody_braintree_id);
                custbodyBraintreeId.value = transaction.Id;
                paymentCustomFields.Add(custbodyBraintreeId);

                BooleanCustomFieldRef custbodyBraintreeCharged = new BooleanCustomFieldRef();
                custbodyBraintreeCharged.scriptId = Enum.GetName(typeof(CustomScriptIdEnum), CustomScriptIdEnum.custbody_braintree_charged);
                custbodyBraintreeCharged.value = true;
                paymentCustomFields.Add(custbodyBraintreeCharged);
                customerPayment.customFieldList = paymentCustomFields.ToArray();

                if (!isTransactionSuccess)
                {
                    BooleanCustomFieldRef custbodyOrderOnHold = new BooleanCustomFieldRef();
                    custbodyOrderOnHold.scriptId = Enum.GetName(typeof(CustomScriptIdEnum), CustomScriptIdEnum.custbody_order_on_hold);
                    custbodyOrderOnHold.value = true;
                    paymentCustomFields.Add(custbodyOrderOnHold);

                }

                this.SecureAuthService();
                addResponse customerPaymentResponse = await SuiteTalkClient.addAsync(null, CreateTokenPassport(), null, null, null, customerPayment);
                customerPaymentResult = customerPaymentResponse.writeResponse;
            }
            return customerPaymentResult;
        }

【问题讨论】:

    标签: api soap netsuite


    【解决方案1】:

    你应该发送一个recordRef而不是一个裸ID。你是?要确保的另一件事是您将 undepFunds 设置为 false。

    【讨论】:

    • 感谢您的回复,您能否提供一个创建付款记录失败的 RecordRef 的示例代码。
    • 很抱歉最近通知你,其实我只是作为 RecordRef 发送的,虽然它会返回同样的问题。
    • 您可以发布您用于创建付款的整个代码吗?
    • 您好,我已经发布了我的代码,请您现在查看并告诉我您的想法。
    • 你有机会看到这个吗?
    猜你喜欢
    • 2013-05-26
    • 1970-01-01
    • 1970-01-01
    • 2016-07-05
    • 1970-01-01
    • 2021-07-14
    • 2021-10-11
    • 2014-04-05
    • 2020-12-05
    相关资源
    最近更新 更多