- config/services.php에 barobill 설정 등록 (운영/테스트 모드 분기 정상화) - BarobillSetting 모델에 BelongsToTenant 적용 및 use_* 필드 casts 추가 - BarobillService API URL을 baroservice.com(SOAP)으로 수정 - BarobillService callApi 메서드 경로 하드코딩 제거 (서비스별 분기) - BarobillService 예외 이중 래핑 문제 수정 - BarobillController URL 메서드 중복 코드 제거 - 누락 모델 16개 생성 (MNG 패턴 준수, BelongsToTenant 적용) - 바로빌 전 테이블 options JSON 컬럼 추가 마이그레이션
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Barobill;
|
|
|
|
use App\Traits\BelongsToTenant;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class BarobillCardTransactionHide extends Model
|
|
{
|
|
use BelongsToTenant;
|
|
|
|
protected $table = 'barobill_card_transaction_hides';
|
|
|
|
protected $fillable = [
|
|
'tenant_id',
|
|
'original_unique_key',
|
|
'card_num',
|
|
'use_date',
|
|
'approval_num',
|
|
'original_amount',
|
|
'merchant_name',
|
|
'hidden_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'original_amount' => 'decimal:2',
|
|
];
|
|
|
|
// =========================================================================
|
|
// 헬퍼 메서드
|
|
// =========================================================================
|
|
|
|
public static function getHiddenKeys(int $tenantId, string $startDate, string $endDate)
|
|
{
|
|
return static::where('tenant_id', $tenantId)
|
|
->whereBetween('use_date', [$startDate, $endDate])
|
|
->pluck('original_unique_key')
|
|
->toArray();
|
|
}
|
|
|
|
public static function hideTransaction(int $tenantId, string $uniqueKey, array $originalData, int $userId): self
|
|
{
|
|
return static::create([
|
|
'tenant_id' => $tenantId,
|
|
'original_unique_key' => $uniqueKey,
|
|
'card_num' => $originalData['card_num'] ?? '',
|
|
'use_date' => $originalData['use_date'] ?? '',
|
|
'approval_num' => $originalData['approval_num'] ?? '',
|
|
'original_amount' => $originalData['approval_amount'] ?? 0,
|
|
'merchant_name' => $originalData['merchant_name'] ?? '',
|
|
'hidden_by' => $userId,
|
|
]);
|
|
}
|
|
|
|
public static function restoreTransaction(int $tenantId, string $uniqueKey): bool
|
|
{
|
|
return static::where('tenant_id', $tenantId)
|
|
->where('original_unique_key', $uniqueKey)
|
|
->delete() > 0;
|
|
}
|
|
}
|