Skip to content

Commit

Permalink
Merge pull request #4 from wanniDev/main
Browse files Browse the repository at this point in the history
결제 승인 요청, 멱등키를 활용한 중복 결제 방지 기능 추가
  • Loading branch information
wanniDev authored Aug 9, 2023
2 parents 802f292 + 98feccd commit 1697aa0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ open class DefaultPaymentsProcessor(
newPaymentEntity.completeOf(principal.id)
val newPaymentRecord = tossPaymentsRepository.save(newPaymentEntity)

logger.info("complete {}", objectMapper.writeValueAsString(newPaymentRecord))

newPaymentRecord.pollAllEvents().forEach { publisher.publishEvent(it) }
newPaymentRecord.pollAllEvents().forEach {
logger.info("complete {}", objectMapper.writeValueAsString(it))
publisher.publishEvent(it)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class TossPaymentsKeyInApprovalProcessor(

headers.setBasicAuth(String(Base64.getEncoder().encode("${secretKey}:".toByteArray(StandardCharsets.ISO_8859_1))))
headers.contentType = MediaType.APPLICATION_JSON
headers.set("Idempotency-Key", "SAAABPQbcqjEXiDL")

return HttpEntity(dto, headers)
}
Expand Down

0 comments on commit 1697aa0

Please sign in to comment.