Skip to content

Commit bfaed04

Browse files
author
이용홍
committed
📝 README.md
1 parent 49fb803 commit bfaed04

File tree

1 file changed

+2
-144
lines changed

1 file changed

+2
-144
lines changed

README.md

Lines changed: 2 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,2 @@
1-
# spring-boot-starter-toss-payments
2-
spring boot starter toss payments
3-
4-
토스페이먼츠 API 버전 2022-11-16 으로 작성되었습니다.
5-
6-
## How to
7-
To get a Git project into your build:
8-
9-
*Step 1*. Add the JitPack repository to your build file
10-
11-
Add it in your root build.gradle at the end of repositories:
12-
13-
```groovy
14-
allprojects {
15-
repositories {
16-
...
17-
maven { url 'https://jitpack.io' }
18-
}
19-
}
20-
```
21-
22-
*Step 2*. Add the dependency
23-
24-
```groovy
25-
dependencies {
26-
implementation 'com.github.herbaccara:spring-boot-starter-toss-payments:Tag'
27-
}
28-
```
29-
30-
## application.yml 설정
31-
```yaml
32-
toss:
33-
payments:
34-
enabled: true
35-
client-key: 클라이언트 키
36-
client-secret: 클라이언트 시크릿
37-
webhook:
38-
enabled: true
39-
path: /toss/payments/webhook
40-
```
41-
42-
## 사용하기
43-
```kotlin
44-
class SpringComponent (
45-
private val tossPaymentsService: TossPaymentsService
46-
)
47-
48-
```
49-
50-
## RestTemplate 커스텀 설정
51-
아래 2개의 인터페이스를 상속받은 class 를 만들고 bean 으로 등록
52-
53-
```kotlin
54-
interface TossPaymentsRestTemplateBuilderCustomizer {
55-
fun customize(restTemplateBuilder: RestTemplateBuilder)
56-
}
57-
58-
interface TossPaymentsClientHttpRequestInterceptor : ClientHttpRequestInterceptor
59-
```
60-
61-
62-
## Webhook controller
63-
toss.webhook.enabled 값이 true 인 경우 자동으로
64-
[TossPaymentsWebhookController](src%2Fmain%2Fkotlin%2Fherbaccara%2Ftoss%2Fpayments%2FTossPaymentsWebhookController.kt)
65-
가 bean 으로 등록됩니다.
66-
67-
webhook event 는 applicationEventPublisher 에 즉시 publishEvent 됩니다.
68-
69-
직접 TossPaymentsWebhookController 를 상속받은 component 를 등록해서 사용 하실 수 있습니다.
70-
71-
```kotlin
72-
@RestController
73-
@RequestMapping("\${toss.payments.webhook.path:${TossPaymentsProperties.DEFAULT_WEBHOOK_PATH}}")
74-
class TossPaymentsWebhookController(
75-
private val applicationEventPublisher: ApplicationEventPublisher
76-
) {
77-
/***
78-
* 가상계좌 결제 상태를 알려주는 웹훅
79-
*/
80-
@RequestMapping("/deposit-callback")
81-
fun onDepositCallback(depositCallback: DepositCallback) {
82-
applicationEventPublisher.publishEvent(depositCallback)
83-
}
84-
85-
/***
86-
* 카드, 계좌이체, 휴대폰, 상품권 결제 상태를 알려주는 웹훅입니다.
87-
*/
88-
@RequestMapping("/payment-status-changed")
89-
fun onPaymentStatusChanged(paymentStatusChangedEvent: Event<PaymentStatusChanged>) {
90-
applicationEventPublisher.publishEvent(paymentStatusChangedEvent)
91-
}
92-
93-
/***
94-
* 지급대행 요청 상태가 COMPLETED, FAILED로 변경되면 웹훅이 전송됩니다. 자세한 상태 설명은 status에서 확인하세요.
95-
*/
96-
@RequestMapping("/payout-status-changed")
97-
fun onPayoutStatusChanged(payoutStatusChangedEvent: Event<PayoutStatusChanged>) {
98-
applicationEventPublisher.publishEvent(payoutStatusChangedEvent)
99-
}
100-
101-
/***
102-
* 브랜드페이 고객의 결제 수단이 변경되면 웹훅이 전송됩니다.
103-
*/
104-
@RequestMapping("/method-updated")
105-
fun onMethodUpdated(methodUpdatedEvent: Event<MethodUpdated>) {
106-
applicationEventPublisher.publishEvent(methodUpdatedEvent)
107-
}
108-
109-
/***
110-
* 브랜드페이 고객의 상태가 변경되면 웹훅이 전송됩니다.
111-
*/
112-
@RequestMapping("/customer-status-changed")
113-
fun onCustomerStatusChanged(customerStatusChangedEvent: Event<CustomerStatusChanged>) {
114-
applicationEventPublisher.publishEvent(customerStatusChangedEvent)
115-
}
116-
}
117-
118-
```
119-
120-
## Webhook event
121-
122-
[AbstractTossPaymentsEventListener.kt](src%2Fmain%2Fkotlin%2Fherbaccara%2Ftoss%2Fpayments%2FAbstractTossPaymentsEventListener.kt)
123-
를 상속받은 component 를 bean 으로 등록해서 webhook event 를 처리 할 수 있습니다.
124-
125-
```kotlin
126-
abstract class AbstractTossPaymentsEventListener {
127-
128-
@EventListener
129-
abstract fun onDepositCallback(depositCallback: DepositCallback)
130-
131-
@EventListener
132-
abstract fun onPaymentStatusChanged(paymentStatusChangedEvent: Event<PaymentStatusChanged>)
133-
134-
@EventListener
135-
abstract fun onPayoutStatusChanged(payoutStatusChangedEvent: Event<PayoutStatusChanged>)
136-
137-
@EventListener
138-
abstract fun onMethodUpdated(methodUpdatedEvent: Event<MethodUpdated>)
139-
140-
@EventListener
141-
abstract fun onCustomerStatusChanged(customerStatusChangedEvent: Event<CustomerStatusChanged>)
142-
}
143-
144-
```
1+
# spring-boot-starter-xss
2+
spring boot starter xss filter

0 commit comments

Comments
 (0)