조갱
TPToss payments 개발자 커뮤니티
•Created by 조갱 on 5/19/2023 in #❓┃연동개발-문의
XPayClient 응답값 문의
안녕하세요, 토스페이 알파환경 연동중에 문의드립니다.
구매 confirm 요청을 보내고, Response를 받아오는 과정에서 Exception이 발생합니다.
XPayClient의 Response를 수집하는 코드는 아래와 같습니다.
그리고, 위 코드에서 출력되는 로그는 아래와 같습니다.
즉,
kotlin
private fun XPayClient.toResponseMap(): Map<String, String> {
val result = HashMap<String, String>()
log.info("====== [DEBUG] : ResponseNameCount: ${this.ResponseNameCount()}")
log.info("====== [DEBUG] : ResponseCount: ${this.ResponseCount()}")
for (i in 0 until this.ResponseNameCount()) {
log.info("===== [DEBUG] this.Responsename(i) = ${this.ResponseName(i)} ===== ")
log.info("===== [DEBUG] this.ResponseCount() - 1 = ${this.ResponseCount() - 1} =====")
result[this.ResponseName(i)] = this.Response(this.ResponseName(i), this.ResponseCount() - 1)
log.info("===== [DEBUG] $i 번까지 수행 완료")
}
return result
}
kotlin
private fun XPayClient.toResponseMap(): Map<String, String> {
val result = HashMap<String, String>()
log.info("====== [DEBUG] : ResponseNameCount: ${this.ResponseNameCount()}")
log.info("====== [DEBUG] : ResponseCount: ${this.ResponseCount()}")
for (i in 0 until this.ResponseNameCount()) {
log.info("===== [DEBUG] this.Responsename(i) = ${this.ResponseName(i)} ===== ")
log.info("===== [DEBUG] this.ResponseCount() - 1 = ${this.ResponseCount() - 1} =====")
result[this.ResponseName(i)] = this.Response(this.ResponseName(i), this.ResponseCount() - 1)
log.info("===== [DEBUG] $i 번까지 수행 완료")
}
return result
}
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] 38 번까지 수행 완료
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.Responsename(i) = LGD_BUYERID =====
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.ResponseCount() - 1 = 0 =====
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] 39 번까지 수행 완료
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.Responsename(i) = LGD_ORDERS_METADATA =====
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.ResponseCount() - 1 = 0 =====
20:47:14.186 [NioDispatcher-2 @coroutine#1] ERROR c.n.p.c.GlobalErrorWebExceptionHandler - Internal Error
java.lang.NullPointerException: this.Response(this.Respo…this.ResponseCount() - 1) must not be null
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] 38 번까지 수행 완료
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.Responsename(i) = LGD_BUYERID =====
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.ResponseCount() - 1 = 0 =====
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] 39 번까지 수행 완료
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.Responsename(i) = LGD_ORDERS_METADATA =====
20:47:14.136 [NioDispatcher-2 @coroutine#1] INFO c.n.p.g.t.TossPaymentsClient - ===== [DEBUG] this.ResponseCount() - 1 = 0 =====
20:47:14.186 [NioDispatcher-2 @coroutine#1] ERROR c.n.p.c.GlobalErrorWebExceptionHandler - Internal Error
java.lang.NullPointerException: this.Response(this.Respo…this.ResponseCount() - 1) must not be null
LGD_ORDERS_METADATA
이 ResponseName의 값이 없는것 같은데, 이유가 궁금합니다.
(리얼(운영) 환경에서는 정상 동작하는데, 알파환경만 발생합니다..)11 replies