# WooNooW Testing Checklist

**Last Updated:** 2025-10-28 15:58 GMT+7  
**Status:** Ready for Testing

---

## 📋 How to Use This Checklist

1. **Test each item** in order
2. **Mark with [x]** when tested and working
3. **Report issues** if something doesn't work
4. **I'll fix** and update this same document
5. **Re-test** the fixed items

**One document, one source of truth!**

---

## 🧪 Testing Checklist

### A. Loading States ✅ (Polish Feature)

- [x] Order Edit page shows loading state
- [x] Order Detail page shows inline loading
- [x] Orders List shows table skeleton
- [x] Loading messages are translatable
- [x] Mobile responsive
- [x] Desktop responsive
- [x] Full-screen overlay works

**Status:** ✅ All tested and working

---

### B. Payment Channels ✅ (Polish Feature)

- [x] BACS shows bank accounts (if configured)
- [x] Other gateways show gateway name
- [x] Payment selection works
- [x] Order creation with channel works
- [x] Order edit preserves channel
- [x] Third-party gateway can add channels
- [x] Order with third-party channel displays correctly

**Status:** ✅ All tested and working

---

### C. Translation Loading Warning (Bug Fix)

- [x] Reload WooNooW admin page
- [x] Check `wp-content/debug.log`
- [x] Verify NO translation warnings appear

**Expected:** No PHP notices about `_load_textdomain_just_in_time`

**Files Changed:**
- `woonoow.php` - Added `load_plugin_textdomain()` on `init`
- `includes/Compat/NavigationRegistry.php` - Changed to `init` hook

---

### D. Order Detail Page - Payment & Shipping Display (Bug Fix)

