use of uk.gov.pay.api.model.TransactionResponse in project pay-publicapi by alphagov.
the class TransactionSearchService method processResponse.
private TransactionSearchResults processResponse(Response connectorResponse) {
PaymentSearchResponse<TransactionResponse> response;
try {
response = connectorResponse.readEntity(new GenericType<PaymentSearchResponse<TransactionResponse>>() {
});
} catch (ProcessingException ex) {
throw new SearchTransactionsException(ex);
}
List<PaymentForSearchResult> chargeFromResponses = response.getPayments().stream().map(this::getPaymentForSearchResult).collect(toList());
return new TransactionSearchResults(response.getTotal(), response.getCount(), response.getPage(), chargeFromResponses, transformLinks(response.getLinks()));
}
use of uk.gov.pay.api.model.TransactionResponse in project pay-publicapi by alphagov.
the class LedgerService method searchPayments.
public PaymentSearchResponse<TransactionResponse> searchPayments(Account account, Map<String, String> paramsAsMap) {
paramsAsMap.put(PARAM_ACCOUNT_ID, account.getAccountId());
paramsAsMap.put(PARAM_TRANSACTION_TYPE, PAYMENT_TRANSACTION_TYPE);
paramsAsMap.put(PARAM_EXACT_REFERENCE_MATCH, "true");
Response response = client.target(ledgerUriGenerator.transactionsURIWithParams(paramsAsMap)).request().accept(MediaType.APPLICATION_JSON_TYPE).get();
if (response.getStatus() == SC_OK) {
try {
return response.readEntity(new GenericType<PaymentSearchResponse<TransactionResponse>>() {
});
} catch (ProcessingException ex) {
throw new SearchPaymentsException(ex);
}
}
throw new SearchPaymentsException(response);
}
Aggregations