Sha256: a2732457c7e95039ae467b455d2f0a93bce7ab5d1ac0ac85a94cc50ed8112e0d

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'active_model'

class Kaui::PaymentMethod < Kaui::Base
  define_attr :account_id
  define_attr :is_default
  define_attr :payment_method_id
  define_attr :plugin_name
  has_one :plugin_info, Kaui::PluginInfo

  def initialize(data = {})
    super(:account_id => data['accountId'],
          :is_default => data['isDefault'],
          :payment_method_id => data['paymentMethodId'],
          :plugin_name => data['pluginName'],
          :plugin_info => data['pluginInfo'])
  end

  def card_type
    plugin_info.property("cardType") if plugin_info.present?
  end

  def type
    plugin_info.property("type") if plugin_info.present?
  end

  def mask_number
    plugin_info.property("maskNumber") if plugin_info.present?
  end

  def card_holder_name
    plugin_info.property("cardHolderName") if plugin_info.present?
  end

  def expiration_dt
    plugin_info.property("expirationDate") if plugin_info.present?
  end

  def baid
    plugin_info.property("baid") if plugin_info.present?
  end

  def email
    plugin_info.property("email") if plugin_info.present?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kaui-0.1.0 app/models/kaui/payment_method.rb
kaui-0.0.9 app/models/kaui/payment_method.rb
kaui-0.0.8 app/models/kaui/payment_method.rb
kaui-0.0.7 app/models/kaui/payment_method.rb
kaui-0.0.6 app/models/kaui/payment_method.rb