-
Notifications
You must be signed in to change notification settings - Fork 0
feat: separate payment domain #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
using Bmb.Domain.Core.ValueObjects; | ||
|
||
namespace Bmb.Payment.Application.UseCases; | ||
|
||
public interface ICreatePaymentUseCase | ||
{ | ||
Task<Bmb.Domain.Core.Entities.Payment?> Execute(Guid orderId, PaymentType paymentType); | ||
Task<Domain.Entities.Payment?> Execute(Guid orderId, Domain.ValueObjects.PaymentType paymentType); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
using Bmb.Domain.Core.ValueObjects; | ||
using Bmb.Payment.Domain.ValueObjects; | ||
|
||
namespace Bmb.Payment.Application.UseCases; | ||
|
||
public interface IUpdatePaymentStatusUseCase | ||
{ | ||
Task<bool> Execute(Bmb.Domain.Core.Entities.Payment? payment, PaymentStatus status); | ||
Task<bool> Execute(Domain.Entities.Payment? payment, PaymentStatus status); | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Bmb.Domain.Core.ValueObjects; | ||
using PaymentStatus = Bmb.Payment.Domain.ValueObjects.PaymentStatus; | ||
using ValueObjects_PaymentStatus = Bmb.Payment.Domain.ValueObjects.PaymentStatus; | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Simplify PaymentStatus references to improve clarity The current setup has multiple PaymentStatus references which could lead to confusion:
This might indicate a violation of DDD bounded contexts or unnecessary complexity. Consider:
-using Bmb.Domain.Core.ValueObjects;
-using PaymentStatus = Bmb.Payment.Domain.ValueObjects.PaymentStatus;
-using ValueObjects_PaymentStatus = Bmb.Payment.Domain.ValueObjects.PaymentStatus;
+using Bmb.Payment.Domain.ValueObjects;
|
||
|
||
namespace Bmb.Payment.Domain.Contracts; | ||
|
||
public interface IPaymentGateway | ||
{ | ||
Task<Entities.Payment> CreatePaymentAsync(OrderDto order); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace OrderDto with domain entity in gateway interface Using Consider:
-Task<Entities.Payment> CreatePaymentAsync(OrderDto order);
+Task<Entities.Payment> CreatePaymentAsync(Order order);
|
||
|
||
Task<ValueObjects_PaymentStatus?> GetPaymentStatusAsync(string paymentId); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Bmb.Domain.Core.ValueObjects; | ||
using PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType; | ||
using ValueObjects_PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType; | ||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Simplify PaymentType imports to avoid confusion The current import structure with multiple PaymentType references and aliases creates unnecessary complexity. Consider consolidating the PaymentType references to avoid confusion. -using Bmb.Domain.Core.ValueObjects;
-using PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType;
-using ValueObjects_PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType;
+using Bmb.Payment.Domain.ValueObjects;
|
||
|
||
namespace Bmb.Payment.Domain.Contracts; | ||
|
||
public interface IPaymentGatewayFactoryMethod | ||
{ | ||
IPaymentGateway Create(ValueObjects_PaymentType paymentType); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||||||||
using Bmb.Domain.Core.ValueObjects; | ||||||||||||
using PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType; | ||||||||||||
using ValueObjects_PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType; | ||||||||||||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Simplify import statements to avoid confusion The current import statements create unnecessary complexity with aliases:
Consider this simplified approach: using Bmb.Domain.Core.ValueObjects;
-using PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType;
-using ValueObjects_PaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType;
+using DomainPaymentType = Bmb.Payment.Domain.ValueObjects.PaymentType; 📝 Committable suggestion
Suggested change
|
||||||||||||
|
||||||||||||
namespace Bmb.Payment.Domain.Contracts; | ||||||||||||
|
||||||||||||
public interface IPaymentRepository | ||||||||||||
{ | ||||||||||||
Task<Entities.Payment> SaveAsync(Entities.Payment payment); | ||||||||||||
|
||||||||||||
Task<Entities.Payment?> GetPaymentAsync(PaymentId paymentId); | ||||||||||||
|
||||||||||||
Task<Entities.Payment?> GetPaymentAsync(string externalReference, ValueObjects_PaymentType paymentType); | ||||||||||||
|
||||||||||||
Task<bool> UpdatePaymentStatusAsync(Entities.Payment payment); | ||||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
Refactor cross-domain dependency to respect bounded contexts
The verification reveals a significant coupling between Orders and Payment domains:
OrderDto
is defined in Payment.Domain but represents an Order entityIOrdersGateway
interface is also defined in Payment.Domain but implemented in Orders.GatewayPaymentId
) mixed with order dataRecommendations:
OrderDto
andIOrdersGateway
to a shared kernel or contracts projectOrderDto
(in Orders domain) andPaymentOrderDto
(in Payment domain)🔗 Analysis chain
Review the domain dependency between Orders and Payment
While the namespace change from
Core
toDomain
better reflects DDD principles, the direct reference fromOrders.Gateway
toPayment.Domain
might indicate a coupling between bounded contexts. Consider if this dependency could be inverted or isolated through an anti-corruption layer or domain events.Let's analyze the usage of Payment.Domain types in the Orders context:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1197
Script:
Length of output: 2022
Script:
Length of output: 2621
Script:
Length of output: 2094