0

I am developing a accounting third party C# form application for my company which bulk load the payments from external source, for prototype, I using an excel file for actual payment data.

Now that I have IRecievePaymenttoDeposit, I get all unpaid invoices with customer refs and by IInvoiceQuery I can get customers, but what is the reference keys for these two queries?

I will be getting a customer name, customer id and invoice no, how can I add the amount to the selected payment.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Aunn Raza
  • 468
  • 2
  • 12

1 Answers1

0

In order to apply a payment to an invoice, you need the TxnID of the invoice, which is different than the invoice number. You can use the invoice number, however to query for the invoice to get the TxnID.

IInvoiceQuery invQuery = MsgRequest.AppendInvoiceQueryRq();
invQuery.ORInvoiceQuery.InvoiceFilter.ORRefNumberFilter.RefNumberFilter.RefNumber.SetValue(invoiceNumber);

// Use either the full name of the customer or the ListID invQuery.ORInvoiceQuery.InvoiceFilter.EntityFilter.OREntityFilter.FullNameList.Add(customerName); invQuery.ORInvoiceQuery.InvoiceFilter.EntityFilter.OREntityFilter.ListIDList.Add(customerid);

Once you have the invoice, you get can get the TxnID. Then, when you create your ReceivePaymentAdd you specify the TxnID to apply the payment to:

// Create the payment add request
IReceivePaymentAdd pmtAdd = MsgRequest.AppendReceivePaymentAddRq();

// Create the AppliedToTxn request for the payment. IAppliedToTxnAdd appAdd = pmtAdd.ORApplyPayment.AppliedToTxnAddList.Append();

// Set the invoice TxnID and amount of the payment to apply appAdd.TxnID.SetValue(invoiceTxnID); appAdd.PaymentAmount.SetValue(amountToApply);

Hpjchobbes
  • 1,309
  • 1
  • 8
  • 11
  • I would also like to ask that if i am bulk receiving payments loading in the iterator give in qbfc, and if one txnid has an invalid ref the entire transaction will fail or it will return me the failed transaction error only in the response set? – Aunn Raza Jan 20 '14 at 23:20
  • I'm not totally sure how it handles it, and it may be based on if you set your IMsgSetRequest.Attributes to continue or stop on errors. The response code you get back would probably be a non-zero value to indicate there is a problem. Each of your requests are processed in the order that you added them, so it should be easy to determine which one is failing. You might get more information if you post this as a separate question. – Hpjchobbes Jan 21 '14 at 05:47