# language: en Feature: Manage customer accounts Background: Given the system has the following customers: | prenom | nom | numeroTelephone | pointsFidelite | | Marie | Dupont | 0612345678 | 100 | | Jean | Martin | 0687654321 | 50 | | Sophie | Dubois | 0698765432 | 0 | Scenario: Create a new customer account When I create a new customer with the following information: | prenom | nom | numeroTelephone | | Pierre | Lambert | 0611223344 | Then a new customer is created And the customer has 0 loyalty points And the system now has 4 customers Scenario: Retrieve a customer by ID When I request the customer with phone number "0612345678" Then I receive the following customer information: | prenom | nom | numeroTelephone | pointsFidelite | | Marie | Dupont | 0612345678 | 100 | Scenario: Update a customer's information When I update customer "0687654321" with the following information: | prenom | nom | numeroTelephone | | Jean | Bernard | 0666666666 | Then the customer "0687654321" has the following updated information: | prenom | nom | numeroTelephone | | Jean | Bernard | 0666666666 | And the loyalty points remain unchanged at 50 Scenario: Delete a customer When I delete the customer with phone number "0698765432" Then the customer "0698765432" is removed from the system And the system now has 2 customers Scenario: Add loyalty points to a customer When I add 25 loyalty points to customer "0687654321" Then customer "0687654321" now has 75 loyalty points Scenario: Deduct loyalty points for a purchase When I deduct 30 loyalty points from customer "0612345678" for a purchase Then customer "0612345678" now has 70 loyalty points Scenario: Attempt to create a customer with invalid phone number When I try to create a new customer with the following information: | prenom | nom | numeroTelephone | | Thomas | Petit | abcdefgh | Then the creation fails And I receive an error for validation customer message containing "Phone number is not valid" And the system still has 3 customers Scenario: Attempt to deduct more loyalty points than available When I try to deduct 150 loyalty points from customer "0687654321" for a purchase Then the deduction fails And I receive an error for illegal customer exception message containing "Cannot remove 150 points from 50 points" And customer "0687654321" now has 50 loyalty points