-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2521 from alphagov/pp_7077_get_refunds_from_ledger
PP-7077 Get refunds from Ledger
- Loading branch information
Showing
7 changed files
with
211 additions
and
10 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/main/java/uk/gov/pay/connector/paritycheck/GetRefundsForPaymentException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package uk.gov.pay.connector.paritycheck; | ||
|
||
import javax.ws.rs.core.Response; | ||
|
||
public class GetRefundsForPaymentException extends LedgerException { | ||
public GetRefundsForPaymentException(Response response) { | ||
super(response); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/uk/gov/pay/connector/paritycheck/LedgerException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package uk.gov.pay.connector.paritycheck; | ||
|
||
import javax.ws.rs.core.Response; | ||
|
||
public class LedgerException extends RuntimeException { | ||
private Integer status; | ||
|
||
public LedgerException(Response response) { | ||
super(response.toString()); | ||
status = response.getStatus(); | ||
} | ||
|
||
public LedgerException(Exception exception) { | ||
super(exception); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "LedgerException{" + | ||
"status=" + status + | ||
", message=" + getMessage() + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/uk/gov/pay/connector/paritycheck/RefundTransactionsForPayment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package uk.gov.pay.connector.paritycheck; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategy; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
|
||
import java.util.List; | ||
|
||
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class RefundTransactionsForPayment { | ||
|
||
String parentTransactionId; | ||
List<LedgerTransaction> transactions; | ||
|
||
public String getParentTransactionId() { | ||
return parentTransactionId; | ||
} | ||
|
||
public List<LedgerTransaction> getTransactions() { | ||
return transactions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/test/resources/templates/ledger/refunds_for_payment.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"parent_transaction_id": "650516the13q5jpfo435f1m1fm", | ||
"transactions": [ | ||
{ | ||
"gateway_account_id": "152", | ||
"amount": 100, | ||
"state": { | ||
"finished": true, | ||
"status": "success" | ||
}, | ||
"created_date": "2019-12-23T15:24:07.061Z", | ||
"gateway_transaction_id": "ff3f12da-fa4e-4f2c-8460-fa80d20b3e97", | ||
"refunded_by": "refunded_by_user1", | ||
"transaction_type": "REFUND", | ||
"payment_details": { | ||
"description": "An example payment description", | ||
"reference": "V58CDG66T2", | ||
"email": "[email protected]", | ||
"card_details": { | ||
"cardholder_name": "test", | ||
"card_brand": "Visa", | ||
"last_digits_card_number": "4242", | ||
"first_digits_card_number": "424242", | ||
"expiry_date": "11/21", | ||
"card_type": "credit" | ||
}, | ||
"transaction_type": "PAYMENT" | ||
}, | ||
"transaction_id": "nklfm1pk9flpu91j815kp2835o", | ||
"parent_transaction_id": "650516the13q5jpfo435f1m1fm" | ||
}, | ||
{ | ||
"gateway_account_id": "152", | ||
"amount": 110, | ||
"state": { | ||
"finished": true, | ||
"status": "failed" | ||
}, | ||
"created_date": "2019-12-23T16:20:12.343Z", | ||
"gateway_transaction_id": "0ecb93b8-2db6-41b1-a63d-5438ab7cf0ba", | ||
"refunded_by": "refunded_by_user1", | ||
"refunded_by_user_email": "[email protected]", | ||
"transaction_type": "REFUND", | ||
"payment_details": { | ||
"description": "An example payment description", | ||
"reference": "V58CDG66T2", | ||
"email": "[email protected]", | ||
"card_details": { | ||
"cardholder_name": "test", | ||
"card_brand": "Visa", | ||
"last_digits_card_number": "4242", | ||
"first_digits_card_number": "424242", | ||
"expiry_date": "11/21", | ||
"card_type": "credit" | ||
}, | ||
"transaction_type": "PAYMENT" | ||
}, | ||
"transaction_id": "migtkmlt6gvm16sim5h0p7oeje", | ||
"parent_transaction_id": "650516the13q5jpfo435f1m1fm" | ||
} | ||
] | ||
} |