Module: PaymentsHelper

Defined in:
lib/generators/tosspayments2/install/templates/payments_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_currency(amount) ⇒ Object



34
35
36
# File 'lib/generators/tosspayments2/install/templates/payments_helper.rb', line 34

def format_currency(amount)
  "#{amount.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse}원"
end

#payment_status_class(status) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/tosspayments2/install/templates/payments_helper.rb', line 4

def payment_status_class(status)
  case status
  when 'confirmed'
    'bg-success'
  when 'pending'
    'bg-warning'
  when 'cancelled'
    'bg-secondary'
  when 'failed'
    'bg-danger'
  else
    'bg-light'
  end
end

#payment_status_text(status) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/tosspayments2/install/templates/payments_helper.rb', line 19

def payment_status_text(status)
  case status
  when 'confirmed'
    '결제완료'
  when 'pending'
    '결제대기'
  when 'cancelled'
    '결제취소'
  when 'failed'
    '결제실패'
  else
    status
  end
end