challenge
challenge copied to clipboard
[Challenge]: feat: payment strategy (Rodrigo Antas - Software engineer position)
- [ ] You have read the CONTRIBUTING.md
- [ ] For Terraform changes, you have read the Terraform Naming Conventions
- [ ] For Terraform changes, you have already executed the Terraform plan on this branch
- [x] The changes inside this pull request are organization-agnostic
Why?
This pull request is for the Challenge regarding the software engineer posistion. It introduces a new approach to handling payment processing and shipping rules in the order management system.
What?
- Implemented a strategy pattern to handle different payment processing rules based on product types.
- Added specific strategies for
Book
,Digital
,Membership
, andPhysical
products. - Updated the
Order
andOrderItem
class to use these strategies for payment processing. - Added unit tests to cover the new behavior introduced by the strategies.
- Created a CI for the unit tests.
Jira link:
How:
- Refactored the
Order
class to include apaymentStrategyMap
for handling different product types. - Created individual strategy classes for each product type that implement the
PaymentStrategy
interface. - Updated the
OrderItem
class to allow quantity adjustments with validation. - Added unit tests to ensure that each payment strategy is invoked correctly during payment processing.