String serverReferenceCode="ABC-123";
String resourceURL=getRequestHostnameAndContext(request)+request.getServletPath()+"/1/payment/"+(endUserId!=null?urlEncode(endUserId):"")+"/transactions/amount"+(referenceCode!=null?("/"+urlEncode(serverReferenceCode)):"");
AmountTransaction rd=new AmountTransaction();
rd.setClientCorrelator(clientCorrelator);
rd.setEndUserId(endUserId);
AmountTransaction.PaymentAmount.ChargingInformation charge=new AmountTransaction.PaymentAmount.ChargingInformation();
charge.setAmount(amount);
charge.setCurrency(currency);
charge.setDescription(description);
AmountTransaction.PaymentAmount payment=new AmountTransaction.PaymentAmount();
payment.setChargingInformation(charge);
payment.setTotalAmountCharged(amount);
rd.setPaymentAmount(payment);
rd.setReferenceCode(referenceCode);
rd.setTransactionOperationStatus(transactionOperationStatus);
rd.setResourceURL(resourceURL);
rd.setClientCorrelator(clientCorrelator);
rd.setServerReferenceCode(serverReferenceCode);
ObjectMapper mapper=new ObjectMapper();
String jsonResponse="{\"amountTransaction\":"+mapper.writeValueAsString(rd)+"}";
sendJSONResponse(response, jsonResponse, OK, resourceURL);