im正在处理与付款相关的rest API。但是我遇到了一个例外。我知道这是由于将参数设置为其余的uri。
String uri = "https://test-gateway.mastercard.com/api/rest/version/52/merchant/{merchantId}/order/{orderId}/transaction/{transactionId}";
LinkedMultiValueMap<String, String> uriVars = new LinkedMultiValueMap<>();
uriVars.add("merchantId", _paymentInstrument.getAcquirerMid());
uriVars.add("orderId", _paymentInstrument.getOrderId().toString());
uriVars.add("transactionId", _paymentInstrument.getTargetTransactionId().toString());
String uri = UriComponentsBuilder.fromHttpUrl(url)
.queryParams(uriVars).build().toUriString();
VoidRequest voidRequest =
createVoidRequest(_paymentInstrument.getTargetTransactionId());
HttpEntity<VoidRequest> requestEntity = new HttpEntity<>(voidRequest, headers);
ResponseEntity<TransactionResponse> responseEntity = restTemplate.exchange(uri, HttpMethod.PUT, requestEntity, TransactionResponse.class);
即时通讯异常是在Spring中使用RestTemplate。例外-没有足够的变量来扩展“ merchantId”。