Introduction

The module’s integration allows you to the user to

  • accumulate credits (bonus points) and

  • spend these bonus points when purchasing different items in the website

Business

Development

Core

Entity Definitions

asciidoctor diagram CreditAccountBalanceEntityDefinition
CreditAccountCustomerEntityDefinition

The CreditAccountCustomerEntityDefinition extends inherited features from the CustomerEntityDefinition, the UserEntityDefinition, the PrincipalEntityDefinition and the AbstractEntityDefinition:

asciidoctor diagram CreditAccountCustomerEntityDefinition

Apart from the inherited, the defined property here is creditAccountBalance. Via the respective getter/setter, a CreditAccountBalanceEntityDefinition can be retrieved/stored in the database.

Spring Data JPA Repositories

CreditAccountBalanceRepository

The CreditAccountBalanceRepository extends the BaseEntityRepository and is the corresponding Spring Data JPA repository for the CreditAccountBalanceEntityDefinition

asciidoctor diagram CreditAccountBalanceRepository

Business Services

CreditAccountService

The additional service logic for the account module is to be stored in the CreditAccountService.

Facade

MapperFactoryConfigurers

CreditAccountPaymentInfoMapperFactoryConfigurer

The CreditAccountPaymentInfoMapperFactoryConfigurer implements the MapperFactoryConfigurer, converting the PaymentInfoEntityDefinition to CreditAccountPaymentInfoDtoDefinition:

asciidoctor diagram CreditAccountPaymentInfoMapperFactoryConfigurer

The conversion is customized.

More about the mapping configurations you may read in the respective Orika guide.

Dto definitions

CreditAccountPaymentInfoDtoDefinition

The CreditAccountPaymentInfoDtoDefinition extends the PaymentInfoDtoDefinition:

asciidoctor diagram CreditAccountPaymentInfoDtoDefinition

This is the corresponding Dto for the PaymentInfoEntityDefinition.

Facades

CreditAccountFacade

The defined method in the CreditAccountFacade provides information for the credit account balance of the current session’s user.

Storefront

CreditAccountCheckoutController

The CreditAccountCheckoutController defines an HTTP Endpoint at /payment/creditaccount/perform

There are no views, associated with the module.

For further details on mapping, check the corresponding mapping actuator accessible at /platform/mappings.

Integration

The integration with the Nemesis platform is pretty straight-forward - just add the module in your classpath:

<dependency>
    <groupId>io.nemesis.platform.module</groupId>
    <artifactId>nemesis-module-creditaccount</artifactId>
</dependency>