Class: Payment
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Payment
- Defined in:
- lib/generators/tosspayments2/install/templates/payment.rb
Overview
결제 정보를 저장하는 Payment 모델
Instance Method Summary collapse
- #cancelled? ⇒ Boolean
- #confirmed? ⇒ Boolean
- #failed? ⇒ Boolean
- #formatted_amount ⇒ Object
- #pending? ⇒ Boolean
Instance Method Details
#cancelled? ⇒ Boolean
22 23 24 |
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 22 def cancelled? status == 'cancelled' end |
#confirmed? ⇒ Boolean
14 15 16 |
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 14 def confirmed? status == 'confirmed' end |
#failed? ⇒ Boolean
26 27 28 |
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 26 def failed? status == 'failed' end |
#formatted_amount ⇒ Object
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
18 19 20 |
# File 'lib/generators/tosspayments2/install/templates/payment.rb', line 18 def pending? status == 'pending' end |