백로그
0할 일
0진행 중
0리뷰
0완료 (전체)
2Admin Payments 컨트롤러 + 라우팅 + 테스트
## 작업 내용 Admin::PaymentsController를 생성하고, 결제 목록 조회 + 취소 기능을 구현합니다. ## 완료 기준 ### 1. 라우팅 (config/routes.rb) admin 네임스페이스에 추가: ```ruby resources :payments, only: [:index] do member do post :cancel end end ``` ### 2. Admin::PaymentsController (app/controllers/admin/payments_controller.rb) - `Admin::BaseController` 상속 - **index 액션:** - Payment.includes(:user).order(created_at: :desc) 로 기본 조회 - 검색: 사용자명/이메일/전화번호로 검색 (params[:search]) - 필터: 상태 (params[:status] - pending/completed/failed/canceled) - 필터: 결제 유형 (params[:payment_type] - report/career_up/premium/analysis_credit/package/workshop/strength_diary/custom) - 페이지네이션: PER_PAGE = 50, pagy 사용 (기존 컨트롤러들이 pagy 사용 중) - 정렬: created_at desc (기본), amount, status - **cancel 액션:** - 관리자 취소 기능. 기존 Payments::CancellationService를 참고하되, 관리자는 7일 제한 없이 취소 가능해야 함 - 취소 성공 시 flash notice와 함께 리다이렉트 - 취소 실패 시 flash alert와 함께 리다이렉트 ### 3. 테스트 (test/controllers/admin/payments_controller_test.rb) - index 액션 테스트: 관리자 접근 가능, 비관리자 접근 불가 - 검색 테스트 - 필터 테스트 - cancel 액션 테스트 - 기존 테스트 패턴: test/controllers/admin/ 디렉토리의 기존 테스트 참고 ### 참고 사항 - 기존 Admin::UsersController, Admin::DiagnosisSessionsController의 패턴을 따라주세요 - Payment 모델은 이미 존재합니다 (app/models/payment.rb) - 사용자 정보: user.name, user.email_address, user.phone - 상태 enum: pending, completed, failed, canceled - 결제 유형 enum: report, career_up, premium, analysis_credit, package, workshop, strength_diary, custom - pagy gem이 이미 설치되어 있습니다 - 기존 Admin::BaseController (app/controllers/admin/base_controller.rb) 상속 필수
Admin Payments 뷰 + 사이드바 메뉴
## 작업 내용 관리자 결제 관리 페이지의 뷰를 구현하고, 사이드바에 메뉴를 추가합니다. ## 완료 기준 ### 1. 사이드바 메뉴 추가 (app/views/admin/shared/_sidebar.html.erb) - "진단 세션" 메뉴 아래에 "결제 관리" 메뉴 추가 - 아이콘: Heroicon의 credit-card 또는 banknotes 아이콘 사용 - 링크: admin_payments_path - 활성 상태 표시: 기존 패턴 따르기 ### 2. Payments Index 뷰 (app/views/admin/payments/index.html.erb) 기존 admin 뷰 패턴(diagnosis_sessions/index.html.erb)을 참고하여 일관된 디자인으로 구현: **페이지 헤더:** - 제목: "결제 관리" - 전체 건수 표시 **검색 & 필터 영역:** - 검색: 사용자명/이메일/전화번호 통합 검색 - 상태 필터: 전체/대기중(pending)/완료(completed)/실패(failed)/취소(canceled) - 결제 유형 필터: 전체 + 각 payment_type (한글 표시) **테이블 컬럼 (요구사항 순서):** 1. 사용자 (user.name) 2. 이메일 (user.email_address) 3. 전화번호 (user.phone) 4. 상품명 (payment_type 한글 표시 - report: "강점 진단 리포트", analysis_credit: "분석 크레딧" 등) 5. 가격 (amount, number_to_currency 포맷) 6. 상태 (status, 색상 배지로 표시 - completed: green, pending: yellow, failed: red, canceled: gray) 7. 할인금액 (discount_amount, 0이면 "-") 8. 결제일 (approved_at, 없으면 "-") 9. 영수증 (receipt_url이 있으면 링크, 없으면 "-") 10. 취소 (취소 버튼 - completed 상태이고 canceled_at이 없을 때만 표시) **페이지네이션:** - pagy 사용 (기존 패턴 참고) **결제 유형 한글 매핑:** ``` report → 강점 진단 리포트 career_up → 커리어업 premium → 프리미엄 analysis_credit → 분석 크레딧 package → 패키지 workshop → 워크숍 strength_diary → 강점 다이어리 custom → 커스텀 결제 ``` **상태 한글 매핑:** ``` pending → 대기중 completed → 완료 failed → 실패 canceled → 취소 ``` ### 3. Tailwind CSS 스타일 - 기존 admin 뷰의 Tailwind 클래스 패턴을 정확히 따르세요 - 반응형 테이블 (overflow-x-auto) - 상태 배지, 버튼 등 기존 디자인 시스템 유지 ### 참고 사항 - 기존 admin 뷰 패턴: app/views/admin/diagnosis_sessions/index.html.erb 참고 - 사이드바: app/views/admin/shared/_sidebar.html.erb - Tailwind CSS 사용 중 - ERB 템플릿 엔진 - 한국어 UI