Skip to content

Commit

Permalink
update exception error mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
Elwizzy12 committed Oct 8, 2024
1 parent 69b54f8 commit ebc81fb
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ private DepositHttpStatusResolver() {
container.put(PAYMENT_NOT_FOUND, NOT_FOUND);

//400 Block
// This error is thrown when attempting to create a deposit account that already exists.
container.put(DEPOSIT_ACCOUNT_EXISTS, BAD_REQUEST);

// This error is thrown when a failure occurs during the processing of a payment, typically due to server-side issues.
container.put(PAYMENT_PROCESSING_FAILURE, INTERNAL_SERVER_ERROR);

// This error is thrown when an attempt is made to process a payment with an ID that already exists in the system.
container.put(PAYMENT_WITH_ID_EXISTS, BAD_REQUEST);

// This error is thrown when there is a failure in performing a deposit operation, such as adding or removing funds from an account.
container.put(DEPOSIT_OPERATION_FAILURE, BAD_REQUEST);
Expand All @@ -43,13 +35,23 @@ private DepositHttpStatusResolver() {
// This error is thrown when an unsupported credit limit is set, either exceeding the allowed limit or being invalid for the account.
container.put(UNSUPPORTED_CREDIT_LIMIT, BAD_REQUEST);

//402 Block
//403 Block
// This error is thrown when there are insufficient funds in the deposit account to complete the requested transaction.
container.put(INSUFFICIENT_FUNDS, PAYMENT_REQUIRED);
container.put(INSUFFICIENT_FUNDS, FORBIDDEN);

//417 Block

container.put(COULD_NOT_EXECUTE_STATEMENT, EXPECTATION_FAILED);

//500
// This error is thrown when a failure occurs during the processing of a payment, typically due to server-side issues.
container.put(PAYMENT_PROCESSING_FAILURE, INTERNAL_SERVER_ERROR);

//409
// This error is thrown when an attempt is made to process a payment with an ID that already exists in the system.
container.put(PAYMENT_WITH_ID_EXISTS, CONFLICT);
// This error is thrown when attempting to create a deposit account that already exists.
container.put(DEPOSIT_ACCOUNT_EXISTS, CONFLICT);
}
public static HttpStatus resolveHttpStatusByCode(DepositErrorCode code) {
return container.getOrDefault(code, BAD_REQUEST) ;
Expand Down

0 comments on commit ebc81fb

Please sign in to comment.