as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
AWS
Documentation
Support
Contact Us
My Cases
Docs
Resources
Ecommerce Plug-ins
Publish
Connect

Checkout service testing

Summary

While the test cases below outline key testing scenarios, it should be supplemented with your organization's established testing best practices to ensure comprehensive coverage of any use cases not explicitly included in this test plan.

1. Test Case: Successful Checkout (201 Response)

Objective: Trigger successful cart checkout

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        },
        "promotions": [
          {
            "promotionAmount": {
              "amount": "0.01",
              "currencyCode": "USD"
            },
            "promotionDescription": "Discount"
          }
        ]
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.01",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "orderId": "generated-order-id"
}

2. Test Case: Unknown Shopping Trip (400 Error)

Objective: Trigger "UnknownShoppingTripException"

{
  "idempotentShoppingTripId": "invalid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "UnknownShoppingTripException"
}

3. Test Case: Invalid Request - Missing Required Fields (400 Error)

Objective: Trigger "InvalidRequestException" for missing storeId

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

Expected Response:

{
  "errorMsg": "InvalidRequestException"
}

4. Test Case: Cart Content Validation Failed - Empty Cart (400 Error)

Objective: Trigger "CartContentValidationFailedException" for empty lineItems

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "CartContentValidationFailedException"
}

5. Test Case: Cart Order Total Invalid - Missing Price (400 Error)

Objective: Trigger "CartOrderTotalInvalidException" for missing price

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "CartOrderTotalInvalidException"
}

6. Test Case: Shopping Trip Expired (400 Error)

Objective: Trigger "ShoppingTripExpiredException"

{
  "idempotentShoppingTripId": "expired-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ],
  "orderTotals": {
    "priceTotal": {
      "amount": "0.99",
      "currencyCode": "USD"
    },
    "subTotal": {
      "amount": "1.00",
      "currencyCode": "USD"
    },
    "promotionsTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    },
    "salesTaxTotal": {
      "amount": "0.00",
      "currencyCode": "USD"
    }
  }
}

Expected Response:

{
  "errorMsg": "ShoppingTripExpiredException"
}

7. Test Case: Authentication Exception (403 Error)

Objective: Trigger "AuthenticationException"

Test Method: Send request with invalid/expired IAM credentials

Expected Response:

{
  "errorMsg": "AuthenticationException"
}

8. Test Case: Internal Server Exception (500 Error)

Objective: Trigger "InternalServerException"

Test Method: This typically occurs during server issues or unhandled exceptions

Expected Response:

{
  "errorMsg": "InternalServerException"
}

Field Validation Test Cases

9. Test Case: Invalid Product ID Length (400 Error)

Objective: Test productId length validation (> 255 characters)

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "A".repeat(256),
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

10. Test Case: Invalid Currency Code (400 Error)

Objective: Test invalid currency code

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "INVALID"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

11. Test Case: Invalid Amount Format (400 Error)

Objective: Test invalid decimal precision (> 2 places)

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.999",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.000",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.000",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

12. Test Case: Invalid Quantity Value Length (400 Error)

Objective: Test quantity value length validation (> 10 characters)

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "12345678901",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "0.99",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}

13. Test Case: Invalid Description Pattern (400 Error)

Objective: Test depositAndFeeDescription pattern validation ^[0-9a-zA-Z_-]$.,'/@

{
  "idempotentShoppingTripId": "valid-shopping-trip-uuid",
  "storeId": "VALID_STORE_ID",
  "lineItems": [
    {
      "productId": "835143001047",
      "type": "SKU",
      "quantity": {
        "value": "1.0",
        "unit": "each"
      },
      "unitPrice": {
        "totalPrice": {
          "amount": "1.09",
          "currencyCode": "USD"
        },
        "price": {
          "amount": "1.00",
          "currencyCode": "USD"
        },
        "depositsAndFees": [
          {
            "depositAndFeeAmount": {
              "amount": "0.10",
              "currencyCode": "USD"
            },
            "depositAndFeeDescription": "Invalid#Description!",
            "salesTax": {
              "amount": "0.00",
              "currencyCode": "USD"
            }
          }
        ],
        "salesTax": {
          "amount": "0.00",
          "currencyCode": "USD"
        }
      }
    }
  ]
}