package com.braintree.cart.factory.impl;

import de.hybris.platform.commerceservices.order.impl.CommerceCartFactory;
import de.hybris.platform.commerceservices.util.GuidKeyGenerator;
import de.hybris.platform.core.model.order.CartModel;

public class DefaultBraintreeCartFactory extends CommerceCartFactory {

    private GuidKeyGenerator guidGenerator;

    @Override
    protected CartModel createCartInternal()
    {
        final CartModel cart = getCreateCartInternal();
        cart.setBrainTreeOrderId(guidGenerator.generate().toString());
        return cart;
    }

    protected CartModel getCreateCartInternal() {
        return super.createCartInternal();
    }

    public void setGuidGenerator(GuidKeyGenerator guidGenerator) {
        this.guidGenerator = guidGenerator;
    }
}
