SaveSundryReceiptPaymentsGetBackTransactionIDs - accountsIQ/API-Wiki GitHub Wiki

The SaveSundryReceiptPaymentsGetBackTransactionIDs function creates a sundry receipt or payment in an Entity for the indicated bank. It will creates a movement between the bank and the specified GL account.

It is possible to send both receipts and payments at the same time. The value of the transaction is what is going to decide whether the transaction is a sundry receipt or a sundry payment.

Declaration

C#

public WSResultStatus[] SaveSundryReceiptPaymentsGetBackTransactionIDs(String token, WSSundryReceiptPayment[] entries, out int[] transactionIDs)

Parameter List

Parameter Type Description
token String The session token retrieved during authentication.
entries WSSundryReceiptPayment[] The sundry payments/receipt to create.
transactionIDs int[] The unique IDs of the transactions that were created to represent the given sundry receipts and payments

Description

The SaveSundryReceiptPaymentsGetBackTransactionIDs method will create a set of new sunrdry receipts (BR) or sundry payments (BP).

The operation returns an array of WSResultStatus objects. Some sundries may be created while others may not, this is not an all or nothing operation.

When the operation is successful for a given sundry, the Status property is Success or Created. The unique ID of the matching transaction will be at the same index than that of its incoming parameter in the transactionIDs array.

When the operation is unsuccessful for a given sundry, the ErrorCode property holds the precise error that happened. In this case, the value in the transactionIDs array will contain a non-sensical value that must not be used.

Example

C#

Integration ws = new Integration();

String auth = ws.Login(entityID, partnerKey, userKey);
if (auth != null)
{
  var entries = new WSSundryReceiptPayment[3];
  for (int i = 1; i <= 3; ++i) 
  {
      entries[i - 1] = new WSSundryReceiptPayment()
      {
          BankAccountCode = "6010",
          Description = "Sundry " + i.ToString(),
          ExchangeRate = 0.5M,
          ExternalReference = "Reference " + i.ToString(),
          GLAccountCode = "1000",
          TaxAmount = 21M,
          TaxID = "V01",
          TaxRate = 0.21M,
          TransactionDate = DateTime.Now,
          Value = (i % 2 == 1 ? 1 : -1) * 100M
      };
  }
  
  int[] tids;
  var result = ws.SaveSundryReceiptPaymentsGetBackTransactionIDs(auth, entries, out tids);
  Assert.AreEqual(result.Result[0].Status == OperationStatus.Created);
  Assert.AreEqual(result.Result[1].Status == OperationStatus.Created);
  Assert.AreEqual(result.Result[2].Status == OperationStatus.Created);

  var trRes = ws.GetTransaction(auth, tids[0]);
  Assert.AreEqual(3, trRes.Result.Lines.Length );
  Assert.AreEqual("BR", trRes.Result.Lines.Where(x => x.GLAccountCode == "6010").First().TransactionLineType);
  Assert.AreEqual(121M, trRes.Result.Lines.Where(x => x.GLAccountCode == "6010").First().Amount);
  Assert.AreEqual(-100M, trRes.Result.Lines.Where(x => x.GLAccountCode == "1000").First().Amount);
}

See Also

⚠️ **GitHub.com Fallback** ⚠️