Adjust Charge Testing
- Summary
- 1. Test Case: Successful Adjustment - APPROVED (200 Response)
- 2. Test Case: Charge Declined (200 Response)
- 3. Test Case: Pending Status (200 Response)
- 4. Test Case: Unknown Shopping Trip (400 Error)
- 5. Test Case: Bad Request - Invalid Store ID (400 Error)
- 6. Test Case: Bad Request - Missing Required Fields (400 Error)
- 7. Test Case: Bad Request - Invalid Data Types (400 Error)
- 8. Test Case: Bad Request - Invalid Currency Code (400 Error)
- 9. Test Case: Rate Limiting (429 Error)
- 10. Test Case: Server Error (500 Error)
- 11. Test Case: Service Unavailable (503 Error)
- 12. Test Case: StoreId Format Validation (400 Error)
- 13. Test Case: ShoppingTripId Format Validation (400 Error)
- 14. Test Case: Field Length Validation (400 Error)
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 Adjustment - APPROVED (200 Response)
Objective: Trigger successful charge adjustment with APPROVED status
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "valid-shopping-trip-uuid",
"amount": {
"amount": 15.99,
"code": "USD"
}
}
Expected Response:
{
"status": "APPROVED",
"authorizedAmount": {
"amount": 15.99,
"code": "USD"
}
}
2. Test Case: Charge Declined (200 Response)
Objective: Trigger DECLINED status (insufficient funds, card declined, etc.)
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "declined-payment-trip-uuid",
"amount": {
"amount": 999999.99,
"code": "USD"
}
}
Expected Response:
{
"status": "DECLINED",
"authorizedAmount": {
"amount": 0,
"code": "USD"
}
}
3. Test Case: Pending Status (200 Response)
Objective: Trigger PENDING status requiring retry
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "pending-processing-trip-uuid",
"amount": {
"amount": 25.50,
"code": "USD"
}
}
Expected Response:
{
"status": "PENDING",
"authorizedAmount": {
"amount": 25.50,
"code": "USD"
}
}
4. Test Case: Unknown Shopping Trip (400 Error)
Objective: Trigger "UnknownShoppingTrip" error
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "invalid-shopping-trip-uuid",
"amount": {
"amount": 10.00,
"code": "USD"
}
}
Expected Response:
{
"errorMsg": "UnknownShoppingTrip"
}
5. Test Case: Bad Request - Invalid Store ID (400 Error)
Objective: Trigger "BadRequestException" for invalid storeId
{
"storeId": "INVALID_STORE_ID",
"shoppingTripId": "valid-shopping-trip-uuid",
"amount": {
"amount": 10.00,
"code": "USD"
}
}
Expected Response:
{
"errorMsg": "BadRequestException - Invalid storeId"
}
6. Test Case: Bad Request - Missing Required Fields (400 Error)
Objective: Trigger "BadRequestException" for missing required fields
{
"storeId": "VALID_STORE_ID"
// Missing shoppingTripId and amount
}
Expected Response:
{
"errorMsg": "BadRequestException - Missing required fields"
}
7. Test Case: Bad Request - Invalid Data Types (400 Error)
Objective: Trigger "BadRequestException" for incorrect data types
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "valid-shopping-trip-uuid",
"amount": {
"amount": "invalid_string_amount", // Should be number
"code": "USD"
}
}
Expected Response:
{
"errorMsg": "BadRequestException - Invalid data type for amount"
}
8. Test Case: Bad Request - Invalid Currency Code (400 Error)
Objective: Trigger "BadRequestException" for invalid currency format
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "valid-shopping-trip-uuid",
"amount": {
"amount": 10.00,
"code": "INVALID" // Should be 3 character currency code
}
}
Expected Response:
{
"errorMsg": "BadRequestException - Invalid currency code format"
}
9. Test Case: Rate Limiting (429 Error)
Objective: Trigger "Too Many Requests" error
Test Method: Send multiple rapid requests to exceed rate limit
Expected Response:
{
"errorMsg": "Too Many Requests"
}
Headers: Retry-After: 600
10. Test Case: Server Error (500 Error)
Objective: Trigger "ServiceException"
Test Method: This typically occurs during server issues or unhandled exceptions
Expected Response:
{
"errorMsg": "ServiceException - Internal server error"
}
11. Test Case: Service Unavailable (503 Error)
Objective: Trigger "ServiceUnavailableException"
Test Method: Send request during maintenance or service downtime
Expected Response:
{
"errorMsg": "Service temporarily unavailable",
"retryAfter": "300"
}
12. Test Case: StoreId Format Validation (400 Error)
Objective: Test storeId pattern validation ^[0-9a-zA-Z_-]*$
{
"storeId": "invalid@store#id", // Contains invalid characters
"shoppingTripId": "valid-shopping-trip-uuid",
"amount": {
"amount": 10.00,
"code": "USD"
}
}
13. Test Case: ShoppingTripId Format Validation (400 Error)
Objective: Test shoppingTripId pattern validation ^[0-9a-zA-Z_-]+$
{
"storeId": "VALID_STORE_ID",
"shoppingTripId": "invalid@trip#id", // Contains invalid characters
"amount": {
"amount": 10.00,
"code": "USD"
}
}
14. Test Case: Field Length Validation (400 Error)
Objective: Test field length limits
{
"storeId": "A".repeat(256), // Exceeds 255 character limit
"shoppingTripId": "valid-shopping-trip-uuid",
"amount": {
"amount": 10.00,
"code": "TOOLONG" // Exceeds 3 character limit
}
}

