From ff45a19b4b47cf44c0ff84caf3351d1ef356e377 Mon Sep 17 00:00:00 2001 From: thisgun Date: Tue, 7 Jul 2026 14:11:57 +0900 Subject: [PATCH] =?UTF-8?q?fix(payment):=20NHN=20KCP=20=EB=B6=80=EB=B6=84?= =?UTF-8?q?=EC=B7=A8=EC=86=8C=20=EA=B0=80=EB=8A=A5=EA=B8=88=EC=95=A1=20?= =?UTF-8?q?=EC=A0=84=EB=8B=AC=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md | 1 + .../sirsoft-pay_nhnkcp/src/Services/NhnKcpApiService.php | 7 ++++--- .../tests/Unit/Services/NhnKcpApiServiceTest.php | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md b/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md index e7dff7e3..16a3ab1c 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/CHANGELOG.md @@ -11,6 +11,7 @@ - 비회원 NHN KCP 주문완료/주문상세에서 매출전표 조회가 인증 사용자 전용 라우트에 막히지 않도록 게스트 주문 토큰과 결제 성공 후 임시 영수증 쿠키 접근을 지원했습니다. - 관리자 주문상세의 NHN KCP 결제 정보 패널이 원승인 정보와 현재 취소/환불 상태를 함께 표시하도록 보강했습니다. - PC 결제창 close-report와 승인 콜백이 경쟁할 때 결제 성공 주문이 실패 처리로 덮이지 않도록 주문번호 단위 콜백 락과 최신 결제 상태 가드를 적용했습니다. +- NHN KCP 부분취소 요청에서 `rem_mny`를 취소 후 잔액이 아닌 현재 부분취소 가능 금액으로 전달해 큰 금액 부분취소가 거절될 수 있던 문제를 수정했습니다. ## [1.0.0-beta.5] - 2026-06-23 diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/src/Services/NhnKcpApiService.php b/plugins/_bundled/sirsoft-pay_nhnkcp/src/Services/NhnKcpApiService.php index a4d4f547..1bd2861c 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/src/Services/NhnKcpApiService.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/src/Services/NhnKcpApiService.php @@ -197,7 +197,7 @@ class NhnKcpApiService * @param int $cancelAmt 취소 금액 * @param string $cancelMsg 취소 사유 * @param bool $isPartial 부분 취소 여부 - * @param int $totalAmt 원거래 결제 금액 (부분취소 시 rem_mny 계산에 사용) + * @param int $totalAmt 현재 부분취소 가능 금액 (KCP rem_mny) * @return array 파싱된 KCP 응답 */ public function cancelPayment( @@ -217,8 +217,9 @@ class NhnKcpApiService ]; if ($isPartial && $totalAmt > 0) { - $remMny = $totalAmt - $cancelAmt; - $fields['rem_mny'] = (string) $remMny; + // KCP rem_mny는 취소 후 잔액이 아니라 현재 부분취소 가능한 금액이다. + // 첫 부분취소는 원거래금액, 이후에는 이전 부분취소 후 남은 잔액을 전달한다. + $fields['rem_mny'] = (string) $totalAmt; $fields['mod_mny'] = (string) $cancelAmt; } diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Services/NhnKcpApiServiceTest.php b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Services/NhnKcpApiServiceTest.php index c4571550..6fb596cd 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Services/NhnKcpApiServiceTest.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Unit/Services/NhnKcpApiServiceTest.php @@ -261,7 +261,7 @@ class NhnKcpApiServiceTest extends PluginTestCase $args = $this->capturedCliArgs($stub['log']); $this->assertStringContainsString('mod_type=RN07', $args); $this->assertStringContainsString('mod_mny=10000', $args); - $this->assertStringContainsString('rem_mny=40000', $args); + $this->assertStringContainsString('rem_mny=50000', $args); } finally { $this->removeStubbedCliDirectory($stub['dir']); }