Fluent builder for creating and saving an InvoicePayment. Set the payment's properties by chaining calls, add one or more invoices with the amount applied to each, then call build() to create and save the InvoicePayment and link it to those invoices. A payment must be linked to exactly one of a PaymentTransaction or a PointsDebit, never both. Obtained from PaymentManager.newInvoicePaymentBuilder().
Group: Builders
Methods
build()
Returns: InvoicePayment
Creates and saves the InvoicePayment using the options set on this builder, and links it to each invoice added via addInvoice.
addInvoice(Invoice invoice, BigDecimal amount)
Returns: InvoicePaymentBuilder
Adds an invoice to be linked to the payment being built, along with the amount applied to it.
| Parameter | Description |
|---|---|
invoice | the invoice to link the payment to |
amount | the amount of the payment applied to this invoice |
paymentDate(Date pd)
Returns: InvoicePaymentBuilder
Sets the date the payment was made. Defaults to null if not set.
| Parameter | Description |
|---|---|
pd | the payment date |
createdDate(Date pd)
Returns: InvoicePaymentBuilder
Sets the created date recorded on the payment. Defaults to the current date if not set.
| Parameter | Description |
|---|---|
pd | the created date |
createdBy(Profile pd)
Returns: InvoicePaymentBuilder
Sets the profile the payment is recorded as created by. Defaults to the current user if not set.
| Parameter | Description |
|---|---|
pd | the profile the payment is created by |
paymentAmount(BigDecimal pd)
Returns: InvoicePaymentBuilder
Sets the total amount of the payment.
| Parameter | Description |
|---|---|
pd | the payment amount |
paymentTransaction(PaymentTransaction pd)
Returns: InvoicePaymentBuilder
Sets the payment transaction the payment is recorded against. Cannot be combined with a points debit.
| Parameter | Description |
|---|---|
pd | the payment transaction the payment is for |
pointsDebit(PointsDebit pd)
Returns: InvoicePaymentBuilder
Sets the points debit the payment is recorded against. Cannot be combined with a payment transaction.
| Parameter | Description |
|---|---|
pd | the points debit the payment is for |