Remove debit payment data
This commit is contained in:
@@ -78,7 +78,7 @@ public class SaleService {
|
||||
sale.setSaleDate(LocalDateTime.now());
|
||||
sale.setEmployee(employee);
|
||||
sale.setStore(store);
|
||||
sale.setPaymentMethod(request.getPaymentMethod());
|
||||
sale.setPaymentMethod(normalizePaymentMethod(request.getPaymentMethod()));
|
||||
sale.setIsRefund(request.getIsRefund() != null ? request.getIsRefund() : false);
|
||||
|
||||
if (request.getCustomerId() != null) {
|
||||
@@ -215,4 +215,22 @@ public class SaleService {
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
String normalizePaymentMethod(String paymentMethod) {
|
||||
if (paymentMethod == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String normalized = paymentMethod.trim();
|
||||
if (normalized.equalsIgnoreCase("Debit")) {
|
||||
return "Card";
|
||||
}
|
||||
if (normalized.equalsIgnoreCase("Cash")) {
|
||||
return "Cash";
|
||||
}
|
||||
if (normalized.equalsIgnoreCase("Card")) {
|
||||
return "Card";
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
UPDATE sale
|
||||
SET paymentMethod = 'Card'
|
||||
WHERE LOWER(paymentMethod) = 'debit';
|
||||
@@ -128,7 +128,7 @@ VALUES
|
||||
('2026-01-05 09:15:00', 125.00, 'Card', 1, 1, 1),
|
||||
('2026-01-08 11:30:00', 200.00, 'Card', 2, 1, 2),
|
||||
('2026-01-12 14:20:00', 60.00, 'Cash', 3, 2, 3),
|
||||
('2026-01-15 10:45:00', 150.00, 'Debit', 1, 1, 1),
|
||||
('2026-01-15 10:45:00', 150.00, 'Card', 1, 1, 1),
|
||||
('2026-01-18 16:30:00', 80.00, 'Card', 4, 3, 2),
|
||||
('2026-01-22 13:15:00', 95.00, 'Cash', 2, 2, NULL),
|
||||
('2026-01-25 15:40:00', 240.00, 'Card', 5, 4, 4),
|
||||
@@ -136,12 +136,12 @@ VALUES
|
||||
('2026-02-01 09:00:00', 175.00, 'Card', 3, 3, 1),
|
||||
('2026-02-03 11:20:00', 120.00, 'Card', 2, 1, 3),
|
||||
('2026-02-05 14:50:00', 45.00, 'Cash', 4, 2, NULL),
|
||||
('2026-02-08 16:15:00', 160.00, 'Debit', 1, 1, 2),
|
||||
('2026-02-08 16:15:00', 160.00, 'Card', 1, 1, 2),
|
||||
('2026-02-10 10:25:00', 100.00, 'Card', 5, 4, NULL),
|
||||
('2026-02-12 13:45:00', 50.00, 'Cash', 2, 2, 1),
|
||||
('2026-02-15 15:30:00', 85.00, 'Card', 3, 3, NULL),
|
||||
('2026-02-18 11:10:00', 200.00, 'Card', 1, 1, 4),
|
||||
('2026-02-20 14:35:00', 155.00, 'Debit', 4, 3, NULL),
|
||||
('2026-02-20 14:35:00', 155.00, 'Card', 4, 3, NULL),
|
||||
('2026-02-22 16:50:00', 75.00, 'Cash', 2, 1, 2),
|
||||
('2026-02-24 10:15:00', 140.00, 'Card', 5, 4, NULL),
|
||||
(NOW(), 95.00, 'Card', 1, 1, 1);
|
||||
|
||||
Reference in New Issue
Block a user