v7.0.0 release

This commit is contained in:
HeuJung committed 2026-07-01 10:30:32 +09:00
1 parent 0e7fa04b03
commit c4ea9a6cd1
3582 files changed
+626189 -160151

No files matched your search

@@ -1,8 +1,8 @@
<?php
namespace Modules\Sirsoft\Ecommerce\Tests\Unit\Http\Controllers\User;
namespace Modules\Sirsoft\Ecommerce\Tests\Unit\Http\Controllers\Public;
use Modules\Sirsoft\Ecommerce\Http\Controllers\User\OrderController;
use Modules\Sirsoft\Ecommerce\Http\Controllers\Public\OrderController;
use Modules\Sirsoft\Ecommerce\Models\Order;
use Modules\Sirsoft\Ecommerce\Models\OrderAddress;
use Modules\Sirsoft\Ecommerce\Models\OrderOption;
@@ -34,7 +34,7 @@ class BuildPgPaymentDataTest extends ModuleTestCase
/**
* protected buildPgPaymentData 메서드 호출 헬퍼
*
* @param Order $order 주문
* @param Order $order 주문
* @return array PG 결제 데이터
*/
private function callBuildPgPaymentData(Order $order): array
@@ -104,7 +104,7 @@ class BuildPgPaymentDataTest extends ModuleTestCase
/**
* 여러 상품 주문 시 "외 N건" 표시 확인
*/
public function test_복수_상품_주문명에_외_N건_표시(): void
public function test_복수_상품_주문명에_외_n건_표시(): void
{
app()->setLocale('ko');
@@ -226,7 +226,7 @@ class BuildPgPaymentDataTest extends ModuleTestCase
/**
* currency_snapshot에 order_currency가 없는 경우 기본값 KRW 확인
*/
public function test_통화_기본값_KRW(): void
public function test_통화_기본값_krw(): void
{
$user = $this->createUser();
$order = Order::factory()->forUser($user)->create([
@@ -244,4 +244,65 @@ class BuildPgPaymentDataTest extends ModuleTestCase
$this->assertEquals('KRW', $result['currency']);
}
// ──────────────────────────────────────────────
// base ≠ 결제통화: PG 청구 금액/통화 환산 (실제 버그 시나리오)
// ──────────────────────────────────────────────
/**
* base=USD 주문 스냅샷 (실제 버그 재현 형태).
*/
private function usdBaseSnapshot(string $orderCurrency): array
{
return [
'base_currency' => 'USD',
'order_currency' => $orderCurrency,
'exchange_rates' => [
'KRW' => ['rate' => 1176470, 'rounding_unit' => '1', 'rounding_method' => 'floor', 'decimal_places' => 0],
'USD' => ['rate' => 1, 'rounding_unit' => '0.01', 'rounding_method' => 'round', 'decimal_places' => 2],
'JPY' => ['rate' => 157000, 'rounding_unit' => '1', 'rounding_method' => 'floor', 'decimal_places' => 0],
'CNY' => ['rate' => 0, 'rounding_unit' => '0.01', 'rounding_method' => 'round', 'decimal_places' => 2],
],
];
}
private function makeOrderWithSnapshot(array $snapshot, float $baseDue): Order
{
$user = $this->createUser();
$order = Order::factory()->forUser($user)->create([
'total_due_amount' => $baseDue,
'currency_snapshot' => $snapshot,
]);
OrderOption::factory()->forOrder($order)->create(['product_name' => ['ko' => '상품']]);
OrderAddress::factory()->shipping()->forOrder($order)->create();
return $order->fresh();
}
public function test_base_usd_결제통화_krw_환산_청구(): void
{
// $6(base) → KRW 7058 (화면 표시액과 일치), price min:100 통과
$result = $this->callBuildPgPaymentData($this->makeOrderWithSnapshot($this->usdBaseSnapshot('KRW'), 6.0));
$this->assertEquals('KRW', $result['currency']);
$this->assertEquals(7058, $result['amount']);
}
public function test_base_usd_결제통화_usd_minor_unit_청구(): void
{
// $6(base=결제통화) → minor unit 600 (KG "1달러=100" 규칙)
$result = $this->callBuildPgPaymentData($this->makeOrderWithSnapshot($this->usdBaseSnapshot('USD'), 6.0));
$this->assertEquals('USD', $result['currency']);
$this->assertEquals(600, $result['amount']);
}
public function test_base_usd_결제통화_jpy_정수_청구(): void
{
// $6(base) → JPY 942 (CBT 결제 경로로 전달될 정수)
$result = $this->callBuildPgPaymentData($this->makeOrderWithSnapshot($this->usdBaseSnapshot('JPY'), 6.0));
$this->assertEquals('JPY', $result['currency']);
$this->assertEquals(942, $result['amount']);
}
}