Skip to Content
DeveloperBusiness LogicTest Case: Request to change total products for registration

Test Case: Request to change total products for registration

Objective

Verify that when a user (John) requests to change the “wanted quantity” of products, the system correctly updates the order, considering the current and invoiced products.

Preconditions

John has already placed orders #255 and #256. Both are invoiced, and they cannot be changed. The minimum quantity of K1 conference ticket is 1, and minimum daily rates is 2.

Order # 255 - Invoiced

ItemCodeProduct nameQuantityPriceLine total
K1Conference ticket (3 days)110001000
K2-1Small dinner1400400
K3Daily rate2200400

Order # 256 - Invoiced

ItemCodeProduct nameQuantityPriceLine total
K2-1Refund of Small dinner-1400-400
K2-2Large dinner1600600

Aggregate order now

ItemCodeProduct nameCurrent Quantity
K1Ticket1
K2-1Small dinner0
K2-2Large dinner1
K3Daily rate2
K4Sightseeing0
K5Guided walk0

If he wants to change his products, we will be dropping his editable orders, and place the minimum orderlines to correct it to the wanted quantity of products.

Cases

Request for sightseeing

As John would love to have a sightseeing instead of dinner, the frontend sends a json of the total products for Johns registration. It might look like:

{ "registrationId" : 23 "products": [ { "productId": "K1", "quantity": 1 }, { "productId": "K2-1", "quantity": 0 }, { "productId": "K2-2", "quantity": 0 }, { "productId": "K3", "quantity": 2 }, { "productId": "K4", "quantity": 1 }, { "productId": "K5", "quantity": 0 } ] }

Since both orders for the registration is invoiced, we will need to make a new order for John.

The (first) new order #257

ItemCodeProduct nameQuantityPriceLine total
K2-2Refund of Large dinner-1600-600
K4Sightseeing1300300

John never decides…

Before order 257 is invoiced, John redecides. He want a Guided walk instead of sightseeing. Since order 257 is not invoiced, we could just update it.

The frontend request might be like this:

{ "registrationId" : 23 "products": [ { "productId": "K1", "quantity": 1 }, { "productId": "K2-1", "quantity": 0 }, { "productId": "K2-2", "quantity": 0 }, { "productId": "K3", "quantity": 2 }, { "productId": "K4", "quantity": 0 }, { "productId": "K5", "quantity": 1 } ] }

and then the system should just change order 257 to this:

The (second) new order #257

ItemCodeProduct nameQuantityPriceLine total
K2-2Refund of Large dinner-1600-600
K5Guided walk1350300

No more coffee for John

John thinks the coffee is to expensive, so he tries to cancel the daily rates (which is including coffee.). As the validation on the front end did not catch it, the backend receives this:

{ "registrationId" : 23 "products": [ { "productId": "K1", "quantity": 1 }, { "productId": "K2-1", "quantity": 0 }, { "productId": "K2-2", "quantity": 0 }, { "productId": "K3", "quantity": 0 }, { "productId": "K4", "quantity": 0 }, { "productId": "K5", "quantity": 1 } ] }

However, since K3 is a mandatory product with a minimum of 2, it should be rejected. But the sum of all orders belonging to his registration has to aggregated to ensure that the sum quantity will be less than the minimum before rejecting.