@RestResource(id="atg.commerce.profile.restresources.CurrentUserCreditCardRestSubresource") public class CurrentUserCreditCardRestSubresource extends CreditCardRestSubresource
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ADDRESS_NICK_NAME |
static java.lang.String |
BILLING_ADDRESS_CLASSNAME |
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
MSG_ADDRESS_WITH_NICK_NAME_NOT_FOUND |
static java.lang.String |
MSG_CREDIT_CARD_NICKNAME_EXISTS |
static java.lang.String |
RESOURCE_NAME |
static java.lang.String |
SET_AS_DEFAULT |
static java.util.ResourceBundle |
sResourceBundle
Resource Bundle
|
static java.lang.String |
USE_EXISTING_ADDRESS |
mProfileTools, MSG_ERR_MATCHING_CREDIT_CARD, MSG_NO_CREDIT_CARD_FOUND, SUBRESOURCE_CONTEXT_MISSING
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
CurrentUserCreditCardRestSubresource() |
Modifier and Type | Method and Description |
---|---|
RepresentationModel |
addCreditCard(org.json.JSONObject pInputJson)
Creates a credit card with the given properties and adds it to the given user profile.
|
protected java.lang.String |
addCreditCardToProfile(RepositoryItem pProfile,
java.util.Map pUpdatesMap,
CommercePropertyManager pCommercePropertyManager)
Create credit card item based on updatesMap and add it to the profile.
|
Response |
deleteCreditCard(java.lang.String pCreditCardId)
Removes a credit card associated to a given profile for a given credit card id.
|
protected java.net.URI |
getCreatedItemURI(java.lang.String pCreditCardNickname)
Build a URI to the newly added/created credit card.
|
protected Link |
getSelfLink(RepositoryItem pProfile,
RepositoryItem pCreditCard)
Build a self link to the credit card.
|
protected void |
removeCreditCardFromProfile(RepositoryItem pProfile,
RepositoryItem pCreditCard)
Method to remove a credit card from the given profile based on the nickname.
|
protected java.lang.Object |
retrieveBillingAddress(java.util.Map pInputJSONMap,
RepositoryItem pProfile,
CommercePropertyManager pCommercePropertyManager)
Get the billingAddress from the input json.
|
RepresentationModel |
updateCreditCard(java.lang.String pCreditCardId,
org.json.JSONObject pInputJson)
Updates a credit card associated with the current user profile.
|
RepresentationModel |
updateCreditCards(org.json.JSONObject pInputJson)
Updates one or more credit cards associated with the given user profile.
|
protected void |
updateProfileCreditCard(RepositoryItem pProfile,
RepositoryItem pCardToUpdate,
java.util.Map pUpdatesMap,
CommercePropertyManager pCommercePropertyManager)
This method updates a credit card associated with the given user profile.
|
buildMemberUris, getCreditCard, getCreditCards, getProfile, getProfileTools, getRepresentationModelBuilder, getRepresentationModelBuilder, setProfileTools
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService, toString
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public static final java.lang.String CLASS_VERSION
public static final java.lang.String MSG_CREDIT_CARD_NICKNAME_EXISTS
public static final java.lang.String MSG_ADDRESS_WITH_NICK_NAME_NOT_FOUND
public static final java.lang.String USE_EXISTING_ADDRESS
public static final java.lang.String SET_AS_DEFAULT
public static final java.lang.String ADDRESS_NICK_NAME
public static final java.lang.String BILLING_ADDRESS_CLASSNAME
public static final java.lang.String RESOURCE_NAME
public static java.util.ResourceBundle sResourceBundle
public CurrentUserCreditCardRestSubresource()
@Endpoint(id="/creditCards/{creditCardId}#DELETE", isSingular=true) public Response deleteCreditCard(java.lang.String pCreditCardId) throws RestException, RepositoryException
pCreditCardId
- the id of the credit card which has to be removed from the profileRestException
- if an error occurs deleting the credit cardRepositoryException
- if an error occurs deleting the credit card@Endpoint(id="/creditCards#POST", validatorId="creditCards.id-Full", filterId="creditCards.id-Default", disableChangeTracking=true) public RepresentationModel addCreditCard(org.json.JSONObject pInputJson) throws RestException, RepositoryException, java.beans.IntrospectionException, PropertyNotFoundException
pInputJson
- JSON representation of the credit card to be addedRestException
- if an error occurs adding the credit cardRepositoryException
- if an error occurs adding the credit cardjava.beans.IntrospectionException
- if an error occurs adding the credit cardPropertyNotFoundException
- if an error occurs adding the credit card@PATCH @Endpoint(id="/creditCards/{creditCardId}#PATCH", isSingular=true, validatorId="creditCards.id-Full", updateTarget=true) public RepresentationModel updateCreditCard(java.lang.String pCreditCardId, org.json.JSONObject pInputJson) throws RestException, RepositoryException
pCreditCardId
- id of credit card to updatepInputJson
- representation of credit card updates to applyRestException
- if an error occurs updating the credit cardRepositoryException
- if an error occurs updating the credit card@PATCH @Endpoint(id="/creditCards#PATCH", filterId="creditCards-Default", validatorId="creditCards-Full", isSingular=false) public RepresentationModel updateCreditCards(org.json.JSONObject pInputJson) throws RestException, java.beans.IntrospectionException, RepositoryException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, PropertyNotFoundException
pInputJson
- JSON representation of the credit cards to be updatedRestException
- if an error occurs updating/adding/deleting a credit cardjava.beans.IntrospectionException
- if an error occurs updating/adding/deleting a credit cardRepositoryException
- if an error occurs updating/adding/deleting a credit cardjava.lang.InstantiationException
- if an error occurs updating/adding/deleting a credit cardjava.lang.IllegalAccessException
- if an error occurs updating/adding/deleting a credit cardjava.lang.ClassNotFoundException
- if an error occurs updating/adding/deleting a credit cardPropertyNotFoundException
- if an error occurs updating/adding/deleting a credit cardprotected void updateProfileCreditCard(RepositoryItem pProfile, RepositoryItem pCardToUpdate, java.util.Map pUpdatesMap, CommercePropertyManager pCommercePropertyManager) throws RestException, RepositoryException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.beans.IntrospectionException
pProfile
- the profile to which credit card is mappedpCardToUpdate
- the credit card item to be updatedpUpdatesMap
- the map containing the properties to be updated for the credit cardpCommercePropertyManager
- the CommercePropertyManager component containing the property namesRestException
- if an error occurs updating a credit cardjava.beans.IntrospectionException
- if an error occurs updating a credit cardRepositoryException
- if an error occurs updating a credit cardjava.lang.InstantiationException
- if an error occurs updating a credit cardjava.lang.IllegalAccessException
- if an error occurs updating a credit cardjava.lang.ClassNotFoundException
- if an error occurs updating a credit cardprotected java.lang.String addCreditCardToProfile(RepositoryItem pProfile, java.util.Map pUpdatesMap, CommercePropertyManager pCommercePropertyManager) throws RestException, RepositoryException, java.beans.IntrospectionException, PropertyNotFoundException
pProfile
- the profile to which credit card will to be addedpUpdatesMap
- the map containing the credit card propertiespCommercePropertyManager
- the CommercePropertyManager component containing the property namesRestException
- if an error occurs adding the credit card to the user profileRepositoryException
- if an error occurs adding the credit card to the user profilejava.beans.IntrospectionException
- if an error occurs adding the credit card to the user profilePropertyNotFoundException
- if an error occurs adding the credit card to the user profileprotected void removeCreditCardFromProfile(RepositoryItem pProfile, RepositoryItem pCreditCard) throws RestException, RepositoryException
pProfile
- the profile from which credit card is removedpCreditCard
- the credit card item to be removed from the profileRestException
- if an error occurs removing a credit card from the user profileRepositoryException
- if an error occurs removing a credit card from the user profileprotected java.lang.Object retrieveBillingAddress(java.util.Map pInputJSONMap, RepositoryItem pProfile, CommercePropertyManager pCommercePropertyManager) throws RestException
RestException
- if billingAddress is not found with given nicknameprotected java.net.URI getCreatedItemURI(java.lang.String pCreditCardNickname)
pCreditCardNickname
- Credit card nicknameprotected Link getSelfLink(RepositoryItem pProfile, RepositoryItem pCreditCard)
pProfile
- - the profile to which the credit card is mapped.pCreditCard
- - the credit card item to build a self link to.