fix(ecommerce): 장바구니 담기·바로구매 옵션 식별을 product_option_id 기반으로 전환

담기/바로구매가 메인 옵션을 로케일 값 조합(option_values)으로 전송하고 서버가
문자열 동등비교로 역매칭하던 방식은, 클라·서버 로케일 불일치나 관리자의 옵션 값
텍스트 수정 시 매칭 실패를 유발했다. 클라이언트가 이미 보유한 옵션 ID(optionId)를
전송하고, 서버는 요청 상품의 옵션 집합 내에서 ID로만 조회하도록 전환한다.
추가옵션(value_id/custom_text)은 이미 ID 기반이라 변경 없음.
This commit is contained in:
HeuJung committed 2026-07-19 23:20:18 +09:00
1 parent 8522245137
commit 0cdb97862f
21 files changed
+187 -46

No files matched your search

@@ -77,4 +77,16 @@ describe('_purchase_card.json - 바로 구매 장바구니 미경유', () => {
});
expect(usesDirectItems).toBe(true);
});
it('바로 구매 direct_items 가 옵션을 product_option_id(옵션 ID)로 전달한다 (값 기반 option_values 미사용)', () => {
const checkoutBody = buyNowApiCalls
.map((n) => n.params?.body)
.find((body) => typeof body === 'string' && body.includes('direct_items')) as
| string
| undefined;
expect(checkoutBody, '체크아웃 direct_items body 를 찾지 못함').toBeTruthy();
// 옵션 식별은 옵션 ID 기반이어야 하며, 로케일 값 조합(option_values) 을 실어보내지 않는다
expect(checkoutBody).toContain('product_option_id: item.optionId');
expect(checkoutBody).not.toContain('option_values');
});
});
@@ -165,6 +165,12 @@ describe('_purchase_card.json 구조 — 블럭별 추가옵션', () => {
expect(str).toContain('value_id');
});
it('담기/구매 body가 메인 옵션을 product_option_id(옵션 ID)로 전달한다 (값 기반 option_values 미사용)', () => {
// 메인 옵션 식별은 옵션 ID 기반이어야 하며, 로케일 값 조합(option_values) 을 실어보내지 않는다
expect(str).toContain('product_option_id: item.optionId');
expect(str).not.toContain('option_values');
});
it('필수 추가옵션 미선택 차단 가드(additional_option_required)가 있다', () => {
expect(str).toContain('shop.additional_option_required');
expect(str).toContain('is_required');