Skip to content
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

[OrderRefactor][Order][Checkout] Proceed to Payment - [Step1] Apply Promotion Code and Lock Product Stock #1121

Open
nashtech-vietvuhoang1 opened this issue Oct 3, 2024 · 0 comments

Comments

@nashtech-vietvuhoang1
Copy link

nashtech-vietvuhoang1 commented Oct 3, 2024

When the Checkout is fulfilled (ticket 1110):

  • Payment method is added
  • Shipment method is added
  • Shipment address is specified
  • Promotion Code is added (not required)
  • Total checkout amount is specified includes: Checkout Total amount, Tax, Shipment amount, Shipment Tax, discount amount

Customer now can continue to proceed to payment.
In this Step, following actions will be done:

  • Promotion code is actually applied, Checkout state will be PAYMENT_PROCESSING, progress attribute is PROMOTION_CODE_APPLIED
  • Product stock (quantity) is locked in Inventory, Checkout state will be PAYMENT_PROCESSING, progress attribute is STOCK_LOCKED
  • Create Checkout Payment object to process payment, Checkout state will be PAYMENT_PROCESSING, **progress ** field is PAYMENT_CREATED
    • Checkout attributes field will keep returned payment_id for further processing tracking

When any failure, error will be reported to last_error field (Error code and error message).

  • if applying Promotion code failed, Checkout state will be PAYMENT_PROCESSING, progress attribute is PROMOTION_CODE_APPLYING_FAILED, user is required to re-enter promotion code.
  • if any error of locking stock (Out Of Stock for example), Checkout state will be PAYMENT_PROCESSING, progress attribute is STOCK_LOCKING_FAILED, user is required to re-enter product quantity.
  • if calling to Payment Service failure, rollback promocode and rollback stock will be executed

Note: Consider Retry execution

Checkout ERD

checkout erd

Checkout Lifecycle Diagram

Checkout Lifecycle

Init Payment Flow

Payment Flow  Payment Initialization

@nashtech-vietvuhoang1 nashtech-vietvuhoang1 changed the title [OrderRefactor][Order][Checkout] Proceed to Payment [OrderRefactor][Order][Checkout] Proceed to Payment - [Step1] Apply Promotion Code and Lock Product Stock Oct 3, 2024
@nashtech-huyphamphu nashtech-huyphamphu self-assigned this Oct 14, 2024
@nashtech-huyphamphu nashtech-huyphamphu removed their assignment Nov 8, 2024
@duylv27 duylv27 moved this to 📋 Backlog in Yas's backlog Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants