diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/CurrencyIsLimitException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/CurrencyIsLimitException.cs index 98a54742..616d91a7 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/CurrencyIsLimitException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/CurrencyIsLimitException.cs @@ -5,10 +5,9 @@ namespace EasyAbp.EShop.Orders.Orders { public class CurrencyIsLimitException : BusinessException { - public CurrencyIsLimitException(string expectedCurrency) : base( - "CurrencyIsLimit", - $"Only the specified currency {expectedCurrency} is allowed.") + public CurrencyIsLimitException(string expectedCurrency) : base(OrdersErrorCodes.CurrencyIsLimit) { + WithData(nameof(expectedCurrency), expectedCurrency); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderLineInvalidQuantityException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderLineInvalidQuantityException.cs index a67027c0..1d187d7e 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderLineInvalidQuantityException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Application/EasyAbp/EShop/Orders/Orders/OrderLineInvalidQuantityException.cs @@ -5,9 +5,11 @@ namespace EasyAbp.EShop.Orders.Orders { public class OrderLineInvalidQuantityException : BusinessException { - public OrderLineInvalidQuantityException(Guid productId, Guid? productSkuId, int quantity) : base( - message: $"Invalid quantity {quantity} for product {productId} (SKU: {productSkuId}).") + public OrderLineInvalidQuantityException(Guid productId, Guid? productSkuId, int quantity) : base(OrdersErrorCodes.OrderLineInvalidQuantity) { + WithData(nameof(productId), productId); + WithData(nameof(productSkuId), productSkuId); + WithData(nameof(quantity), quantity); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json index 903f1103..1d7c6263 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/Localization/Orders/en.json @@ -40,6 +40,15 @@ "OrderLineTotalPrice": "Total price", "OrderLineTotalDiscount": "Total discount", "OrderLineActualTotalPrice": "Actual total price", - "OrderLineQuantity": "Quantity" + "OrderLineQuantity": "Quantity", + "EasyAbp.EShop.Orders:CurrencyIsLimit": "Only the specified currency {expectedCurrency} is allowed.", + "EasyAbp.EShop.Orders:OrderLineInvalidQuantity": "Invalid quantity {quantity} for product {productId} (SKU: {productSkuId}).", + "EasyAbp.EShop.Orders:DiscountAmountOverflow": "The discount amount overflow.", + "EasyAbp.EShop.Orders:DuplicateOrderExtraFee": "The extra fee {extraFeeName} (key: {extraFeeKey}) is existed.", + "EasyAbp.EShop.Orders:InvalidOrderExtraFee": "The extra fee {extraFee} is invalid.", + "EasyAbp.EShop.Orders:InvalidPayment": "The payment {paymentId} has invalid configurations for the order {orderId}.", + "EasyAbp.EShop.Orders:InvalidRefundAmount": "The refund amount ({amount}) is invalid.", + "EasyAbp.EShop.Orders:InvalidRefundQuantity": "The refund quantity ({quantity}) is invalid.", + "EasyAbp.EShop.Orders:OrderIsInWrongStage": "The order {orderId} is in the wrong stage." } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs index aed7958d..e9f33aa1 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain.Shared/EasyAbp/EShop/Orders/OrdersErrorCodes.cs @@ -2,6 +2,14 @@ { public static class OrdersErrorCodes { - //Add your business exception error codes here... + public const string CurrencyIsLimit = "EasyAbp.EShop.Orders:CurrencyIsLimit"; + public const string OrderLineInvalidQuantity = "EasyAbp.EShop.Orders:OrderLineInvalidQuantity"; + public const string DiscountAmountOverflow = "EasyAbp.EShop.Orders:DiscountAmountOverflow"; + public const string DuplicateOrderExtraFee = "EasyAbp.EShop.Orders:DuplicateOrderExtraFee"; + public const string InvalidOrderExtraFee = "EasyAbp.EShop.Orders:InvalidOrderExtraFee"; + public const string InvalidPayment = "EasyAbp.EShop.Orders:InvalidPayment"; + public const string InvalidRefundAmount = "EasyAbp.EShop.Orders:InvalidRefundAmount"; + public const string InvalidRefundQuantity = "EasyAbp.EShop.Orders:InvalidRefundQuantity"; + public const string OrderIsInWrongStage = "EasyAbp.EShop.Orders:OrderIsInWrongStage"; } } diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs index 69c0dce4..f1b59db1 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DiscountAmountOverflowException.cs @@ -4,8 +4,7 @@ namespace EasyAbp.EShop.Orders.Orders { public class DiscountAmountOverflowException : BusinessException { - public DiscountAmountOverflowException() - : base("DiscountAmountOverflow", $"The discount amount overflow.") + public DiscountAmountOverflowException() : base(OrdersErrorCodes.DiscountAmountOverflow) { } } diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DuplicateOrderExtraFeeException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DuplicateOrderExtraFeeException.cs index 15414045..f6071ab1 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DuplicateOrderExtraFeeException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/DuplicateOrderExtraFeeException.cs @@ -4,9 +4,10 @@ namespace EasyAbp.EShop.Orders.Orders { public class DuplicateOrderExtraFeeException : BusinessException { - public DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey) - : base("DuplicateOrderExtraFee", $"The extra fee {extraFeeName} (key: {extraFeeKey}) is existed.") + public DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey) : base(OrdersErrorCodes.DuplicateOrderExtraFee) { + WithData(nameof(extraFeeName), extraFeeName); + WithData(nameof(extraFeeKey), extraFeeKey); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidOrderExtraFeeException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidOrderExtraFeeException.cs index 7c53fb0a..567b93df 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidOrderExtraFeeException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidOrderExtraFeeException.cs @@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Orders.Orders { public class InvalidOrderExtraFeeException : BusinessException { - public InvalidOrderExtraFeeException(decimal extraFee) - : base("InvalidExtraFee", $"The extra fee {extraFee} is invalid.") + public InvalidOrderExtraFeeException(decimal extraFee) : base(OrdersErrorCodes.InvalidOrderExtraFee) { + WithData(nameof(extraFee), extraFee); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs index 923db2fd..ed1cde96 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidPaymentException.cs @@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Orders.Orders { public class InvalidPaymentException : BusinessException { - public InvalidPaymentException(Guid paymentId, Guid orderId) - : base(message: $"The payment {paymentId} has invalid configurations for the order {orderId}.") + public InvalidPaymentException(Guid paymentId, Guid orderId) : base(OrdersErrorCodes.InvalidPayment) { + WithData(nameof(paymentId), paymentId); + WithData(nameof(orderId), orderId); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundAmountException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundAmountException.cs index d440f931..17027959 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundAmountException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundAmountException.cs @@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Orders.Orders { public class InvalidRefundAmountException : BusinessException { - public InvalidRefundAmountException(decimal amount) - : base("InvalidRefundAmount", $"The refund amount ({amount}) is invalid.") + public InvalidRefundAmountException(decimal amount) : base(OrdersErrorCodes.InvalidRefundAmount) { + WithData(nameof(amount), amount); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundQuantityException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundQuantityException.cs index 75179e70..43e09603 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundQuantityException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/InvalidRefundQuantityException.cs @@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Orders.Orders { public class InvalidRefundQuantityException : BusinessException { - public InvalidRefundQuantityException(int quantity) - : base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.") + public InvalidRefundQuantityException(int quantity) : base(OrdersErrorCodes.InvalidRefundQuantity) { + WithData(nameof(quantity), quantity); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderIsInWrongStageException.cs b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderIsInWrongStageException.cs index 825faf53..05807797 100644 --- a/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderIsInWrongStageException.cs +++ b/modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/OrderIsInWrongStageException.cs @@ -5,8 +5,9 @@ namespace EasyAbp.EShop.Orders.Orders { public class OrderIsInWrongStageException : BusinessException { - public OrderIsInWrongStageException(Guid orderId) : base(message: $"The order {orderId} is in the wrong stage.") + public OrderIsInWrongStageException(Guid orderId) : base(OrdersErrorCodes.OrderIsInWrongStage) { + WithData(nameof(orderId), orderId); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/MultiStorePaymentNotSupportedException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/MultiStorePaymentNotSupportedException.cs index 9b3e7ed7..d4acc4a8 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/MultiStorePaymentNotSupportedException.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Payments/MultiStorePaymentNotSupportedException.cs @@ -4,9 +4,8 @@ namespace EasyAbp.EShop.Payments.Payments { public class MultiStorePaymentNotSupportedException : BusinessException { - public MultiStorePaymentNotSupportedException() : base(message: $"Should create payments for each store.") + public MultiStorePaymentNotSupportedException() : base(PaymentsErrorCodes.MultiStorePaymentNotSupported) { - } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/InvalidRefundQuantityException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/InvalidRefundQuantityException.cs index 958520fb..9c6a6ef5 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/InvalidRefundQuantityException.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/InvalidRefundQuantityException.cs @@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Payments.Refunds { public class InvalidRefundQuantityException : BusinessException { - public InvalidRefundQuantityException(int quantity) - : base("InvalidRefundQuantity", $"The refund quantity ({quantity}) is invalid.") + public InvalidRefundQuantityException(int quantity) : base(PaymentsErrorCodes.InvalidRefundQuantity) { + WithData(nameof(quantity), quantity); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs index 659c9974..80a82e73 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Application/EasyAbp/EShop/Payments/Refunds/OrderIsNotInSpecifiedPaymentException.cs @@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Payments.Refunds { public class OrderIsNotInSpecifiedPaymentException : BusinessException { - public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId) - : base("OrderIsNotInSpecifiedPayment", $"The order ({orderId}) is not in the specified payment ({paymentId}).") + public OrderIsNotInSpecifiedPaymentException(Guid orderId, Guid paymentId) : base(PaymentsErrorCodes.OrderIsNotInSpecifiedPayment) { + WithData(nameof(orderId), orderId); + WithData(nameof(paymentId), paymentId); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json index 044b4ca1..1c270813 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json @@ -7,6 +7,11 @@ "Permission:Payments": "Payment", "PaymentItemStoreId": "Store ID", "Permission:Refunds": "Refund", - "RefundItemStoreId": "Store ID" + "RefundItemStoreId": "Store ID", + "EasyAbp.EShop.Payments:MultiStorePaymentNotSupported": "Should create payments for each store.", + "EasyAbp.EShop.Payments:InvalidRefundQuantity": "The refund quantity ({quantity}) is invalid.", + "EasyAbp.EShop.Payments:OrderIsNotInSpecifiedPayment": "The order ({orderId}) is not in the specified payment ({paymentId}).", + "EasyAbp.EShop.Payments:OrderIdNotFound": "Cannot get valid OrderId from ExtraProperties.", + "EasyAbp.EShop.Payments:StoreIdNotFound": "Cannot get valid StoreId from ExtraProperties.", } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/PaymentsErrorCodes.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/PaymentsErrorCodes.cs index 005cbaf8..6a07234d 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/PaymentsErrorCodes.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/PaymentsErrorCodes.cs @@ -2,6 +2,10 @@ { public static class PaymentsErrorCodes { - //Add your business exception error codes here... + public const string MultiStorePaymentNotSupported = "EasyAbp.EShop.Payments:MultiStorePaymentNotSupported"; + public const string InvalidRefundQuantity = "EasyAbp.EShop.Payments:InvalidRefundQuantity"; + public const string OrderIsNotInSpecifiedPayment = "EasyAbp.EShop.Payments:OrderIsNotInSpecifiedPayment"; + public const string OrderIdNotFound = "EasyAbp.EShop.Payments:OrderIdNotFound"; + public const string StoreIdNotFound = "EasyAbp.EShop.Payments:StoreIdNotFound"; } } diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/OrderIdNotFoundException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/OrderIdNotFoundException.cs index 4cd08f43..ed971d6a 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/OrderIdNotFoundException.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/OrderIdNotFoundException.cs @@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Payments { public class OrderIdNotFoundException : BusinessException { - public OrderIdNotFoundException() : base(message: $"Cannot get valid OrderId from ExtraProperties.") + public OrderIdNotFoundException() : base(PaymentsErrorCodes.OrderIdNotFound) { } } diff --git a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/StoreIdNotFoundException.cs b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/StoreIdNotFoundException.cs index e2490b51..1a1bad62 100644 --- a/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/StoreIdNotFoundException.cs +++ b/modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp/EShop/Payments/StoreIdNotFoundException.cs @@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Payments { public class StoreIdNotFoundException : BusinessException { - public StoreIdNotFoundException() : base(message: $"Cannot get valid StoreId from ExtraProperties.") + public StoreIdNotFoundException() : base(PaymentsErrorCodes.StoreIdNotFound) { } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs index 44fdb291..dde19a57 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/NotAllowedToGetProductListWithShowHiddenException.cs @@ -5,8 +5,7 @@ namespace EasyAbp.EShop.Products.Products { public class NotAllowedToGetProductListWithShowHiddenException : BusinessException { - public NotAllowedToGetProductListWithShowHiddenException() : base( - message: $"You have no permission to get product list with hidden products.") + public NotAllowedToGetProductListWithShowHiddenException() : base(ProductsErrorCodes.NotAllowedToGetProductListWithShowHidden) { } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs index fc5e70b3..4f27844b 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributeOptionsDeletionFailedException.cs @@ -5,8 +5,7 @@ namespace EasyAbp.EShop.Products.Products { public class ProductAttributeOptionsDeletionFailedException : BusinessException { - public ProductAttributeOptionsDeletionFailedException() : base( - message: "Should ensure there are no SKUs using the attribute option which you want to delete.") + public ProductAttributeOptionsDeletionFailedException() : base(ProductsErrorCodes.ProductAttributeOptionsDeletionFailed) { } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs index 0cf909df..d3ec9138 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/ProductAttributesModificationFailedException.cs @@ -5,8 +5,7 @@ namespace EasyAbp.EShop.Products.Products { public class ProductAttributesModificationFailedException : BusinessException { - public ProductAttributesModificationFailedException() : base( - message: "Should ensure SKUs are empty if you want to modify attributes of a product.") + public ProductAttributesModificationFailedException() : base(ProductsErrorCodes.ProductAttributesModificationFailed) { } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs index 869011c1..c6f5ae17 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StaticProductCannotBeModifiedException.cs @@ -5,9 +5,9 @@ namespace EasyAbp.EShop.Products.Products { public class StaticProductCannotBeModifiedException : BusinessException { - public StaticProductCannotBeModifiedException(Guid productId) : base( - message: $"Cannot modify the static product: {productId}") + public StaticProductCannotBeModifiedException(Guid productId) : base(ProductsErrorCodes.StaticProductCannotBeModified) { + WithData(nameof(productId), productId); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs index 22ca2765..2fb2a9e0 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/StoreIsNotProductOwnerException.cs @@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Products.Products { public class StoreIsNotProductOwnerException : BusinessException { - public StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base( - message: $"Store {storeId} is not a owner of the product {productId}") + public StoreIsNotProductOwnerException(Guid productId, Guid storeId) : base(ProductsErrorCodes.StoreIsNotProductOwner) { + WithData(nameof(productId), productId); + WithData(nameof(storeId), storeId); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/NotAllowedToGetCategoryListWithShowHiddenException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/NotAllowedToGetCategoryListWithShowHiddenException.cs index 780fb99d..26e3093e 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/NotAllowedToGetCategoryListWithShowHiddenException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Categories/NotAllowedToGetCategoryListWithShowHiddenException.cs @@ -4,8 +4,7 @@ namespace EasyAbp.EShop.Products.Categories { public class NotAllowedToGetCategoryListWithShowHiddenException : BusinessException { - public NotAllowedToGetCategoryListWithShowHiddenException() : base( - message: $"You have no permission to get category list with hidden categories.") + public NotAllowedToGetCategoryListWithShowHiddenException() : base(ProductsErrorCodes.NotAllowedToGetCategoryListWithShowHidden) { } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json index d6c11f44..c02f1fe9 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/Localization/Products/en.json @@ -83,12 +83,19 @@ "DecreaseInventory": "Decrease", "ProductInventoryInventory": "Inventory", "ChangeProductInventory": "Change inventory", - "EasyAbp.EShop.Products.ErrorCodes:DuplicateCategoryUniqueName": "The category unique name '{uniqueName}' is duplicated.", - "EasyAbp.EShop.Products.ErrorCodes:DuplicatedProductUniqueName": "The product unique name '{uniqueName}' is duplicated.", - "EasyAbp.EShop.Products.ErrorCodes:InventoryChangeFailed": "Inventory of product {productId} (SKU: {productSkuId}) cannot be changed by {changedInventory} from {originalInventory}", - "EasyAbp.EShop.Products.ErrorCodes:NonexistentProductGroup": "The specified product group ({productGroupName}) is nonexistent.", - "EasyAbp.EShop.Products.ErrorCodes:ProductDetailHasBeenUsed": "ProductDetail {productDetailId} has been used.", - "EasyAbp.EShop.Products.ErrorCodes:ProductSkuCodeDuplicated": "Sku code {code} is duplicate for the product {productId}", - "EasyAbp.EShop.Products.ErrorCodes:ProductSkuDuplicated": "Sku {serializedAttributeOptionIds} is duplicate for the product {productId}" + "EasyAbp.EShop.Products:DuplicateCategoryUniqueName": "The category unique name '{uniqueName}' is duplicated.", + "EasyAbp.EShop.Products:DuplicatedProductUniqueName": "The product unique name '{uniqueName}' is duplicated.", + "EasyAbp.EShop.Products:InventoryChangeFailed": "Inventory of product {productId} (SKU: {productSkuId}) cannot be changed by {changedInventory} from {originalInventory}", + "EasyAbp.EShop.Products:NonexistentProductGroup": "The specified product group ({productGroupName}) is nonexistent.", + "EasyAbp.EShop.Products:ProductDetailHasBeenUsed": "ProductDetail {productDetailId} has been used.", + "EasyAbp.EShop.Products:ProductSkuCodeDuplicated": "Sku code {code} is duplicate for the product {productId}", + "EasyAbp.EShop.Products:ProductSkuDuplicated": "Sku {serializedAttributeOptionIds} is duplicate for the product {productId}", + "EasyAbp.EShop.Products:NotAllowedToGetCategoryListWithShowHidden": "You have no permission to get category list with hidden categories.", + "EasyAbp.EShop.Products:NotAllowedToGetProductListWithShowHidden": "You have no permission to get product list with hidden products.", + "EasyAbp.EShop.Products:ProductAttributeOptionsDeletionFailed": "Should ensure there are no SKUs using the attribute option which you want to delete.", + "EasyAbp.EShop.Products:ProductAttributesModificationFailed": "Should ensure SKUs are empty if you want to modify attributes of a product.", + "EasyAbp.EShop.Products:StaticProductCannotBeModified": "Cannot modify the static product: {productId}", + "EasyAbp.EShop.Products:StoreIsNotProductOwner": "Store {storeId} is not a owner of the product {productId}", + "EasyAbp.EShop.Products:InventoryInsufficient": "The inventory of the product {productId} (SKU: {productSkuId}) is insufficient, {quantity} are needed, but only {inventory}." } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductInventories/InventoryInsufficientException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductInventories/InventoryInsufficientException.cs index 16c8041d..e5002395 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductInventories/InventoryInsufficientException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductInventories/InventoryInsufficientException.cs @@ -5,9 +5,12 @@ namespace EasyAbp.EShop.Products.ProductInventories { public class InventoryInsufficientException : BusinessException { - public InventoryInsufficientException(Guid productId, Guid productSkuId, int quantity, int inventory) : base( - message: $"The inventory of the product {productId} (SKU: {productSkuId}) is insufficient, {quantity} are needed, but only {inventory}.") + public InventoryInsufficientException(Guid productId, Guid productSkuId, int quantity, int inventory) : base(ProductsErrorCodes.InventoryInsufficient) { + WithData(nameof(productId), productId); + WithData(nameof(productSkuId), productSkuId); + WithData(nameof(quantity), quantity); + WithData(nameof(inventory), inventory); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductsErrorCodes.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductsErrorCodes.cs index 59b59bf1..714cbc0a 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductsErrorCodes.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain.Shared/EasyAbp/EShop/Products/ProductsErrorCodes.cs @@ -9,6 +9,12 @@ public const string ProductDetailHasBeenUsed = "EasyAbp.EShop.Products:ProductDetailHasBeenUsed"; public const string ProductSkuCodeDuplicated = "EasyAbp.EShop.Products:ProductSkuCodeDuplicated"; public const string ProductSkuDuplicated = "EasyAbp.EShop.Products:ProductSkuDuplicated"; - //Add your business exception error codes here... + public const string NotAllowedToGetCategoryListWithShowHidden = "EasyAbp.EShop.Products:NotAllowedToGetCategoryListWithShowHidden"; + public const string NotAllowedToGetProductListWithShowHidden = "EasyAbp.EShop.Products:NotAllowedToGetProductListWithShowHidden"; + public const string ProductAttributeOptionsDeletionFailed = "EasyAbp.EShop.Products:ProductAttributeOptionsDeletionFailed"; + public const string ProductAttributesModificationFailed = "EasyAbp.EShop.Products:ProductAttributesModificationFailed"; + public const string StaticProductCannotBeModified = "EasyAbp.EShop.Products:StaticProductCannotBeModified"; + public const string StoreIsNotProductOwner = "EasyAbp.EShop.Products:StoreIsNotProductOwner"; + public const string InventoryInsufficient = "EasyAbp.EShop.Products:InventoryInsufficient"; } } diff --git a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs index be9de0d5..71cf9d44 100644 --- a/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs +++ b/modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Categories/DuplicateCategoryUniqueNameException.cs @@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Products.Categories { public class DuplicateCategoryUniqueNameException : BusinessException { - public DuplicateCategoryUniqueNameException(string uniqueName) : base("DuplicateCategoryUniqueName") + public DuplicateCategoryUniqueNameException(string uniqueName) : base(ProductsErrorCodes.DuplicateCategoryUniqueName) { WithData(nameof(uniqueName), uniqueName); } diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerDuplicatedException.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerDuplicatedException.cs index 0dca6466..8fd49165 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerDuplicatedException.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Application.Contracts/EasyAbp/EShop/Stores/StoreOwners/StoreOwnerDuplicatedException.cs @@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Stores.StoreOwners { public class StoreOwnerDuplicatedException : BusinessException { - public StoreOwnerDuplicatedException(Guid storeId, Guid ownerUserId) : base( - message: $"Owner {ownerUserId} is duplicate for the store {storeId}") + public StoreOwnerDuplicatedException(Guid storeId, Guid ownerUserId) : base(StoresErrorCodes.StoreOwnerDuplicated) { + WithData(nameof(storeId), storeId); + WithData(nameof(ownerUserId), ownerUserId); } } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json index 668a23ce..3657b4ec 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/Localization/Stores/en.json @@ -34,6 +34,7 @@ "TransactionAmount": "Amount", "CreateTransaction": "New", "EditTransaction": "Edit", - "TransactionDeletionConfirmationMessage": "Are you sure to delete the transaction {0}?" + "TransactionDeletionConfirmationMessage": "Are you sure to delete the transaction {0}?", + "EasyAbp.EShop.Stores:StoreOwnerDuplicated": "Owner {ownerUserId} is duplicate for the store {storeId}." } } \ No newline at end of file diff --git a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs index fbe78da7..83548d9b 100644 --- a/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs +++ b/modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Domain.Shared/EasyAbp/EShop/Stores/StoresErrorCodes.cs @@ -2,6 +2,6 @@ { public static class StoresErrorCodes { - //Add your business exception error codes here... + public const string StoreOwnerDuplicated = "EasyAbp.EShop.Stores:StoreOwnerDuplicated"; } } diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp/EShop/Plugins/Baskets/BasketItems/ProductSkuNotFoundException.cs b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp/EShop/Plugins/Baskets/BasketItems/ProductSkuNotFoundException.cs index 045ee7c9..b361b9a6 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp/EShop/Plugins/Baskets/BasketItems/ProductSkuNotFoundException.cs +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Application/EasyAbp/EShop/Plugins/Baskets/BasketItems/ProductSkuNotFoundException.cs @@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Plugins.Baskets.BasketItems { public class ProductSkuNotFoundException : BusinessException { - public ProductSkuNotFoundException(Guid productId, Guid productSkuId) : base( - message: $"Product {productId} (SKU: {productSkuId}) not found.") + public ProductSkuNotFoundException(Guid productId, Guid productSkuId) : base(BasketsErrorCodes.ProductSkuNotFound) { + WithData(nameof(productId), productId); + WithData(nameof(productSkuId), productSkuId); } } } \ No newline at end of file diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/BasketsErrorCodes.cs b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/BasketsErrorCodes.cs index b69a5e16..6bdd1cc5 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/BasketsErrorCodes.cs +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/BasketsErrorCodes.cs @@ -2,6 +2,6 @@ { public static class BasketsErrorCodes { - //Add your business exception error codes here... + public const string ProductSkuNotFound = "EasyAbp.EShop.Plugins.Baskets:ProductSkuNotFound"; } } diff --git a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/en.json b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/en.json index 8af054f4..23ab0c62 100644 --- a/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/en.json +++ b/plugins/Baskets/src/EasyAbp.EShop.Plugins.Baskets.Domain.Shared/EasyAbp/EShop/Plugins/Baskets/Localization/en.json @@ -27,6 +27,8 @@ "CreateBasketItem": "New", "EditBasketItem": "Edit", "BasketItemDeletionConfirmationMessage": "Are you sure to delete the basket item {0}?", - "SuccessfullyDeleted": "Successfully deleted" + "SuccessfullyDeleted": "Successfully deleted", + "EasyAbp.EShop.Plugins.Baskets:ProductSkuNotFound": "Product {productId} (SKU: {productSkuId}) not found.", + } } \ No newline at end of file diff --git a/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs b/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs index d59921d6..9a72709f 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponNotFoundOrHasExpiredException.cs @@ -1,11 +1,11 @@ using Volo.Abp; +using EasyAbp.EShop.Plugins.Coupons; namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount { public class CouponNotFoundOrHasExpiredException : BusinessException { - public CouponNotFoundOrHasExpiredException() : base("CouponNotFoundOrHasExpired", - "Coupon not found or has expired.") + public CouponNotFoundOrHasExpiredException() : base(CouponsErrorCodes.CouponNotFoundOrHasExpired) { } } diff --git a/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs b/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs index 22765152..048ef808 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/CouponTemplateNotFoundOrUnavailableException.cs @@ -1,11 +1,11 @@ using Volo.Abp; +using EasyAbp.EShop.Plugins.Coupons; namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount { public class CouponTemplateNotFoundOrUnavailableException : BusinessException { - public CouponTemplateNotFoundOrUnavailableException() : base("CouponTemplateNotFoundOrUnavailable", - "Coupon template not found or unavailable.") + public CouponTemplateNotFoundOrUnavailableException() : base(CouponsErrorCodes.CouponTemplateNotFoundOrUnavailable) { } } diff --git a/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs b/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs index 6afaf0b4..a9368b7c 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Orders.Plugins.Coupons/EasyAbp/EShop/Orders/Plugins/Coupons/OrderDiscount/OrderDoesNotMeetCouponUsageConditionException.cs @@ -1,11 +1,11 @@ using Volo.Abp; +using EasyAbp.EShop.Plugins.Coupons; namespace EasyAbp.EShop.Orders.Plugins.Coupons.OrderDiscount { public class OrderDoesNotMeetCouponUsageConditionException : BusinessException { - public OrderDoesNotMeetCouponUsageConditionException() : base("OrderDoesNotMeetCouponUsageCondition", - "Order does not meet the coupon usage condition.") + public OrderDoesNotMeetCouponUsageConditionException() : base(CouponsErrorCodes.OrderDoesNotMeetCouponUsageCondition) { } } diff --git a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs index 939b7887..d9c217d3 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Application.Contracts/EasyAbp/EShop/Plugins/Coupons/Coupons/CouponHasBeenOccupiedException.cs @@ -4,7 +4,7 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons { public class CouponHasBeenOccupiedException : BusinessException { - public CouponHasBeenOccupiedException() : base("CouponHasBeenOccupied", "Coupon has been occupied.") + public CouponHasBeenOccupiedException() : base(CouponsErrorCodes.CouponHasBeenOccupied) { } } diff --git a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsErrorCodes.cs b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsErrorCodes.cs index b7b0d167..d64abe67 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsErrorCodes.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/CouponsErrorCodes.cs @@ -2,6 +2,11 @@ { public static class CouponsErrorCodes { - //Add your business exception error codes here... + public const string CouponNotFoundOrHasExpired = "EasyAbp.EShop.Plugins.Coupons:CouponNotFoundOrHasExpired"; + public const string CouponTemplateNotFoundOrUnavailable = "EasyAbp.EShop.Plugins.Coupons:CouponTemplateNotFoundOrUnavailable"; + public const string OrderDoesNotMeetCouponUsageCondition = "EasyAbp.EShop.Plugins.Coupons:OrderDoesNotMeetCouponUsageCondition"; + public const string CouponHasBeenOccupied = "EasyAbp.EShop.Plugins.Coupons:CouponHasBeenOccupied"; + public const string InvalidCouponOrderId = "EasyAbp.EShop.Plugins.Coupons:InvalidCouponOrderId"; + public const string UserCouponQuantityExceedsLimit = "EasyAbp.EShop.Plugins.Coupons:UserCouponQuantityExceedsLimit"; } } diff --git a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Localization/en.json b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Localization/en.json index 1aa72c9e..1e2b5ae4 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Localization/en.json +++ b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain.Shared/EasyAbp/EShop/Plugins/Coupons/Localization/en.json @@ -48,6 +48,12 @@ "CouponDiscountedAmount": "Discounted amount", "CreateCoupon": "New", "EditCoupon": "Edit", - "CouponDeletionConfirmationMessage": "Are you sure to delete the coupon {0}?" + "CouponDeletionConfirmationMessage": "Are you sure to delete the coupon {0}?", + "EasyAbp.EShop.Plugins.Coupons:CouponNotFoundOrHasExpired": "Coupon not found or has expired.", + "EasyAbp.EShop.Plugins.Coupons:CouponTemplateNotFoundOrUnavailable": "Coupon template not found or unavailable.", + "EasyAbp.EShop.Plugins.Coupons:OrderDoesNotMeetCouponUsageCondition": "Order does not meet the coupon usage condition.", + "EasyAbp.EShop.Plugins.Coupons:CouponHasBeenOccupied": "Coupon has been occupied.", + "EasyAbp.EShop.Plugins.Coupons:InvalidCouponOrderId": "The expected order ID is {expectedOrderId}, but the actual order ID is {actualOrderId}.", + "EasyAbp.EShop.Plugins.Coupons:UserCouponQuantityExceedsLimit": "User's coupon quantity exceeds the limit: {maxQuantity}." } } \ No newline at end of file diff --git a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/InvalidCouponOrderIdException.cs b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/InvalidCouponOrderIdException.cs index f607eb9f..d10aa63c 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/InvalidCouponOrderIdException.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.Domain/EasyAbp/EShop/Plugins/Coupons/Coupons/InvalidCouponOrderIdException.cs @@ -5,9 +5,10 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons { public class InvalidCouponOrderIdException : BusinessException { - public InvalidCouponOrderIdException(Guid expectedOrderId, Guid? actualOrderId) : base("InvalidCouponOrderId", - $"The expected order ID is {expectedOrderId}, but the actual order ID is {actualOrderId}.") + public InvalidCouponOrderIdException(Guid expectedOrderId, Guid? actualOrderId) : base(CouponsErrorCodes.InvalidCouponOrderId) { + WithData(nameof(expectedOrderId), expectedOrderId); + WithData(nameof(actualOrderId), actualOrderId); } } } \ No newline at end of file diff --git a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore/EasyAbp/EShop/Plugins/Coupons/Coupons/UserCouponQuantityExceedsLimitException.cs b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore/EasyAbp/EShop/Plugins/Coupons/Coupons/UserCouponQuantityExceedsLimitException.cs index 2fd05cf4..672094d3 100644 --- a/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore/EasyAbp/EShop/Plugins/Coupons/Coupons/UserCouponQuantityExceedsLimitException.cs +++ b/plugins/Coupons/src/EasyAbp.EShop.Plugins.Coupons.EntityFrameworkCore/EasyAbp/EShop/Plugins/Coupons/Coupons/UserCouponQuantityExceedsLimitException.cs @@ -4,9 +4,9 @@ namespace EasyAbp.EShop.Plugins.Coupons.Coupons { public class UserCouponQuantityExceedsLimitException : BusinessException { - public UserCouponQuantityExceedsLimitException(int maxQuantity) : base("UserCouponQuantityExceedsLimit", - $"User's coupon quantity exceeds the limit: {maxQuantity}.") + public UserCouponQuantityExceedsLimitException(int maxQuantity) : base(CouponsErrorCodes.UserCouponQuantityExceedsLimit) { + WithData(nameof(maxQuantity), maxQuantity); } } } \ No newline at end of file