Preorder Validation Gherkin / BDD
Objective
Express Preorder creation rules with credit limit validation and pricing calculation in a clear format that Product, QA, Development, and Business teams can understand.
Business Rule
When creating a Preorder using “CREDIT” payment method, the system must calculate pricing correctly (subtotal, discount, PPN) and automatically deduct the final total from the customer’s available credit limit. Preorder must be blocked if credit limit is insufficient.
Feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Feature: Preorder Creation with Credit Limit Validation
As a Sales user
I want to create Preorder with proper credit limit check and pricing calculation
So that financial exposure is controlled and totals are accurate
Background:
Given user is logged in as Sales user
And customer "CUST-DEMO-078" has available credit limit of Rp 8000000
Scenario: Successfully create Preorder with CREDIT payment and credit limit deduction
When user creates a Preorder with the following details:
| customer | product | quantity |
| CUST-DEMO-078 | PROD-001 | 8 |
And selects payment method "CREDIT"
Then Preorder should be created successfully with status "SUBMITTED"
And final total should be calculated correctly including PPN and discount
And available credit limit should be deducted by the final total amount
Scenario: Preorder is blocked when credit limit is insufficient
Given customer "CUST-DEMO-078" has available credit limit of Rp 2000000
When user creates a Preorder with quantity 10 using payment method "CREDIT"
Then Preorder should be blocked
And credit limit exceeded warning should be displayed
Scenario Outline: Credit limit impact on Preorder
Given customer has available credit limit of <available_limit>
When user creates Preorder with total amount <order_total> using "CREDIT"
Then Preorder creation should be <result>
Examples:
| available_limit | order_total | result |
| 8000000 | 6000000 | successful |
| 2000000 | 6000000 | blocked |
Supporting Validation
- Verify pricing calculation (subtotal, discount, PPN, final total).
- Confirm credit limit is deducted only on successful Preorder with CREDIT method.
- Check error message and blocking behavior when limit is exceeded.
- Reconcile Preorder record, credit usage, and customer balance in database.