Class: PaymentType
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- PaymentType
- Defined in:
- app/models/payment_type.rb
Overview
Schema Information
Table name: payment_types
id :bigint not null, primary key
name :string(191)
created_at :datetime not null
updated_at :datetime not null
Indexes
index_payment_types_on_name (name) UNIQUE
Class Method Summary collapse
- .alipay_plus ⇒ Object
- .all_type_name ⇒ Object
- .credit_card ⇒ Object
- .promptpay ⇒ Object
- .shopee_pay ⇒ Object
- .true_wallet ⇒ Object
- .wechat_pay ⇒ Object
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Class Method Details
.alipay_plus ⇒ Object
58 59 60 |
# File 'app/models/payment_type.rb', line 58 def self.alipay_plus @alipay_plus ||= PaymentType.find_by!(name: 'alipay_plus') end |
.all_type_name ⇒ Object
21 22 23 |
# File 'app/models/payment_type.rb', line 21 def self.all_type_name PaymentType.all.map(&:name) end |
.credit_card ⇒ Object
46 47 48 |
# File 'app/models/payment_type.rb', line 46 def self.credit_card @credit_card ||= PaymentType.find_by!(name: 'credit_card') end |
.promptpay ⇒ Object
42 43 44 |
# File 'app/models/payment_type.rb', line 42 def self.promptpay @promptpay ||= PaymentType.find_by!(name: 'promptpay') end |
.shopee_pay ⇒ Object
54 55 56 |
# File 'app/models/payment_type.rb', line 54 def self.shopee_pay @shopee_pay ||= PaymentType.find_by!(name: 'shopee_pay') end |
.true_wallet ⇒ Object
50 51 52 |
# File 'app/models/payment_type.rb', line 50 def self.true_wallet @true_wallet ||= PaymentType.find_by!(name: 'true_wallet') end |
.wechat_pay ⇒ Object
62 63 64 |
# File 'app/models/payment_type.rb', line 62 def self.wechat_pay @wechat_pay ||= PaymentType.find_by!(name: 'wechat_pay') end |
Instance Method Details
#humanize_name ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/models/payment_type.rb', line 25 def humanize_name case name when 'promptpay' 'PromptPay QR' when 'shopee_pay' 'Shopee Pay' when 'credit_card' 'Debit/ Credit Card' when 'true_wallet' 'True Money Wallet' when 'alipay_plus' 'Alipay+' when 'wechat_pay' 'WeChat Pay' end end |