Skip to content

Commit

Permalink
Merge pull request #30 from ShipEngine/ENGINE-7190-funding-sources-wa…
Browse files Browse the repository at this point in the history
…llet-errors

Added error codes for funding sources errors
  • Loading branch information
ChristianCasado authored Jan 9, 2025
2 parents 40bd59d + c41ac9d commit 724c1ae
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 22 deletions.
21 changes: 13 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@

## [1.0.3](https://github.com/ShipEngine/shipengine-java/compare/v1.0.2...v1.0.3) (2024-01-17)


### Bug Fixes

* update timeout to 60s ([f8bca01](https://github.com/ShipEngine/shipengine-java/commit/f8bca01e115aba99343f64de30282c25c13ea045))
- update timeout to 60s ([f8bca01](https://github.com/ShipEngine/shipengine-java/commit/f8bca01e115aba99343f64de30282c25c13ea045))

## 1.0.2 (2022-10-21)


### Bug Fixes

* Fixed exception handling
* Fixed bug in deriveUserAgent method in the InternalClient now reads sdk version from resources/project.properties instead of version.txt. ([2aa3d13](https://github.com/ShipEngine/shipengine-java/commit/2aa3d133756cfb311beb10bec3474dfad91bffef))
* Testing and linting working CI ([748d2ce](https://github.com/ShipEngine/shipengine-java/commit/748d2ceced376e0d66f895f5251ba166e70d9c5f))
* Updated pom.xml settings to fix JaCoCo coverage reporting bug. ([a91ef99](https://github.com/ShipEngine/shipengine-java/commit/a91ef99f29adf74e99478cc248291731be38ddff))
- Fixed exception handling
- Fixed bug in deriveUserAgent method in the InternalClient now reads sdk version from resources/project.properties instead of version.txt. ([2aa3d13](https://github.com/ShipEngine/shipengine-java/commit/2aa3d133756cfb311beb10bec3474dfad91bffef))
- Testing and linting working CI ([748d2ce](https://github.com/ShipEngine/shipengine-java/commit/748d2ceced376e0d66f895f5251ba166e70d9c5f))
- Updated pom.xml settings to fix JaCoCo coverage reporting bug. ([a91ef99](https://github.com/ShipEngine/shipengine-java/commit/a91ef99f29adf74e99478cc248291731be38ddff))

## 1.0.3

### Changes

* increase default timeout to 60s
- increase default timeout to 60s

## 1.0.4

### Changes

- Added error code FundingSourceMissingConfiguration
- Added error code FundingSourceError
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.shipengine</groupId>
<artifactId>shipengine</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>

<name>ShipEngine SDK</name>
<description>The official Java SDK for ShipEngine API.</description>
Expand Down
29 changes: 16 additions & 13 deletions src/main/java/com/shipengine/exception/ShipEngineException.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ public enum ErrorType {
ERROR,
SECURITY,
SYSTEM,
VALIDATION
VALIDATION,
WALLET,
FUNDING_SOURCES
}

public enum ErrorCode {
Expand Down Expand Up @@ -81,7 +83,9 @@ public enum ErrorCode {
UNSPECIFIED,
VERIFICATION_CONFLICT,
WAREHOUSE_CONFLICT,
WEBHOOK_EVENT_TYPE_CONFLICT
WEBHOOK_EVENT_TYPE_CONFLICT,
FUNDING_SOURCE_MISSING_CONFIGURATION,
FUNDING_SOURCE_ERROR
}

/**
Expand All @@ -96,23 +100,26 @@ public enum ErrorCode {
* contact ShipEngine for support or if you should contact the carrier or
* marketplace instead.
*
* @see <a href="https://www.shipengine.com/docs/errors/codes/#error-source">...</a>
* @see <a href=
* "https://www.shipengine.com/docs/errors/codes/#error-source">...</a>
*/
private ErrorSource source;

/**
* Indicates the type of error that occurred, such as a validation error, a
* security error, etc.
*
* @see <a href="https://www.shipengine.com/docs/errors/codes/#error-type">...</a>
* @see <a href=
* "https://www.shipengine.com/docs/errors/codes/#error-type">...</a>
*/
private ErrorType type;

/**
* A code that indicates the specific error that occurred, such as missing a
* required field, an invalid address, a timeout, etc.
*
* @see <a href="https://www.shipengine.com/docs/errors/codes/#error-code">...</a>
* @see <a href=
* "https://www.shipengine.com/docs/errors/codes/#error-code">...</a>
*/
private ErrorCode code;

Expand Down Expand Up @@ -172,8 +179,7 @@ public ShipEngineException(
ErrorSource source,
ErrorType type,
ErrorCode code,
String url
) {
String url) {
super(message);
setRequestID(requestID);
setSource(source);
Expand All @@ -187,8 +193,7 @@ public ShipEngineException(
ErrorSource source,
ErrorType type,
ErrorCode code,
String url
) {
String url) {
super(message);
setSource(source);
setType(type);
Expand All @@ -201,8 +206,7 @@ public ShipEngineException(
String requestID,
String source,
String type,
String code
) {
String code) {
super(message);
setRequestID(requestID);
setSource(ErrorSource.valueOf(source.toUpperCase()));
Expand All @@ -214,8 +218,7 @@ public ShipEngineException(
String message,
String source,
String type,
String code
) {
String code) {
super(message);
setSource(ErrorSource.valueOf(source.toUpperCase()));
setType(ErrorType.valueOf(type.toUpperCase()));
Expand Down

0 comments on commit 724c1ae

Please sign in to comment.