Skip to content

Conversation

@gustaavik
Copy link
Member

This pull request introduces several changes across the codebase to enhance multi-currency support, streamline Docker commands, and improve test coverage. The most significant updates include refactoring currency handling in the checkout and payment processes, updating Docker commands for compatibility, and modifying database configurations. Below is a categorized summary of the most important changes:

Multi-Currency Enhancements:

  • Refactored ProcessPayment in internal/application/usecase/checkout_usecase.go to use the order's currency instead of the default currency for payment validation and processing. This ensures accurate currency handling throughout the payment flow. [1] [2] [3] [4] [5]
  • Added getPriceInCurrency method in internal/application/usecase/checkout_usecase.go to dynamically retrieve or convert variant prices based on the checkout's currency.
  • Updated GetOrCreateCheckoutBySessionIDWithCurrency in internal/application/usecase/checkout_usecase.go to allow creating checkouts with a specified currency, including validation of enabled currencies.
  • Revised test cases in internal/application/usecase/discount_usecase_test.go to include currency information in order creation, ensuring multi-currency compatibility in discount logic. [1] [2] [3] [4] [5] [6]

Docker Command Updates:

  • Updated Makefile to replace docker-compose commands with docker compose for compatibility with newer Docker versions. This change applies to database operations (db-start, db-stop, etc.) and application stack commands (run-docker, stop-docker). [1] [2]

Database Configuration:

  • Changed the default PostgreSQL database name from commercify to commercifydb in docker-compose.yml to align with updated naming conventions. [1] [2]

Postman Test Adjustments:

  • Modified Postman tests in docs/commercify_checkout_postman_tests.json to remove the "+" prefix from phone numbers, ensuring consistency in test data formatting. [1] [2]

API Documentation Updates:

  • Expanded docs/product_api_examples.md to include detailed examples for setting, retrieving, and removing multi-currency variant prices, along with benefits and use cases for multi-currency pricing.

- Updated order and checkout creation to include currency as a parameter.
- Implemented functions to set, remove, and retrieve variant prices in multiple currencies.
- Enhanced product variant entity to manage prices in different currencies.
- Modified API handlers to support new currency-related endpoints for variant price management.
- Updated DTOs to include currency information for checkout and product variant responses.
- Added validation for currency and price inputs across relevant use cases and handlers.
- Updated order processing to use order-specific currency instead of default currency.
- Modified payment services to accept currency as a parameter for refunds, captures, and cancellations.
- Enhanced checkout and order use cases to handle currency correctly.
- Added currency field to the Order entity and updated related database migrations.
- Adjusted payment service interfaces and implementations for consistency with currency handling.
- Updated mock payment service to simulate currency behavior.
- Refactored checkout handler to streamline order creation from checkout sessions.
…irectly and improve unauthorized access handling in order handler
@gustaavik gustaavik merged commit 2df2a13 into main Jun 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants