@RestController
@RequiredArgsConstructor
@Slf4j
public class HandWritePayController {
private final WebClient webClient = WebClient.builder().baseUrl("https://api.portone.io").build();
private final String mytoken =
@PostMapping("/handwritepay")
public Mono<BillingPayResponse> HandWritePay()
{
MethodDto handwritemethod = new MethodDto(
new CardDto
(new CredentialDTO("testcard",
2026,
11)
));
PaymentAmount amount = new PaymentAmount(30000);
HandwritePayRequest handwritePayRequest =
new HandwritePayRequest("channel-key-4bc1f3ce-78aa-4265-9f5d-49bb1a1d9896",
handwritemethod,
"test를위한이름",
amount,
"KRW") ;
Mono<BillingPayResponse> monoResult = webClient
.post()
.uri("/payments/{paymentId}/instant", "testfor1")
.header("Authorization", "Bearer " + mytoken)
.retrieve()
.bodyToMono(BillingPayResponse.class)
.onErrorResume(e -> {
log.info("Error occurred: {}", e.getMessage());
return Mono.error(e) ;
});
return monoResult;
}
현재 이와 같이, 굳이 백엔드 단에 모든 결제 권한을 위임하였다.
그 이유는, 책임의 명확한 분리와, msa구조로 변경시 위함이다 .
하지만 현재 invalid request라는 error가 계속해서 등장한다.
해당 문제에 대해 고민하여 보겠다 .
* 해당 문제가, 카드 정보 개인사 불가능이란 문제로 인해 유발될 가능성이 있다고 생각하여
고객센터에 정책 관련하여 질문을 올려보도록 하겠다.
'프로젝트 > 장애인 PT 플랫폼, PTFD' 카테고리의 다른 글
SERVICE/CONTROLLER단 분할, 그에 따른 비동기적 형태 변경 (0) | 2024.02.23 |
---|---|
FRONT에서의 결제 + 결제 정보 저장 (0) | 2024.02.22 |
PORTONE활용 결제부, 상품 관련 DB 추가. (0) | 2024.02.18 |
PortOne을 활용한 간단 결제단 구축 (0) | 2024.02.11 |
PortOne을 활용한 결제 프로그램 구축 (0) | 2024.02.11 |