Class DefaultSavedPaymentMethodValidator<P extends SavedPaymentMethod>
java.lang.Object
com.broadleafcommerce.paymenttransaction.service.validation.DefaultSavedPaymentMethodValidator<P>
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
public class DefaultSavedPaymentMethodValidator<P extends SavedPaymentMethod>
extends Object
implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected SavedPaymentMethodService<P>
protected SavedPaymentMethodStatus
getSavedPaymentMethodStatus
(@NonNull String status) protected static String
prefixWithEntityValidationMessageKey
(String errorCode) void
setSavedPaymentMethodService
(SavedPaymentMethodService<P> savedPaymentMethodService) Lazy injection since this validator is itself a service component.boolean
supports
(@NonNull Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validate
(@NonNull Object savedPaymentMethod, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validateForCreate
(Object createBusinessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validateForReplace
(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validateForUpdate
(@NonNull Object updatedBusinessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected void
validateGatewayReferenceIdNotUpdated
(P existingInstance, P updatedInstance, @NonNull org.springframework.validation.Errors errors) protected void
validateGatewayType
(@NonNull org.springframework.validation.Errors errors) protected void
validateImmutableSavedPaymentFields
(P existingInstance, P updatedInstance, @NonNull org.springframework.validation.Errors errors) Validates that the immutable fields ofSavedPaymentMethod
are not being changed.protected void
validateOriginatingPaymentIdNotUpdated
(P existingInstance, P updatedInstance, @NonNull org.springframework.validation.Errors errors) protected void
validateOwnerIdNotUpdated
(P existingInstance, P updatedInstance, @NonNull org.springframework.validation.Errors errors) protected void
validateOwnerTypeNotUpdated
(P existingInstance, P updatedInstance, @NonNull org.springframework.validation.Errors errors) protected void
validateOwningEntity
(@NonNull org.springframework.validation.Errors errors) protected void
validatePaymentMethodProperties
(P savedPaymentMethod, @NonNull org.springframework.validation.Errors errors) protected void
validateSavedPaymentFields
(P savedPaymentMethod, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theSavedPaymentMethod
fields.protected void
validateStatusAndAction
(P savedPaymentMethod, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
validateType
(@NonNull org.springframework.validation.Errors errors) protected void
validateUpdatedStatus
(P existingInstance, P updatedInstance, @NonNull org.springframework.validation.Errors errors)
-
Constructor Details
-
DefaultSavedPaymentMethodValidator
public DefaultSavedPaymentMethodValidator()
-
-
Method Details
-
setSavedPaymentMethodService
@Autowired @Lazy public void setSavedPaymentMethodService(SavedPaymentMethodService<P> savedPaymentMethodService) Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions- Parameters:
savedPaymentMethodService
- the saved payment method service
-
validate
public void validate(@NonNull @NonNull Object savedPaymentMethod, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForCreate
public void validateForCreate(Object createBusinessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validateForCreate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForUpdate
public void validateForUpdate(@NonNull @NonNull Object updatedBusinessInstance, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validateForUpdate
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateForReplace
public void validateForReplace(@NonNull @NonNull Object businessInstance, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
validateForReplace
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
supports
public boolean supports(@NonNull @NonNull Class<?> serviceClass, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) - Specified by:
supports
in interfacecom.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
-
validateSavedPaymentFields
protected void validateSavedPaymentFields(@NonNull P savedPaymentMethod, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Validates theSavedPaymentMethod
fields.- Parameters:
savedPaymentMethod
- theSavedPaymentMethod
to validateerrors
- an errors object bound to theSavedPaymentMethod
to be validatedcontextInfo
- context information around sandbox and multitenant state
-
validateStatusAndAction
protected void validateStatusAndAction(@NonNull P savedPaymentMethod, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getSavedPaymentMethodStatus
-
validateImmutableSavedPaymentFields
protected void validateImmutableSavedPaymentFields(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors) Validates that the immutable fields ofSavedPaymentMethod
are not being changed.- Parameters:
existingInstance
- the original, unchanged instance ofSavedPaymentMethod
updatedInstance
- the updated instance ofSavedPaymentMethod
errors
- an errors object bound to theSavedPaymentMethod
to be validated
-
validateUpdatedStatus
-
validateOwningEntity
protected void validateOwningEntity(@NonNull @NonNull org.springframework.validation.Errors errors) -
validateType
protected void validateType(@NonNull @NonNull org.springframework.validation.Errors errors) -
validateGatewayType
protected void validateGatewayType(@NonNull @NonNull org.springframework.validation.Errors errors) -
validatePaymentMethodProperties
protected void validatePaymentMethodProperties(@NonNull P savedPaymentMethod, @NonNull @NonNull org.springframework.validation.Errors errors) -
validateOwnerTypeNotUpdated
-
validateOwnerIdNotUpdated
-
validateOriginatingPaymentIdNotUpdated
-
validateGatewayReferenceIdNotUpdated
-
prefixWithEntityValidationMessageKey
-
getSavedPaymentMethodService
-