Class Invoice
The Invoice can be a debit or credit invoice, and is created
from custom scripts using one of the methods
ShippingOrder.createInvoice(String) ,
Appeasement.createInvoice(String) ,
ReturnCase.createInvoice(String) or
Return.createInvoice(String) .
Order post-processing APIs (gillian) are now inactive by default and will throw
an exception if accessed. Activation needs preliminary approval by Product Management.
Please contact support in this case. Existing customers using these APIs are not
affected by this change and can use the APIs until further notice.
Constant Summary
Property Summary
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
Method Description account () The invoice will be accounted.
addCaptureTransaction (OrderPaymentInstrument , Money )Calling this method registers an amount captured for a given order payment instrument. addRefundTransaction (OrderPaymentInstrument , Money )Calling this method registers an amount refunded for a given order payment instrument. getCapturedAmount ()Returns the sum of the captured amounts. getInvoiceNumber ()Returns the invoice number. getItems ()Access the collection of InvoiceItem s. getPaymentTransactions ()Returns the payment transactions belonging to this Invoice. getRefundedAmount ()Returns the sum of the refunded amounts. getStatus ()Returns the invoice status. The possible values are STATUS_NOT_PAID , STATUS_MANUAL , STATUS_PAID , STATUS_FAILED . getType ()Returns the invoice type. The possible values are TYPE_SHIPPING , TYPE_RETURN , TYPE_RETURN_CASE , TYPE_APPEASEMENT . setStatus (String )Sets the invoice status. The possible values are STATUS_NOT_PAID , STATUS_MANUAL , STATUS_PAID , STATUS_FAILED .
Methods inherited from class AbstractItemCtnr
getCreatedBy , getCreationDate , getGrandTotal , getItems , getLastModified , getModifiedBy , getOrder , getProductSubtotal , getServiceSubtotal
Methods inherited from class Extensible
describe , getCustom
Methods inherited from class Object
assign , create , create , defineProperties , defineProperty , entries , freeze , fromEntries , getOwnPropertyDescriptor , getOwnPropertyNames , getOwnPropertySymbols , getPrototypeOf , hasOwnProperty , is , isExtensible , isFrozen , isPrototypeOf , isSealed , keys , preventExtensions , propertyIsEnumerable , seal , setPrototypeOf , toLocaleString , toString , valueOf , values
Constant Details
ORDERBY_CREATION_DATE
ORDERBY_CREATION_DATE: Object
Sorting by creation date. Use with method getPaymentTransactions() as an argument to
method FilteringCollection.sort(Object) .
ORDERBY_ITEMID
ORDERBY_ITEMID: Object
Sorting by item id. Use with method getItems() as an argument to
method FilteringCollection.sort(Object) .
ORDERBY_ITEMPOSITION
ORDERBY_ITEMPOSITION: Object
Sorting by the position of the related oder item. Use with method
getItems() as an argument to method
FilteringCollection.sort(Object) .
ORDERBY_REVERSE
ORDERBY_REVERSE: Object
Reverse orders. Use as an argument
to method FilteringCollection.sort(Object) .
ORDERBY_UNSORTED
ORDERBY_UNSORTED: Object
Unsorted , as it is. Use with method getItems() as an argument
to method FilteringCollection.sort(Object) .
QUALIFIER_CAPTURE
QUALIFIER_CAPTURE: Object
Selects the capture transactions. Use with method getPaymentTransactions() as an
argument to method FilteringCollection.select(Object) .
QUALIFIER_PRODUCTITEMS
QUALIFIER_PRODUCTITEMS: Object
Selects the product items. Use with method getItems() as an
argument to method FilteringCollection.select(Object) .
QUALIFIER_REFUND
QUALIFIER_REFUND: Object
Selects the refund transactions. Use with method getPaymentTransactions() as an
argument to method FilteringCollection.select(Object) .
QUALIFIER_SERVICEITEMS
QUALIFIER_SERVICEITEMS: Object
Selects for the service items. Use with method getItems() as an
argument to method FilteringCollection.select(Object) .
STATUS_FAILED
STATUS_FAILED: String = "FAILED"
Constant for Invoice Status Failed.
The invoice handling failed.
STATUS_MANUAL
STATUS_MANUAL: String = "MANUAL"
Constant for Invoice Status Manual.
The invoice is not paid but will not be handled automatically.
A manual invoice handling (capture or refund) is necessary.
STATUS_NOT_PAID
STATUS_NOT_PAID: String = "NOT_PAID"
Constant for Invoice Status Not Paid.
The invoice is not paid and will be handled automatically.
STATUS_PAID
STATUS_PAID: String = "PAID"
Constant for Invoice Status Paid.
The invoice was successfully paid.
TYPE_APPEASEMENT
TYPE_APPEASEMENT: String = "APPEASEMENT"
Constant for Invoice Type Appeasement.
The invoice was created for an appeasement.
The invoice amount needs to be refunded.
TYPE_RETURN
TYPE_RETURN: String = "RETURN"
Constant for Invoice Type Return.
The invoice was created for a return.
The invoice amount needs to be refunded.
TYPE_RETURN_CASE
TYPE_RETURN_CASE: String = "RETURN_CASE"
Constant for Invoice Type Return Case.
The invoice was created for a return case.
The invoice amount needs to be refunded.
TYPE_SHIPPING
TYPE_SHIPPING: String = "SHIPPING"
Constant for Invoice Type Shipping.
The invoice was created for a shipping order.
The invoice amount needs to be captured.
Property Details
capturedAmount
capturedAmount: Money (read-only)
Returns the sum of the captured amounts. The captured amounts are
calculated on the fly.
Associate a payment capture for a OrderPaymentInstrument
with an Invoice using
addCaptureTransaction(OrderPaymentInstrument, Money) .
invoiceNumber
invoiceNumber: String (read-only)
Returns the invoice number.
items
items: FilteringCollection (read-only)
Access the collection of InvoiceItem s.
This FilteringCollection can be sorted / filtered using:
paymentTransactions
paymentTransactions: FilteringCollection (read-only)
Returns the payment transactions belonging to this Invoice.
This FilteringCollection can be sorted / filtered using:
See Also:
refundedAmount
refundedAmount: Money (read-only)
Returns the sum of the refunded amounts. The refunded amounts are
calculated on the fly.
Associate a payment capture for a OrderPaymentInstrument
with an Invoice using
addRefundTransaction(OrderPaymentInstrument, Money) .
status
status: EnumValue
Returns the invoice status.
The possible values are STATUS_NOT_PAID , STATUS_MANUAL ,
STATUS_PAID , STATUS_FAILED .
type
type: EnumValue (read-only)
Returns the invoice type.
The possible values are TYPE_SHIPPING , TYPE_RETURN ,
TYPE_RETURN_CASE , TYPE_APPEASEMENT .
Method Details
account()
account(): Boolean
The invoice will be accounted.
It will be captured in case of a shipping invoice and it will be refunded in
case of an appeasement, return case or return invoice.
The accounting will be handled in the payment hooks
PaymentHooks.capture(Invoice) or
PaymentHooks.refund(Invoice) . The implementing script could add
payment transactions to the invoice. The accompanying business logic will
set the status to PAID or FAILED.
The accounting will fail when the invoice state is different to
STATUS_NOT_PAID or STATUS_FAILED .
The method implements its own transaction handling. The method must not
be called inside a transaction.
Returns:
true when the accounting was successful, otherwise
false.
addCaptureTransaction(OrderPaymentInstrument, Money)
addCaptureTransaction(instrument: OrderPaymentInstrument , capturedAmount: Money ): PaymentTransaction
Calling this method registers an amount captured for a given
order payment instrument. The authorization for the
capture is associated with the payment transaction belonging to the
instrument. Calling this method allows the Invoice, the
OrderPaymentInstrument and the Order to
return their captured amount as a sum calculated on the fly. The method
may be called multiple times for the same instrument (multiple capture
for one authorization) or for different instruments (invoice settlement
using multiple payments).
Parameters:
instrument - the order payment instrument
capturedAmount - amount to register as captured
Returns:
the created capture transaction
addRefundTransaction(OrderPaymentInstrument, Money)
addRefundTransaction(instrument: OrderPaymentInstrument , refundedAmount: Money ): PaymentTransaction
Calling this method registers an amount refunded for a given
order payment instrument. Calling this method allows the
Invoice, the OrderPaymentInstrument and
the Order to return their refunded amount as a sum
calculated on the fly. The method may be called multiple times for the
same instrument (multiple refunds of one payment) or for different
instruments (invoice settlement using multiple payments).
Parameters:
instrument - the order payment instrument
refundedAmount - amount to register as refunded
Returns:
the created refund transaction
getCapturedAmount()
getCapturedAmount(): Money
Returns the sum of the captured amounts. The captured amounts are
calculated on the fly.
Associate a payment capture for a OrderPaymentInstrument
with an Invoice using
addCaptureTransaction(OrderPaymentInstrument, Money) .
Returns:
getInvoiceNumber()
getInvoiceNumber(): String
Returns the invoice number.
Returns:
getItems()
getItems(): FilteringCollection
Access the collection of InvoiceItem s.
This FilteringCollection can be sorted / filtered using:
Returns:
getPaymentTransactions()
getPaymentTransactions(): FilteringCollection
Returns the payment transactions belonging to this Invoice.
This FilteringCollection can be sorted / filtered using:
Returns:
the payment transactions.
See Also:
getRefundedAmount()
getRefundedAmount(): Money
Returns the sum of the refunded amounts. The refunded amounts are
calculated on the fly.
Associate a payment capture for a OrderPaymentInstrument
with an Invoice using
addRefundTransaction(OrderPaymentInstrument, Money) .
Returns:
getStatus()
getStatus(): EnumValue
Returns the invoice status.
The possible values are STATUS_NOT_PAID , STATUS_MANUAL ,
STATUS_PAID , STATUS_FAILED .
Returns:
getType()
getType(): EnumValue
Returns the invoice type.
The possible values are TYPE_SHIPPING , TYPE_RETURN ,
TYPE_RETURN_CASE , TYPE_APPEASEMENT .
Returns:
setStatus(String)
setStatus(status: String ): void
Sets the invoice status.
The possible values are STATUS_NOT_PAID , STATUS_MANUAL ,
STATUS_PAID , STATUS_FAILED .
Parameters:
status - the invoice status to set