Class: Payment

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
lib/generators/tosspayments2/install/templates/payment.rb

Overview

결제 정보를 저장하는 Payment 모델

Instance Method Summary collapse

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 22

def cancelled?
  status == 'cancelled'
end

#confirmed?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 14

def confirmed?
  status == 'confirmed'
end

#failed?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 26

def failed?
  status == 'failed'
end

#formatted_amountObject



30
31
32
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 30

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

#pending?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 18

def pending?
  status == 'pending'
end