Java Shell Other
Permalink
Failed to load latest commit information.
.git-crypt Add 1 git-crypt collaborator Feb 23, 2017
app Adding reset password confirmation page (#666) Nov 14, 2017
common Remove final from HttpAuthenticationFilter to allow overriding Aug 1, 2018
conf Move actioncomposition config to application.conf due to #694 Dec 4, 2017
docker-cloud Bumpto latest production version. May 10, 2016
it Fix test Dec 15, 2017
manual Update theme readme (#642) Aug 6, 2017
my-account Adding reset password confirmation page (#666) Nov 14, 2017
product-catalog Adding reset password confirmation page (#666) Nov 14, 2017
project Update to Theme 0.72.0 and little template fix Dec 4, 2017
public Wishlist (#607) Jun 16, 2017
shopping-cart Adding reset password confirmation page (#666) Nov 14, 2017
test-lib/app/com/commercetools/sunrise Cart discount code (#686) Nov 7, 2017
test/resources Recover password small improvements (#652) Sep 5, 2017
wishlist/app/com/commercetools/sunrise/wishlist Adding reset password confirmation page (#666) Nov 14, 2017
.gitignore Recover password small improvements (#652) Sep 5, 2017
.slugignore Remove target folders after packaging Feb 26, 2016
.travis.yml Update scala version on travis Apr 7, 2017
CONTRIBUTING.md typo Jul 21, 2016
GUIDELINES.md Split documentation and put in manual folder Jul 21, 2016
LICENSE Initial commit May 21, 2014
Procfile Fix logging configuration (#586) Apr 11, 2017
README.md Update README.md Dec 4, 2017
app.json Update app.json Apr 5, 2017
build.sbt Add provider class for solutioninfo and file which point at it (#614) Sep 20, 2017
sbt Add sbt file Mar 21, 2017
system.properties Configure Heroku for Java 8. Jun 3, 2014
version.sbt Setting version to 1.0.0-M10 Aug 1, 2018

README.md

Sunrise Java Shop Framework 🌅

Build Status Maven Central stability-unstable Heroku Stories in Ready

The next generation shop framework.

Installation

Sunrise Starter Project

The recommended way to start using Sunrise is to clone the Sunrise Starter Project and use it as a template project. It already contains all dependencies (i.e. Sunrise Framework and Theme) and configurations needed to run your Sunrise-based project.

Starting from scratch

Alternatively you can start your own Play Framework project and configure it yourself, using Sunrise as dependency:

val sunriseFrameworkVersion = "1.0.0-M9" // or desired version
libraryDependencies ++= Seq(
  // add Sunrise Framework dependencies as needed, e.g.:
  "com.commercetools.sunrise" %% "product-catalog" % sunriseFrameworkVersion,
  "com.commercetools.sunrise" %% "shopping-cart" % sunriseFrameworkVersion,
  "com.commercetools.sunrise" %% "my-account" % sunriseFrameworkVersion,
  "com.commercetools.sunrise" %% "wishlist" % sunriseFrameworkVersion,
  // add the desired Sunrise Theme as dependency, e.g.:
  "com.commercetools.sunrise" % "commercetools-sunrise-theme" % "0.61.1"
)

These dependencies provide default Controllers which can be enabled by extending them into your own Controller and registering a route for it.

For example, if we wanted to enable an endpoint to see the contents of the cart, we would simply extend the SunriseCartDetailController:

// here you can register controller components
@RegisteredComponents(CartOperationsControllerComponentSupplier.class)
public final class CartDetailController extends SunriseCartDetailController {

    @Inject
    public CartDetailController(final ContentRenderer contentRenderer,
                                final CartFinder cartFinder,
                                final CartDetailPageContentFactory pageContentFactory) {
        // parameters that you can change via injection
        super(contentRenderer, cartFinder, pageContentFactory);
    }

    @Nullable
    @Override
    public String getTemplateName() {
        // here goes the name of your template
        return "cart";
    }
    
    // here you can override methods to change behaviour
}

Then we only need to associate our CartDetailController to a route with the desired pattern in conf/routes:

# Shows the details of the cart belonging to the current session
GET  /:languageTag/cart       @controllers.CartDetailController.show(languageTag: String)

Accessing http://localhost:9000/en/cart should now allow us to see the contents of our cart.

Check Sunrise Starter Project to adjust any other required configuration.

Integration tests against commercetools platform

  • Setup your environment variables (use a test project), so you need not to put your shop credentials under version control:
export SUNRISE_IT_CTP_PROJECT_KEY="your-CTP-project-key"
export SUNRISE_IT_CTP_CLIENT_SECRET="your-CTP-client-secret"
export SUNRISE_IT_CTP_CLIENT_ID="your-CTP-client-id"
  • sbt it:test

Related projects

Sunrise Starter Project

The starting point to build your own online shop project

https://github.com/commercetools/commercetools-sunrise-java-starter

Sunrise Theme

Handlebars templates + i18n messages + web assets

https://github.com/commercetools/commercetools-sunrise-theme

Sunrise Data

Example data used on our demo

https://github.com/commercetools/commercetools-sunrise-data

commercetools JVM SDK

SDK for JVM languages to communicate with comercetools projects

https://github.com/commercetools/commercetools-jvm-sdk