test(payment): NHN KCP 테스트 주문 통화 스냅샷 보정

NHN KCP 결제 콜백/재시도/창닫기/모바일 승인 테스트가 현재 주문 금액 계산 로직의 KRW 통화 스냅샷 계약을 따르도록 보정합니다.
This commit is contained in:
thisgun committed 2026-07-03 17:55:12 +09:00
1 parent f0d44989e1
commit 022d629144
4 files changed
+79

No files matched your search

@@ -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);
@@ -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 = [
@@ -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,
],
],
];
}
}
@@ -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);