Class: Externals::GbPrimepay::Merchant
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Externals::GbPrimepay::Merchant
- Defined in:
- app/models/externals/gb_primepay/merchant.rb
Overview
typed: ignore
Schema Information
Table name: externals_gb_primepay_merchants
id :bigint not null, primary key
accepted_credit_cards :text(65535)
customer_key :text(16777215)
name :string(191)
public_key :text(16777215)
secret_key :text(16777215)
created_at :datetime not null
updated_at :datetime not null
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Instance Method Details
#accepted_credit_cards ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/models/externals/gb_primepay/merchant.rb', line 25 def accepted_credit_cards cards = read_attribute(:accepted_credit_cards).to_s if cards.empty? [] else cards.split(',').map(&:strip) end end |
#accepted_credit_cards=(value) ⇒ Object
34 35 36 37 38 |
# File 'app/models/externals/gb_primepay/merchant.rb', line 34 def accepted_credit_cards=(value) allowed_cards = ['Visa', 'Mastercard', 'JCB', 'Amex', 'UnionPay'] filtered_cards = value.reject(&:blank?).select { |card| allowed_cards.include?(card) } write_attribute(:accepted_credit_cards, filtered_cards.join(',')) end |