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 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 interface com.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 interface com.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 interface com.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 interface com.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 interface com.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 the SavedPaymentMethod fields.
      Parameters:
      savedPaymentMethod - the SavedPaymentMethod to validate
      errors - an errors object bound to the SavedPaymentMethod to be validated
      contextInfo - 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

      protected SavedPaymentMethodStatus getSavedPaymentMethodStatus(@NonNull @NonNull String status)
    • validateImmutableSavedPaymentFields

      protected void validateImmutableSavedPaymentFields(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors)
      Validates that the immutable fields of SavedPaymentMethod are not being changed.
      Parameters:
      existingInstance - the original, unchanged instance of SavedPaymentMethod
      updatedInstance - the updated instance of SavedPaymentMethod
      errors - an errors object bound to the SavedPaymentMethod to be validated
    • validateUpdatedStatus

      protected void validateUpdatedStatus(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors)
    • 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

      protected void validateOwnerTypeNotUpdated(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors)
    • validateOwnerIdNotUpdated

      protected void validateOwnerIdNotUpdated(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors)
    • validateOriginatingPaymentIdNotUpdated

      protected void validateOriginatingPaymentIdNotUpdated(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors)
    • validateGatewayReferenceIdNotUpdated

      protected void validateGatewayReferenceIdNotUpdated(@NonNull P existingInstance, @NonNull P updatedInstance, @NonNull @NonNull org.springframework.validation.Errors errors)
    • prefixWithEntityValidationMessageKey

      protected static String prefixWithEntityValidationMessageKey(String errorCode)
    • getSavedPaymentMethodService

      protected SavedPaymentMethodService<P> getSavedPaymentMethodService()