package com.red.circle.wallet.inner.service.user.impl;

import com.red.circle.wallet.infra.database.cache.service.UserPayAuthCacheService;
import com.red.circle.wallet.infra.database.rds.service.auth.PayAuthService;
import com.red.circle.wallet.inner.service.user.PayAuthClientService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 支付密码
 * @author zongpubin on 2024/1/29
 */
@Service
@RequiredArgsConstructor
public class PayAuthClientServiceImpl implements PayAuthClientService {
  private final PayAuthService payAuthService;
  private final UserPayAuthCacheService userPayAuthCacheService;

  @Override
  public void initUserPayAuth(Long userId) {
    userPayAuthCacheService.deleteByUserId(userId);
  }

  @Override
  public void deleteUserPayAuth(Long userId) {
    userPayAuthCacheService.deleteByUserId(userId);
    payAuthService.deleteByUserId(userId);

  }
}
