1. Gift cards service layer

The gift cards domain model

Version:

This section describes the domain model that represents the gift card objects, where the following three assertions hold true:

  • The domain model primarily serves as DTO objects for transferring information between the external commerce system and Sitecore.
  • The domain model contains the minimum required information as contracts and will typically be extended, when integrated with a specific commerce system.
  • The domain model is used when a Sitecore developer needs to synchronize product data with the external commerce system or product data is pushed into Sitecore from the external commerce system.

The following class diagram shows the domain model:

Class diagram of the gift card domain model
Note

The domain model consists of abstract classes that make up the contracts with the external system. The contracts are defined as abstract classes instead of interfaces to allow the model to be easily extended later if needed. This follows the best practice guidelines defined in the Framework Design Guidelines.

A default implementation of the contracts is delivered as part of Connect. If an actual Connect provider with an external commerce system contains more functionality than provided by default, the implementation can be replaced. All instantiation of actual classes will be handled through dependency injection.

Class: GiftCard

The GiftCard class is responsible for representing a gift card entity in an external system.

NameTypeDescription
ExternalIdStringUnique identifier for the product in the commerce system. This can be used to get a reference to the product using the commerce system's native API.
NameStringThe name, if any, of the gift card.
CustomerIdStringThe identifier of the owner of the card.
ShopNameStringThe shop the card is associated to if any.
CurrencyCodeStringThe currency of the card value.
BalanceDecimalThe remaining value of the card.
OriginalAmountDecimalThe initial value of the card.
DescriptionStringReference to the manufacturers.

Class: GiftCardPaymentInfo

The GiftCardPaymentInfo class is an implementation of the PaymentInfo class that allows a payment to be made with a gift card.

NameTypeDescription
AmountDecimalThe amount being charged against the gift card.
CardNumberStringThe ID of the gift card being used for payment.
If you have suggestions for improving this article, let us know!