-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Api-v1.0.5
- Loading branch information
Showing
6 changed files
with
100 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,10 @@ | |
</div> | ||
<br/> | ||
<div> | ||
<b>입금과 세금 계산서 발행</b>을 위해 | ||
<b>입금</b>을 위해 | ||
</div> | ||
<div> | ||
입금받으실 분의 주민등록번호와 성함을 평문으로, | ||
입금받으실 분의 성함을 평문으로, | ||
</div> | ||
<div> | ||
통장사본은 첨부하셔서 <b>[email protected]</b> 으로 이메일을 보내주시면 감사하겠습니다. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...a/band/gosrock/infrastructure/outer/api/tossPayments/client/PaymentsCancelClientTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package band.gosrock.infrastructure.outer.api.tossPayments.client; | ||
|
||
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.post; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; | ||
import static com.github.tomakehurst.wiremock.client.WireMock.verify; | ||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
import static org.assertj.core.api.AssertionsForClassTypes.catchThrowable; | ||
|
||
import band.gosrock.infrastructure.InfraIntegrateProfileResolver; | ||
import band.gosrock.infrastructure.InfraIntegrateTestConfig; | ||
import band.gosrock.infrastructure.outer.api.tossPayments.dto.request.CancelPaymentsRequest; | ||
import feign.RetryableException; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.cloud.contract.spec.internal.HttpStatus; | ||
import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
@ContextConfiguration | ||
@SpringBootTest( | ||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, | ||
classes = InfraIntegrateTestConfig.class) | ||
@AutoConfigureWireMock(port = 0) | ||
@ActiveProfiles(resolver = InfraIntegrateProfileResolver.class) | ||
@TestPropertySource(properties = {"feign.toss.url=http://localhost:${wiremock.server.port}"}) | ||
class PaymentsCancelClientTest { | ||
private static final String IDEMPOTENCY_KEY = "idempotency-key"; | ||
private static final String PAYMENT_KEY = "1234"; | ||
private static final CancelPaymentsRequest REQUEST = | ||
CancelPaymentsRequest.builder().cancelReason("test").build(); | ||
@Autowired private PaymentsCancelClient paymentsCancelClient; | ||
|
||
@Test | ||
public void 주문취소_실패시_멱등성_테스트() { | ||
final String URL = "/v1/payments/" + PAYMENT_KEY + "/cancel"; | ||
// given | ||
stubFor( | ||
post(urlEqualTo(URL)) | ||
.willReturn(aResponse().withStatus(HttpStatus.SERVICE_UNAVAILABLE))); | ||
|
||
// when | ||
Throwable exception = | ||
catchThrowable( | ||
() -> paymentsCancelClient.execute(IDEMPOTENCY_KEY, PAYMENT_KEY, REQUEST)); | ||
|
||
// then | ||
assertThat(exception).isInstanceOf(RetryableException.class); | ||
verify(3, postRequestedFor(urlEqualTo(URL))); | ||
} | ||
} |