In Core Commerce, you can use the CommerceItemManager (class atg.commerce.order.CommerceItemManager) to manage the return of items in an Order. Call CommerceItemManager.returnCommerceItem() to mark a given CommerceItem as returned. This method does the following:
Reduces the
quantityproperty in theCommerceItemby the quantity returned.Reduces the
quantityproperty in theShippingGroupCommerceItemRelationshipby the quantity returned.Increases the
returnedQuantityproperty in theShippingGroupCommerceItemRelationshipby the quantity returned.
After the item is returned, the quantity of the CommerceItem reflects the final quantity that was purchased. The quantity property of the ShippingGroupCommerceItemRelationship reflects the quantity that was shipped, and its returnedQuantity reflects that quantity of the CommerceItem that was returned.
The store credit system in Core Commerce can also manage the return of items. The Claimable Repository contains a storeCreditClaimable item that includes the following properties:
amount(double) – the original amount of the creditamountAuthorized(double) – the amount of credit authorized for useamountRemaining(double) – the current amount of the store creditownerId(String) – the ID of the user or organization for which the credit was issuedlastUsed(date) – the date the credit was last accessed
To modify an existing store credit account (for example, to increase the amount of remaining credit), call the ClaimableManager.updateClaimableStoreCredit method. To create a new store credit account for a user or organization, call the ClaimableManager.createClaimableStoreCredit method (atg.commerce.claimable.ClaimableManager) to create the new store credit and then call the ClaimableManager.initializeClaimableStoreCredit method to set its initial values.
Note that only one store credit account can exist for a given user or organization.
For more information on the Claimable Repository, including gift certificates, see the Configuring Core Commerce Services chapter.

