fix(payment): KG이니시스 간편결제 설정 노출 복구

신규 설치 사이트에서도 이커머스 주문설정에서 KG 이니시스 국내 간편결제 수단을 켤 수 있도록 배포 원본의 등록 조건을 정리합니다.
This commit is contained in:
thisgun committed 2026-07-03 11:51:12 +09:00
1 parent 479d537dfb
commit 9863ea9d3a
3 files changed
+81 -43

No files matched your search

@@ -50,6 +50,7 @@
- CBT 설정 저장 검증 실패 메시지가 번역 키 그대로 노출되지 않도록 백엔드 언어팩과 플러그인 번역 로딩 경로를 보강했습니다.
- 운영 모드의 국내 표준/모바일 결제 설정이 미완료된 경우 결제창 호출 전에 명확히 중단하도록 클라이언트 설정 상태를 노출했습니다.
- 플러그인 설정의 국내 간편결제 개별 토글이 실제 주문서 결제수단 등록과 결제 요청 가능 여부에 반영되도록 수정했습니다.
- 신규 설치 사이트의 이커머스 주문설정 결제수단 목록에 KG 이니시스 네이버페이·삼성페이·L.pay·카카오페이 선택지가 표시되지 않던 문제를 수정했습니다.
### Changed
@@ -65,30 +65,24 @@ class RegisterEasyPayMethodsListener implements HookListenerInterface
{
$kgInicisMethods = [];
$this->appendIfEnabled($kgInicisMethods, 'kginicis_samsung_pay',
$this->buildEntry(
id: 'kginicis_samsung_pay',
nameKey: 'sirsoft-pay_kginicis::payment_methods.samsung_pay.name',
descriptionKey: 'sirsoft-pay_kginicis::payment_methods.samsung_pay.description',
icon: 'mobile-screen-button',
)
$kgInicisMethods[] = $this->buildDomesticEntry(
id: 'kginicis_samsung_pay',
nameKey: 'sirsoft-pay_kginicis::payment_methods.samsung_pay.name',
descriptionKey: 'sirsoft-pay_kginicis::payment_methods.samsung_pay.description',
icon: 'mobile-screen-button',
);
$this->appendIfEnabled($kgInicisMethods, 'kginicis_naverpay', $this->buildNaverPayEntry());
$this->appendIfEnabled($kgInicisMethods, 'kginicis_lpay',
$this->buildEntry(
id: 'kginicis_lpay',
nameKey: 'sirsoft-pay_kginicis::payment_methods.lpay.name',
descriptionKey: 'sirsoft-pay_kginicis::payment_methods.lpay.description',
icon: 'mobile-screen-button',
)
$kgInicisMethods[] = $this->buildNaverPayEntry();
$kgInicisMethods[] = $this->buildDomesticEntry(
id: 'kginicis_lpay',
nameKey: 'sirsoft-pay_kginicis::payment_methods.lpay.name',
descriptionKey: 'sirsoft-pay_kginicis::payment_methods.lpay.description',
icon: 'mobile-screen-button',
);
$this->appendIfEnabled($kgInicisMethods, 'kginicis_kakaopay',
$this->buildEntry(
id: 'kginicis_kakaopay',
nameKey: 'sirsoft-pay_kginicis::payment_methods.kakaopay.name',
descriptionKey: 'sirsoft-pay_kginicis::payment_methods.kakaopay.description',
icon: 'mobile-screen-button',
)
$kgInicisMethods[] = $this->buildDomesticEntry(
id: 'kginicis_kakaopay',
nameKey: 'sirsoft-pay_kginicis::payment_methods.kakaopay.name',
descriptionKey: 'sirsoft-pay_kginicis::payment_methods.kakaopay.description',
icon: 'mobile-screen-button',
);
if ($this->settingEnabled('japan_enabled')) {
@@ -126,6 +120,21 @@ class RegisterEasyPayMethodsListener implements HookListenerInterface
);
}
/**
* 국내 간편결제 entry 는 항상 등록해 이커머스 주문설정에서 켜고 끌 수 있게 한다.
* 기존 플러그인 설정값은 신규 저장값이 없을 때 사용할 기본 활성 상태로만 반영한다.
*/
private function buildDomesticEntry(string $id, string $nameKey, string $descriptionKey, string $icon): array
{
return $this->buildEntry(
id: $id,
nameKey: $nameKey,
descriptionKey: $descriptionKey,
icon: $icon,
isActive: $this->domesticMethodEnabled($id),
);
}
/**
* 브랜드 버튼 옵션은 표시 메타데이터만 바꾸고 결제수단 ID는 유지한다.
*/
@@ -138,6 +147,7 @@ class RegisterEasyPayMethodsListener implements HookListenerInterface
? 'sirsoft-pay_kginicis::payment_methods.naverpay_brand.description'
: 'sirsoft-pay_kginicis::payment_methods.naverpay.description',
icon: 'wallet',
isActive: $this->domesticMethodEnabled('kginicis_naverpay'),
);
}
@@ -152,21 +162,16 @@ class RegisterEasyPayMethodsListener implements HookListenerInterface
}
/**
* 플러그인 설정에서 활성화된 국내 간편결제 수단만 목록에 추가합니다.
* 기존 플러그인 설정의 국내 간편결제 활성값을 읽습니다.
*
* @param array<int, array<string, mixed>> $methods
* @param string $id
* @param array<string, mixed> $entry
* @return void
* @return bool
*/
private function appendIfEnabled(array &$methods, string $id, array $entry): void
private function domesticMethodEnabled(string $id): bool
{
$settingKey = self::DOMESTIC_EASY_PAY_SETTINGS[$id] ?? null;
if ($settingKey === null || ! $this->settingEnabled($settingKey)) {
return;
}
$methods[] = $entry;
return $settingKey !== null && $this->settingEnabled($settingKey);
}
/**
@@ -187,7 +192,7 @@ class RegisterEasyPayMethodsListener implements HookListenerInterface
/**
* 결제수단 entry 1건 빌더 — EcommerceSettingsService 의 getBuiltinPaymentMethods 와 동일 형식.
*/
private function buildEntry(string $id, string $nameKey, string $descriptionKey, string $icon): array
private function buildEntry(string $id, string $nameKey, string $descriptionKey, string $icon, bool $isActive = false): array
{
return [
'id' => $id,
@@ -205,7 +210,7 @@ class RegisterEasyPayMethodsListener implements HookListenerInterface
// PG 선택 불필요 — orderResponseInterceptor 가 prefix 'kginicis_' 를 인식해
// 기본 PG 사 설정과 무관하게 KG 이니시스 결제 흐름으로 강제.
'pg_provider' => null,
'is_active' => false,
'is_active' => $isActive,
'min_order_amount' => 0,
'stock_deduction_timing' => 'payment_complete',
],
@@ -13,10 +13,10 @@ class RegisterEasyPayMethodsListenerTest extends PluginTestCase
public function test_injects_easy_pay_methods_between_phone_and_point(): void
{
$this->mockSettings([
'easy_pay_samsung_pay' => true,
'easy_pay_naverpay' => true,
'easy_pay_lpay' => true,
'easy_pay_kakaopay' => true,
'easy_pay_samsung_pay' => false,
'easy_pay_naverpay' => false,
'easy_pay_lpay' => false,
'easy_pay_kakaopay' => false,
'japan_enabled' => true,
]);
@@ -46,10 +46,10 @@ class RegisterEasyPayMethodsListenerTest extends PluginTestCase
public function test_easy_pay_methods_do_not_require_pg_provider_in_saved_defaults(): void
{
$this->mockSettings([
'easy_pay_samsung_pay' => true,
'easy_pay_naverpay' => true,
'easy_pay_lpay' => true,
'easy_pay_kakaopay' => true,
'easy_pay_samsung_pay' => false,
'easy_pay_naverpay' => false,
'easy_pay_lpay' => false,
'easy_pay_kakaopay' => false,
'japan_enabled' => true,
]);
@@ -118,11 +118,11 @@ class RegisterEasyPayMethodsListenerTest extends PluginTestCase
$this->assertSame('wallet', $naverpay['icon'] ?? null);
}
public function test_disabled_easy_pay_settings_are_not_injected(): void
public function test_disabled_easy_pay_settings_are_injected_as_inactive_for_admin_toggle(): void
{
$this->mockSettings([
'easy_pay_samsung_pay' => false,
'easy_pay_naverpay' => true,
'easy_pay_naverpay' => false,
'easy_pay_lpay' => false,
'easy_pay_kakaopay' => false,
'japan_enabled' => false,
@@ -137,9 +137,41 @@ class RegisterEasyPayMethodsListenerTest extends PluginTestCase
$this->assertSame([
'phone',
'kginicis_samsung_pay',
'kginicis_naverpay',
'kginicis_lpay',
'kginicis_kakaopay',
'point',
], array_column($methods, 'id'));
foreach ($methods as $method) {
if (str_starts_with((string) ($method['id'] ?? ''), 'kginicis_')) {
$this->assertFalse($method['defaults']['is_active'] ?? true);
}
}
}
public function test_legacy_easy_pay_settings_are_used_as_default_active_state(): void
{
$this->mockSettings([
'easy_pay_samsung_pay' => true,
'easy_pay_naverpay' => false,
'easy_pay_lpay' => true,
'easy_pay_kakaopay' => false,
'japan_enabled' => false,
]);
$listener = new RegisterEasyPayMethodsListener();
$methods = collect($listener->injectEasyPayMethods([
['id' => 'phone'],
['id' => 'point'],
]))->keyBy('id');
$this->assertTrue($methods->get('kginicis_samsung_pay')['defaults']['is_active'] ?? false);
$this->assertFalse($methods->get('kginicis_naverpay')['defaults']['is_active'] ?? true);
$this->assertTrue($methods->get('kginicis_lpay')['defaults']['is_active'] ?? false);
$this->assertFalse($methods->get('kginicis_kakaopay')['defaults']['is_active'] ?? true);
}
private function mockSettings(array $settings): void