chore(core,ecommerce,tosspayments,pay_kginicis,message_bizppurio,admin_basic): 리베이스 후속 정합화 — 보류 테스트 정리·소스맵 게이트 강제
develop 리베이스 완주 후 보류 항목 처리. - ApiDocPipelineTest 의 예시값 갱신 단언을 병합 계약(타입 동일 시 보존 — 멱등)에 정합화. 예시값 최신성 단언과 멱등성 설계가 같은 상황에 정반대를 요구하던 stale test 로, 병합에서 의도 채택한 쪽은 멱등성이다. - 환경설정 보안 탭 체크박스 2개의 label prop 을 Label 래핑+형제 Span 으로 교체. label prop 은 렌더되지 않아 설명 문구가 화면에 없었다. - 확장 vite config 의 sourcemap: true 하드코딩이 --production 의 G7_BUILD_SOURCEMAP=0 주입을 조용히 무시해 배포본 dist 에 .map 과 dangling 참조가 남던 문제를 tosspayments·message_bizppurio 에서 정정하고 production 재빌드. template-security.md 에 게이트 형태를 명시하고 audit 룰 vite-sourcemap-env-gate(error) 를 신설해 재발을 차단한다. - PHPUnit 12 대비: 접촉 테스트 파일의 docblock 메타데이터 6건 attribute 전환.
This commit is contained in:
1 parent
0207ae024e
commit
c9a73e7877
14 files changed
+76
-42
No files matched your search
@@ -283,6 +283,14 @@ class TemplateService
|
||||
가리키기 때문이다 — 차단하면 브라우저 콘솔에 404 가 쌓인다. `--production` 빌드는 소스맵을
|
||||
생성하지 않으므로(`G7_BUILD_SOURCEMAP=0`) 운영에서는 참조 자체가 없다.
|
||||
|
||||
이 주입이 실제로 먹으려면 확장의 vite config 가 그 환경변수를 읽어야 한다. `sourcemap: true`
|
||||
리터럴 하드코딩은 주입을 조용히 무시해 `--production` 빌드에도 `.map` 과 dangling 참조가
|
||||
배포본에 남는다. 확장 vite config 의 소스맵 선언은 다음 형태만 사용한다:
|
||||
|
||||
```ts
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
```
|
||||
|
||||
판정 지점은 `Allowed{Module,Plugin,Template}FileType::getAllowedExtensions()` 한 곳이며,
|
||||
`validate()` 도 이 게터를 참조한다(상수 직접 참조 금지 — 환경 분기가 우회된다).
|
||||
|
||||
|
||||
+4
-4
@@ -11,6 +11,7 @@ use Modules\Sirsoft\Ecommerce\Models\Category;
|
||||
use Modules\Sirsoft\Ecommerce\Models\Product;
|
||||
use Modules\Sirsoft\Ecommerce\Seo\EcommerceSitemapContributor;
|
||||
use Modules\Sirsoft\Ecommerce\Tests\ModuleTestCase;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
|
||||
/**
|
||||
* EcommerceSitemapContributor 단위 테스트
|
||||
@@ -19,11 +20,10 @@ use Modules\Sirsoft\Ecommerce\Tests\ModuleTestCase;
|
||||
* - getIdentifier: 'sirsoft-ecommerce' 반환
|
||||
* - getUrls: 기본(토글 ON) 상태에서 목록/카테고리/상품 URL 포함
|
||||
* - getUrls: SEO 제공 페이지 토글 OFF 시 해당 URL 유형 제외 (회귀)
|
||||
*
|
||||
* @group ecommerce
|
||||
* @group unit
|
||||
* @group seo
|
||||
*/
|
||||
#[Group('ecommerce')]
|
||||
#[Group('unit')]
|
||||
#[Group('seo')]
|
||||
class EcommerceSitemapContributorTest extends ModuleTestCase
|
||||
{
|
||||
private EcommerceSitemapContributor $contributor;
|
||||
|
||||
+2
-2
@@ -35,6 +35,7 @@ use Modules\Sirsoft\Ecommerce\Services\OrderCalculationService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\OrderProcessingService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\StockService;
|
||||
use Modules\Sirsoft\Ecommerce\Tests\ModuleTestCase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
|
||||
/**
|
||||
@@ -1197,9 +1198,8 @@ class OrderProcessingServiceTest extends ModuleTestCase
|
||||
* 하도록 바뀌었으나, validatePaymentAmount 2단계가 base(total_due_amount)를 직접 비교해
|
||||
* base≠order_currency(예: base JPY 500 → 결제 KRW 4,750) 에서 "결제금액 불일치"로 오차단됐다.
|
||||
* 검증 기준을 결제 통화 환산액으로 통일했으므로, 환산 청구액은 통과하고 base 금액은 거부되어야 한다.
|
||||
*
|
||||
* @dataProvider providePaymentCurrencyCombinations
|
||||
*/
|
||||
#[DataProvider('providePaymentCurrencyCombinations')]
|
||||
public function test_validate_payment_amount_uses_payment_currency_charge(
|
||||
string $baseCurrency,
|
||||
string $orderCurrency,
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
var SirsoftMessageBizppurio=(function(r){"use strict";const i={},t="sirsoft-message_bizppurio",o=window.G7Core?.createLogger?.(`Plugin:${t}`)??{log:(...e)=>console.log(`[Plugin:${t}]`,...e),warn:(...e)=>console.warn(`[Plugin:${t}]`,...e),error:(...e)=>console.error(`[Plugin:${t}]`,...e)};function a(e){Object.entries(i).forEach(([n,c])=>{e.registerHandler(`${t}.${n}`,c,{category:"plugin",source:t})}),o.log(`${Object.keys(i).length} handler(s) registered:`,Object.keys(i).map(n=>`${t}.${n}`))}function g(e){const n=window.G7Core?.getActionDispatcher?.();if(n){a(n);return}if(!e){o.warn("ActionDispatcher 를 찾지 못해 핸들러를 등록하지 못했습니다.");return}let c=0;const l=50,u=()=>{const d=window.G7Core?.getActionDispatcher?.();if(d){a(d);return}++c<=l?setTimeout(u,100):o.error("ActionDispatcher 를 찾지 못해 핸들러 등록에 실패했습니다.")};u()}function s(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>g(!0));else{const e=!!window.G7Core?.getActionDispatcher?.();g(!e)}}return s(),typeof window<"u"&&(window.__SirsoftMessageBizppurio={identifier:t,handlers:Object.keys(i),initPlugin:s}),r.initPlugin=s,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r})({});
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
var SirsoftMessageBizppurio=function(r){"use strict";const i={},t="sirsoft-message_bizppurio",o=window.G7Core?.createLogger?.(`Plugin:${t}`)??{log:(...e)=>console.log(`[Plugin:${t}]`,...e),warn:(...e)=>console.warn(`[Plugin:${t}]`,...e),error:(...e)=>console.error(`[Plugin:${t}]`,...e)};function a(e){Object.entries(i).forEach(([n,c])=>{e.registerHandler(`${t}.${n}`,c,{category:"plugin",source:t})}),o.log(`${Object.keys(i).length} handler(s) registered:`,Object.keys(i).map(n=>`${t}.${n}`))}function g(e){const n=window.G7Core?.getActionDispatcher?.();if(n){a(n);return}if(!e){o.warn("ActionDispatcher 를 찾지 못해 핸들러를 등록하지 못했습니다.");return}let c=0;const l=50,u=()=>{const d=window.G7Core?.getActionDispatcher?.();if(d){a(d);return}++c<=l?setTimeout(u,100):o.error("ActionDispatcher 를 찾지 못해 핸들러 등록에 실패했습니다.")};u()}function s(){if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",()=>g(!0));else{const e=!!window.G7Core?.getActionDispatcher?.();g(!e)}}return s(),typeof window<"u"&&(window.__SirsoftMessageBizppurio={identifier:t,handlers:Object.keys(i),initPlugin:s}),r.initPlugin=s,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r}({});
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/handlers/index.ts","../../resources/js/index.ts"],"sourcesContent":["/**\n * sirsoft-message_bizppurio 플러그인 커스텀 핸들러 맵.\n *\n * 키는 네임스페이스 없는 핸들러 이름이며, ActionDispatcher 등록 시 플러그인\n * 식별자가 네임스페이스로 접두된다.\n *\n * 현재 등록 핸들러 없음(알림톡 템플릿 등록·이미지 업로드 제거로 uploadTemplateImage 제거).\n * 커스텀 핸들러 추가 시 이 맵에 등록한다.\n */\n\nexport const handlerMap = {} as const;","/**\n * sirsoft-message_bizppurio 플러그인 엔트리포인트.\n *\n * 플러그인 활성화 시 자동 로드되어 handlerMap 의 커스텀 핸들러를 ActionDispatcher 에\n * 등록한다. 핸들러명은 `sirsoft-message_bizppurio.{name}` 네임스페이스를 갖는다.\n * (현재 등록 핸들러 없음 — 필요 시 handlers/index.ts 에 추가.)\n */\n\nimport { handlerMap } from './handlers';\n\nconst PLUGIN_IDENTIFIER = 'sirsoft-message_bizppurio';\n\nconst logger = ((window as any).G7Core?.createLogger?.(`Plugin:${PLUGIN_IDENTIFIER}`)) ?? {\n log: (...args: unknown[]) => console.log(`[Plugin:${PLUGIN_IDENTIFIER}]`, ...args),\n warn: (...args: unknown[]) => console.warn(`[Plugin:${PLUGIN_IDENTIFIER}]`, ...args),\n error: (...args: unknown[]) => console.error(`[Plugin:${PLUGIN_IDENTIFIER}]`, ...args),\n};\n\n/**\n * handlerMap 의 모든 핸들러를 ActionDispatcher 에 등록합니다.\n *\n * @param dispatcher 코어 ActionDispatcher 인스턴스\n */\nfunction register(dispatcher: any): void {\n Object.entries(handlerMap).forEach(([name, handler]) => {\n dispatcher.registerHandler(`${PLUGIN_IDENTIFIER}.${name}`, handler, {\n category: 'plugin',\n source: PLUGIN_IDENTIFIER,\n });\n });\n\n logger.log(\n `${Object.keys(handlerMap).length} handler(s) registered:`,\n Object.keys(handlerMap).map(name => `${PLUGIN_IDENTIFIER}.${name}`),\n );\n}\n\n/**\n * ActionDispatcher 준비 후 핸들러를 등록합니다.\n *\n * 최초 로드 시 ActionDispatcher 가 아직 없을 수 있으므로 짧게 재시도한다.\n *\n * @param retry ActionDispatcher 부재 시 재시도 여부\n */\nfunction registerHandlers(retry: boolean): void {\n const dispatcher = (window as any).G7Core?.getActionDispatcher?.();\n\n if (dispatcher) {\n register(dispatcher);\n return;\n }\n\n if (!retry) {\n logger.warn('ActionDispatcher 를 찾지 못해 핸들러를 등록하지 못했습니다.');\n return;\n }\n\n let count = 0;\n const max = 50; // 최대 5초 (50 * 100ms)\n const tick = () => {\n const found = (window as any).G7Core?.getActionDispatcher?.();\n if (found) {\n register(found);\n return;\n }\n if (++count <= max) {\n setTimeout(tick, 100);\n } else {\n logger.error('ActionDispatcher 를 찾지 못해 핸들러 등록에 실패했습니다.');\n }\n };\n tick();\n}\n\n/**\n * 플러그인 초기화 — DOM 준비 후 핸들러 등록.\n */\nexport function initPlugin(): void {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => registerHandlers(true));\n } else {\n const hasDispatcher = !!(window as any).G7Core?.getActionDispatcher?.();\n registerHandlers(!hasDispatcher);\n }\n}\n\ninitPlugin();\n\nif (typeof window !== 'undefined') {\n (window as any).__SirsoftMessageBizppurio = {\n identifier: PLUGIN_IDENTIFIER,\n handlers: Object.keys(handlerMap),\n initPlugin,\n };\n}"],"names":["handlerMap","PLUGIN_IDENTIFIER","logger","args","register","dispatcher","name","handler","registerHandlers","retry","count","max","tick","found","initPlugin","hasDispatcher"],"mappings":"sDAUO,MAAMA,EAAa,CAAA,ECApBC,EAAoB,4BAEpBC,EAAW,OAAe,QAAQ,eAAe,UAAUD,CAAiB,EAAE,GAAM,CACtF,IAAK,IAAIE,IAAoB,QAAQ,IAAI,WAAWF,CAAiB,IAAK,GAAGE,CAAI,EACjF,KAAM,IAAIA,IAAoB,QAAQ,KAAK,WAAWF,CAAiB,IAAK,GAAGE,CAAI,EACnF,MAAO,IAAIA,IAAoB,QAAQ,MAAM,WAAWF,CAAiB,IAAK,GAAGE,CAAI,CACzF,EAOA,SAASC,EAASC,EAAuB,CACrC,OAAO,QAAQL,CAAU,EAAE,QAAQ,CAAC,CAACM,EAAMC,CAAO,IAAM,CACpDF,EAAW,gBAAgB,GAAGJ,CAAiB,IAAIK,CAAI,GAAIC,EAAS,CAChE,SAAU,SACV,OAAQN,CAAA,CACX,CACL,CAAC,EAEDC,EAAO,IACH,GAAG,OAAO,KAAKF,CAAU,EAAE,MAAM,0BACjC,OAAO,KAAKA,CAAU,EAAE,OAAY,GAAGC,CAAiB,IAAIK,CAAI,EAAE,CAAA,CAE1E,CASA,SAASE,EAAiBC,EAAsB,CAC5C,MAAMJ,EAAc,OAAe,QAAQ,sBAAA,EAE3C,GAAIA,EAAY,CACZD,EAASC,CAAU,EACnB,MACJ,CAEA,GAAI,CAACI,EAAO,CACRP,EAAO,KAAK,2CAA2C,EACvD,MACJ,CAEA,IAAIQ,EAAQ,EACZ,MAAMC,EAAM,GACNC,EAAO,IAAM,CACf,MAAMC,EAAS,OAAe,QAAQ,sBAAA,EACtC,GAAIA,EAAO,CACPT,EAASS,CAAK,EACd,MACJ,CACI,EAAEH,GAASC,EACX,WAAWC,EAAM,GAAG,EAEpBV,EAAO,MAAM,0CAA0C,CAE/D,EACAU,EAAA,CACJ,CAKO,SAASE,GAAmB,CAC/B,GAAI,SAAS,aAAe,UACxB,SAAS,iBAAiB,mBAAoB,IAAMN,EAAiB,EAAI,CAAC,MACvE,CACH,MAAMO,EAAgB,CAAC,CALine truncated
|
||||
@@ -21,7 +21,10 @@ export default defineConfig({
|
||||
},
|
||||
outDir: 'dist',
|
||||
emptyOutDir: true,
|
||||
sourcemap: true,
|
||||
// 소스맵 생성
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
rollupOptions: {
|
||||
output: {
|
||||
entryFileNames: 'js/plugin.iife.js',
|
||||
|
||||
+2
-2
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Plugins\Sirsoft\PayKginicis\Tests\Unit\Support;
|
||||
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Plugins\Sirsoft\PayKginicis\Tests\PluginTestCase;
|
||||
|
||||
/**
|
||||
@@ -66,9 +67,8 @@ class BackendMessageKeyResolutionTest extends PluginTestCase
|
||||
|
||||
/**
|
||||
* 백엔드가 내보내는 모든 메시지 키가 각 로케일에서 해석되어야 합니다.
|
||||
*
|
||||
* @dataProvider localeProvider
|
||||
*/
|
||||
#[DataProvider('localeProvider')]
|
||||
public function test_every_emitted_message_key_resolves(string $locale): void
|
||||
{
|
||||
$emitted = $this->emittedMessageKeys();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"identifier": "sirsoft-tosspayments",
|
||||
"version": "1.0.0-beta.4",
|
||||
"version": "1.0.0",
|
||||
"components": {
|
||||
"basic": [],
|
||||
"composite": [],
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
(function(){"use strict";function b(t){return new Promise((r,o)=>{if(document.querySelector(`script[src="${t}"]`)){r();return}const e=document.createElement("script");e.src=t,e.async=!0,e.onload=()=>r(),e.onerror=()=>o(new Error(`Failed to load script: ${t}`)),document.head.appendChild(e)})}function C(t,r){if(!t.order_sheet_mode||!r)return{method:"CARD",easyPay:null};const o=(t.enabled_methods??[]).find(e=>e.id===r);return o?{method:o.method,easyPay:o.easy_pay_provider}:{method:"CARD",easyPay:null}}function p(t){if(t==="on")return!0;if(t==="off")return!1}function E(t,r){const o={validHours:t.vbank?.valid_hours??24},e=t.vbank?.cash_receipt_type??"";e&&(o.cashReceipt={type:e});const s=p(t.use_escrow);return s!==void 0&&(o.useEscrow=s),o}function w(t,r,o){if(r.use_escrow==="off")return;const e=o.escrow_products??[];e.length>0&&(t.escrowProducts=e)}async function A(t,r){const o=t.params||{},{pgPaymentData:e}=o;if(!e){console.error("[sirsoft-tosspayments] pgPaymentData is required");return}const s=window.G7Core,l=o.paymentMethod??s?.state?.getLocal?.()?.paymentMethod;try{const n=await s.api.get("/modules/sirsoft-ecommerce/payments/client-config/tosspayments");if(!n.data){console.error("[sirsoft-tosspayments] Failed to fetch client config",n);return}const a=n.data;if(window.TossPayments||await b(a.sdk_url),window.TossPayments||await new Promise(u=>setTimeout(u,100)),!window.TossPayments){console.error("[sirsoft-tosspayments] TossPayments SDK not available");return}const R=window.TossPayments(a.client_key).payment({customerKey:e.customer_key??window.TossPayments.ANONYMOUS}),f=e.currency??"KRW",{method:d,easyPay:y}=C(a,l);if(f!=="KRW"&&(d!=="CARD"||y!==null)){console.warn("[sirsoft-tosspayments] non-KRW currency supports card only",{currency:f,method:d}),s?.state?.setLocal?.({paymentErrorMessage:s?.t?.("sirsoft-tosspayments.errors.non_krw_method")??"This payment method is available for KRW only.",isSubmittingOrder:!1}),s?.modal?.open?.("tosspayments_payment_error_modal");return}const v=window.location.origin,c={method:d,amount:{currency:f,value:e.amount},orderId:e.order_number,orderName:e.order_name,successUrl:v+a.callback_urls.success,failUrl:v+a.callback_urls.fail,customerEmail:e.customer_email??void 0,customerName:e.customer_name??void 0,customerMobilePhone:e.customer_phone??void 0};if(d==="CARD")c.card={flowMode:"DEFAULT",useCardPoint:!1,useAppCardOnly:!1},y&&(c.easyPay={provider:y});else if(d==="VIRTUAL_ACCOUNT")c.virtualAccount=E(a,e),w(c,a,e);else if(d==="TRANSFER"){const u=p(a.use_escrow);u!==void 0&&(c.transfer={useEscrow:u}),w(c,a,e)}await R.requestPayment(c)}catch(n){if(console.error("[sirsoft-tosspayments] requestPayment error",n),n?.code==="USER_CANCEL"){console.info("[sirsoft-tosspayments] Payment cancelled by user");try{await s.api.post(`/modules/sirsoft-ecommerce/orders/${e.order_number}/cancel-payment`,{cancel_code:n.code,cancel_message:n.message})}catch(P){console.warn("[sirsoft-tosspayments] Failed to record cancellation",P)}s?.state?.setLocal?.({isSubmittingOrder:!1}),s?.modal?.open?.("tosspayments_payment_cancel_modal");return}const a=n?.message??"Unknown error";s?.state?.setLocal?.({paymentErrorMessage:a,isSubmittingOrder:!1}),s?.modal?.open?.("tosspayments_payment_error_modal")}}const _={requestPayment:A},i="sirsoft-tosspayments",m={info:(...t)=>console.info(`[${i}]`,...t),warn:(...t)=>console.warn(`[${i}]`,...t),error:(...t)=>console.error(`[${i}]`,...t)};function h(){const t=window.G7Core;if(!t)return 0;const r=t.getActionDispatcher;if(typeof r!="function")return 0;const o=r();if(!o||typeof o.registerHandler!="function")return 0;let e=0;for(const[s,l]of Object.entries(_)){const n=`${i}.${s}`;o.registerHandler(n,l,{category:"plugin",source:i}),e++}return e}function g(){const t=()=>{const r=h();if(r>0){m.info(`${r} handler(s) registered`);return}let o=0;const e=50,s=setInterval(()=>{o++;const l=h();if(l>0){clearInterval(s),m.info(`${l} handler(s) registered (after ${o} retries)`);return}o>=e&&(clearInterval(s),m.warn("ActionDispatcher not available after timeout"))},100)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):t()}g(),window.__SirsoftTosspayments={identifier:i,handlers:Object.keys(_),initPlugin:g}})();
|
||||
//# sourceMappingURL=plugin.iife.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"plugin.iife.js","sources":["../../resources/js/handlers/requestPayment.ts","../../resources/js/handlers/index.ts","../../resources/js/index.ts"],"sourcesContent":["/**\n * 토스페이먼츠 결제창 호출 핸들러\n *\n * 체크아웃 레이아웃에서 주문 생성 API 성공 후 호출됩니다:\n * handler: \"sirsoft-tosspayments.requestPayment\"\n * params: { pgPaymentData: response.data.pg_payment_data }\n *\n * 호출 순서:\n * 1. Client Config API 호출 → clientKey 획득\n * 2. TossPayments SDK 동적 로드 (미로드 시)\n * 3. SDK 초기화 + payment 인스턴스 생성\n * 4. payment.requestPayment() 호출 → 통합결제창 오픈\n * 5. 결제 완료 시 브라우저가 successUrl/failUrl로 리다이렉트\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\ninterface EscrowProduct {\n id: string;\n name: string;\n code: string;\n unitPrice: number;\n quantity: number;\n}\n\ninterface PgPaymentData {\n order_number: string;\n order_name: string;\n amount: number;\n currency?: string;\n customer_name?: string;\n customer_email?: string;\n customer_phone?: string;\n customer_key?: string | null;\n escrow_products?: EscrowProduct[];\n}\n\ninterface RequestPaymentParams {\n pgPaymentData: PgPaymentData;\n // 주문서형에서 사용자가 선택한 결제수단 id (toss_*). 미지정 시 _local.paymentMethod 참조.\n paymentMethod?: string;\n}\n\ninterface EnabledMethod {\n id: string;\n method: string;\n easy_pay_provider: string | null;\n core_payment_method: string;\n}\n\ninterface ClientConfig {\n client_key: string;\n sdk_url: string;\n order_sheet_mode?: boolean;\n enabled_methods?: EnabledMethod[];\n vbank?: {\n valid_hours: number;\n cash_receipt_type: string;\n };\n use_escrow?: string;\n callback_urls: {\n success: string;\n fail: string;\n };\n}\n\ndeclare global {\n interface Window {\n TossPayments: any;\n }\n}\n\n/**\n * 스크립트를 동적으로 로드합니다.\n *\n * @param src 스크립트 URL\n * @returns Promise\n */\nfunction loadScript(src: string): Promise<void> {\n return new Promise((resolve, reject) => {\n // 이미 로드된 스크립트인지 확인\n if (document.querySelector(`script[src=\"${src}\"]`)) {\n resolve();\n return;\n }\n\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n script.onload = () => resolve();\n script.onerror = () => reject(new Error(`Failed to load script: ${src}`));\n document.head.appendChild(script);\n });\n}\n\n/**\n * 토스페이먼츠 결제창 호출 핸들러\n *\n * ActionDispatcher는 커스텀 핸들러를 (action, context) 시그니처로 호출합니다.\n * params는 action.params에서 접근해야 합니다.\n *\n * @param action 액션 정의 (handler, params 등)\n * @param _context 액션 컨텍스트\n */\n/**\n * 선택된 결제수단 id 를 SDK 파라미터로 변환합니다.\n *\n * 서버가 내려준 enabled_methods 에서 선택 id 를 찾아 SDK method / easyPay provider 를\n * 결정한다. 프론트는 결제수단 매핑을 하드코딩하지 않는다 (서버가 SSoT).\n * order_sheet_mode 가 off 이거나 선택 id 를 못 찾으면 통합결제창 카드(CARD)로 처리한다.\n *\n * @param config 클라이언트 설정 (enabled_methods 포함)\n * @param selectedId 선택된 toss_* 결제수단 id\n * @returns SDK method 와 easyPay provider\n */\nfunction resolveMethod(config: ClientConfig, selectedId?: string): { method: string; easyPay: string | null } {\n if (!config.order_sheet_mode || !selectedId) {\n return { method: 'CARD', easyPay: null };\n }\n\n const entry = (config.enabled_methods ?? []).find((m) => m.id === selectedId);\n if (!entry) {\n return { method: 'CARD', easyPay: null };\n }\n\n return { method: entry.method, easyPay: entry.easy_pay_provider };\n}\n\n/**\n * use_escrow 설정 문자열을 SDK useEscrow boolean/undefined 로 변환합니다.\n *\n * off → false, on → true, buyer_choice → undefined(키 생략 → 결제창에서 구매자 선택).\n *\n * @param useEscrow 설정값 (off | on | buyer_choice)\n * @returns SDK useEscrow 값 (undefined 면 키를 넣지 않음)\n */\nfunction resolveEscrowFlag(useEscrow?: string): boolean | undefined {\n if (useEscrow === 'on') return true;\n if (useEscrow === 'off') return false;\n // buyer_choice (또는 미설정) → 키 자체를 생략\n return undefined;\n}\n\n/**\n * 가상계좌 SDK 페이로드를 구성합니다.\n *\n * @param config 클라이언트 설정 (vbank / use_escrow 포함)\n * @param pgPaymentData PG 결제 데이터 (escrow_products 포함)\n * @returns virtualAccount 페이로드\n */\nfunction buildVirtualAccountPayload(config: ClientLine truncated
|
||||
+5
-12
@@ -8,6 +8,7 @@ use App\Extension\HookListenerRegistrar;
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Plugins\Sirsoft\Tosspayments\Listeners\ValidateTossSettingsListener;
|
||||
use Plugins\Sirsoft\Tosspayments\Plugin;
|
||||
use Plugins\Sirsoft\Tosspayments\Tests\PluginTestCase;
|
||||
@@ -82,9 +83,7 @@ class ValidateTossSettingsListenerTest extends PluginTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validHoursProvider
|
||||
*/
|
||||
#[DataProvider('validHoursProvider')]
|
||||
public function test_valid_vbank_valid_hours_pass(int $hours): void
|
||||
{
|
||||
$this->listener->validateBeforeSave('sirsoft-tosspayments', ['vbank_valid_hours' => $hours]);
|
||||
@@ -105,9 +104,7 @@ class ValidateTossSettingsListenerTest extends PluginTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidHoursProvider
|
||||
*/
|
||||
#[DataProvider('invalidHoursProvider')]
|
||||
public function test_out_of_range_vbank_valid_hours_are_rejected(mixed $hours): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
@@ -136,9 +133,7 @@ class ValidateTossSettingsListenerTest extends PluginTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidEscrowProvider
|
||||
*/
|
||||
#[DataProvider('invalidEscrowProvider')]
|
||||
public function test_invalid_use_escrow_is_rejected(string $value): void
|
||||
{
|
||||
$this->expectException(ValidationException::class);
|
||||
@@ -158,9 +153,7 @@ class ValidateTossSettingsListenerTest extends PluginTestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider validEscrowProvider
|
||||
*/
|
||||
#[DataProvider('validEscrowProvider')]
|
||||
public function test_valid_use_escrow_passes(string $value): void
|
||||
{
|
||||
$this->listener->validateBeforeSave('sirsoft-tosspayments', ['use_escrow' => $value]);
|
||||
|
||||
@@ -14,7 +14,10 @@ export default defineConfig({
|
||||
entryFileNames: 'js/plugin.iife.js',
|
||||
},
|
||||
},
|
||||
sourcemap: true,
|
||||
// 소스맵 생성
|
||||
// 배포용 빌드(--production)는 G7_BUILD_SOURCEMAP=0 을 주입해 소스맵을 생성하지 않는다.
|
||||
// 미설정(로컬 npm run build)이면 생성 — 개발 디버깅 경험을 유지한다.
|
||||
sourcemap: !['0', 'false'].includes(process.env.G7_BUILD_SOURCEMAP ?? ''),
|
||||
minify: 'esbuild',
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 500,
|
||||
|
||||
+37
-10
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"comment": "e2e:allow 체크박스 label prop 미렌더 정정(Label 래핑+Span) — 마크업 치환만, 동작 변화 없음. admin-settings-security-password-policy 레이아웃 테스트가 커버",
|
||||
"meta": {
|
||||
"is_partial": true,
|
||||
"description": "환경설정 보안 탭 콘텐츠"
|
||||
@@ -450,12 +451,25 @@
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Checkbox",
|
||||
"name": "Label",
|
||||
"props": {
|
||||
"name": "security.require_password_special_char",
|
||||
"disabled": "{{_computed.isReadOnly}}",
|
||||
"label": "$t:admin.settings.security.require_password_special_char_label"
|
||||
}
|
||||
"className": "flex items-center gap-2 cursor-pointer text-sm text-gray-700 dark:text-gray-300"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Checkbox",
|
||||
"props": {
|
||||
"name": "security.require_password_special_char",
|
||||
"disabled": "{{_computed.isReadOnly}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "$t:admin.settings.security.require_password_special_char_label"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
@@ -485,12 +499,25 @@
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Checkbox",
|
||||
"name": "Label",
|
||||
"props": {
|
||||
"name": "security.two_factor_auth",
|
||||
"disabled": "{{_computed.isReadOnly}}",
|
||||
"label": "$t:admin.settings.security.two_factor_auth_label"
|
||||
}
|
||||
"className": "flex items-center gap-2 cursor-pointer text-sm text-gray-700 dark:text-gray-300"
|
||||
},
|
||||
"children": [
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Checkbox",
|
||||
"props": {
|
||||
"name": "security.two_factor_auth",
|
||||
"disabled": "{{_computed.isReadOnly}}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
"name": "Span",
|
||||
"text": "$t:admin.settings.security.two_factor_auth_label"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "basic",
|
||||
|
||||
@@ -1429,7 +1429,11 @@ MD;
|
||||
* 도구의 설명은 필드명에서 유추한 일반 문구라 사람이 적은 도메인 사실보다 정보량이 적다.
|
||||
* 회귀 배경 (#518): `플러그인 이름 (다국어 JSON)` 이 `대상의 이름/명칭 (다국어 필드는 …)` 로,
|
||||
* `desc 는 주문별 가장 늦은 발송일` 같은 서술이 일반 문구로 대체돼 224건이 후퇴했다.
|
||||
* 값이 바뀌는 컬럼(타입·예시·허용값)은 그대로 재생성되므로 최신성은 유지된다.
|
||||
*
|
||||
* 예시값 컬럼은 타입이 그대로면 기존 값을 유지한다 (#454 멱등성 — 실측값은 호출 시점
|
||||
* DB 표본이라 매번 덮으면 스펙이 그대로인 문서까지 재실행마다 diff 가 난다). 타입이
|
||||
* 바뀌면(스펙 변경) 새 실측값으로 갱신되므로 최신성은 그 경로로 유지된다 —
|
||||
* `재생성_시_타입이_같은_필드의_실측_예시값을_보존한다` / `신규_필드와_타입_변경은_실측_예시값을_갱신한다` 참조.
|
||||
*/
|
||||
#[Test]
|
||||
public function 기존_설명은_도구의_일반_문구로_덮어쓰지_않는다(): void
|
||||
@@ -1461,9 +1465,9 @@ MD;
|
||||
// 설명은 사람 서술을 유지하고,
|
||||
$this->assertStringContainsString('플러그인 이름 (다국어 JSON)', $merged);
|
||||
$this->assertStringNotContainsString('대상의 이름/명칭', $merged);
|
||||
// 실측으로 갱신되는 예시값은 새 값으로 바뀐다.
|
||||
$this->assertStringContainsString('`새값`', $merged);
|
||||
$this->assertStringNotContainsString('`옛값`', $merged);
|
||||
// 타입이 같으므로 실측 예시값도 기존 값이 유지된다 (멱등 — 타입 변경 시에만 갱신).
|
||||
$this->assertStringContainsString('`옛값`', $merged);
|
||||
$this->assertStringNotContainsString('`새값`', $merged);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user