From 022d629144747965c68bd896aa8ee22234a51bed Mon Sep 17 00:00:00 2001 From: thisgun Date: Fri, 3 Jul 2026 17:55:12 +0900 Subject: [PATCH] =?UTF-8?q?test(payment):=20NHN=20KCP=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=A3=BC=EB=AC=B8=20=ED=86=B5=ED=99=94=20=EC=8A=A4?= =?UTF-8?q?=EB=83=85=EC=83=B7=20=EB=B3=B4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NHN KCP 결제 콜백/재시도/창닫기/모바일 승인 테스트가 현재 주문 금액 계산 로직의 KRW 통화 스냅샷 계약을 따르도록 보정합니다. --- .../MobileApprovalControllerTest.php | 20 +++++++++++++++++++ .../PaymentCallbackControllerTest.php | 20 +++++++++++++++++++ .../PaymentCloseReportControllerTest.php | 19 ++++++++++++++++++ .../PaymentRetryControllerTest.php | 20 +++++++++++++++++++ 4 files changed, 79 insertions(+) diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/MobileApprovalControllerTest.php b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/MobileApprovalControllerTest.php index 9c551d8b..b3f13163 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/MobileApprovalControllerTest.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/MobileApprovalControllerTest.php @@ -41,6 +41,8 @@ class MobileApprovalControllerTest extends PluginTestCase 'total_tax_amount' => $taxable, 'total_vat_amount' => $vat, 'total_tax_free_amount'=> $taxFree, + 'currency' => 'KRW', + 'currency_snapshot' => self::krwCurrencySnapshot(), ]); OrderPaymentFactory::new()->create([ @@ -53,6 +55,24 @@ class MobileApprovalControllerTest extends PluginTestCase return $order; } + private static function krwCurrencySnapshot(): array + { + return [ + 'base_currency' => 'KRW', + 'order_currency' => 'KRW', + 'base_unit' => 1, + 'exchange_rates' => [ + 'KRW' => [ + 'rate' => 1, + 'rounding_unit' => '1', + 'rounding_method' => 'round', + 'decimal_places' => 0, + 'base_unit' => 1, + ], + ], + ]; + } + private function mockSoapService(string $approvalKey = 'TEST_APPROVAL_KEY'): void { $mock = $this->createMock(KcpSoapService::class); diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCallbackControllerTest.php b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCallbackControllerTest.php index 19172126..be6be6fe 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCallbackControllerTest.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCallbackControllerTest.php @@ -73,6 +73,8 @@ class PaymentCallbackControllerTest extends PluginTestCase 'total_tax_amount' => $taxable, 'total_vat_amount' => $vat, 'total_tax_free_amount' => $taxFree, + 'currency' => 'KRW', + 'currency_snapshot' => self::krwCurrencySnapshot(), ]); OrderPaymentFactory::new()->create([ @@ -89,6 +91,24 @@ class PaymentCallbackControllerTest extends PluginTestCase return $order; } + private static function krwCurrencySnapshot(): array + { + return [ + 'base_currency' => 'KRW', + 'order_currency' => 'KRW', + 'base_unit' => 1, + 'exchange_rates' => [ + 'KRW' => [ + 'rate' => 1, + 'rounding_unit' => '1', + 'rounding_method' => 'round', + 'decimal_places' => 0, + 'base_unit' => 1, + ], + ], + ]; + } + private function mockPluginSettings(array $overrides = []): void { $defaults = [ diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCloseReportControllerTest.php b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCloseReportControllerTest.php index 4128a6e5..e37255ef 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCloseReportControllerTest.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentCloseReportControllerTest.php @@ -163,8 +163,27 @@ class PaymentCloseReportControllerTest extends PluginTestCase $order->order_number = $orderNumber; $order->order_status = OrderStatusEnum::PENDING_ORDER; $order->currency = 'KRW'; + $order->currency_snapshot = self::krwCurrencySnapshot(); $order->total_due_amount = $amount; return $order; } + + private static function krwCurrencySnapshot(): array + { + return [ + 'base_currency' => 'KRW', + 'order_currency' => 'KRW', + 'base_unit' => 1, + 'exchange_rates' => [ + 'KRW' => [ + 'rate' => 1, + 'rounding_unit' => '1', + 'rounding_method' => 'round', + 'decimal_places' => 0, + 'base_unit' => 1, + ], + ], + ]; + } } diff --git a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentRetryControllerTest.php b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentRetryControllerTest.php index a82e3f01..94177d2e 100644 --- a/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentRetryControllerTest.php +++ b/plugins/_bundled/sirsoft-pay_nhnkcp/tests/Feature/Controllers/PaymentRetryControllerTest.php @@ -34,6 +34,8 @@ class PaymentRetryControllerTest extends PluginTestCase 'total_due_amount' => $amount, 'total_paid_amount' => 0, 'order_meta' => $orderMeta, + 'currency' => 'KRW', + 'currency_snapshot' => self::krwCurrencySnapshot(), ]); OrderPaymentFactory::new()->create([ @@ -52,6 +54,24 @@ class PaymentRetryControllerTest extends PluginTestCase return $order; } + private static function krwCurrencySnapshot(): array + { + return [ + 'base_currency' => 'KRW', + 'order_currency' => 'KRW', + 'base_unit' => 1, + 'exchange_rates' => [ + 'KRW' => [ + 'rate' => 1, + 'rounding_unit' => '1', + 'rounding_method' => 'round', + 'decimal_places' => 0, + 'base_unit' => 1, + ], + ], + ]; + } + public function test_retry_returns_ready_for_pending_order(): void { $order = $this->createOrder(10000);