콘텐츠로 이동

isFullyCanceled — @gj-kit/toss-payments

@gj-kit/toss-payments에서 공개하는 function입니다. package version 0.6.1의 release declaration을 그대로 표시합니다.

import { isFullyCanceled } from '@gj-kit/toss-payments';
/**
* 완전 취소 판정 — ⚠ `status === 'CANCELED'` 검사가 아니다.
*
* Phase 0 실측(2026-08-09): 부분취소 이력이 있으면 잔액 전액 취소 후에도
* status가 `PARTIAL_CANCELED`로 남는다(balanceAmount 0). 따라서 CANCELED 문자열만
* 검사하지 않고, `balanceAmount === 0`과 취소 상태/이력 신호를 함께 본다. 취소 신호가
* 없는 READY의 잔액 0은 완전 취소가 아니다.
*
* The parameter is the structural subset this predicate actually reads (`status`,
* `balanceAmount`, `cancels`), so callers that only hold a reduced payment snapshot
* (see `PaymentStateInput`) can use it too. A full `Payment` is always assignable —
* including a fresh inline object literal: the explicit `| Payment` union member exists
* solely so the excess-property check accepts literals spelling out non-Pick `Payment`
* fields. Existing call sites compile unchanged.
*/
declare function isFullyCanceled(p: Pick<Payment, 'status' | 'balanceAmount' | 'cancels'> | Payment): boolean;

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/toss-payments
  • 버전: 0.6.1
  • 공개 entry: .
  • 소스: GitHub

완전 취소 판정 — ⚠ status === 'CANCELED' 검사가 아니다.

Phase 0 실측(2026-08-09): 부분취소 이력이 있으면 잔액 전액 취소 후에도 status가 PARTIAL_CANCELED로 남는다(balanceAmount 0). 따라서 CANCELED 문자열만 검사하지 않고, balanceAmount === 0과 취소 상태/이력 신호를 함께 본다. 취소 신호가 없는 READY의 잔액 0은 완전 취소가 아니다.

The parameter is the structural subset this predicate actually reads (status, balanceAmount, cancels), so callers that only hold a reduced payment snapshot (see PaymentStateInput) can use it too. A full Payment is always assignable — including a fresh inline object literal: the explicit | Payment union member exists solely so the excess-property check accepts literals spelling out non-Pick Payment fields. Existing call sites compile unchanged.