- [x] Open existing order (e.g., Order #75 with `bacs_dwindi-ramadhana_0`)
- [x] Check **Payment** field
  - Should show channel title (e.g., "Bank BCA - Dwindi Ramadhana (1234567890)")
  - OR gateway title (e.g., "Bank Transfer")
  - OR "No payment method" if empty
  - Should NOT show "No payment method" when channel exists
- [x] Check **Shipping** field
  - Should show shipping method title (e.g., "Free Shipping")
  - OR "No shipping method" if empty
  - Should NOT show ID like "free_shipping"

**Expected for Order #75:**
- Payment: "Bank BCA - Dwindi Ramadhana (1234567890)" ✅ (channel title)
- Shipping: "Free Shipping" ✅ (not "free_shipping")

**Files Changed:**
- `includes/Api/OrdersController.php` - Fixed methods:
  - `get_payment_method_title()` - Handles channel IDs
  - `get_shipping_method_title()` - Uses `get_name()` with fallback
  - `get_shipping_method_id()` - Returns `method_id:instance_id` format
  - `shippings()` API - Uses `$m->title` instead of `get_method_title()`

**Fix Applied:** ✅ shippings() API now returns user's custom label

---

### E. Order Edit Page - Auto-Select (Bug Fix)

- [x] Edit existing order with payment method
- [x] Payment method dropdown should be **auto-selected**
- [x] Shipping method dropdown should be **auto-selected**

**Expected:**
- Payment dropdown shows current payment method selected
- Shipping dropdown shows current shipping method selected

**Files Changed:**
- `includes/Api/OrdersController.php` - Added `payment_method_id` and `shipping_method_id`
- `admin-spa/src/routes/Orders/partials/OrderForm.tsx` - Use IDs for auto-select

---

### F. Customer Note Storage (Bug Fix)

**Test 1: Create Order with Note**
- [x] Go to Orders → New Order
- [x] Fill in order details
- [x] Add text in "Customer note (optional)" field
- [x] Save order
- [x] View order detail
- [x] Customer note should appear in order details

**Test 2: Edit Order Note**
- [x] Edit the order you just created
- [x] Customer note field should be **pre-filled** with existing note
- [x] Change the note text
- [x] Save order
- [x] View order detail
- [x] Note should show updated text

**Expected:**
- Customer note saves on create ✅
- Customer note displays in detail view ✅
- Customer note pre-fills in edit form ✅
- Customer note updates when edited ✅

**Files Changed:**
- `includes/Api/OrdersController.php` - Fixed `customer_note` key and allow empty notes
- `admin-spa/src/routes/Orders/partials/OrderForm.tsx` - Initialize from `customer_note`
- `admin-spa/src/routes/Orders/Detail.tsx` - Added customer note card display

**Status:** ✅ Fixed (2025-10-28 15:30)

---

### G. WooCommerce Integration (General)

- [x] Payment gateways load correctly
- [x] Shipping zones load correctly
- [x] Enabled/disabled status respected
- [x] No conflicts with WooCommerce
- [x] HPOS compatible

**Status:** ✅ Fixed (2025-10-28 15:50) - Disabled methods now filtered

**Files Changed:**
- `includes/Api/OrdersController.php` - Added `is_enabled()` check for shipping and payment methods

---

### H. OrderForm UX Improvements ⭐ (New Features)

**H1. Conditional Address Fields (Virtual Products)**
- [x] Create order with only virtual/downloadable products
- [x] Billing address fields (Address, City, Postcode, Country, State) should be **hidden**
- [x] Only Name, Email, Phone should show
- [x] Blue info box should appear: "Digital products only - shipping not required"
- [x] Shipping method dropdown should be **hidden**
- [x] "Ship to different address" checkbox should be **hidden**
- [x] Add a physical product to cart
- [x] Address fields should **appear**
- [x] Shipping method should **appear**

**H2. Strike-Through Price Display**
- [x] Add product with sale price to order (e.g., Regular: Rp199.000, Sale: Rp129.000)
- [x] Product dropdown should show: "Rp129.000 ~~Rp199.000~~"
- [x] In cart, should show: "**Rp129.000** ~~Rp199.000~~" (red sale price, gray strike-through)
- [x] Works in both Create and Edit modes

**H3. Register as Member Checkbox**
- [x] Create new order with new customer email
- [x] "Register customer as site member" checkbox should appear
- [x] Check the checkbox
- [x] Save order
- [ ] Customer should receive welcome email with login credentials
- [ ] Customer should be able to login to site
- [x] Order should be linked to customer account
- [x] If email already exists, order should link to existing user

**H4. Customer Autofill by Email**
- [x] Create new order
- [x] Enter existing customer email (e.g., customer@example.com)
- [x] Tab out of email field (blur)
- [x] All fields should **autofill automatically**:
  - First name, Last name, Phone
  - Billing: Address, City, Postcode, Country, State
  - Shipping: All fields (if different from billing)
- [x] "Ship to different address" should auto-check if shipping differs
- [x] Enter non-existent email
- [x] Nothing should happen (silent, no error)

**Expected:**
- Virtual products hide address fields ✅
- Sale prices show with strike-through ✅
- Register member creates WordPress user ✅
- Customer autofill saves time ✅

**Files Changed:**
- `includes/Api/OrdersController.php`:
  - Added `virtual`, `downloadable`, `regular_price`, `sale_price` to order items API
  - Added `register_as_member` logic in `create()` method
  - Added `search_customers()` endpoint
- `admin-spa/src/routes/Orders/partials/OrderForm.tsx`:
  - Added `hasPhysicalProduct` check
  - Conditional rendering for address/shipping fields
  - Strike-through price display
  - Register member checkbox
  - Customer autofill on email blur

**Status:** ✅ Implemented (2025-10-28 15:45) - Awaiting testing

---

### I. Order Detail Page Improvements (New Features)

**I1. Hide Shipping Card for Virtual Products**
- [x] View order with only virtual/downloadable products
- [x] Shipping card should be **hidden**
- [x] Billing card should still show
- [x] Customer note card should show (if note exists)
- [x] View order with physical products
- [x] Shipping card should **appear**

**I2. Customer Note Display**
- [x] Create order with customer note
- [x] View order detail
- [x] Customer Note card should appear in right column
- [x] Note text should display correctly
- [ ] Multi-line notes should preserve formatting

**Expected:**
- Shipping card hidden for virtual-only orders ✅
- Customer note displays in dedicated card ✅

**Files Changed:**
- `admin-spa/src/routes/Orders/Detail.tsx`:
  - Added `isVirtualOnly` check
  - Conditional shipping card rendering
  - Added customer note card

**Status:** ✅ Implemented (2025-10-28 15:35) - Awaiting testing

---

### J. Disabled Methods Filter (Bug Fix)

**J1. Disabled Shipping Methods**
- [x] Go to WooCommerce → Settings → Shipping
- [x] Disable "Free Shipping" method
- [x] Create new order
- [x] Shipping dropdown should NOT show "Free Shipping"
- [x] Re-enable "Free Shipping"
- [x] Create new order
- [x] Shipping dropdown should show "Free Shipping"

**J2. Disabled Payment Gateways**
- [x] Go to WooCommerce → Settings → Payments
- [x] Disable "Bank Transfer (BACS)" gateway
- [x] Create new order
- [x] Payment dropdown should NOT show "Bank Transfer"
- [x] Re-enable "Bank Transfer"
- [x] Create new order
- [x] Payment dropdown should show "Bank Transfer"

**Expected:**
- Only enabled methods appear in dropdowns ✅
- Matches WooCommerce frontend behavior ✅

**Files Changed:**
- `includes/Api/OrdersController.php`:
  - Added `is_enabled()` check in `shippings()` method
  - Added enabled check in `payments()` method

**Status:** ✅ Implemented (2025-10-28 15:50) - Awaiting testing

---

## 📊 Progress Summary

**Completed & Tested:**
- ✅ Loading States (7/7)
- ✅ BACS Channels (1/6 - main feature working)
- ✅ Translation Warning (3/3)
- ✅ Order Detail Display (2/2)
- ✅ Order Edit Auto-Select (2/2)
- ✅ Customer Note Storage (6/6)

**Implemented - Awaiting Testing:**
- 🔧 OrderForm UX Improvements (0/25)
  - H1: Conditional Address Fields (0/8)
  - H2: Strike-Through Price (0/3)
  - H3: Register as Member (0/7)
  - H4: Customer Autofill (0/7)
- 🔧 Order Detail Improvements (0/8)
  - I1: Hide Shipping for Virtual (0/5)
  - I2: Customer Note Display (0/3)
- 🔧 Disabled Methods Filter (0/8)
  - J1: Disabled Shipping (0/4)
  - J2: Disabled Payment (0/4)
- 🔧 WooCommerce Integration (0/3)

**Total:** 21/62 items tested (34%)

---

## 🐛 Issues Found

*Report issues here as you test. I'll fix and update this document.*

### Issue Template:
```
**Issue:** [Brief description]
**Test:** [Which test item]
**Expected:** [What should happen]
**Actual:** [What actually happened]
**Screenshot:** [If applicable]
```

---

## 🔧 Fixes & Features Applied

### Fix 1: Translation Loading Warning ✅
**Date:** 2025-10-28 13:00  
**Status:** ✅ Tested and working  
**Files:** `woonoow.php`, `includes/Compat/NavigationRegistry.php`

### Fix 2: Order Detail Display ✅
**Date:** 2025-10-28 13:30  
**Status:** ✅ Tested and working  
**Files:** `includes/Api/OrdersController.php`

### Fix 3: Order Edit Auto-Select ✅
**Date:** 2025-10-28 14:00  
**Status:** ✅ Tested and working  
**Files:** `includes/Api/OrdersController.php`, `admin-spa/src/routes/Orders/partials/OrderForm.tsx`

### Fix 4: Customer Note Storage ✅
**Date:** 2025-10-28 15:30  
**Status:** ✅ Fixed and working  
**Files:** `includes/Api/OrdersController.php`, `admin-spa/src/routes/Orders/partials/OrderForm.tsx`, `admin-spa/src/routes/Orders/Detail.tsx`

### Feature 5: OrderForm UX Improvements ⭐
**Date:** 2025-10-28 15:45  
**Status:** 🔧 Implemented, awaiting testing  
**Features:**
- Conditional address fields for virtual products
- Strike-through price display for sale items
- Register as member checkbox
- Customer autofill by email
**Files:** `includes/Api/OrdersController.php`, `admin-spa/src/routes/Orders/partials/OrderForm.tsx`

### Feature 6: Order Detail Improvements ⭐
**Date:** 2025-10-28 15:35  
**Status:** 🔧 Implemented, awaiting testing  
**Features:**
- Hide shipping card for virtual-only orders
- Customer note card display
**Files:** `admin-spa/src/routes/Orders/Detail.tsx`

### Fix 7: Disabled Methods Filter
**Date:** 2025-10-28 15:50  
**Status:** 🔧 Implemented, awaiting testing  
**Files:** `includes/Api/OrdersController.php`

---

## 📝 Notes

### Testing Priority
1. **High Priority:** Test sections H, I, J (new features & fixes)
2. **Medium Priority:** Complete section G (WooCommerce integration)
3. **Low Priority:** Retest sections A-F (already working)

### Important
- Keep WP_DEBUG enabled during testing
- Test on fresh orders to avoid cache issues
- Test both Create and Edit modes
- Test with both virtual and physical products

### API Endpoints Added
- `GET /wp-json/woonoow/v1/customers/search?email=xxx` - Customer autofill

---

## 🎯 Quick Test Scenarios

### Scenario 1: Virtual Product Order
1. Create order with virtual product only
2. Check: Address fields hidden ✓
3. Check: Shipping hidden ✓
4. Check: Blue info box appears ✓
5. View detail: Shipping card hidden ✓

### Scenario 2: Sale Product Order
1. Create order with sale product
2. Check: Strike-through price in dropdown ✓
3. Check: Red sale price in cart ✓
4. Edit order: Still shows strike-through ✓

### Scenario 3: New Customer Registration
1. Create order with new email
2. Check: "Register as member" checkbox ✓
3. Submit with checkbox checked
4. Check: Customer receives email ✓
5. Check: Customer can login ✓

### Scenario 4: Existing Customer Autofill
1. Create order
2. Enter existing customer email
3. Tab out of field
4. Check: All fields autofill ✓
5. Check: Shipping auto-checks if different ✓

---

## 🔄 Phase 3: Payment Actions (October 28, 2025)

### H. Retry Payment Feature

#### Test 1: Retry Payment - Pending Order
- [x] Create order with Tripay BNI VA
- [x] Order status: Pending
- [x] View order detail
- [x] Check: "Retry Payment" button visible in Payment Instructions card
- [x] Click "Retry Payment"
- [x] Check: Confirmation dialog appears
- [x] Confirm retry
- [x] Check: Loading spinner shows
- [x] Check: Success toast "Payment processing retried"
- [x] Check: Order data refreshes
- [x] Check: New payment code generated
- [x] Check: Order note added "Payment retry requested via WooNooW Admin"

#### Test 2: Retry Payment - On-Hold Order
- [x] Create order with payment gateway
- [x] Change status to On-Hold
- [x] View order detail
- [x] Check: "Retry Payment" button visible
- [x] Click retry
- [x] Check: Works correctly
Note: the load time is too long, it should be checked and fixed in the next update

#### Test 3: Retry Payment - Failed Order
- [x] Create order with payment gateway
- [x] Change status to Failed
- [x] View order detail
- [x] Check: "Retry Payment" button visible
- [x] Click retry
- [x] Check: Works correctly
Note: the load time is too long, it should be checked and fixed in the next update. same with test 2. about 20-30 seconds to load

#### Test 4: Retry Payment - Completed Order
- [x] Create order with payment gateway
- [x] Change status to Completed
- [x] View order detail
- [x] Check: "Retry Payment" button NOT visible
- [x] Reason: Cannot retry completed orders

#### Test 5: Retry Payment - No Payment Method
- [x] Create order without payment method
- [x] View order detail
- [x] Check: No Payment Instructions card (no payment_meta)
- [x] Check: No retry button

#### Test 6: Retry Payment - Error Handling
- [x] Disable Tripay API (wrong credentials)
- [x] Create order with Tripay
- [x] Click "Retry Payment"
- [x] Check: Error logged
- [x] Check: Order note added with error
- [x] Check: Order still exists
Note: the toast notice = success (green), not failed (red)

#### Test 7: Retry Payment - Expired Payment
- [x] Create order with Tripay (wait for expiry or use old order)
- [x] Payment code expired
- [x] Click "Retry Payment"
- [x] Check: New payment code generated
- [x] Check: New expiry time set
- [x] Check: Amount unchanged

#### Test 8: Retry Payment - Multiple Retries
- [x] Create order with payment gateway
- [x] Click "Retry Payment" (1st time)
- [x] Wait for completion
- [x] Click "Retry Payment" (2nd time)
- [x] Check: Each retry creates new transaction
- [x] Check: Multiple order notes added

#### Test 9: Retry Payment - Permission Check - skip for now
- [ ] Login as Shop Manager
- [ ] View order detail
- [ ] Check: "Retry Payment" button visible
- [ ] Click retry
- [ ] Check: Works (has manage_woocommerce capability)
- [ ] Login as Customer
- [ ] Try to access order detail
- [ ] Check: Cannot access (no permission)

#### Test 10: Retry Payment - Mobile Responsive
- [x] Open order detail on mobile
- [x] Check: "Retry Payment" button visible
- [x] Check: Button responsive (proper size)
- [x] Check: Confirmation dialog works
- [x] Check: Toast notifications visible

---

**Next:** Test Retry Payment feature and report any issues found.
