나중에 추가 결제검증로직

서현서현·2022년 9월 16일
0

Spring

목록 보기
30/31

https://tyrannocoding.tistory.com/44

	private IamportClient api;
	
	public ReserveCreateController() {
		this.api = new IamportClient("5396366384017153","483b3abedb0f4e219f1fe9528a7fe23131a03914c61ecc767f0886e618f94e907da270c735dbd609");
	}
			
	@ResponseBody
	@RequestMapping(value="/verifyIamport/{imp_uid}", method=RequestMethod.POST)
	public IamportResponse<Payment> paymentByImpUid(
			Model model
			, Locale locale
			, HttpSession session
			, @PathVariable(value= "imp_uid") String imp_uid) throws IamportResponseException, IOException
	{	
			return api.paymentByImpUid(imp_uid);
	}
	

쓰던 컨트롤러에 저 내용들 추가함

xml로 뜨는문제 발생

jQuery.ajax({
	        	type : "POST",
				beforeSend : function(xhr)
				{
				   xhr.setRequestHeader(header,token);
				},
	        	url : "${cPath}/reserve/verifyIamport/" + rsp.imp_uid 
	        }).done(function(data) {
	        	console.log(data);

	        	let value = jQuery(data).find("amount").text()
	        	console.log("value",value); // HTML

파싱으로 해결하였다

0개의 댓글