Skip to content

Commit

Permalink
update RunAll to add failure samples
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkumarpalani committed Feb 15, 2021
1 parent f95bd19 commit 5dc1615
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 219 deletions.
12 changes: 12 additions & 0 deletions payouts-sdk-sample/src/main/java/com/paypal/RunAll.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static void main(String[] args) throws IOException, InterruptedException
HttpResponse<PayoutItemResponse> cancelResponse = new CancelPayoutItem().cancelPayoutItem(itemId);
if (cancelResponse.statusCode() == 200) {
System.out.println("Successfully cancelled unclaimed Payout item with id: " + itemId);

//Run cancel failure scenario
System.out.println("Simulate failure on cancelling an already cancelled Payout item with id: " + itemId);
new CancelPayoutItem().cancelPayoutItem(itemId);
} else {
System.out.println("Failed to cancel unclaimed Payout item with id: " + itemId);
}
Expand All @@ -55,5 +59,13 @@ public static void main(String[] args) throws IOException, InterruptedException
System.out.println("Failed to retrieve Payout batch with id: " + batchId);
}
}

//Execute all failure cases
System.out.println("Create a payout with validation failure");
new CreatePayoutsBatch().createPayoutFailure();
System.out.println("Retrieving an invalid payout");
new GetPayoutBatch().getPayoutBatch("DUMMY");
System.out.println("Retrieving an invalid payout item");
new GetPayoutItem().getPayoutItem("DUMMY");
}
}
16 changes: 16 additions & 0 deletions payouts-sdk/src/main/java/com/paypal/payouts/ErrorDetails.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,20 @@ public ErrorDetails issue(String issue) {
this.issue = issue;
return this;
}

/**
* REQUIRED
* The reason for the error.
*/
@SerializedName("location")
private String location;

public String location() {
return issue;
}

public ErrorDetails location(String location) {
this.location = location;
return this;
}
}
15 changes: 0 additions & 15 deletions payouts-sdk/src/main/java/com/paypal/payouts/PayoutBatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ public PayoutBatch batchHeader(PayoutBatchHeader batchHeader) {
return this;
}

/**
* The error details.
*/
@SerializedName("errors")
private PayoutError errors;

public PayoutError errors() {
return errors;
}

public PayoutBatch errors(PayoutError errors) {
this.errors = errors;
return this;
}

/**
* An array of individual items.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,6 @@ public PayoutBatchHeader currencyConversion(PayoutCurrencyConversion currencyCon
return this;
}

/**
* The error information.
*/
@SerializedName("errors")
private Error errors;

public Error errors() {
return errors;
}

public PayoutBatchHeader errors(Error errors) {
this.errors = errors;
return this;
}

/**
* The currency and amount for a financial transaction, such as a balance or payment due.
*/
Expand Down
101 changes: 0 additions & 101 deletions payouts-sdk/src/main/java/com/paypal/payouts/PayoutError.java

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions payouts-sdk/src/main/java/com/paypal/payouts/PayoutHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,6 @@ public PayoutHeader batchStatus(String batchStatus) {
return this;
}

/**
* The error information.
*/
@SerializedName("errors")
private Error errors;

public Error errors() {
return errors;
}

public PayoutHeader errors(Error errors) {
this.errors = errors;
return this;
}

/**
* REQUIRED
* The PayPal-generated ID for a payout.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ public PayoutItemResponse currencyConversion(PayoutCurrencyConversion currencyCo
* The error details.
*/
@SerializedName("errors")
private PayoutError errors;
private Error errors;

public PayoutError errors() {
public Error errors() {
return errors;
}

public PayoutItemResponse errors(PayoutError errors) {
public PayoutItemResponse errors(Error errors) {
this.errors = errors;
return this;
}
Expand Down

0 comments on commit 5dc1615

Please sign in to comment.