| title | First architecture ISA |
|---|---|
| author | Equipe C (FALCOZ Alban, GALLI Evan, GRIPARI Alexandre, LASSAUNIERE Theo, LUBRAT Jilian, MICHELOZZI Antoine-Marie) |
- For the moment, there is no points system to utilize the advantages and discounts. It simply depends on whether you have access or not. For example, if the customer is a VFP, they can only use one VFP advantage per week. However, this system may evolve in the future.
- To become a VFP member, the customer must make at least three purchases at a partner business within the last 7 days.
- The service is a monthly subscription service.
- The discounts are automatically deducted at the payment, but the advantages must be activated by the customer before the payment to be used.
- Pierre (Customer)
- Laura (Partner)
- Laurence (Partner)
- HappyKids (Affiliated Business)
- Bank
Subscribe to service: Customers can subscribe to the service in order to obtain their own card to take advantage of the benefits. There is a charge for this subscription, which involves communicating with the Bank.Consult benefits: Customers can view all the benefits available with the card, whether they have VFP status or not.Activate benefits: Once a customer has selected a benefit, he can activate it if it is not a pre-activated benefit.Consult transactions history: A user, customer or partner must be able to obtain a list of the services they have received/applied respectively.Get order price: Partners need to retrieve the price of a new order before the customer proceeds with payment.Simulate benefits: Customers can simulate their potential benefits to determine what they might receive. Before paying an order, partners and affiliated business use this simulation to calculate the order price. However, some partners or affiliated business prefer to calculate the order's new price within their own system.
- PartnerRegistery: The
PartnerRegistrycomponent manages the registration of partners. It serves as the link between thePartnerRepository, theTransactionHandler, and thePartnerController, enabling thePartnerControllerand theTransactionHandlerto find a partner in the repository. - TransactionHandler: This component handles the transactions. It receives demands from the
TransactionControllerto get the benefits with the interfaceTransactionProcessorand uses the interfacePayment,BenefitsGetter,PartnerFinderandItemFinderto get respectivly : the payment, the benefits that can be applied, the partner and the items. - Benefits: This component handles the benefits. It receives demands from the
BenefitsControllerto get the benefits with the interfaceBenefitsGetterand uses the interfaceBenefits,CustomerStatusGetter,ItemFinderandAffiliatedBusinessto get respectivly : the benefits of the affiliated business, the customer status (subscribed / vfp / not subscribed), the offered item and ordered item and the affiliated business. - Cashier: This component save a transaction. He receives demands and the
Paymentfrom theTransactionHandler. It uses the interfaceHistoryAdderto be able to add the transaction to the history and theAffiliatedBusinessto get the price to pay. - ItemRegistry: The
ItemRegistrycomponent manages the registration of items. It serves as the link between theItemRepository, theTransactionHandler, theBenefitsand theItemControllerenabling theItemRepositoryand theTransactionHandler, theBenefitsand theItemControllerto find a item in the repository. - BenefitsHistoryService: This component is used to manage the benefits history. It uses the
Historyinterface of theTransactionHistoryRepositoryto obtain history data. It allows theCashiercomponent to add transactions to the history via theHistoryAdderinterface and to search the history via theHistoryFinderinterface. - CustomerStatus: This component receives information from both the
HistoryControllerand theSubscriptionController, using theHistoryFinderandSubscriptionStatusinterfaces respectively. It uses the information obtained to identify the customer's status and calculate the benefits accordingly. - CustomerSubscription: This component enables a customer to be subscribed, and the status of a customer to be obtained (subscribed or not). To subscribe a customer, it will receive the customer via the
CustomerFinderinterface fromCustomerController, and make the payment via theBankinterface. Then, to retrieve the status of the customer, it will obtain the information from theSubscruptioninterface from theSubscriptionRepository. - CustomerService: This component manages customers, making it possible to respond to requests to search for and register a customer. It receives customers via the
Customerinterface of theCustomerRepositoryand uses theCustomerFinderandCustomerRegistrationinterfaces respectively to respond to registration requests and customer searches.
/** Provides methods to retrieve a customer by their ID or retrieve all customers in the system */
public interface CustomerFinder {
Customer findById(Long customerId) throws CustomerNotFoundException;
List<Customer> findAll();
}
/** Handles the registration of new customers. */
public interface CustomerRegistration {
void registerCustomer(String name) throws CustomerAlreadyExistsException;
}
/** Provides methods to retrieve a partner by their ID or retrieve all partners in the system */
public interface PartnerFinder {
Partner findById(Long partnerId) throws PartnerNotFoundException;
List<Partner> findAll();
}
/** Subscribe a customer to the fidelity service */
public interface Subscribe {
Subscription subscribeCustomer(Long customerId) throws CustomerNotFoundException;
}
/** Check if the customer is subscribed and retrieves their subscribtion details */
public interface SubscriptionStatus {
boolean isSubscribed(Long customerId);
Subscription getSubscription(Long customerId) throws SubscriptionNotFoundException;
}
/** Add a transaction to the history */
public interface TransactionProcessor {
void addTransaction(Transaction transaction) throws PartnerNotFoundException, SubscriptionNotFoundException;
}
/** Retrieves the transaction history for a specific customer or partner */
public interface HistoryFinder {
List<Transaction> getTransactionHistory(Long customerId) throws CustomerNotFoundException;
List<Transaction> getPartnerTransactionHistory(Long partnerId) throws PartnerNotFoundException;
}
/** Finds items by ID or retrieves the list of item of a partner */
public interface ItemFinder {
Item findById(Long itemId) throws ItemNotFoundException;
List<Item> findByPartnerId(Long partnerId);
List<Item> findAll();
}
/** Adds a transaction to the history */
public interface HistoryAdder {
void addTransactionToHistory(Transaction transaction) throws CustomerNotFoundException;
}
/** Retrieves all the benefits, all available for a specific customer, the benefits applicable for a transaction */
public interface BenefitsGetter {
List<Benefit> getAllBenefits();
List<Benefit> getAvailableBenefits(Long customerId) throws CustomerNotFoundException;
Benefit getBenefitForTransaction(Transaction transaction);
}
/** Activate the benefits if the customer has requested it */
public interface BenefitsActivator {
void activateBenefit(Long customerId, Long benefitId) throws CustomerNotFoundException, BenefitNotFoundException, BenefitUnavailableExecption;
}
/** Check if a customer is subscribed or has a VFP status */
public interface CustomerStatusGetter {
boolean isVFP(Long customerId);
boolean isSubscribed(Long customerId);
}
/** Retrieves all subscriptions or a subscription for a specific customer */
public interface Subscription {
List<Subscription> findAll();
Subscription findByCustomerId(Long customerId);
void addSubscription(Subscription subscription);
}
/** Processes payment transactions using a card number and amount, throwing an exception if payment fails */
public interface Bank {
boolean processPayment(String cardNumber, double amount) throws PaymentFailedException;
}
/** Calculates the price and adds the transaction to the history */
public interface Payment {
void markAsPayed(Transaction transaction, Benefit benefit);
}
/** Manages customer data, including retrieving, adding, and searching customers */
public interface Customer {
List<Customer> findAll();
Customer findById(Long customerId);
void addCustomer(Customer customer);
}
/** Transfers the transaction and the benefits to the affiliated business, allowing it to calculate the transaction price */
public interface AffiliatedBusiness {
double getPriceToPay(Transaction transaction, Benefit benefit);
}
/** Retrieve or add transaction to the history */
public interface History {
List<Transaction> getCustomerHistory(Long customerId);
List<Transaction> getPartnerHistory(Long partnerId);
void addTransaction(Transaction transaction);
}
/** Retrieve all the benefits or a specific beneit*/
public interface Benefits {
List<Benefit> findAll();
Benefit findById(Long benefitId);
}classDiagram
class Customer {
id : Long
name : String
cardNumber : String
}
class Partner {
id : Long
name : String
distantServer : String
}
class Transaction {
id: Long
date : LocalDateTime
price : double
subPrice : double
}
class Benefit {
id : Long
discount: double
description: String
}
class Subscription {
id : Long
endDate : LocalDateTime
barcode : String
}
class Item {
id : Long
name : String
price : double
}
class TypeOfBenefits {
<<enumeration>>
FLAT_REDUCTION
REDUCTION
FREE_ITEM
}
Item "*" --> "partner 1" Partner : belongs to ▸
Customer "customer 1" <-- "*" Transaction : performs ▸
Customer "customer 1" <--* "1" Subscription : has ▸
Transaction "*" --> "partner 1" Partner : associated with ▸
Transaction "*" --> "benefit *" Benefit : applies ▸
Transaction "*" --> "item 1..*" Item : contains ▸
Benefit "*" --> "item *" Item : references ▸
Benefit "*" --> "1 type" TypeOfBenefits : has type ▸
- The
Customerclass represents a user of the application who has subscribed to our service. It contains attributes such as id, name, and the cardNumber of the customer. Customers are the central actors in the system. In the "Subscribe to service" use case, a customer is registered and linked to a subscription. Additionally, the customer is involved in the "Consult transactions history" and "Consult benefits" use cases to review their past activity and available advantages. - The
Subscriptionclass models the registration of a customer. Each subscription is uniquely identified by its id and contains attributes such as endDate to indicate the validity period, which is typically one month from the subscription date, and the barCode of the multi-fidelity card. The use case ‘Subscription to a service’ involves the creation of a subscription for the customer during the registration process. - The
Transactionclass represents a record of a customer’s purchase or operation within the system. It contains attributes such as date for the timestamp of the transaction, price for the total amount before discounts, and subPrice for the final amount after applying benefits. Each transaction involves a specific customer, one or more items purchased, and any applicable benefits. Transactions are also linked to a partner, representing the business facilitating the purchase. This class is necessary to the "Consult transactions history" use case, where customers can review their previous purchases. - The
Partnerclass represents the company that proposes benefits for a multi fidelity card user. They are identified by a unique id and characterized by a name. Each partner offers a multitude of items, and is linked to all transactions carried out in its company. - The
Itemclass represents the products or services that customers can purchase or receive as benefits. Each item is characterized by attributes such as id, name, and price. Items belong to a specific partner and are also referenced in benefits, enabling features like discounts or free products. - The
Benefitclass encapsulates advantages available to customers, such as discounts or free items. It includes attributes like id, discount, and description to describe the benefit and its conditions. Each benefit is associated with a single type from the TypeOfBenefits enumeration, which defines whether the benefit offers a flat reduction, percentage reduction, or free item. Additionally, benefits may reference specific items to apply targeted offers. Benefits are integral to use cases like "Consult benefits," "Simulate benefits," and "Activate benefits," where customers explore, calculate, and apply their advantages. - The
TypeOfBenefitsclass is an enumeration that defines the available types of benefits in the system:FLAT_REDUCTIONfor fixed discounts,REDUCTIONfor percentage-based discounts, andFREE_ITEMfor free products.
(CLI -> SubscriptionController -> CustomerSubscription -> SubscriptionRepository)
- A customer subscribes to the service and obtains his multi-fidelity card.
(CLI -> BenefitController -> TransactionHandler -> Benefits -> AffiliatedBusinessProxy -> AffiliatedBusinessSystem)
- The customer enters the requested information.
- The system queries the HappyKids partner to verify the information and get the reduction.
(CLI -> BenefitController -> TransactionHandler -> Benefits)
- The customer checks if a 10% discount is applicable after 6:30 PM, without interaction with an external partner.
(CLI -> BenefitController -> TransactionHandler -> Cashier -> AffiliatedBusinessProxy -> AffiliatedBusinessSystem)
- The customer presents their multi-fidelity card to the partner.
- The partner requests the system to calculate the amount to be paid, considering the discounts defined by HappyKids.
(CLI -> BenefitController -> TransactionHandler -> Cashier)
- The customer presents their multi-fidelity card to the partner.
- The partner directly obtains the reduced price to be paid without external interaction.
(CLI -> HistoryController -> BenefitsHistoryService -> TransactionHistoryRepository)
- The customer views the list of advantages they have benefited from.
(HistoryController -> BenefitsHistoryService)
- The partner views the number of free childcare hours used to analyze their distribution.
(HistoryController -> BenefitsHistoryService)
- The partner reviews purchases made after 6:30 PM to evaluate their impact on losses.