- {h.fromStatus ? orderStatusMeta(h.fromStatus).label : '—'} →{' '}
-
{orderStatusMeta(h.toStatus).label}
+
+
+ {h.fromStatus ? orderStatusMeta(h.fromStatus).label : '—'} →{' '}
+ {orderStatusMeta(h.toStatus).label}
+
+ {actorLabel(h.actorType)}
{formatKst(h.changedAt, true)}
+ {h.cancelReason && (
+
+ 사유 {cancelReasonLabel(h.cancelReason)}
+ {h.cancelFault && ` · ${cancelFaultLabel(h.cancelFault)}`}
+ {h.refundAmount !== null && ` · 환불 ${formatKrw(h.refundAmount)}`}
+
+ )}
{h.note && (
{h.note}
@@ -231,3 +269,47 @@ export function OrderHistory({ order }: { order: OrderDetail }) {
);
}
+
+export function OrderRequestNote({ note }: { note: string }) {
+ return (
+
+
+ 요청 사항
+
+
+ {note}
+
+
+ );
+}
+
+/** 판매자 픽업 일시 변경 이력. 오래된 순 */
+export function OrderPickupChanges({ changes }: { changes: OrderDetail['pickupChanges'] }) {
+ return (
+
+
+ 픽업 일시 변경
+ 판매자 변경 · {changes.length}건
+
+
+
+ {changes.map((c) => (
+ -
+
+ {formatKst(c.fromPickupAt, true)} → {formatKst(c.toPickupAt, true)}
+
+
+ 변경 {formatKst(c.changedAt, true)}
+
+ {c.note && (
+
+ {c.note}
+
+ )}
+
+ ))}
+
+
+
+ );
+}
diff --git a/src/features/orders/components/order-money-sections.tsx b/src/features/orders/components/order-money-sections.tsx
new file mode 100644
index 0000000..554eb98
--- /dev/null
+++ b/src/features/orders/components/order-money-sections.tsx
@@ -0,0 +1,188 @@
+import { type ReactNode } from 'react';
+
+import { formatKrw } from '@/shared/lib/format';
+import { formatKst } from '@/shared/lib/kst';
+import { Badge } from '@/shared/ui/badge';
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/shared/ui/card';
+import { StatusPill } from '@/shared/ui/status-pill';
+
+import {
+ actorLabel,
+ cancelFaultLabel,
+ confirmSourceLabel,
+ formatBps,
+ paymentMethodLabel,
+ paymentStatusMeta,
+ refundKindLabel,
+ refundStatusMeta,
+} from '../meta';
+import { type OrderDetail } from './order-detail-sections';
+
+type Row = [label: string, value: ReactNode];
+
+/** 조건이 false인 줄은 빼고 보인다 */
+function Rows({ rows }: { rows: (Row | false)[] }) {
+ return (
+
+ {rows
+ .filter((r): r is Row => r !== false)
+ .map(([label, value]) => [
+ -
+ {label}
+
,
+ -
+ {value}
+
,
+ ])}
+
+ );
+}
+
+const time = (iso: string | null) => (iso ? formatKst(iso, true) : '—');
+// 목록·카드에서는 끝 4자리만 보인다(계좌번호 표시 규칙)
+const maskAccount = (num: string) => `****${num.slice(-4)}`;
+
+function MoneyCard({
+ title,
+ caption,
+ children,
+}: {
+ title: string;
+ caption?: string;
+ children: ReactNode;
+}) {
+ return (
+
+
+ {title}
+ {caption && {caption}}
+
+ {children}
+
+ );
+}
+
+export function OrderPayment({ payment }: { payment: OrderDetail['payment'] }) {
+ if (!payment) {
+ return (
+
+ 결제 도입 전 주문이라 결제 기록이 없습니다.
+
+ );
+ }
+ const status = paymentStatusMeta(payment.status);
+ const confirmedBy = [
+ payment.confirmSource && confirmSourceLabel(payment.confirmSource),
+ payment.confirmedByLabel,
+ ].filter(Boolean);
+ return (
+
+ {status.label}],
+ ['금액', formatKrw(payment.amount)],
+ ['입금자명', payment.depositorName],
+ [
+ '입금 계좌',
+ `${payment.depositBank.name} ${maskAccount(payment.depositAccountNumber)} · ${payment.depositAccountHolder}`,
+ ],
+ ['입금 기한', time(payment.expiresAt)],
+ [
+ '입금 알림',
+ payment.buyerClaimedAt ? `${time(payment.buyerClaimedAt)} 구매자 '입금했어요'` : '—',
+ ],
+ [
+ '확인 처리',
+ payment.confirmedAt
+ ? `${time(payment.confirmedAt)}${confirmedBy.length ? ` · ${confirmedBy.join(' · ')}` : ''}`
+ : '—',
+ ],
+ payment.confirmNote !== null && ['확인 메모', payment.confirmNote],
+ ]}
+ />
+
+ );
+}
+
+export function OrderCancellation({
+ cancellation: c,
+}: {
+ cancellation: NonNullable
;
+}) {
+ const refund = c.refundStatus && refundStatusMeta(c.refundStatus);
+ return (
+
+
+ {formatKrw(c.refundAmount)}
+ {refund && {refund.label}}
+ ,
+ ],
+ c.refundCompletedAt !== null && ['환불 완료', time(c.refundCompletedAt)],
+ c.note !== null && ['메모', {c.note}],
+ ]}
+ />
+
+ );
+}
+
+export function OrderRefunds({ refunds }: { refunds: OrderDetail['refunds'] }) {
+ return (
+
+
+ {refunds.map((r) => {
+ const status = refundStatusMeta(r.status);
+ return (
+ -
+
+ {refundKindLabel(r.kind)}
+ {formatKrw(r.amount)}
+ {status.label}
+
+
+ {r.bank && r.accountNumberMasked
+ ? `${r.bank.name} ${r.accountNumberMasked} · ${r.accountHolder ?? ''}`
+ : '환불 계좌 입력 전'}
+
+
+ 요청 {time(r.requestedAt)}
+ {r.accountSubmittedAt && ` · 계좌 입력 ${time(r.accountSubmittedAt)}`}
+ {r.completedAt && ` · 송금 ${time(r.completedAt)}`}
+
+
+ );
+ })}
+
+
+ );
+}
+
+export function OrderSettlement({ order: o }: { order: OrderDetail }) {
+ const finalized = o.settlementFinalizedAt !== null;
+ const won = (n: number | null) => (n === null ? '—' : formatKrw(n));
+ return (
+
+
+
+ );
+}
diff --git a/src/features/orders/components/orders-filter-bar.tsx b/src/features/orders/components/orders-filter-bar.tsx
index 91d4244..820908d 100644
--- a/src/features/orders/components/orders-filter-bar.tsx
+++ b/src/features/orders/components/orders-filter-bar.tsx
@@ -1,5 +1,6 @@
import { useQuery } from '@tanstack/react-query';
+import { Button } from '@/shared/ui/button';
import { EntityPicker } from '@/shared/ui/entity-picker';
import { FilterBar } from '@/shared/ui/filter-bar';
import { FilterField } from '@/shared/ui/filter-field';
@@ -9,8 +10,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
import {
buyerNameQueryOptions,
buyerOptionsQueryOptions,
- storeNameQueryOptions,
storeOptionsQueryOptions,
+ storeRefQueryOptions,
} from '../api/queries';
import { type OrdersSearch, hasOrderFilters } from '../search';
import { ORDER_STATUS } from '../status';
@@ -24,9 +25,10 @@ interface Props {
}
export function OrdersFilterBar({ search, onChange, onReset }: Props) {
+ const inProgress = search.inProgress === 'true';
// 주소로 들어온 ID(매장 상세의 '주문 보기' 등)는 이름을 따로 불러 선택기에 보인다
- const storeName = useQuery({
- ...storeNameQueryOptions(search.storeId ?? ''),
+ const store = useQuery({
+ ...storeRefQueryOptions(search.storeId ?? ''),
enabled: search.storeId !== undefined,
});
const buyerName = useQuery({
@@ -61,6 +63,16 @@ export function OrdersFilterBar({ search, onChange, onReset }: Props) {
+
onChange({ storeId })}
/>
diff --git a/src/features/orders/meta.spec.ts b/src/features/orders/meta.spec.ts
new file mode 100644
index 0000000..d0d5c11
--- /dev/null
+++ b/src/features/orders/meta.spec.ts
@@ -0,0 +1,84 @@
+import {
+ actorLabel,
+ cancelFaultLabel,
+ cancelReasonLabel,
+ confirmSourceLabel,
+ formatBps,
+ paymentMethodLabel,
+ paymentStatusMeta,
+ refundKindLabel,
+ refundStatusMeta,
+} from './meta';
+
+describe('order meta', () => {
+ it.each([
+ [actorLabel, ['BUYER', 'SELLER', 'ADMIN', 'SYSTEM'], ['구매자', '판매자', '관리자', '시스템']],
+ [
+ cancelReasonLabel,
+ [
+ 'DESIGN_NOT_FEASIBLE',
+ 'OUT_OF_MATERIALS',
+ 'SCHEDULE_UNAVAILABLE',
+ 'INAPPROPRIATE_REQUEST',
+ 'BUYER_REQUEST',
+ 'OTHER',
+ 'PAYMENT_NOT_RECEIVED',
+ 'CONFIRM_TIMEOUT',
+ ],
+ [
+ '제작할 수 없는 디자인',
+ '재료 소진',
+ '일정 불가',
+ '부적절한 요청',
+ '구매자 요청',
+ '기타',
+ '미입금',
+ '판매자 미확정',
+ ],
+ ],
+ [cancelFaultLabel, ['SELLER', 'BUYER'], ['판매자 사정', '구매자 사정']],
+ [refundKindLabel, ['CANCEL', 'DEPOSIT_RETURN'], ['취소 환불', '입금 반환']],
+ [paymentMethodLabel, ['BANK_TRANSFER', 'TOSS'], ['계좌이체', '토스']],
+ [confirmSourceLabel, ['AUTO', 'ADMIN'], ['자동 매칭', '관리자 확인']],
+ ] as const)(
+ '라벨 표 %#는 SDL 값을 전부 바꾸고 모르는 값은 원문으로 둔다',
+ (fn, values, labels) => {
+ expect(values.map((v) => fn(v))).toEqual(labels);
+ expect(fn('NEW_VALUE')).toBe('NEW_VALUE');
+ expect(fn('constructor')).toBe('constructor');
+ },
+ );
+
+ it.each([
+ [refundStatusMeta, 'AWAITING_ACCOUNT', '계좌 입력 대기', 'caution'],
+ [refundStatusMeta, 'AWAITING_TRANSFER', '송금 대기', 'primary'],
+ [refundStatusMeta, 'COMPLETED', '송금 완료', 'positive'],
+ [paymentStatusMeta, 'PENDING', '입금 대기', 'neutral'],
+ [paymentStatusMeta, 'CONFIRMED', '입금 확인', 'positive'],
+ [paymentStatusMeta, 'CANCELED', '입금 전 취소', 'negative'],
+ [refundStatusMeta, 'toString', 'toString', 'neutral'],
+ [paymentStatusMeta, 'REFUNDED', 'REFUNDED', 'neutral'],
+ ] as const)('%#: %s는 %s(%s)', (fn, value, label, tone) => {
+ expect(fn(value)).toEqual({ label, tone });
+ });
+
+ it.each([
+ [0, '0%'],
+ [1, '0.01%'],
+ [50, '0.5%'],
+ [555, '5.55%'],
+ [1000, '10%'],
+ [10000, '100%'],
+ ])('수수료율 %ibp는 %s', (bps, text) => {
+ expect(formatBps(bps)).toBe(text);
+ });
+
+ it('0~10000bp 전부 정수 문자열 연산 결과와 같다', () => {
+ for (let bps = 0; bps <= 10000; bps += 1) {
+ const frac = String(bps % 100)
+ .padStart(2, '0')
+ .replace(/0+$/, '');
+ expect(formatBps(bps)).toBe(`${Math.floor(bps / 100)}${frac ? `.${frac}` : ''}%`);
+ }
+ });
+});
diff --git a/src/features/orders/meta.ts b/src/features/orders/meta.ts
new file mode 100644
index 0000000..09da221
--- /dev/null
+++ b/src/features/orders/meta.ts
@@ -0,0 +1,74 @@
+import {
+ type OrderActorType,
+ type OrderCancelFaultType,
+ type OrderCancelReasonType,
+ type PaymentConfirmSourceType,
+ type PaymentMethodType,
+ type PaymentStatusType,
+ type RefundKindType,
+ type RefundStatusType,
+} from '@/graphql/generated/graphql';
+import { type PillTone } from '@/shared/ui/status-pill';
+
+// Record라 codegen enum에 값이 늘면 tsc가 잡는다. 화면은 모르는 값이 와도 원문으로 보인다
+const ACTOR: Record = {
+ BUYER: '구매자',
+ SELLER: '판매자',
+ ADMIN: '관리자',
+ SYSTEM: '시스템',
+};
+// BE 사유 라벨과 같은 문구(이력에는 라벨이 따로 오지 않는다)
+const CANCEL_REASON: Record = {
+ DESIGN_NOT_FEASIBLE: '제작할 수 없는 디자인',
+ OUT_OF_MATERIALS: '재료 소진',
+ SCHEDULE_UNAVAILABLE: '일정 불가',
+ INAPPROPRIATE_REQUEST: '부적절한 요청',
+ BUYER_REQUEST: '구매자 요청',
+ OTHER: '기타',
+ PAYMENT_NOT_RECEIVED: '미입금',
+ CONFIRM_TIMEOUT: '판매자 미확정',
+};
+const CANCEL_FAULT: Record = {
+ SELLER: '판매자 사정',
+ BUYER: '구매자 사정',
+};
+const REFUND_KIND: Record = {
+ CANCEL: '취소 환불',
+ DEPOSIT_RETURN: '입금 반환',
+};
+const REFUND_STATUS: Record = {
+ AWAITING_ACCOUNT: { label: '계좌 입력 대기', tone: 'caution' },
+ AWAITING_TRANSFER: { label: '송금 대기', tone: 'primary' },
+ COMPLETED: { label: '송금 완료', tone: 'positive' },
+};
+const PAYMENT_METHOD: Record = {
+ BANK_TRANSFER: '계좌이체',
+ TOSS: '토스',
+};
+const PAYMENT_STATUS: Record = {
+ PENDING: { label: '입금 대기', tone: 'neutral' },
+ CONFIRMED: { label: '입금 확인', tone: 'positive' },
+ CANCELED: { label: '입금 전 취소', tone: 'negative' },
+};
+const CONFIRM_SOURCE: Record = {
+ AUTO: '자동 매칭',
+ ADMIN: '관리자 확인',
+};
+
+/** 표에 있는 값만 바꾼다. `constructor` 같은 프로토타입 키도 모르는 값이다 */
+const label = (table: Record, value: string) =>
+ Object.hasOwn(table, value) ? table[value]! : value;
+const pill = (table: Record, value: string) =>
+ Object.hasOwn(table, value) ? table[value]! : { label: value, tone: 'neutral' as const };
+
+export const actorLabel = (v: string) => label(ACTOR, v);
+export const cancelReasonLabel = (v: string) => label(CANCEL_REASON, v);
+export const cancelFaultLabel = (v: string) => label(CANCEL_FAULT, v);
+export const refundKindLabel = (v: string) => label(REFUND_KIND, v);
+export const refundStatusMeta = (v: string) => pill(REFUND_STATUS, v);
+export const paymentMethodLabel = (v: string) => label(PAYMENT_METHOD, v);
+export const paymentStatusMeta = (v: string) => pill(PAYMENT_STATUS, v);
+export const confirmSourceLabel = (v: string) => label(CONFIRM_SOURCE, v);
+
+/** 수수료율 bp(1bp = 0.01%) → '5.55%'. 정수 ÷ 100은 가장 가까운 double이라 소수 둘째 자리까지 그대로 찍힌다 */
+export const formatBps = (bps: number) => `${bps / 100}%`;
diff --git a/src/features/orders/pages/order-detail-page.tsx b/src/features/orders/pages/order-detail-page.tsx
index f5b1637..f0b4750 100644
--- a/src/features/orders/pages/order-detail-page.tsx
+++ b/src/features/orders/pages/order-detail-page.tsx
@@ -9,14 +9,23 @@ import { Skeleton } from '@/shared/ui/skeleton';
import { orderDetailQueryOptions } from '../api/queries';
import { CancelOrderDialog } from '../components/cancel-order-dialog';
+import { CompletePickupDialog } from '../components/complete-pickup-dialog';
import {
OrderBuyer,
OrderHistory,
OrderItems,
+ OrderPickupChanges,
OrderProgress,
+ OrderRequestNote,
} from '../components/order-detail-sections';
+import {
+ OrderCancellation,
+ OrderPayment,
+ OrderRefunds,
+ OrderSettlement,
+} from '../components/order-money-sections';
import { OrderStatusPill } from '../components/order-status-pill';
-import { isCancelable } from '../status';
+import { canCompletePickup } from '../status';
export function OrderDetailPage({ orderId }: { orderId: string }) {
const q = useQuery(orderDetailQueryOptions(orderId));
@@ -53,8 +62,15 @@ export function OrderDetailPage({ orderId }: { orderId: string }) {
감사 이력
- {isCancelable(order.status) && (
-
+ {canCompletePickup(order.status) && (
+
+ )}
+ {order.cancelOptions.cancelable && (
+
)}
>
}
@@ -63,9 +79,15 @@ export function OrderDetailPage({ orderId }: { orderId: string }) {
+ {order.requestNote !== null && }
+
+ {order.cancellation && }
+ {order.refunds.length > 0 && }
+
+ {order.pickupChanges.length > 0 && }
diff --git a/src/features/orders/pages/orders.spec.tsx b/src/features/orders/pages/orders.spec.tsx
index 9873ae8..2263470 100644
--- a/src/features/orders/pages/orders.spec.tsx
+++ b/src/features/orders/pages/orders.spec.tsx
@@ -147,29 +147,115 @@ const detail = {
toStatus: 'CONFIRMED',
changedAt: '2026-09-27T02:34:00.000Z',
note: null,
+ actorType: 'SELLER',
+ cancelReason: null,
+ cancelFault: null,
+ refundAmount: null,
},
{
id: 'h1',
- fromStatus: null,
+ fromStatus: 'PENDING_PAYMENT',
toStatus: 'SUBMITTED',
changedAt: '2026-09-27T02:20:00.000Z',
note: null,
+ actorType: 'ADMIN',
+ cancelReason: null,
+ cancelFault: null,
+ refundAmount: null,
},
],
+ requestNote: null as string | null,
+ payment: {
+ method: 'BANK_TRANSFER',
+ status: 'CONFIRMED',
+ amount: 48000,
+ depositorName: '김서연',
+ depositBank: { code: '020', name: '우리은행' },
+ depositAccountNumber: '1002123456789',
+ depositAccountHolder: '케이퀵',
+ expiresAt: '2026-09-27T03:10:00.000Z',
+ buyerClaimedAt: null,
+ confirmedAt: '2026-09-27T02:20:00.000Z',
+ confirmSource: 'ADMIN',
+ confirmedByLabel: '운영자(ops.admin)',
+ confirmNote: null,
+ } as Record
| null,
+ refunds: [] as Record[],
+ cancellation: null as Record | null,
+ cancelOptions: {
+ cancelable: true,
+ reasons: ['OUT_OF_MATERIALS', 'BUYER_REQUEST', 'OTHER'],
+ refundRule: 'BY_FAULT' as string | null,
+ paidAmount: 48000,
+ },
+ confirmDeadlineAt: null as string | null,
+ autoPickupAt: '2026-09-29T05:00:00.000Z' as string | null,
+ noShowAt: null as string | null,
+ pickupChanges: [] as Record[],
+ commissionRateBps: 1000,
+ expectedPayoutAmount: 43200 as number | null,
+ settlementBaseAmount: null as number | null,
+ commissionAmount: null as number | null,
+ settlementFinalizedAt: null as string | null,
+ settlementId: null as string | null,
};
-// 확정·제작 완료는 사정(fault) 선택이 필요해 지금 다이얼로그로는 취소할 수 없다
const submitted = {
...detail,
status: 'SUBMITTED',
confirmedAt: null,
statusHistories: detail.statusHistories.slice(1),
+ cancelOptions: { ...detail.cancelOptions, refundRule: 'FULL_REFUND' },
+ confirmDeadlineAt: '2026-09-28T02:20:00.000Z',
+ autoPickupAt: null,
};
+const canceledBy = (refundAmount: number) => ({
+ ...detail,
+ status: 'CANCELED',
+ canceledAt: '2026-09-27T03:00:00.000Z',
+ cancelOptions: { cancelable: false, reasons: [], refundRule: null, paidAmount: 48000 },
+ autoPickupAt: null,
+ cancellation: {
+ actorType: 'ADMIN',
+ reason: 'BUYER_REQUEST',
+ reasonLabel: '구매자 요청',
+ note: '구매자가 전화로 요청',
+ fault: 'BUYER',
+ refundAmount,
+ refundStatus: 'AWAITING_ACCOUNT',
+ refundCompletedAt: null,
+ canceledAt: '2026-09-27T03:00:00.000Z',
+ },
+});
+
+const pendingPayment = {
+ ...submitted,
+ status: 'PENDING_PAYMENT',
+ submittedAt: null,
+ statusHistories: [],
+ payment: {
+ ...detail.payment,
+ status: 'PENDING',
+ confirmedAt: null,
+ confirmSource: null,
+ confirmedByLabel: null,
+ },
+ cancelOptions: {
+ cancelable: true,
+ reasons: ['PAYMENT_NOT_RECEIVED', 'OTHER'],
+ refundRule: 'NO_REFUND',
+ paidAmount: 0,
+ },
+ confirmDeadlineAt: null,
+ expectedPayoutAmount: null,
+};
+const AUTO_PICKUP_UNKNOWN =
+ '09-29 14:00에 자동 픽업 완료 예정입니다. 매장이 숨김이면 자동으로 처리되지 않습니다.';
/** 매장·구매자 이름 조회 기본 응답. 테스트가 뒤에 등록한 핸들러가 이긴다 */
function useNameLookups() {
server.use(
gqlOk('AdminOrdersStoreName', {
- adminStore: { store: { id: '17', storeName: '달빛 케이크' } },
+ adminStore: { store: { id: '17', storeName: '달빛 케이크', isActive: true } },
}),
gqlOk('AdminOrdersBuyerName', {
adminUser: { accountId: '17', nickname: 'seoyeon', name: null, email: 'a@b.c' },
@@ -247,6 +333,51 @@ describe('주문 목록', () => {
expect(inputs.at(-1)).toMatchObject({ status: null, keyword: null });
});
+ it('진행 중 칩은 첫 페이지부터 inProgress를 켜고 끄며 상태 필터에 7개 상태가 있다', async () => {
+ const inputs: Record[] = [];
+ server.use(
+ graphql.query('AdminOrders', ({ variables }) => {
+ inputs.push((variables as { input: Record }).input);
+ return HttpResponse.json({
+ data: {
+ adminOrders: {
+ items: [row('1', 'PENDING_PAYMENT'), row('2', 'NO_SHOW')],
+ totalCount: 2,
+ hasMore: false,
+ nextCursor: null,
+ },
+ },
+ });
+ }),
+ );
+ boot('/orders?cursor=zzz');
+ const table = await screen.findByRole('table');
+ expect(await within(table).findByText('입금 대기')).toBeInTheDocument();
+ expect(within(table).getByText('노쇼')).toBeInTheDocument();
+ expect(inputs[0]).toMatchObject({ inProgress: false });
+ const chip = screen.getByRole('button', { name: '진행 중' });
+ expect(chip).toHaveAttribute('aria-pressed', 'false');
+ await userEvent.click(chip);
+ await vi.waitFor(() => expect(inputs.at(-1)).toMatchObject({ inProgress: true, cursor: null }));
+ expect(window.location.search).toContain('inProgress=true');
+ expect(screen.getByRole('button', { name: '진행 중' })).toHaveAttribute('aria-pressed', 'true');
+ await userEvent.click(screen.getByRole('button', { name: '진행 중' }));
+ await vi.waitFor(() => expect(inputs.at(-1)).toMatchObject({ inProgress: false }));
+ expect(window.location.search).not.toContain('inProgress');
+
+ await userEvent.click(screen.getByRole('combobox', { name: '주문 상태' }));
+ expect(screen.getAllByRole('option').map((o) => o.textContent)).toEqual([
+ '전체',
+ '입금 대기',
+ '접수',
+ '주문 확정',
+ '제작 완료',
+ '픽업 완료',
+ '노쇼',
+ '취소',
+ ]);
+ });
+
it('이전은 지나온 커서로 돌아가고 필터를 유지한다', async () => {
server.use(
graphql.query('AdminOrders', ({ variables }) => {
@@ -422,7 +553,7 @@ describe('주문 목록', () => {
});
}),
gqlOk('AdminOrdersStoreName', {
- adminStore: { store: { id: '0', storeName: '달빛 베이커리' } },
+ adminStore: { store: { id: '0', storeName: '달빛 베이커리', isActive: false } },
}),
gqlOk('AdminOrdersBuyerOptions', {
adminUsers: {
@@ -522,7 +653,7 @@ describe('주문 상세', () => {
forgetSearches();
});
- it('구매자·상품·옵션·문구·이력을 보여주고 취소 시 사유를 보내며 목록·상세를 갱신한다', async () => {
+ it('구매자·상품·옵션·문구·이력을 보여주고 접수 주문은 사유를 골라 전액 환불로 취소한다', async () => {
let detailCalls = 0;
let cancelInput: unknown;
server.use(
@@ -533,7 +664,23 @@ describe('주문 상세', () => {
adminOrder:
detailCalls === 1
? submitted
- : { ...submitted, status: 'CANCELED', canceledAt: '2026-09-27T03:00:00.000Z' },
+ : {
+ ...canceledBy(48000),
+ statusHistories: [
+ {
+ id: 'h3',
+ fromStatus: 'SUBMITTED',
+ toStatus: 'CANCELED',
+ changedAt: '2026-09-27T03:00:00.000Z',
+ note: '재고 없음',
+ actorType: 'ADMIN',
+ cancelReason: 'OUT_OF_MATERIALS',
+ cancelFault: null,
+ refundAmount: 48000,
+ },
+ ...submitted.statusHistories,
+ ],
+ },
},
});
}),
@@ -550,32 +697,455 @@ describe('주문 상세', () => {
expect(screen.getByText('seoyeon')).toBeInTheDocument();
const history = screen.getByText('상태 이력').closest('[data-slot="card"]')!;
expect(within(history).getAllByRole('listitem')).toHaveLength(1);
+ expect(screen.queryByRole('button', { name: '픽업 완료' })).not.toBeInTheDocument();
- await userEvent.click(screen.getByRole('button', { name: '주문 취소' }));
+ await userEvent.click(screen.getByRole('button', { name: '강제 취소' }));
const dialog = await screen.findByRole('dialog');
- const confirm = within(dialog).getByRole('button', { name: '주문 취소' });
+ const confirm = within(dialog).getByRole('button', { name: '강제 취소' });
expect(confirm).toBeDisabled();
- await userEvent.type(within(dialog).getByLabelText('취소 사유 (필수)'), ' 재고 없음 ');
+ // 접수 주문은 사정을 묻지 않는다
+ expect(within(dialog).queryByRole('radio')).not.toBeInTheDocument();
+ expect(within(dialog).getByRole('status')).toHaveTextContent(
+ '결제액 48,000원을 전액 환불합니다.',
+ );
+ await userEvent.click(within(dialog).getByRole('combobox', { name: '취소 사유' }));
+ expect(screen.getAllByRole('option').map((o) => o.textContent)).toEqual([
+ '재료 소진',
+ '구매자 요청',
+ '기타',
+ ]);
+ await userEvent.click(screen.getByRole('option', { name: '재료 소진' }));
+ await userEvent.type(within(dialog).getByLabelText('메모 (선택)'), ' 재고 없음 🎂 ');
+ expect(within(dialog).getByText('7 / 500')).toBeInTheDocument();
await userEvent.click(confirm);
await vi.waitFor(() =>
- expect(cancelInput).toEqual({ orderId: '1', reason: 'OTHER', note: '재고 없음' }),
+ expect(cancelInput).toEqual({
+ orderId: '1',
+ reason: 'OUT_OF_MATERIALS',
+ note: '재고 없음 🎂',
+ }),
);
await vi.waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
expect(await screen.findByText(/취소됨/)).toBeInTheDocument();
- expect(screen.queryByRole('button', { name: '주문 취소' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: '강제 취소' })).not.toBeInTheDocument();
expect(detailCalls).toBe(2);
+ const canceled = within(history).getAllByRole('listitem')[0]!;
+ expect(canceled).toHaveTextContent('관리자');
+ expect(canceled).toHaveTextContent('사유 재료 소진 · 환불 48,000원');
+ });
+
+ it('확정 주문은 사정을 골라야 하고 구매자 사정이면 0원~결제액 금액을 받는다', async () => {
+ const inputs: unknown[] = [];
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: detail }),
+ graphql.mutation('AdminCancelOrder', ({ variables }) => {
+ inputs.push((variables as { input: unknown }).input);
+ return HttpResponse.json({
+ data: null,
+ errors: [
+ {
+ message: '테스트는 다이얼로그를 남긴다',
+ extensions: { code: 'TEST', classification: 'CONFLICT', statusCode: 409 },
+ },
+ ],
+ });
+ }),
+ );
+ boot('/orders/1');
+ await userEvent.click(await screen.findByRole('button', { name: '강제 취소' }));
+ const dialog = await screen.findByRole('dialog');
+ const confirm = within(dialog).getByRole('button', { name: '강제 취소' });
+ await userEvent.click(within(dialog).getByRole('combobox', { name: '취소 사유' }));
+ await userEvent.click(screen.getByRole('option', { name: '구매자 요청' }));
+ expect(within(dialog).getByRole('status')).toHaveTextContent(
+ '사정을 고르면 환불 금액이 정해집니다.',
+ );
+ expect(confirm).toBeDisabled();
+ expect(within(dialog).queryByLabelText('환불 금액 (필수)')).not.toBeInTheDocument();
+
+ await userEvent.click(within(dialog).getByRole('radio', { name: '판매자 사정' }));
+ expect(within(dialog).queryByLabelText('환불 금액 (필수)')).not.toBeInTheDocument();
+ expect(within(dialog).getByRole('status')).toHaveTextContent(
+ '판매자 사정이라 결제액 48,000원을 전액 환불합니다.',
+ );
+ await userEvent.click(confirm);
+ await vi.waitFor(() =>
+ expect(inputs.at(-1)).toEqual({
+ orderId: '1',
+ reason: 'BUYER_REQUEST',
+ note: null,
+ fault: 'SELLER',
+ }),
+ );
+ // 입력 오류가 아닌 거절은 폼이 아니라 토스트로 알린다
+ expect(await screen.findByText('테스트는 다이얼로그를 남긴다')).toBeInTheDocument();
+ expect(within(dialog).queryByRole('alert')).not.toBeInTheDocument();
+
+ await userEvent.click(within(dialog).getByRole('radio', { name: '구매자 사정' }));
+ const amount = within(dialog).getByLabelText('환불 금액 (필수)');
+ expect(confirm).toBeDisabled();
+ await userEvent.type(amount, '48001');
+ expect(amount).toHaveAttribute('aria-invalid', 'true');
+ expect(confirm).toBeDisabled();
+ await userEvent.click(within(dialog).getByRole('button', { name: '전액' }));
+ expect(amount).toHaveValue('48000');
+ expect(amount).toHaveAttribute('aria-invalid', 'false');
+ await userEvent.click(within(dialog).getByRole('button', { name: '0원' }));
+ expect(amount).toHaveValue('0');
+ expect(within(dialog).getByRole('status')).toHaveTextContent(
+ '0원을 환불하고, 남은 48,000원은 수수료를 뺀 뒤 매장 정산에 포함합니다.',
+ );
+ // '0'도 금액이다
+ await userEvent.click(confirm);
+ await vi.waitFor(() =>
+ expect(inputs.at(-1)).toEqual({
+ orderId: '1',
+ reason: 'BUYER_REQUEST',
+ note: null,
+ fault: 'BUYER',
+ refundAmount: 0,
+ }),
+ );
+ expect(inputs).toHaveLength(2);
+ });
+
+ it('입금 대기 주문은 미입금 사유로 환불 없이 취소하고 입금 기한을 안내한다', async () => {
+ let cancelInput: unknown;
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: pendingPayment }),
+ graphql.mutation('AdminCancelOrder', ({ variables }) => {
+ cancelInput = (variables as { input: unknown }).input;
+ return HttpResponse.json({ data: { adminCancelOrder: { id: '1', status: 'CANCELED' } } });
+ }),
+ );
+ boot('/orders/1');
+ expect(await screen.findByRole('note', { name: '자동 처리 예정' })).toHaveTextContent(
+ '09-27 12:10까지 입금이 확인되지 않으면 자동 취소됩니다.',
+ );
+ const progress = screen.getByText('진행 상태').closest('[data-slot="card"]')!;
+ expect(within(progress).getAllByRole('listitem')[0]).toHaveTextContent('입금 대기09-27 11:20');
+ await userEvent.click(screen.getByRole('button', { name: '강제 취소' }));
+ const dialog = await screen.findByRole('dialog');
+ expect(within(dialog).getByRole('status')).toHaveTextContent(
+ '입금 전 주문이라 환불 없이 취소합니다.',
+ );
+ await userEvent.click(within(dialog).getByRole('combobox', { name: '취소 사유' }));
+ await userEvent.click(screen.getByRole('option', { name: '미입금' }));
+ await userEvent.click(within(dialog).getByRole('button', { name: '강제 취소' }));
+ await vi.waitFor(() =>
+ expect(cancelInput).toEqual({ orderId: '1', reason: 'PAYMENT_NOT_RECEIVED', note: null }),
+ );
+ });
+
+ it.each([
+ ['PICKED_UP', '픽업 완료'],
+ ['NO_SHOW', '노쇼'],
+ ])('%s처럼 취소할 수 없는 주문은 강제 취소·픽업 완료 버튼이 없다', async (status, label) => {
+ server.use(
+ gqlOk('AdminOrder', {
+ adminOrder: {
+ ...detail,
+ status,
+ noShowAt: status === 'NO_SHOW' ? '2026-09-28T06:00:00.000Z' : null,
+ autoPickupAt: null,
+ cancelOptions: { cancelable: false, reasons: [], refundRule: null, paidAmount: 48000 },
+ },
+ }),
+ );
+ boot('/orders/1');
+ await screen.findByText('레터링 생크림 케이크');
+ expect(screen.getAllByText(label).length).toBeGreaterThan(0);
+ expect(screen.queryByRole('button', { name: '강제 취소' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: '픽업 완료' })).not.toBeInTheDocument();
+ if (status === 'NO_SHOW')
+ expect(screen.getByText('노쇼 · 2026-09-28 15:00')).toBeInTheDocument();
});
it.each(['CONFIRMED', 'MADE'])(
- '%s 주문은 사정 선택이 필요해 취소 버튼이 없다',
+ '%s 주문은 메모와 함께 픽업 완료로 처리하고 상세·목록을 갱신한다',
async (status) => {
- server.use(gqlOk('AdminOrder', { adminOrder: { ...detail, status } }));
+ let detailCalls = 0;
+ let pickupInput: unknown;
+ server.use(
+ graphql.query('AdminOrder', () => {
+ detailCalls += 1;
+ return HttpResponse.json({
+ data: {
+ adminOrder:
+ detailCalls === 1
+ ? { ...detail, status }
+ : {
+ ...detail,
+ status: 'PICKED_UP',
+ pickedUpAt: '2026-09-28T06:00:00.000Z',
+ autoPickupAt: null,
+ cancelOptions: { ...detail.cancelOptions, cancelable: false },
+ },
+ },
+ });
+ }),
+ graphql.mutation('AdminCompleteOrderPickup', ({ variables }) => {
+ pickupInput = (variables as { input: unknown }).input;
+ return HttpResponse.json({
+ data: { adminCompleteOrderPickup: { id: '1', status: 'PICKED_UP' } },
+ });
+ }),
+ );
boot('/orders/1');
- await screen.findByText('레터링 생크림 케이크');
- expect(screen.queryByRole('button', { name: '주문 취소' })).not.toBeInTheDocument();
+ // 숨김 매장 진행 주문에서 강제 취소와 나란히 쓴다
+ expect(await screen.findByRole('button', { name: '강제 취소' })).toBeInTheDocument();
+ await userEvent.click(screen.getByRole('button', { name: '픽업 완료' }));
+ const dialog = await screen.findByRole('dialog');
+ expect(within(dialog).getByText(/정산을 확정합니다/)).toBeInTheDocument();
+ await userEvent.type(
+ within(dialog).getByLabelText('메모 (선택)'),
+ '매장 숨김, 전화로 수령 확인',
+ );
+ await userEvent.click(within(dialog).getByRole('button', { name: '픽업 완료' }));
+ await vi.waitFor(() =>
+ expect(pickupInput).toEqual({ orderId: '1', note: '매장 숨김, 전화로 수령 확인' }),
+ );
+ await vi.waitFor(() => expect(detailCalls).toBe(2));
+ await vi.waitFor(() =>
+ expect(screen.queryByRole('button', { name: '픽업 완료' })).not.toBeInTheDocument(),
+ );
+ // 앞 케이스의 토스트가 남아 있을 수 있다
+ expect(await screen.findAllByText(/픽업 완료로 처리했습니다/)).not.toHaveLength(0);
},
);
+ it.each([
+ ['ORDER_STATUS_UNCHANGED', '이미 픽업 완료된 주문입니다.'],
+ ['INVALID_ORDER_STATUS_TRANSITION', '지금 상태에서는 픽업 완료로 처리할 수 없습니다.'],
+ ['ORDER_NOT_FOUND', '주문을 찾을 수 없습니다.'],
+ ])('픽업 완료가 %s로 거절되면 문구를 알리고 상세를 다시 불러온다', async (code, message) => {
+ let detailCalls = 0;
+ let pickupInput: unknown;
+ server.use(
+ graphql.query('AdminOrder', () => {
+ detailCalls += 1;
+ return HttpResponse.json({ data: { adminOrder: detail } });
+ }),
+ graphql.mutation('AdminCompleteOrderPickup', ({ variables }) => {
+ pickupInput = (variables as { input: unknown }).input;
+ return HttpResponse.json({
+ data: null,
+ errors: [
+ {
+ message: '주문을 찾을 수 없습니다.',
+ extensions: {
+ code,
+ classification: code === 'ORDER_NOT_FOUND' ? 'NOT_FOUND' : 'BAD_USER_INPUT',
+ statusCode: code === 'ORDER_NOT_FOUND' ? 404 : 400,
+ },
+ },
+ ],
+ });
+ }),
+ );
+ boot('/orders/1');
+ await userEvent.click(await screen.findByRole('button', { name: '픽업 완료' }));
+ const dialog = await screen.findByRole('dialog');
+ await userEvent.click(within(dialog).getByRole('button', { name: '픽업 완료' }));
+ expect(await screen.findByText(message)).toBeInTheDocument();
+ expect(pickupInput).toEqual({ orderId: '1', note: null });
+ await vi.waitFor(() => expect(detailCalls).toBe(2));
+ expect(screen.getByRole('dialog')).toBeInTheDocument();
+ });
+
+ it('결제·정산 카드와 자동 픽업 완료 예정을 보이고 입금 계좌는 끝 4자리만 보인다', async () => {
+ server.use(gqlOk('AdminOrder', { adminOrder: detail }));
+ boot('/orders/1');
+ const card = (title: string) =>
+ screen
+ .getAllByText(title)
+ .find((el) => el.dataset.slot === 'card-title')!
+ .closest('[data-slot="card"]')!;
+ await screen.findByText('레터링 생크림 케이크');
+ const pay = card('결제');
+ expect(within(pay).getByText('계좌이체')).toBeInTheDocument();
+ expect(within(pay).getByText('입금 확인')).toBeInTheDocument();
+ expect(within(pay).getByText('우리은행 ****6789 · 케이퀵')).toBeInTheDocument();
+ expect(pay).not.toHaveTextContent('1002123456789');
+ expect(
+ within(pay).getByText('2026-09-27 11:20 · 관리자 확인 · 운영자(ops.admin)'),
+ ).toBeInTheDocument();
+ expect(within(pay).queryByText('확인 메모')).not.toBeInTheDocument();
+ const settle = card('정산');
+ expect(within(settle).getByText('10% (주문 시점)')).toBeInTheDocument();
+ expect(within(settle).getByText('정산 예정')).toBeInTheDocument();
+ expect(within(settle).getByText('43,200원')).toBeInTheDocument();
+ expect(within(settle).getByText('묶이기 전')).toBeInTheDocument();
+ expect(within(settle).queryByText('수수료')).not.toBeInTheDocument();
+ await vi.waitFor(() =>
+ expect(screen.getByRole('note', { name: '자동 처리 예정' })).toHaveTextContent(
+ '09-29 14:00에 자동으로 픽업 완료됩니다.',
+ ),
+ );
+ expect(screen.queryByText('요청 사항')).not.toBeInTheDocument();
+ expect(screen.queryByText('픽업 일시 변경')).not.toBeInTheDocument();
+ expect(screen.queryByText('환불')).not.toBeInTheDocument();
+ });
+
+ it('숨김 매장의 확정 주문은 자동 픽업 완료되지 않는다고 알린다', async () => {
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: detail }),
+ gqlOk('AdminOrdersStoreName', {
+ adminStore: { store: { id: '17', storeName: '달빛 케이크', isActive: false } },
+ }),
+ );
+ boot('/orders/1');
+ await vi.waitFor(() =>
+ expect(screen.getByRole('note', { name: '자동 처리 예정' })).toHaveTextContent(
+ '매장이 숨김이라 09-29 14:00에 자동 픽업 완료되지 않습니다. 픽업 완료나 강제 취소로 직접 처리하세요.',
+ ),
+ );
+ });
+
+ it('매장 조회가 끝나기 전에는 자동 픽업 완료를 단정하지 않는다', async () => {
+ let release!: () => void;
+ const gate = new Promise((r) => (release = r));
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: detail }),
+ graphql.query('AdminOrdersStoreName', async () => {
+ await gate;
+ return HttpResponse.json({
+ data: { adminStore: { store: { id: '17', storeName: '달빛 케이크', isActive: false } } },
+ });
+ }),
+ );
+ boot('/orders/1');
+ const note = await screen.findByRole('note', { name: '자동 처리 예정' });
+ expect(note).toHaveTextContent(AUTO_PICKUP_UNKNOWN);
+ release();
+ await vi.waitFor(() => expect(note).toHaveTextContent(/^매장이 숨김이라/));
+ });
+
+ it('상세를 다시 열면 매장 숨김 여부를 다시 확인한다', async () => {
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: detail }),
+ gqlOk('AdminOrders', {
+ adminOrders: { items: [row('1')], totalCount: 1, hasMore: false, nextCursor: null },
+ }),
+ );
+ boot('/orders/1');
+ const note = () => screen.getByRole('note', { name: '자동 처리 예정' });
+ await vi.waitFor(() =>
+ expect(note()).toHaveTextContent('09-29 14:00에 자동으로 픽업 완료됩니다.'),
+ );
+ // 그사이 매장 화면에서 숨겼다
+ server.use(
+ gqlOk('AdminOrdersStoreName', {
+ adminStore: { store: { id: '17', storeName: '달빛 케이크', isActive: false } },
+ }),
+ );
+ await userEvent.click(screen.getByRole('link', { name: '목록으로' }));
+ await userEvent.click(await screen.findByRole('link', { name: 'CQ-2609-1' }));
+ await vi.waitFor(() => expect(note()).toHaveTextContent(/^매장이 숨김이라/));
+ });
+
+ it('취소 주문은 취소·환불 카드와 확정된 정산을, 요청 사항·픽업 변경 이력을 보인다', async () => {
+ server.use(
+ gqlOk('AdminOrder', {
+ adminOrder: {
+ ...canceledBy(10000),
+ requestNote: '초는 빼 주세요.\n포장은 따로',
+ refunds: [
+ {
+ id: 'r1',
+ kind: 'CANCEL',
+ amount: 10000,
+ status: 'AWAITING_ACCOUNT',
+ bank: null,
+ accountHolder: null,
+ accountNumberMasked: null,
+ requestedAt: '2026-09-27T03:00:00.000Z',
+ accountSubmittedAt: null,
+ completedAt: null,
+ },
+ {
+ id: 'r2',
+ kind: 'DEPOSIT_RETURN',
+ amount: 5000,
+ status: 'COMPLETED',
+ bank: { code: '004', name: 'KB국민은행' },
+ accountHolder: '김서연',
+ accountNumberMasked: '****4321',
+ requestedAt: '2026-09-27T04:00:00.000Z',
+ accountSubmittedAt: '2026-09-27T05:00:00.000Z',
+ completedAt: '2026-09-27T06:00:00.000Z',
+ },
+ ],
+ pickupChanges: [
+ {
+ id: 'p1',
+ fromPickupAt: '2026-09-28T03:00:00.000Z',
+ toPickupAt: '2026-09-28T05:00:00.000Z',
+ changedAt: '2026-09-27T02:40:00.000Z',
+ note: '오전 재료 입고 지연',
+ },
+ ],
+ expectedPayoutAmount: 34200,
+ settlementBaseAmount: 38000,
+ commissionAmount: 3800,
+ settlementFinalizedAt: '2026-09-27T03:00:00.000Z',
+ settlementId: '12',
+ },
+ }),
+ );
+ boot('/orders/1');
+ const card = (title: string) =>
+ screen
+ .getAllByText(title)
+ .find((el) => el.dataset.slot === 'card-title')!
+ .closest('[data-slot="card"]')!;
+ await screen.findByText('취소됨 · 2026-09-27 12:00');
+ expect(screen.queryByRole('note', { name: '자동 처리 예정' })).not.toBeInTheDocument();
+ const cancel = card('취소');
+ for (const text of [
+ '주체관리자',
+ '사유구매자 요청',
+ '사정구매자 사정',
+ '환불 금액10,000원계좌 입력 대기',
+ '메모구매자가 전화로 요청',
+ ])
+ expect(cancel).toHaveTextContent(text);
+ const [first, second] = within(card('환불')).getAllByRole('listitem');
+ expect(first).toHaveTextContent('취소 환불10,000원계좌 입력 대기');
+ expect(first).toHaveTextContent('환불 계좌 입력 전');
+ expect(second).toHaveTextContent('입금 반환5,000원송금 완료');
+ expect(second).toHaveTextContent('KB국민은행 ****4321 · 김서연');
+ expect(second).toHaveTextContent(
+ '요청 2026-09-27 13:00 · 계좌 입력 2026-09-27 14:00 · 송금 2026-09-27 15:00',
+ );
+ const settle = card('정산');
+ for (const text of ['매장 지급액', '34,200원', '38,000원', '3,800원', '#12'])
+ expect(within(settle).getByText(text)).toBeInTheDocument();
+ expect(within(card('요청 사항')).getByText(/초는 빼 주세요/)).toHaveClass(
+ 'whitespace-pre-wrap',
+ );
+ expect(within(card('픽업 일시 변경')).getByRole('listitem')).toHaveTextContent(
+ '2026-09-28 12:00 → 2026-09-28 14:00변경 2026-09-27 11:40오전 재료 입고 지연',
+ );
+ });
+
+ it('결제 도입 전 주문은 결제 기록이 없다고 알리고 진행 단계는 접수부터 보인다', async () => {
+ server.use(
+ gqlOk('AdminOrder', {
+ adminOrder: { ...detail, payment: null, expectedPayoutAmount: null },
+ }),
+ );
+ boot('/orders/1');
+ expect(
+ await screen.findByText('결제 도입 전 주문이라 결제 기록이 없습니다.'),
+ ).toBeInTheDocument();
+ const progress = screen.getByText('진행 상태').closest('[data-slot="card"]')!;
+ expect(
+ within(progress)
+ .getAllByRole('listitem')
+ .map((li) => li.textContent?.slice(0, 2)),
+ ).toEqual(['접수', '주문', '제작', '픽업']);
+ });
it('상품·매장·구매자를 해당 상세로 잇고 계정 상태는 한국어로 보인다', async () => {
server.use(gqlOk('AdminOrder', { adminOrder: detail }));
boot('/orders/1');
@@ -850,23 +1420,166 @@ describe('주문 상세', () => {
expect(screen.queryByText('확인')).not.toBeInTheDocument();
});
- it('취소 실패는 토스트로 알리고 다이얼로그는 남는다', async () => {
+ it('선택지 밖 사유로 거절되면 폼 위에 알리고 다시 받은 선택지에 맞춰 사유를 비운다', async () => {
+ let detailCalls = 0;
server.use(
- gqlOk('AdminOrder', { adminOrder: submitted }),
+ graphql.query('AdminOrder', () => {
+ detailCalls += 1;
+ // 그사이 다른 관리자가 입금을 확인해 접수가 됐다
+ return HttpResponse.json({
+ data: { adminOrder: detailCalls === 1 ? pendingPayment : submitted },
+ });
+ }),
gqlError('AdminCancelOrder', {
- message: '이미 픽업된 주문',
- code: 'ORDER_NOT_CANCELABLE',
+ message: '이 주문에는 선택할 수 없는 취소 사유입니다.',
+ code: 'CANCEL_REASON_NOT_ALLOWED',
classification: 'BAD_USER_INPUT',
statusCode: 400,
}),
);
boot('/orders/1');
- await userEvent.click(await screen.findByRole('button', { name: '주문 취소' }));
+ await userEvent.click(await screen.findByRole('button', { name: '강제 취소' }));
const dialog = await screen.findByRole('dialog');
- await userEvent.type(within(dialog).getByLabelText('취소 사유 (필수)'), '사유');
- await userEvent.click(within(dialog).getByRole('button', { name: '주문 취소' }));
- expect(await screen.findByText('이미 픽업된 주문')).toBeInTheDocument();
- expect(screen.getByRole('dialog')).toBeInTheDocument();
+ const reason = () => within(dialog).getByRole('combobox', { name: '취소 사유' });
+ await userEvent.click(reason());
+ await userEvent.click(screen.getByRole('option', { name: '미입금' }));
+ await userEvent.type(within(dialog).getByLabelText('메모 (선택)'), '입금 안 됨');
+ await userEvent.click(within(dialog).getByRole('button', { name: '강제 취소' }));
+ expect(await within(dialog).findByRole('alert')).toHaveTextContent(
+ '이 주문에는 선택할 수 없는 취소 사유입니다.',
+ );
+ await vi.waitFor(() =>
+ expect(within(dialog).getByRole('status')).toHaveTextContent(
+ '결제액 48,000원을 전액 환불합니다.',
+ ),
+ );
+ expect(detailCalls).toBe(2);
+ expect(reason()).toHaveTextContent('사유 선택');
+ expect(within(dialog).getByRole('button', { name: '강제 취소' })).toBeDisabled();
+
+ // 입력을 바꾸면 알림을 지운다
+ await userEvent.click(reason());
+ await userEvent.click(screen.getByRole('option', { name: '기타' }));
+ expect(within(dialog).queryByRole('alert')).not.toBeInTheDocument();
+ expect(within(dialog).getByRole('button', { name: '강제 취소' })).toBeEnabled();
+
+ // 닫았다 다시 열면 새로 입력받는다
+ const footer = dialog.querySelector('[data-slot="dialog-footer"]')!;
+ await userEvent.click(within(footer).getByRole('button', { name: '닫기' }));
+ await userEvent.click(screen.getByRole('button', { name: '강제 취소' }));
+ const reopened = await screen.findByRole('dialog');
+ expect(within(reopened).getByRole('combobox', { name: '취소 사유' })).toHaveTextContent(
+ '사유 선택',
+ );
+ expect(within(reopened).getByLabelText('메모 (선택)')).toHaveValue('');
+ });
+
+ it('취소할 수 없게 된 주문은 토스트로 알리고 다이얼로그는 버튼과 함께 사라진다', async () => {
+ let detailCalls = 0;
+ server.use(
+ graphql.query('AdminOrder', () => {
+ detailCalls += 1;
+ return HttpResponse.json({
+ data: { adminOrder: detailCalls === 1 ? submitted : canceledBy(48000) },
+ });
+ }),
+ gqlError('AdminCancelOrder', {
+ message: '현재 상태에서는 주문을 취소할 수 없습니다.',
+ code: 'ORDER_NOT_CANCELLABLE',
+ classification: 'BAD_USER_INPUT',
+ statusCode: 400,
+ }),
+ );
+ boot('/orders/1');
+ await userEvent.click(await screen.findByRole('button', { name: '강제 취소' }));
+ const dialog = await screen.findByRole('dialog');
+ await userEvent.click(within(dialog).getByRole('combobox', { name: '취소 사유' }));
+ await userEvent.click(screen.getByRole('option', { name: '기타' }));
+ await userEvent.click(within(dialog).getByRole('button', { name: '강제 취소' }));
+ expect(
+ await screen.findByText('현재 상태에서는 주문을 취소할 수 없습니다.'),
+ ).toBeInTheDocument();
+ await vi.waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
+ expect(screen.queryByRole('button', { name: '강제 취소' })).not.toBeInTheDocument();
+ expect(detailCalls).toBe(2);
+ });
+
+ it('픽업 완료 메모는 BE처럼 앞뒤 공백을 뺀 코드 포인트로 500자까지 받는다', async () => {
+ server.use(gqlOk('AdminOrder', { adminOrder: detail }));
+ boot('/orders/1');
+ await userEvent.click(await screen.findByRole('button', { name: '픽업 완료' }));
+ const dialog = await screen.findByRole('dialog');
+ const confirm = within(dialog).getByRole('button', { name: '픽업 완료' });
+ await userEvent.click(within(dialog).getByLabelText('메모 (선택)'));
+ await userEvent.paste(` ${'🎂'.repeat(500)}`);
+ expect(within(dialog).getByText('500 / 500')).toBeInTheDocument();
+ expect(confirm).toBeEnabled();
+ await userEvent.paste('🎂');
+ expect(within(dialog).getByText('501 / 500')).toBeInTheDocument();
+ expect(confirm).toBeDisabled();
+ });
+
+ /** 목록 → 상세에서 처리한 뒤 '목록으로' 돌아갈 때까지 목록 조회 횟수 */
+ async function listCallsAfter(handle: () => Promise) {
+ let listCalls = 0;
+ server.use(
+ graphql.query('AdminOrders', () => {
+ listCalls += 1;
+ return HttpResponse.json({
+ data: {
+ adminOrders: { items: [row('1')], totalCount: 1, hasMore: false, nextCursor: null },
+ },
+ });
+ }),
+ );
+ boot('/orders');
+ await userEvent.click(await screen.findByRole('link', { name: 'CQ-2609-1' }));
+ await handle();
+ expect(listCalls).toBe(1);
+ await userEvent.click(screen.getByRole('link', { name: '목록으로' }));
+ await screen.findByText('전체 1건');
+ return () => listCalls;
+ }
+
+ it('강제 취소가 성공하면 목록으로 돌아갈 때 목록을 다시 불러온다', async () => {
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: submitted }),
+ graphql.mutation('AdminCancelOrder', () =>
+ HttpResponse.json({ data: { adminCancelOrder: { id: '1', status: 'CANCELED' } } }),
+ ),
+ );
+ const listCalls = await listCallsAfter(async () => {
+ await userEvent.click(await screen.findByRole('button', { name: '강제 취소' }));
+ const dialog = await screen.findByRole('dialog');
+ await userEvent.click(within(dialog).getByRole('combobox', { name: '취소 사유' }));
+ await userEvent.click(screen.getByRole('option', { name: '기타' }));
+ await userEvent.click(within(dialog).getByRole('button', { name: '강제 취소' }));
+ await vi.waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
+ });
+ await vi.waitFor(() => expect(listCalls()).toBe(2));
+ });
+
+ it('픽업 완료가 거절돼도 목록으로 돌아갈 때 목록을 다시 불러온다', async () => {
+ server.use(
+ gqlOk('AdminOrder', { adminOrder: detail }),
+ gqlError('AdminCompleteOrderPickup', {
+ message: '허용되지 않는 주문 상태 전이입니다.',
+ code: 'INVALID_ORDER_STATUS_TRANSITION',
+ classification: 'BAD_USER_INPUT',
+ statusCode: 400,
+ }),
+ );
+ const listCalls = await listCallsAfter(async () => {
+ await userEvent.click(await screen.findByRole('button', { name: '픽업 완료' }));
+ const dialog = await screen.findByRole('dialog');
+ await userEvent.click(within(dialog).getByRole('button', { name: '픽업 완료' }));
+ // 앞 케이스의 토스트가 남아 있을 수 있다
+ expect(
+ await screen.findAllByText('지금 상태에서는 픽업 완료로 처리할 수 없습니다.'),
+ ).not.toHaveLength(0);
+ await userEvent.keyboard('{Escape}');
+ });
+ await vi.waitFor(() => expect(listCalls()).toBe(2));
});
it('없는 주문은 NOT_FOUND 문구와 목록 링크', async () => {
diff --git a/src/features/orders/search.spec.ts b/src/features/orders/search.spec.ts
index 96cb8a2..7cfd7b9 100644
--- a/src/features/orders/search.spec.ts
+++ b/src/features/orders/search.spec.ts
@@ -8,6 +8,7 @@ describe('orders search', () => {
cursor: null,
keyword: null,
status: null,
+ inProgress: false,
storeId: null,
accountId: null,
fromCreatedAt: null,
@@ -38,6 +39,22 @@ describe('orders search', () => {
expect(hasOrderFilters(s)).toBe(true);
});
+ it.each([
+ ['true', true, true],
+ [true, true, true],
+ ['false', false, false],
+ [false, false, false],
+ ['yes', false, false],
+ ])('진행 중 %j → inProgress=%s, 필터 표시=%s', (inProgress, sent, active) => {
+ const s = ordersSearchSchema.parse({ inProgress });
+ expect(toOrderListInput(s).inProgress).toBe(sent);
+ expect(hasOrderFilters(s)).toBe(active);
+ });
+
+ it.each(['PENDING_PAYMENT', 'NO_SHOW'])('새 상태 %s도 상태 필터로 받는다', (status) => {
+ expect(toOrderListInput(ordersSearchSchema.parse({ status })).status).toBe(status);
+ });
+
it('이상한 값은 버린다(상태·limit 범위·빈 문자열)', () => {
const s = ordersSearchSchema.parse({ status: 'NOPE', limit: '500', q: '', cursor: '' });
expect(s.status).toBeUndefined();
diff --git a/src/features/orders/search.ts b/src/features/orders/search.ts
index dab27f8..6292af6 100644
--- a/src/features/orders/search.ts
+++ b/src/features/orders/search.ts
@@ -6,6 +6,7 @@ import {
DEFAULT_LIMIT,
keywordText,
listSearchBase,
+ optionalBoolText,
optionalIdText,
optionalText,
} from '@/shared/lib/list-search';
@@ -16,6 +17,8 @@ export const ordersSearchSchema = z.object({
...listSearchBase,
q: keywordText,
status: z.enum(ORDER_STATUS_VALUES).optional().catch(undefined),
+ /** 진행 중(입금 대기~제작 완료)만. 'false'는 전체와 같다 */
+ inProgress: optionalBoolText,
storeId: optionalIdText,
accountId: optionalIdText,
from: optionalText,
@@ -33,6 +36,7 @@ export function toOrderListInput(s: OrdersSearch): AdminOrderListInput {
cursor: s.cursor ?? null,
keyword: s.q ?? null,
status: s.status ?? null,
+ inProgress: s.inProgress === 'true',
storeId: s.storeId ?? null,
accountId: s.accountId ?? null,
fromCreatedAt: from ? kstDayStartIso(from) : null,
@@ -41,5 +45,8 @@ export function toOrderListInput(s: OrdersSearch): AdminOrderListInput {
}
export function hasOrderFilters(s: OrdersSearch): boolean {
- return [s.q, s.status, s.storeId, s.accountId, s.from, s.to].some((v) => v !== undefined);
+ return (
+ s.inProgress === 'true' ||
+ [s.q, s.status, s.storeId, s.accountId, s.from, s.to].some((v) => v !== undefined)
+ );
}
diff --git a/src/features/orders/status.spec.ts b/src/features/orders/status.spec.ts
index c13dd92..921dcd8 100644
--- a/src/features/orders/status.spec.ts
+++ b/src/features/orders/status.spec.ts
@@ -1,32 +1,42 @@
import { type OrderStatusType } from '@/graphql/generated/graphql';
-import { ORDER_STATUS, isCancelable, orderStatusMeta } from './status';
+import { ORDER_STATUS, canCompletePickup, orderStatusMeta } from './status';
describe('order status', () => {
- it.each([
- ['PENDING_PAYMENT', true],
- ['SUBMITTED', true],
- ['CONFIRMED', false],
- ['MADE', false],
- ['PICKED_UP', false],
- ['NO_SHOW', false],
- ['CANCELED', false],
- ] satisfies [OrderStatusType, boolean][])('%s 취소 가능=%s', (status, ok) => {
- expect(isCancelable(status)).toBe(ok);
- });
-
// '확인'은 버튼처럼 읽혀 판매자가 주문을 받아들인 단계를 '주문 확정'으로 부른다
it.each([
- ['SUBMITTED', '접수'],
- ['CONFIRMED', '주문 확정'],
- ['MADE', '제작 완료'],
- ['PICKED_UP', '픽업 완료'],
- ['CANCELED', '취소'],
- ] as const)('%s 라벨은 %s', (status, label) => {
- expect(orderStatusMeta(status).label).toBe(label);
+ ['PENDING_PAYMENT', '입금 대기', 'neutral', false],
+ ['SUBMITTED', '접수', 'primary', false],
+ ['CONFIRMED', '주문 확정', 'caution', true],
+ ['MADE', '제작 완료', 'neutral', true],
+ ['PICKED_UP', '픽업 완료', 'positive', false],
+ ['NO_SHOW', '노쇼', 'negative', false],
+ ['CANCELED', '취소', 'negative', false],
+ ] satisfies [OrderStatusType, string, string, boolean][])(
+ '%s는 %s(%s), 픽업 완료 처리=%s',
+ (status, label, tone, pickup) => {
+ expect(orderStatusMeta(status)).toEqual({ value: status, label, tone });
+ expect(canCompletePickup(status)).toBe(pickup);
+ },
+ );
+
+ it('필터·차트 순서는 흐름 순서 뒤에 종료 상태다', () => {
+ expect(ORDER_STATUS.map((s) => s.label)).toEqual([
+ '입금 대기',
+ '접수',
+ '주문 확정',
+ '제작 완료',
+ '픽업 완료',
+ '노쇼',
+ '취소',
+ ]);
});
- it('모든 상태에 라벨·톤이 있다', () => {
- for (const s of ORDER_STATUS) expect(orderStatusMeta(s.value)).toEqual(s);
+ it.each(['REFUNDED', 'constructor'])('모르는 값 %s는 원문·중립 톤으로 보인다', (value) => {
+ expect(orderStatusMeta(value as OrderStatusType)).toEqual({
+ value,
+ label: value,
+ tone: 'neutral',
+ });
});
});
diff --git a/src/features/orders/status.ts b/src/features/orders/status.ts
index 623d1d8..24df537 100644
--- a/src/features/orders/status.ts
+++ b/src/features/orders/status.ts
@@ -1,26 +1,35 @@
import { type OrderStatusType } from '@/graphql/generated/graphql';
import { type PillTone } from '@/shared/ui/status-pill';
-export const ORDER_STATUS: { value: OrderStatusType; label: string; tone: PillTone }[] = [
- { value: 'SUBMITTED', label: '접수', tone: 'primary' },
- { value: 'CONFIRMED', label: '주문 확정', tone: 'caution' },
- { value: 'MADE', label: '제작 완료', tone: 'neutral' },
- { value: 'PICKED_UP', label: '픽업 완료', tone: 'positive' },
- { value: 'CANCELED', label: '취소', tone: 'negative' },
-];
+// Record라 codegen enum에 값이 늘면 tsc가 잡는다. 적은 순서가 필터·차트 순서다(흐름 → 종료 상태)
+const META: Record = {
+ PENDING_PAYMENT: { label: '입금 대기', tone: 'neutral' },
+ SUBMITTED: { label: '접수', tone: 'primary' },
+ CONFIRMED: { label: '주문 확정', tone: 'caution' },
+ MADE: { label: '제작 완료', tone: 'neutral' },
+ PICKED_UP: { label: '픽업 완료', tone: 'positive' },
+ NO_SHOW: { label: '노쇼', tone: 'negative' },
+ CANCELED: { label: '취소', tone: 'negative' },
+};
+
+export const ORDER_STATUS = (Object.keys(META) as OrderStatusType[]).map((value) => ({
+ value,
+ ...META[value],
+}));
export const ORDER_STATUS_VALUES = ORDER_STATUS.map((s) => s.value) as [
OrderStatusType,
...OrderStatusType[],
];
+/** BE가 먼저 배포돼 모르는 값이 와도 원문으로 보인다 */
export function orderStatusMeta(value: OrderStatusType) {
- return (
- ORDER_STATUS.find((s) => s.value === value) ?? { value, label: value, tone: 'neutral' as const }
- );
+ return Object.hasOwn(META, value)
+ ? { value, ...META[value] }
+ : { value, label: value as string, tone: 'neutral' as const };
}
-/** 사정(fault) 선택 없이 취소할 수 있는 상태. 확정·제작 완료는 BE가 사정을 요구한다 */
-export function isCancelable(status: OrderStatusType): boolean {
- return status === 'PENDING_PAYMENT' || status === 'SUBMITTED';
+/** adminCompleteOrderPickup이 받는 상태. 숨김 매장은 자동 픽업 완료가 돌지 않아 관리자가 처리한다 */
+export function canCompletePickup(status: OrderStatusType): boolean {
+ return status === 'CONFIRMED' || status === 'MADE';
}
diff --git a/src/graphql/generated/gql.ts b/src/graphql/generated/gql.ts
index 41b83d2..a7674c1 100644
--- a/src/graphql/generated/gql.ts
+++ b/src/graphql/generated/gql.ts
@@ -37,7 +37,7 @@ type Documents = {
"\n query AdminBannerCategoryOptions($input: AdminCategoryListInput) {\n adminCategories(input: $input) {\n id\n name\n isActive\n }\n }\n": typeof types.AdminBannerCategoryOptionsDocument,
"\n query AdminBannerProductLabel($productId: ID!) {\n adminProduct(productId: $productId) {\n product {\n id\n name\n }\n }\n }\n": typeof types.AdminBannerProductLabelDocument,
"\n query AdminBannerStoreLabel($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n }\n }\n }\n": typeof types.AdminBannerStoreLabelDocument,
- "\n query AdminDashboardSummary($input: AdminDashboardSummaryInput!) {\n adminDashboardSummary(input: $input) {\n from\n to\n newUserCount\n newSellerCount\n orderCounts {\n submitted\n confirmed\n made\n pickedUp\n canceled\n }\n orderAmountSum\n activeStoreCount\n activeProductCount\n pendingReportCount\n }\n }\n": typeof types.AdminDashboardSummaryDocument,
+ "\n query AdminDashboardSummary($input: AdminDashboardSummaryInput!) {\n adminDashboardSummary(input: $input) {\n from\n to\n newUserCount\n newSellerCount\n orderCounts {\n pendingPayment\n submitted\n confirmed\n made\n pickedUp\n noShow\n canceled\n }\n orderAmountSum\n activeStoreCount\n activeProductCount\n pendingReportCount\n }\n }\n": typeof types.AdminDashboardSummaryDocument,
"\n query AdminSearchKeywordSnapshot($input: AdminSearchKeywordSnapshotInput) {\n adminSearchKeywordSnapshot(input: $input) {\n rankedAt\n items {\n rank\n keyword\n searchCount\n }\n }\n }\n": typeof types.AdminSearchKeywordSnapshotDocument,
"\n query AdminNotificationBroadcasts($input: AdminNotificationBroadcastListInput) {\n adminNotificationBroadcasts(input: $input) {\n items {\n id\n type\n title\n body\n targetKind\n targetCount\n skippedCount\n deliveredCount\n status\n actorAccountId\n actorLabel\n requestedAt\n completedAt\n targetAccountIds\n skippedAccountIds\n }\n totalCount\n hasMore\n nextCursor\n }\n }\n": typeof types.AdminNotificationBroadcastsDocument,
"\n query AdminNotificationBroadcast($broadcastId: ID!) {\n adminNotificationBroadcast(broadcastId: $broadcastId) {\n id\n type\n title\n body\n targetKind\n targetCount\n skippedCount\n deliveredCount\n status\n actorAccountId\n actorLabel\n requestedAt\n completedAt\n targetAccountIds\n skippedAccountIds\n }\n }\n": typeof types.AdminNotificationBroadcastDocument,
@@ -45,12 +45,13 @@ type Documents = {
"\n query AdminNotificationActiveUserCount {\n adminUsers(input: { status: ACTIVE, limit: 1 }) {\n totalCount\n }\n }\n": typeof types.AdminNotificationActiveUserCountDocument,
"\n query AdminNotificationUserOptions($input: AdminUserListInput) {\n adminUsers(input: $input) {\n items {\n accountId\n nickname\n name\n email\n }\n }\n }\n": typeof types.AdminNotificationUserOptionsDocument,
"\n query AdminOrders($input: AdminOrderListInput) {\n adminOrders(input: $input) {\n items {\n id\n orderNumber\n accountId\n storeId\n storeName\n status\n pickupAt\n buyerName\n buyerPhone\n totalPrice\n createdAt\n hasCustom\n }\n totalCount\n hasMore\n nextCursor\n }\n }\n": typeof types.AdminOrdersDocument,
- "\n query AdminOrder($orderId: ID!) {\n adminOrder(orderId: $orderId) {\n id\n orderNumber\n buyer {\n accountId\n email\n nickname\n status\n }\n status\n pickupAt\n buyerName\n buyerPhone\n subtotalPrice\n discountPrice\n totalPrice\n submittedAt\n confirmedAt\n madeAt\n pickedUpAt\n canceledAt\n createdAt\n updatedAt\n items {\n id\n storeId\n productId\n productName\n regularPrice\n salePrice\n quantity\n itemSubtotalPrice\n optionItems {\n id\n groupName\n optionTitle\n priceDelta\n }\n customMode\n customPreviewImageUrl\n customBaseImageUrl\n customImages {\n id\n kind\n imageUrl\n }\n customTexts {\n id\n tokenKey\n label\n defaultText\n valueText\n posX\n posY\n width\n height\n textColor\n textAlign\n sortOrder\n }\n freeEdits {\n id\n posX\n posY\n width\n height\n descriptionText\n sortOrder\n attachments {\n id\n imageUrl\n sortOrder\n }\n }\n }\n statusHistories {\n id\n fromStatus\n toStatus\n changedAt\n note\n }\n }\n }\n": typeof types.AdminOrderDocument,
+ "\n query AdminOrder($orderId: ID!) {\n adminOrder(orderId: $orderId) {\n id\n orderNumber\n buyer {\n accountId\n email\n nickname\n status\n }\n status\n pickupAt\n buyerName\n buyerPhone\n requestNote\n payment {\n method\n status\n amount\n depositorName\n depositBank {\n code\n name\n }\n depositAccountNumber\n depositAccountHolder\n expiresAt\n buyerClaimedAt\n confirmedAt\n confirmSource\n confirmedByLabel\n confirmNote\n }\n subtotalPrice\n discountPrice\n totalPrice\n submittedAt\n confirmedAt\n madeAt\n pickedUpAt\n canceledAt\n createdAt\n updatedAt\n items {\n id\n storeId\n productId\n productName\n regularPrice\n salePrice\n quantity\n itemSubtotalPrice\n optionItems {\n id\n groupName\n optionTitle\n priceDelta\n }\n customMode\n customPreviewImageUrl\n customBaseImageUrl\n customImages {\n id\n kind\n imageUrl\n }\n customTexts {\n id\n tokenKey\n label\n defaultText\n valueText\n posX\n posY\n width\n height\n textColor\n textAlign\n sortOrder\n }\n freeEdits {\n id\n posX\n posY\n width\n height\n descriptionText\n sortOrder\n attachments {\n id\n imageUrl\n sortOrder\n }\n }\n }\n statusHistories {\n id\n fromStatus\n toStatus\n changedAt\n note\n actorType\n cancelReason\n cancelFault\n refundAmount\n }\n refunds {\n id\n kind\n amount\n status\n bank {\n code\n name\n }\n accountHolder\n accountNumberMasked\n requestedAt\n accountSubmittedAt\n completedAt\n }\n cancellation {\n actorType\n reason\n reasonLabel\n note\n fault\n refundAmount\n refundStatus\n refundCompletedAt\n canceledAt\n }\n cancelOptions {\n cancelable\n reasons\n refundRule\n paidAmount\n }\n confirmDeadlineAt\n autoPickupAt\n noShowAt\n pickupChanges {\n id\n fromPickupAt\n toPickupAt\n changedAt\n note\n }\n commissionRateBps\n expectedPayoutAmount\n settlementBaseAmount\n commissionAmount\n settlementFinalizedAt\n settlementId\n }\n }\n": typeof types.AdminOrderDocument,
"\n query AdminOrdersStoreOptions($input: AdminStoreListInput) {\n adminStores(input: $input) {\n items {\n id\n storeName\n isActive\n }\n }\n }\n": typeof types.AdminOrdersStoreOptionsDocument,
"\n query AdminOrdersBuyerOptions($input: AdminUserListInput) {\n adminUsers(input: $input) {\n items {\n accountId\n nickname\n name\n email\n }\n }\n }\n": typeof types.AdminOrdersBuyerOptionsDocument,
- "\n query AdminOrdersStoreName($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n }\n }\n }\n": typeof types.AdminOrdersStoreNameDocument,
+ "\n query AdminOrdersStoreName($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n isActive\n }\n }\n }\n": typeof types.AdminOrdersStoreNameDocument,
"\n query AdminOrdersBuyerName($accountId: ID!) {\n adminUser(accountId: $accountId) {\n accountId\n nickname\n name\n email\n }\n }\n": typeof types.AdminOrdersBuyerNameDocument,
"\n mutation AdminCancelOrder($input: AdminCancelOrderInput!) {\n adminCancelOrder(input: $input) {\n id\n status\n }\n }\n": typeof types.AdminCancelOrderDocument,
+ "\n mutation AdminCompleteOrderPickup($input: AdminCompleteOrderPickupInput!) {\n adminCompleteOrderPickup(input: $input) {\n id\n status\n }\n }\n": typeof types.AdminCompleteOrderPickupDocument,
"\n query AdminProducts($input: AdminProductListInput) {\n adminProducts(input: $input) {\n items {\n id\n storeId\n storeName\n name\n regularPrice\n salePrice\n currency\n thumbnailUrl\n isActive\n createdAt\n updatedAt\n }\n totalCount\n hasMore\n nextCursor\n }\n }\n": typeof types.AdminProductsDocument,
"\n query AdminProduct($productId: ID!) {\n adminProduct(productId: $productId) {\n product {\n id\n storeId\n storeName\n name\n regularPrice\n salePrice\n currency\n customMode\n isActive\n createdAt\n updatedAt\n }\n storeIsActive\n description\n purchaseNotice\n preparationTimeMinutes\n imageUrls\n reviewCount\n orderItemCount\n categories {\n id\n categoryType\n name\n isActive\n }\n tags {\n id\n name\n }\n optionGroups {\n id\n name\n description\n isRequired\n minSelect\n maxSelect\n sortOrder\n isActive\n optionItems {\n id\n title\n description\n imageUrl\n priceDelta\n sortOrder\n isActive\n threeDKey\n }\n }\n customTemplate {\n id\n baseImageUrl\n freeEditEnabled\n textTokens {\n id\n tokenKey\n label\n defaultText\n maxLength\n sortOrder\n isRequired\n textColor\n textAlign\n }\n }\n }\n }\n": typeof types.AdminProductDocument,
"\n query AdminProductStoreOptions($input: AdminStoreListInput) {\n adminStores(input: $input) {\n items {\n id\n storeName\n isActive\n }\n }\n }\n": typeof types.AdminProductStoreOptionsDocument,
@@ -115,7 +116,7 @@ const documents: Documents = {
"\n query AdminBannerCategoryOptions($input: AdminCategoryListInput) {\n adminCategories(input: $input) {\n id\n name\n isActive\n }\n }\n": types.AdminBannerCategoryOptionsDocument,
"\n query AdminBannerProductLabel($productId: ID!) {\n adminProduct(productId: $productId) {\n product {\n id\n name\n }\n }\n }\n": types.AdminBannerProductLabelDocument,
"\n query AdminBannerStoreLabel($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n }\n }\n }\n": types.AdminBannerStoreLabelDocument,
- "\n query AdminDashboardSummary($input: AdminDashboardSummaryInput!) {\n adminDashboardSummary(input: $input) {\n from\n to\n newUserCount\n newSellerCount\n orderCounts {\n submitted\n confirmed\n made\n pickedUp\n canceled\n }\n orderAmountSum\n activeStoreCount\n activeProductCount\n pendingReportCount\n }\n }\n": types.AdminDashboardSummaryDocument,
+ "\n query AdminDashboardSummary($input: AdminDashboardSummaryInput!) {\n adminDashboardSummary(input: $input) {\n from\n to\n newUserCount\n newSellerCount\n orderCounts {\n pendingPayment\n submitted\n confirmed\n made\n pickedUp\n noShow\n canceled\n }\n orderAmountSum\n activeStoreCount\n activeProductCount\n pendingReportCount\n }\n }\n": types.AdminDashboardSummaryDocument,
"\n query AdminSearchKeywordSnapshot($input: AdminSearchKeywordSnapshotInput) {\n adminSearchKeywordSnapshot(input: $input) {\n rankedAt\n items {\n rank\n keyword\n searchCount\n }\n }\n }\n": types.AdminSearchKeywordSnapshotDocument,
"\n query AdminNotificationBroadcasts($input: AdminNotificationBroadcastListInput) {\n adminNotificationBroadcasts(input: $input) {\n items {\n id\n type\n title\n body\n targetKind\n targetCount\n skippedCount\n deliveredCount\n status\n actorAccountId\n actorLabel\n requestedAt\n completedAt\n targetAccountIds\n skippedAccountIds\n }\n totalCount\n hasMore\n nextCursor\n }\n }\n": types.AdminNotificationBroadcastsDocument,
"\n query AdminNotificationBroadcast($broadcastId: ID!) {\n adminNotificationBroadcast(broadcastId: $broadcastId) {\n id\n type\n title\n body\n targetKind\n targetCount\n skippedCount\n deliveredCount\n status\n actorAccountId\n actorLabel\n requestedAt\n completedAt\n targetAccountIds\n skippedAccountIds\n }\n }\n": types.AdminNotificationBroadcastDocument,
@@ -123,12 +124,13 @@ const documents: Documents = {
"\n query AdminNotificationActiveUserCount {\n adminUsers(input: { status: ACTIVE, limit: 1 }) {\n totalCount\n }\n }\n": types.AdminNotificationActiveUserCountDocument,
"\n query AdminNotificationUserOptions($input: AdminUserListInput) {\n adminUsers(input: $input) {\n items {\n accountId\n nickname\n name\n email\n }\n }\n }\n": types.AdminNotificationUserOptionsDocument,
"\n query AdminOrders($input: AdminOrderListInput) {\n adminOrders(input: $input) {\n items {\n id\n orderNumber\n accountId\n storeId\n storeName\n status\n pickupAt\n buyerName\n buyerPhone\n totalPrice\n createdAt\n hasCustom\n }\n totalCount\n hasMore\n nextCursor\n }\n }\n": types.AdminOrdersDocument,
- "\n query AdminOrder($orderId: ID!) {\n adminOrder(orderId: $orderId) {\n id\n orderNumber\n buyer {\n accountId\n email\n nickname\n status\n }\n status\n pickupAt\n buyerName\n buyerPhone\n subtotalPrice\n discountPrice\n totalPrice\n submittedAt\n confirmedAt\n madeAt\n pickedUpAt\n canceledAt\n createdAt\n updatedAt\n items {\n id\n storeId\n productId\n productName\n regularPrice\n salePrice\n quantity\n itemSubtotalPrice\n optionItems {\n id\n groupName\n optionTitle\n priceDelta\n }\n customMode\n customPreviewImageUrl\n customBaseImageUrl\n customImages {\n id\n kind\n imageUrl\n }\n customTexts {\n id\n tokenKey\n label\n defaultText\n valueText\n posX\n posY\n width\n height\n textColor\n textAlign\n sortOrder\n }\n freeEdits {\n id\n posX\n posY\n width\n height\n descriptionText\n sortOrder\n attachments {\n id\n imageUrl\n sortOrder\n }\n }\n }\n statusHistories {\n id\n fromStatus\n toStatus\n changedAt\n note\n }\n }\n }\n": types.AdminOrderDocument,
+ "\n query AdminOrder($orderId: ID!) {\n adminOrder(orderId: $orderId) {\n id\n orderNumber\n buyer {\n accountId\n email\n nickname\n status\n }\n status\n pickupAt\n buyerName\n buyerPhone\n requestNote\n payment {\n method\n status\n amount\n depositorName\n depositBank {\n code\n name\n }\n depositAccountNumber\n depositAccountHolder\n expiresAt\n buyerClaimedAt\n confirmedAt\n confirmSource\n confirmedByLabel\n confirmNote\n }\n subtotalPrice\n discountPrice\n totalPrice\n submittedAt\n confirmedAt\n madeAt\n pickedUpAt\n canceledAt\n createdAt\n updatedAt\n items {\n id\n storeId\n productId\n productName\n regularPrice\n salePrice\n quantity\n itemSubtotalPrice\n optionItems {\n id\n groupName\n optionTitle\n priceDelta\n }\n customMode\n customPreviewImageUrl\n customBaseImageUrl\n customImages {\n id\n kind\n imageUrl\n }\n customTexts {\n id\n tokenKey\n label\n defaultText\n valueText\n posX\n posY\n width\n height\n textColor\n textAlign\n sortOrder\n }\n freeEdits {\n id\n posX\n posY\n width\n height\n descriptionText\n sortOrder\n attachments {\n id\n imageUrl\n sortOrder\n }\n }\n }\n statusHistories {\n id\n fromStatus\n toStatus\n changedAt\n note\n actorType\n cancelReason\n cancelFault\n refundAmount\n }\n refunds {\n id\n kind\n amount\n status\n bank {\n code\n name\n }\n accountHolder\n accountNumberMasked\n requestedAt\n accountSubmittedAt\n completedAt\n }\n cancellation {\n actorType\n reason\n reasonLabel\n note\n fault\n refundAmount\n refundStatus\n refundCompletedAt\n canceledAt\n }\n cancelOptions {\n cancelable\n reasons\n refundRule\n paidAmount\n }\n confirmDeadlineAt\n autoPickupAt\n noShowAt\n pickupChanges {\n id\n fromPickupAt\n toPickupAt\n changedAt\n note\n }\n commissionRateBps\n expectedPayoutAmount\n settlementBaseAmount\n commissionAmount\n settlementFinalizedAt\n settlementId\n }\n }\n": types.AdminOrderDocument,
"\n query AdminOrdersStoreOptions($input: AdminStoreListInput) {\n adminStores(input: $input) {\n items {\n id\n storeName\n isActive\n }\n }\n }\n": types.AdminOrdersStoreOptionsDocument,
"\n query AdminOrdersBuyerOptions($input: AdminUserListInput) {\n adminUsers(input: $input) {\n items {\n accountId\n nickname\n name\n email\n }\n }\n }\n": types.AdminOrdersBuyerOptionsDocument,
- "\n query AdminOrdersStoreName($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n }\n }\n }\n": types.AdminOrdersStoreNameDocument,
+ "\n query AdminOrdersStoreName($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n isActive\n }\n }\n }\n": types.AdminOrdersStoreNameDocument,
"\n query AdminOrdersBuyerName($accountId: ID!) {\n adminUser(accountId: $accountId) {\n accountId\n nickname\n name\n email\n }\n }\n": types.AdminOrdersBuyerNameDocument,
"\n mutation AdminCancelOrder($input: AdminCancelOrderInput!) {\n adminCancelOrder(input: $input) {\n id\n status\n }\n }\n": types.AdminCancelOrderDocument,
+ "\n mutation AdminCompleteOrderPickup($input: AdminCompleteOrderPickupInput!) {\n adminCompleteOrderPickup(input: $input) {\n id\n status\n }\n }\n": types.AdminCompleteOrderPickupDocument,
"\n query AdminProducts($input: AdminProductListInput) {\n adminProducts(input: $input) {\n items {\n id\n storeId\n storeName\n name\n regularPrice\n salePrice\n currency\n thumbnailUrl\n isActive\n createdAt\n updatedAt\n }\n totalCount\n hasMore\n nextCursor\n }\n }\n": types.AdminProductsDocument,
"\n query AdminProduct($productId: ID!) {\n adminProduct(productId: $productId) {\n product {\n id\n storeId\n storeName\n name\n regularPrice\n salePrice\n currency\n customMode\n isActive\n createdAt\n updatedAt\n }\n storeIsActive\n description\n purchaseNotice\n preparationTimeMinutes\n imageUrls\n reviewCount\n orderItemCount\n categories {\n id\n categoryType\n name\n isActive\n }\n tags {\n id\n name\n }\n optionGroups {\n id\n name\n description\n isRequired\n minSelect\n maxSelect\n sortOrder\n isActive\n optionItems {\n id\n title\n description\n imageUrl\n priceDelta\n sortOrder\n isActive\n threeDKey\n }\n }\n customTemplate {\n id\n baseImageUrl\n freeEditEnabled\n textTokens {\n id\n tokenKey\n label\n defaultText\n maxLength\n sortOrder\n isRequired\n textColor\n textAlign\n }\n }\n }\n }\n": types.AdminProductDocument,
"\n query AdminProductStoreOptions($input: AdminStoreListInput) {\n adminStores(input: $input) {\n items {\n id\n storeName\n isActive\n }\n }\n }\n": types.AdminProductStoreOptionsDocument,
@@ -262,7 +264,7 @@ export function graphql(source: "\n query AdminBannerStoreLabel($storeId: ID!)
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
-export function graphql(source: "\n query AdminDashboardSummary($input: AdminDashboardSummaryInput!) {\n adminDashboardSummary(input: $input) {\n from\n to\n newUserCount\n newSellerCount\n orderCounts {\n submitted\n confirmed\n made\n pickedUp\n canceled\n }\n orderAmountSum\n activeStoreCount\n activeProductCount\n pendingReportCount\n }\n }\n"): typeof import('./graphql').AdminDashboardSummaryDocument;
+export function graphql(source: "\n query AdminDashboardSummary($input: AdminDashboardSummaryInput!) {\n adminDashboardSummary(input: $input) {\n from\n to\n newUserCount\n newSellerCount\n orderCounts {\n pendingPayment\n submitted\n confirmed\n made\n pickedUp\n noShow\n canceled\n }\n orderAmountSum\n activeStoreCount\n activeProductCount\n pendingReportCount\n }\n }\n"): typeof import('./graphql').AdminDashboardSummaryDocument;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -294,7 +296,7 @@ export function graphql(source: "\n query AdminOrders($input: AdminOrderListInp
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
-export function graphql(source: "\n query AdminOrder($orderId: ID!) {\n adminOrder(orderId: $orderId) {\n id\n orderNumber\n buyer {\n accountId\n email\n nickname\n status\n }\n status\n pickupAt\n buyerName\n buyerPhone\n subtotalPrice\n discountPrice\n totalPrice\n submittedAt\n confirmedAt\n madeAt\n pickedUpAt\n canceledAt\n createdAt\n updatedAt\n items {\n id\n storeId\n productId\n productName\n regularPrice\n salePrice\n quantity\n itemSubtotalPrice\n optionItems {\n id\n groupName\n optionTitle\n priceDelta\n }\n customMode\n customPreviewImageUrl\n customBaseImageUrl\n customImages {\n id\n kind\n imageUrl\n }\n customTexts {\n id\n tokenKey\n label\n defaultText\n valueText\n posX\n posY\n width\n height\n textColor\n textAlign\n sortOrder\n }\n freeEdits {\n id\n posX\n posY\n width\n height\n descriptionText\n sortOrder\n attachments {\n id\n imageUrl\n sortOrder\n }\n }\n }\n statusHistories {\n id\n fromStatus\n toStatus\n changedAt\n note\n }\n }\n }\n"): typeof import('./graphql').AdminOrderDocument;
+export function graphql(source: "\n query AdminOrder($orderId: ID!) {\n adminOrder(orderId: $orderId) {\n id\n orderNumber\n buyer {\n accountId\n email\n nickname\n status\n }\n status\n pickupAt\n buyerName\n buyerPhone\n requestNote\n payment {\n method\n status\n amount\n depositorName\n depositBank {\n code\n name\n }\n depositAccountNumber\n depositAccountHolder\n expiresAt\n buyerClaimedAt\n confirmedAt\n confirmSource\n confirmedByLabel\n confirmNote\n }\n subtotalPrice\n discountPrice\n totalPrice\n submittedAt\n confirmedAt\n madeAt\n pickedUpAt\n canceledAt\n createdAt\n updatedAt\n items {\n id\n storeId\n productId\n productName\n regularPrice\n salePrice\n quantity\n itemSubtotalPrice\n optionItems {\n id\n groupName\n optionTitle\n priceDelta\n }\n customMode\n customPreviewImageUrl\n customBaseImageUrl\n customImages {\n id\n kind\n imageUrl\n }\n customTexts {\n id\n tokenKey\n label\n defaultText\n valueText\n posX\n posY\n width\n height\n textColor\n textAlign\n sortOrder\n }\n freeEdits {\n id\n posX\n posY\n width\n height\n descriptionText\n sortOrder\n attachments {\n id\n imageUrl\n sortOrder\n }\n }\n }\n statusHistories {\n id\n fromStatus\n toStatus\n changedAt\n note\n actorType\n cancelReason\n cancelFault\n refundAmount\n }\n refunds {\n id\n kind\n amount\n status\n bank {\n code\n name\n }\n accountHolder\n accountNumberMasked\n requestedAt\n accountSubmittedAt\n completedAt\n }\n cancellation {\n actorType\n reason\n reasonLabel\n note\n fault\n refundAmount\n refundStatus\n refundCompletedAt\n canceledAt\n }\n cancelOptions {\n cancelable\n reasons\n refundRule\n paidAmount\n }\n confirmDeadlineAt\n autoPickupAt\n noShowAt\n pickupChanges {\n id\n fromPickupAt\n toPickupAt\n changedAt\n note\n }\n commissionRateBps\n expectedPayoutAmount\n settlementBaseAmount\n commissionAmount\n settlementFinalizedAt\n settlementId\n }\n }\n"): typeof import('./graphql').AdminOrderDocument;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -306,7 +308,7 @@ export function graphql(source: "\n query AdminOrdersBuyerOptions($input: Admin
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
-export function graphql(source: "\n query AdminOrdersStoreName($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n }\n }\n }\n"): typeof import('./graphql').AdminOrdersStoreNameDocument;
+export function graphql(source: "\n query AdminOrdersStoreName($storeId: ID!) {\n adminStore(storeId: $storeId) {\n store {\n id\n storeName\n isActive\n }\n }\n }\n"): typeof import('./graphql').AdminOrdersStoreNameDocument;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -315,6 +317,10 @@ export function graphql(source: "\n query AdminOrdersBuyerName($accountId: ID!)
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n mutation AdminCancelOrder($input: AdminCancelOrderInput!) {\n adminCancelOrder(input: $input) {\n id\n status\n }\n }\n"): typeof import('./graphql').AdminCancelOrderDocument;
+/**
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
+ */
+export function graphql(source: "\n mutation AdminCompleteOrderPickup($input: AdminCompleteOrderPickupInput!) {\n adminCompleteOrderPickup(input: $input) {\n id\n status\n }\n }\n"): typeof import('./graphql').AdminCompleteOrderPickupDocument;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
diff --git a/src/graphql/generated/graphql.ts b/src/graphql/generated/graphql.ts
index 4b4d0d7..3659f78 100644
--- a/src/graphql/generated/graphql.ts
+++ b/src/graphql/generated/graphql.ts
@@ -77,6 +77,13 @@ export type AdminCategoryListInput = {
includeInactive?: boolean | null | undefined;
};
+/** 주문 픽업 완료 입력. 확정·제작 완료 주문만 처리할 수 있다. */
+export type AdminCompleteOrderPickupInput = {
+ /** 처리 메모. 선택, 최대 500자. 상태 이력과 감사 로그에 남는다. */
+ note?: string | null | undefined;
+ orderId: string | number;
+};
+
/** 관리자 계정 생성 입력. */
export type AdminCreateAdminInput = {
/** 이메일. 선택. */
@@ -719,6 +726,15 @@ export type BannerPlacement =
/** 예약값. 이 자리를 읽는 구매자 쿼리가 없어 등록해도 노출되지 않는다. */
| 'STORE';
+/** 지금 상태에서 취소할 때의 환불 규칙. */
+export type CancelRefundRuleType =
+ /** 사정에 따라: 판매자 사정은 전액, 구매자 사정은 0~결제액 중 입력한 금액(확정·제작 완료). */
+ | 'BY_FAULT'
+ /** 결제액 전액 환불(접수). */
+ | 'FULL_REFUND'
+ /** 환불 없음(입금 대기). */
+ | 'NO_REFUND';
+
/** 상품 카테고리 분류. */
export type CategoryType =
/** 상황·이벤트 기준 분류(생일, 기념일 등). 홈 화면 칩에는 이 분류만 노출된다. */
@@ -779,6 +795,17 @@ export type IdentityProvider =
/** 카카오 OIDC. */
| 'KAKAO';
+/** 주문·결제·정산 기록을 남긴 주체. 값은 늘어날 수 있으니 모르는 값을 받아도 화면이 죽지 않게 처리한다. */
+export type OrderActorType =
+ /** 관리자. */
+ | 'ADMIN'
+ /** 구매자. */
+ | 'BUYER'
+ /** 판매자. */
+ | 'SELLER'
+ /** 시스템 자동 처리. */
+ | 'SYSTEM';
+
/** 확정·제작 완료 뒤 취소의 사정. 환불액이 갈린다(판매자 사정 = 전액, 구매자 사정 = 취소자가 정한 금액). */
export type OrderCancelFaultType =
/** 구매자 사정. */
@@ -834,6 +861,45 @@ export type OrderStatusType =
/** 입금이 확인돼 접수된 상태. 판매자 확인 대기. */
| 'SUBMITTED';
+/** 입금을 확인한 경로. */
+export type PaymentConfirmSourceType =
+ /** 관리자가 은행 앱에서 확인. */
+ | 'ADMIN'
+ /** 입금 알림 자동 매칭. 아직 쓰지 않는다. */
+ | 'AUTO';
+
+/** 결제 수단. 값은 늘어날 수 있으니 모르는 값을 받아도 화면이 죽지 않게 처리한다. */
+export type PaymentMethodType =
+ /** 계좌이체(케이퀵 계좌로 입금). */
+ | 'BANK_TRANSFER'
+ /** 토스 결제. 아직 쓰지 않는다. */
+ | 'TOSS';
+
+/** 결제 상태. 값은 늘어날 수 있으니 모르는 값을 받아도 화면이 죽지 않게 처리한다. */
+export type PaymentStatusType =
+ /** 입금 전에 주문이 취소됨. */
+ | 'CANCELED'
+ /** 입금 확인됨. 주문이 나중에 취소돼도 이 값으로 남고 돌려줄 돈은 환불이 맡는다. */
+ | 'CONFIRMED'
+ /** 입금 대기. */
+ | 'PENDING';
+
+/** 환불 종류. */
+export type RefundKindType =
+ /** 주문 취소 환불. */
+ | 'CANCEL'
+ /** 주문과 별개로 들어온 입금을 돌려주는 반환. */
+ | 'DEPOSIT_RETURN';
+
+/** 환불 진행 상태. 값은 늘어날 수 있으니 모르는 값을 받아도 화면이 죽지 않게 처리한다. */
+export type RefundStatusType =
+ /** 구매자의 환불 계좌 입력 대기. */
+ | 'AWAITING_ACCOUNT'
+ /** 계좌가 입력돼 케이퀵 송금 대기. */
+ | 'AWAITING_TRANSFER'
+ /** 송금 완료. */
+ | 'COMPLETED';
+
/** 리뷰 첨부 미디어 종류. */
export type ReviewMediaType =
/** 이미지. */
@@ -1043,7 +1109,7 @@ export type AdminDashboardSummaryQueryVariables = Exact<{
}>;
-export type AdminDashboardSummaryQuery = { adminDashboardSummary: { from: string, to: string, newUserCount: number, newSellerCount: number, orderAmountSum: number, activeStoreCount: number, activeProductCount: number, pendingReportCount: number, orderCounts: { submitted: number, confirmed: number, made: number, pickedUp: number, canceled: number } } };
+export type AdminDashboardSummaryQuery = { adminDashboardSummary: { from: string, to: string, newUserCount: number, newSellerCount: number, orderAmountSum: number, activeStoreCount: number, activeProductCount: number, pendingReportCount: number, orderCounts: { pendingPayment: number, submitted: number, confirmed: number, made: number, pickedUp: number, noShow: number, canceled: number } } };
export type AdminSearchKeywordSnapshotQueryVariables = Exact<{
input?: AdminSearchKeywordSnapshotInput | null | undefined;
@@ -1097,7 +1163,7 @@ export type AdminOrderQueryVariables = Exact<{
}>;
-export type AdminOrderQuery = { adminOrder: { id: string, orderNumber: string, status: OrderStatusType, pickupAt: string, buyerName: string, buyerPhone: string, subtotalPrice: number, discountPrice: number, totalPrice: number, submittedAt: string | null, confirmedAt: string | null, madeAt: string | null, pickedUpAt: string | null, canceledAt: string | null, createdAt: string, updatedAt: string, buyer: { accountId: string, email: string | null, nickname: string | null, status: AccountStatus }, items: Array<{ id: string, storeId: string, productId: string, productName: string, regularPrice: number, salePrice: number | null, quantity: number, itemSubtotalPrice: number, customMode: CustomModeType, customPreviewImageUrl: string | null, customBaseImageUrl: string | null, optionItems: Array<{ id: string, groupName: string, optionTitle: string, priceDelta: number }>, customImages: Array<{ id: string, kind: CustomImageKindType, imageUrl: string }>, customTexts: Array<{ id: string, tokenKey: string, label: string, defaultText: string, valueText: string | null, posX: number, posY: number, width: number, height: number, textColor: string, textAlign: CustomTextAlignType, sortOrder: number }>, freeEdits: Array<{ id: string, posX: number, posY: number, width: number, height: number, descriptionText: string, sortOrder: number, attachments: Array<{ id: string, imageUrl: string, sortOrder: number }> }> }>, statusHistories: Array<{ id: string, fromStatus: OrderStatusType | null, toStatus: OrderStatusType, changedAt: string, note: string | null }> } };
+export type AdminOrderQuery = { adminOrder: { id: string, orderNumber: string, status: OrderStatusType, pickupAt: string, buyerName: string, buyerPhone: string, requestNote: string | null, subtotalPrice: number, discountPrice: number, totalPrice: number, submittedAt: string | null, confirmedAt: string | null, madeAt: string | null, pickedUpAt: string | null, canceledAt: string | null, createdAt: string, updatedAt: string, confirmDeadlineAt: string | null, autoPickupAt: string | null, noShowAt: string | null, commissionRateBps: number, expectedPayoutAmount: number | null, settlementBaseAmount: number | null, commissionAmount: number | null, settlementFinalizedAt: string | null, settlementId: string | null, buyer: { accountId: string, email: string | null, nickname: string | null, status: AccountStatus }, payment: { method: PaymentMethodType, status: PaymentStatusType, amount: number, depositorName: string, depositAccountNumber: string, depositAccountHolder: string, expiresAt: string, buyerClaimedAt: string | null, confirmedAt: string | null, confirmSource: PaymentConfirmSourceType | null, confirmedByLabel: string | null, confirmNote: string | null, depositBank: { code: string, name: string } } | null, items: Array<{ id: string, storeId: string, productId: string, productName: string, regularPrice: number, salePrice: number | null, quantity: number, itemSubtotalPrice: number, customMode: CustomModeType, customPreviewImageUrl: string | null, customBaseImageUrl: string | null, optionItems: Array<{ id: string, groupName: string, optionTitle: string, priceDelta: number }>, customImages: Array<{ id: string, kind: CustomImageKindType, imageUrl: string }>, customTexts: Array<{ id: string, tokenKey: string, label: string, defaultText: string, valueText: string | null, posX: number, posY: number, width: number, height: number, textColor: string, textAlign: CustomTextAlignType, sortOrder: number }>, freeEdits: Array<{ id: string, posX: number, posY: number, width: number, height: number, descriptionText: string, sortOrder: number, attachments: Array<{ id: string, imageUrl: string, sortOrder: number }> }> }>, statusHistories: Array<{ id: string, fromStatus: OrderStatusType | null, toStatus: OrderStatusType, changedAt: string, note: string | null, actorType: OrderActorType, cancelReason: OrderCancelReasonType | null, cancelFault: OrderCancelFaultType | null, refundAmount: number | null }>, refunds: Array<{ id: string, kind: RefundKindType, amount: number, status: RefundStatusType, accountHolder: string | null, accountNumberMasked: string | null, requestedAt: string, accountSubmittedAt: string | null, completedAt: string | null, bank: { code: string, name: string } | null }>, cancellation: { actorType: OrderActorType, reason: OrderCancelReasonType, reasonLabel: string, note: string | null, fault: OrderCancelFaultType | null, refundAmount: number, refundStatus: RefundStatusType | null, refundCompletedAt: string | null, canceledAt: string } | null, cancelOptions: { cancelable: boolean, reasons: Array, refundRule: CancelRefundRuleType | null, paidAmount: number }, pickupChanges: Array<{ id: string, fromPickupAt: string, toPickupAt: string, changedAt: string, note: string | null }> } };
export type AdminOrdersStoreOptionsQueryVariables = Exact<{
input?: AdminStoreListInput | null | undefined;
@@ -1118,7 +1184,7 @@ export type AdminOrdersStoreNameQueryVariables = Exact<{
}>;
-export type AdminOrdersStoreNameQuery = { adminStore: { store: { id: string, storeName: string } } };
+export type AdminOrdersStoreNameQuery = { adminStore: { store: { id: string, storeName: string, isActive: boolean } } };
export type AdminOrdersBuyerNameQueryVariables = Exact<{
accountId: string | number;
@@ -1134,6 +1200,13 @@ export type AdminCancelOrderMutationVariables = Exact<{
export type AdminCancelOrderMutation = { adminCancelOrder: { id: string, status: OrderStatusType } };
+export type AdminCompleteOrderPickupMutationVariables = Exact<{
+ input: AdminCompleteOrderPickupInput;
+}>;
+
+
+export type AdminCompleteOrderPickupMutation = { adminCompleteOrderPickup: { id: string, status: OrderStatusType } };
+
export type AdminProductsQueryVariables = Exact<{
input?: AdminProductListInput | null | undefined;
}>;
@@ -1732,10 +1805,12 @@ export const AdminDashboardSummaryDocument = new TypedDocumentString(`
newUserCount
newSellerCount
orderCounts {
+ pendingPayment
submitted
confirmed
made
pickedUp
+ noShow
canceled
}
orderAmountSum
@@ -1870,6 +1945,25 @@ export const AdminOrderDocument = new TypedDocumentString(`
pickupAt
buyerName
buyerPhone
+ requestNote
+ payment {
+ method
+ status
+ amount
+ depositorName
+ depositBank {
+ code
+ name
+ }
+ depositAccountNumber
+ depositAccountHolder
+ expiresAt
+ buyerClaimedAt
+ confirmedAt
+ confirmSource
+ confirmedByLabel
+ confirmNote
+ }
subtotalPrice
discountPrice
totalPrice
@@ -1938,7 +2032,59 @@ export const AdminOrderDocument = new TypedDocumentString(`
toStatus
changedAt
note
+ actorType
+ cancelReason
+ cancelFault
+ refundAmount
+ }
+ refunds {
+ id
+ kind
+ amount
+ status
+ bank {
+ code
+ name
+ }
+ accountHolder
+ accountNumberMasked
+ requestedAt
+ accountSubmittedAt
+ completedAt
+ }
+ cancellation {
+ actorType
+ reason
+ reasonLabel
+ note
+ fault
+ refundAmount
+ refundStatus
+ refundCompletedAt
+ canceledAt
+ }
+ cancelOptions {
+ cancelable
+ reasons
+ refundRule
+ paidAmount
+ }
+ confirmDeadlineAt
+ autoPickupAt
+ noShowAt
+ pickupChanges {
+ id
+ fromPickupAt
+ toPickupAt
+ changedAt
+ note
}
+ commissionRateBps
+ expectedPayoutAmount
+ settlementBaseAmount
+ commissionAmount
+ settlementFinalizedAt
+ settlementId
}
}
`) as unknown as TypedDocumentString;
@@ -1971,6 +2117,7 @@ export const AdminOrdersStoreNameDocument = new TypedDocumentString(`
store {
id
storeName
+ isActive
}
}
}
@@ -1993,6 +2140,14 @@ export const AdminCancelOrderDocument = new TypedDocumentString(`
}
}
`) as unknown as TypedDocumentString;
+export const AdminCompleteOrderPickupDocument = new TypedDocumentString(`
+ mutation AdminCompleteOrderPickup($input: AdminCompleteOrderPickupInput!) {
+ adminCompleteOrderPickup(input: $input) {
+ id
+ status
+ }
+}
+ `) as unknown as TypedDocumentString;
export const AdminProductsDocument = new TypedDocumentString(`
query AdminProducts($input: AdminProductListInput) {
adminProducts(input: $input) {
diff --git a/src/shared/ui/reason-dialog.tsx b/src/shared/ui/reason-dialog.tsx
index 3588411..4bfe1e5 100644
--- a/src/shared/ui/reason-dialog.tsx
+++ b/src/shared/ui/reason-dialog.tsx
@@ -43,7 +43,9 @@ export function ReasonDialog({
const [reason, setReason] = useState('');
const [busy, setBusy] = useState(false);
const trimmed = reason.trim();
- const invalid = (reasonRequired && trimmed.length === 0) || trimmed.length > maxLength;
+ // BE처럼 코드 포인트로 센다(이모지도 1자)
+ const length = [...trimmed].length;
+ const invalid = (reasonRequired && length === 0) || length > maxLength;
const submit = async () => {
setBusy(true);
try {
@@ -74,12 +76,11 @@ export function ReasonDialog({
value={reason}
onChange={(e) => setReason(e.target.value)}
rows={3}
- maxLength={maxLength + 50}
/>
maxLength ? 'text-negative-foreground' : 'text-muted-foreground'}`}
+ className={`text-xs tabular-nums ${length > maxLength ? 'text-negative-foreground' : 'text-muted-foreground'}`}
>
- {trimmed.length} / {maxLength}
+ {length} / {maxLength}