feat(ecommerce): 마일리지 적립 절사 기준 신설 및 주문 시점 스냅샷
적립 포인트 절사가 코드에 1점 버림으로 고정돼 있어 운영자가 조정할 수 없었다. 언어/통화 설정의 환율 절사를 따라가는 방안을 먼저 검토했으나, 그쪽은 외화 환산 분기에서만 적용되어 기본 통화 상점에는 따라갈 값 자체가 없다. 적립은 기본 통화 원장에 정수로 확정 기록되는 값이라 성격이 다르므로 마일리지 통화별 규칙에 신설했다. - earn_rounding_unit(1/10/100) + earn_rounding_method(floor/round/ceil) - 기본값은 종전 하드코딩과 정확히 같은 금액을 산출 — 기존 쇼핑몰 적립액 무변화 - 주문 계산·옵션 분할·부분취소 안분 전 경로에 동일 기준 적용 - 주문 시점 값을 스냅샷으로 보관 — 이후 기준을 바꿔도 과거 주문이 소급 변경되지 않는다 - 설정 UI·검증·다국어(ko/en/ja)·API 문서 동반, 기존 사이트는 업그레이드 스텝이 명시 기입 함께 처리: 마일리지 내역 목록 테스트가 첫 컬럼 field 를 `no` 로 단언해 실패하던 것을 현재 레이아웃 값(`number`)에 맞춰 정정했다. 이 브랜치와 무관한 stale 케이스다.
This commit is contained in:
1 parent
0ae3289c60
commit
60cccbf62d
36 files changed
+1793
-65
No files matched your search
+6
@@ -9,6 +9,7 @@ use Modules\Sirsoft\Ecommerce\Repositories\Contracts\OrderRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Repositories\Contracts\ProductRepositoryInterface;
|
||||
use Modules\Sirsoft\Ecommerce\Services\EcommerceSettingsService;
|
||||
use Modules\Sirsoft\Ecommerce\Services\PaymentMethodResolver;
|
||||
use Modules\Sirsoft\Ecommerce\Support\MileageRounding;
|
||||
|
||||
/**
|
||||
* 이커머스 설정 저장 요청 검증
|
||||
@@ -311,6 +312,11 @@ class StoreEcommerceSettingsRequest extends FormRequest
|
||||
'mileage.currency_rules.*.max_use_percent' => ['nullable', 'numeric', 'min:'.config('sirsoft-ecommerce.limits.max_use_percent_min', 0), 'max:'.config('sirsoft-ecommerce.limits.max_use_percent_max', 100)],
|
||||
// 최대 사용한도(고정금액): 비합리적 거액 방지를 위해 10억 상한
|
||||
'mileage.currency_rules.*.max_use_value' => ['nullable', 'integer', 'min:'.config('sirsoft-ecommerce.limits.max_use_value_min', 0), 'max:'.config('sirsoft-ecommerce.limits.max_use_value_max', 1000000000)],
|
||||
// 적립 절사 기준 — 통화 환산 절사(language_currency.currencies.*.rounding_*)와 별개다.
|
||||
// 그쪽은 외화 표시 전용이라 기본 통화에는 적용되지 않는 반면, 적립은 기본 통화 원장에
|
||||
// 확정 기록되는 값이므로 자기 규칙을 갖는다. 어휘는 MileageRounding 이 SSoT.
|
||||
'mileage.currency_rules.*.earn_rounding_unit' => ['nullable', 'string', 'in:'.implode(',', MileageRounding::UNITS)],
|
||||
'mileage.currency_rules.*.earn_rounding_method' => ['nullable', 'string', 'in:'.implode(',', MileageRounding::METHODS)],
|
||||
'mileage.expiry_enabled' => ['nullable', 'boolean'],
|
||||
'mileage.expiry_days' => ['nullable', 'integer', 'min:'.config('sirsoft-ecommerce.limits.expiry_days_min', 1), 'max:'.config('sirsoft-ecommerce.limits.expiry_days_max', 3650)],
|
||||
'mileage.expiry_notification_enabled' => ['nullable', 'boolean'],
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Helpers\PermissionHelper;
|
||||
use App\Http\Resources\BaseApiResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Sirsoft\Ecommerce\Http\Resources\Traits\HasMultiCurrencyPrices;
|
||||
use Modules\Sirsoft\Ecommerce\Support\ShippingPolicySnapshot;
|
||||
|
||||
/**
|
||||
* 주문 상세 리소스
|
||||
@@ -188,7 +189,12 @@ class OrderResource extends BaseApiResource
|
||||
|
||||
// 프로모션/배송정책 스냅샷
|
||||
'promotions_applied_snapshot' => $this->promotions_applied_snapshot,
|
||||
'shipping_policy_applied_snapshot' => $this->shipping_policy_applied_snapshot,
|
||||
// 항상 신형 구조(`{items: [...], address: {...}}`)로 정규화해 내보낸다.
|
||||
// 백필 전 구형 행이 남아 있어도 화면은 한 형태만 보면 되고, `items` 가 JSON
|
||||
// 배열로 직렬화되므로 프론트의 `.find(...)` 가 안전하다.
|
||||
'shipping_policy_applied_snapshot' => ShippingPolicySnapshot::normalize(
|
||||
$this->shipping_policy_applied_snapshot
|
||||
),
|
||||
|
||||
// 메모
|
||||
'admin_memo' => $this->admin_memo,
|
||||
|
||||
Reference in new issue
Block a user