Skip to main content

Add clearing record to invoice (by invoice UID)

POST 

/invoices-by-uid/{invoiceUid}/clearingrecords

Adds a clearing record (payment, interest, or reminder) to the invoice's clearing. The invoice is identified by invoice UID. Invoice clearing is created when invoice status is approved and payment status is 'open'. Not allowed for netting members or collection members. Supplier invoices with payment status 'on-hold' do not have clearing; clearing is created when approved for payment.

When totalUnpaid becomes 0 after this record, invoice payment status is set to closed. For CUSTOMER_INVOICE with POSTPAID/PREPAID, payment may be applied to billing balance automatically.

Audit event:

  • invoice.by.uid.clearing.record.add

Privilege (one of; checked against invoice class):

  • finance-invoices.manage
  • finance-cust-invoices.manage
  • finance-supplier-invoices.manage
  • finance-netting-invoices.manage

clearingTypeId:

  • 1 - Invoice (auto-generated)
  • 2 - Payment (paidAmount required)
  • 3 - Interest (amountIncrement required)
  • 4 - Reminder (amountIncrement required)

paymentTypeId:

  • 1 - Bank Transfer (bankAccountId required or 0 for default)
  • 2 - Credit Card
  • 3 - Paypal
  • 4 - Cash

Errors:

  • INVOICE_NOTFOUND - Invoice not found
  • NETTING_MEMBER_COLLECTION_LEAD_CHANGE_NOT_ALLOWED - Can not manage clearing records for netting invoice member
  • COLLECTION_MEMBER_CLEARING_RECORD_NOT_ALLOWED - Invoice is collection member.Collection members ar not allowed to have clearing records
  • INVOICE_CLEARING_NOTFOUND - Invoice clearing not found
  • CREDIT_RECORD_NOTFOUND - Credit record not found
  • PAYMENT_TRANSFER_FAILED - Payment transfer to billing failed
  • BILLING_RECORD_NOTFOUND - Billing record not found
  • INVOICE_CLEARING_RECORD_NOTFOUND - Invoice clearing record not found
  • TOO_MANY_RECORDS_FOR_INV_UID - There are multiple invoices for the given invoice UID
  • NOT_AUTHORIZED - Not authorized
  • NOT_AUTHENTICATED - Not authenticated
  • INT_APP_ERROR - Unexpected internal error

Error items:

  • invalid value - clearingTypeId can not be nil
  • invalid value - clearingTypeId can not be 1
  • invalid value - clearingTypeId must be in (2,3,4)
  • invalid value - recordDate can not be nil
  • invalid value - RecordDate date invalid
  • invalid value - paymentTypeID can not be nil
  • PAYMENT_TYPE_NOT_FOUND - Payment type not found
  • invalid value - amountIncrement must not be empty or 0 for clearingTypeId 3 or 4
  • invalid value - paidAmount must not be empty less than 0 for clearingTypeId 2 or 5
  • payment overflow - maximum paidAmount can be <totalUnpaid>
  • invalid value - bank account id not provided
  • invalid value - bank account with given id not found
  • invalid value - bank account currency and invoice currency do not match
  • BANK_ACC_NOT_ALLOWED_FOR_PAYMENT_TYPE - Bank acc not allowed for payment type: 'paymentTypeName'

Request

Responses

Clearing record added; returns the created record