diff --git a/src/Services/Coupon/Coupon.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs b/src/Services/Coupon/Coupon.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs index be870ff70..4d1807278 100644 --- a/src/Services/Coupon/Coupon.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs +++ b/src/Services/Coupon/Coupon.API/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs @@ -5,16 +5,20 @@ namespace Coupon.API.IntegrationEvents.Events { public record OrderStatusChangedToAwaitingCouponValidationIntegrationEvent : IntegrationEvent { - [JsonProperty] public int OrderId { get; private set; } - [JsonProperty] public string OrderStatus { get; private set; } - [JsonProperty] public string BuyerName { get; private set; } - [JsonProperty] public string Code { get; private set; } + + public OrderStatusChangedToAwaitingCouponValidationIntegrationEvent(int orderId, string orderStatus, string buyerName, string code) + { + OrderId = orderId; + OrderStatus = orderStatus; + BuyerName = buyerName; + Code = code; + } } } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs index 3b145dd99..5fd31477e 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommandHandler.cs @@ -37,7 +37,7 @@ public class CreateOrderCommandHandler // methods and constructor so validations, invariants and business logic // make sure that consistency is preserved across the whole aggregate var address = new Address(message.Street, message.City, message.State, message.Country, message.ZipCode); - var order = new Order(message.UserId, message.UserName, address, message.CardTypeId, message.CardNumber, message.CardSecurityNumber, message.CardHolderName, message.CardExpiration, "", 0); + var order = new Order(message.UserId, message.UserName, address, message.CardTypeId, message.CardNumber, message.CardSecurityNumber, message.CardHolderName, message.CardExpiration, message.CodeDiscount, message.Discount); foreach (var item in message.OrderItems) { diff --git a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs index eef8a3c48..6bf32d20f 100644 --- a/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs +++ b/src/Services/Ordering/Ordering.SignalrHub/IntegrationEvents/Events/OrderStatusChangedToAwaitingCouponValidationIntegrationEvent.cs @@ -3,15 +3,19 @@ namespace Ordering.SignalrHub.IntegrationEvents.Events; public record OrderStatusChangedToAwaitingCouponValidationIntegrationEvent : IntegrationEvent { - [JsonProperty] public int OrderId { get; private set; } - [JsonProperty] public string OrderStatus { get; private set; } - [JsonProperty] public string BuyerName { get; private set; } - [JsonProperty] public string Code { get; private set; } + + public OrderStatusChangedToAwaitingCouponValidationIntegrationEvent(int orderId, string orderStatus, string buyerName, string code) + { + OrderId = orderId; + OrderStatus = orderStatus; + BuyerName = buyerName; + Code = code; + } } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index b42b0bc28..86074c936 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -181,6 +181,7 @@ static class ServiceCollectionExtensions options.Scope.Add("basket"); options.Scope.Add("webshoppingagg"); options.Scope.Add("orders.signalrhub"); + options.Scope.Add("coupon"); }); return services; diff --git a/src/docker-compose.override.yml b/src/docker-compose.override.yml index cbe484434..db11c71e8 100644 --- a/src/docker-compose.override.yml +++ b/src/docker-compose.override.yml @@ -48,6 +48,7 @@ services: - MvcClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5100 - BasketApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5103 - OrderingApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5102 + - CouponApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5106 - MobileShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5120 - WebShoppingAggClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5121 - WebhooksApiClient=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5113 @@ -180,9 +181,13 @@ services: - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - EventBusUserName=${ESHOP_SERVICE_BUS_USERNAME} - EventBusPassword=${ESHOP_SERVICE_BUS_PASSWORD} + - UseCustomizationData=True - AzureServiceBusEnabled=False - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} + - IdentityUrl=http://identity-api + - IdentityUrlExternal=http://${ESHOP_EXTERNAL_DNS_NAME_OR_IP}:5105 + - UseLoadTest=${USE_LOADTEST:-False} - PORT=80 - PATH_BASE=/catalog-api - ConnectionString=mongodb://nosqldata:27017 @@ -210,6 +215,7 @@ services: - urls__basket=http://basket-api - urls__catalog=http://catalog-api - urls__orders=http://ordering-api + - urls__coupon=http://coupon-api - urls__identity=http://identity-api - urls__grpcBasket=http://basket-api:81 - urls__grpcCatalog=http://catalog-api:81 @@ -229,6 +235,7 @@ services: - urls__basket=http://basket-api - urls__catalog=http://catalog-api - urls__orders=http://ordering-api + - urls__coupon=http://coupon-api - urls__identity=http://identity-api - urls__grpcBasket=http://basket-api:81 - urls__grpcCatalog=http://catalog-api:81 diff --git a/src/docker-compose.prod.yml b/src/docker-compose.prod.yml index e8f5d5fbc..73e52822c 100644 --- a/src/docker-compose.prod.yml +++ b/src/docker-compose.prod.yml @@ -62,6 +62,7 @@ services: - MvcClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5100 #Local: You need to open your local dev-machine firewall at range 5100-5110. - BasketApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5103 - OrderingApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5102 + - CouponApiClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5106 - MobileShoppingAggClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5120 - WebShoppingAggClient=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5121 - UseCustomizationData=True @@ -151,6 +152,7 @@ services: - BasketUrl=http://basket-api/hc - IdentityUrl=http://identity-api/hc - PaymentUrl=http://payment-api/hc + - CouponUrl=http://coupon-api/hc - mvc=http://webmvc/hc - spa=http://webspa/hc - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} @@ -182,6 +184,9 @@ services: - ApplicationInsights__InstrumentationKey=${INSTRUMENTATION_KEY} - OrchestratorType=${ORCHESTRATOR_TYPE} - ConnectionString=mongodb://nosqldata:27017 + - identityUrl=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. + - IdentityUrlExternal=http://${ESHOP_PROD_EXTERNAL_DNS_NAME_OR_IP}:5105 + - UseLoadTest=${USE_LOADTEST:-False} ports: - "80" # The API Gateway redirects and access through the internal port (80). @@ -231,6 +236,7 @@ services: - urls__basket=http://basket-api - urls__catalog=http://catalog-api - urls__orders=http://ordering-api + - urls__coupon=http://coupon-api - urls__identity=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. ports: - "80" # Important: In a production environment your should remove the external port (5120) kept here for microservice debugging purposes. @@ -242,6 +248,7 @@ services: - urls__basket=http://basket-api - urls__catalog=http://catalog-api - urls__orders=http://ordering-api + - urls__coupon=http://coupon-api - urls__identity=http://identity-api #Local: You need to open your local dev-machine firewall at range 5100-5110. ports: - "80" # Important: In a production environment your should remove the external port (5121) kept here for microservice debugging purposes. diff --git a/src/docker-compose.yml b/src/docker-compose.yml index 5af0a255d..fd2ab91c1 100644 --- a/src/docker-compose.yml +++ b/src/docker-compose.yml @@ -103,6 +103,7 @@ services: - ordering-api - catalog-api - basket-api + - coupon-api webshoppingagg: image: ${REGISTRY:-eshop}/webshoppingagg:${PLATFORM:-linux}-${TAG:-latest} @@ -117,6 +118,7 @@ services: - ordering-api - catalog-api - basket-api + - coupon-api ordering-signalrhub: image: ${REGISTRY:-eshop}/ordering.signalrhub:${PLATFORM:-linux}-${TAG:-latest} @@ -131,6 +133,7 @@ services: - ordering-api - catalog-api - basket-api + - coupon-api webstatus: image: ${REGISTRY:-eshop}/webstatus:${PLATFORM:-linux}-${TAG:-latest} diff --git a/src/eShopOnContainers-ServicesAndWebApps.sln b/src/eShopOnContainers-ServicesAndWebApps.sln index e7caee557..f95fc1253 100644 --- a/src/eShopOnContainers-ServicesAndWebApps.sln +++ b/src/eShopOnContainers-ServicesAndWebApps.sln @@ -454,8 +454,8 @@ Global {F16E3C6A-1C94-4EAB-BE91-099618060B68}.AppStore|x64.Build.0 = Release|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.AppStore|x86.ActiveCfg = Release|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.AppStore|x86.Build.0 = Release|Any CPU - {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|Any CPU.ActiveCfg = Release|Any CPU - {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|Any CPU.Build.0 = Release|Any CPU + {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|Any CPU.Build.0 = Debug|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|ARM.ActiveCfg = Debug|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|ARM.Build.0 = Debug|Any CPU {F16E3C6A-1C94-4EAB-BE91-099618060B68}.Debug|iPhone.ActiveCfg = Debug|Any CPU