package com.braintree.actions.order;

import de.hybris.platform.orderprocessing.events.PaymentFailedEvent;
import de.hybris.platform.orderprocessing.model.OrderProcessModel;
import de.hybris.platform.processengine.action.AbstractProceduralAction;
import de.hybris.platform.servicelayer.event.EventService;
import org.apache.log4j.Logger;


public class BrainTreeSendPaymentFailedNotificationAction extends AbstractProceduralAction<OrderProcessModel> {

    private static final Logger LOG = Logger.getLogger(BrainTreeSendPaymentFailedNotificationAction.class);

    private EventService eventService;

    @Override
    public void executeAction(final OrderProcessModel process) {
        if (LOG.isInfoEnabled()) {
            LOG.info("Process: " + process.getCode() + " in step " + getClass());
        }
        eventService.publishEvent(new PaymentFailedEvent(process));
    }

    public void setEventService(final EventService eventService) {
        this.eventService = eventService;
    }

}
