3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'app/models/spree_np_atobarai/payment_decorator.rb', line 3
def self.prepended(base)
base.attribute :invoice_sending, :string
base.enum :invoice_sending, { postal: 'postal', email: 'email' }, prefix: :invoice_sending
base.validates :invoice_sending, presence: true,
if: ->(payment) { payment.payment_method.is_a?(Spree::PaymentMethod::NpAtobarai) }
base.define_singleton_method(:human_invoice_sending_name) do |invoice_sending_type|
return if invoice_sending_type.blank?
I18n.t("activerecord.attributes.spree/payment.invoice_sendings.#{invoice_sending_type}")
end
end
|