Skip to content

Test UI

An interactive browser-based tool for testing the calculatecost4 API endpoint.


What It Does

The test UI sends order payloads to both the new endpoint (api.villaecommerce.com/calculatecost4) and the original endpoint (resolveCoupon), then compares the results side by side.

For each order, it checks:

  • grandTotal, subTotal, deliveryFee
  • cartDiscount, bogoDiscount, voucherDiscount
  • shippingDiscount, expressShippingCost
  • totalWeight, isFreeShipping

Fields are displayed as MATCH or DIFF with color coding.


Using the Test UI

Local

Open test-ui/index.html from the villaCalculateCost4 repository in any browser.

Preset Orders

The UI includes 6 preset order payloads:

Preset Description
Simple 1 product, branch 1049, regular delivery
Multi-product 4 products, branch 1049, regular delivery
No Shipping 1 product, no shipping object
With Coupon 1 product with coupon code
Pickup 2 products, pickup (no delivery fee)
Large 11 products, Bangkok delivery

Custom Orders

Paste any JSON order payload into the request body textarea and click "Send to Both Endpoints".


Endpoint Configuration

The test UI defaults to:

  • New: https://api.villaecommerce.com/calculatecost4
  • Old: https://0hbymt9qbk.execute-api.ap-southeast-1.amazonaws.com/Prod/resolveCoupon

Both URLs are editable in the UI.