Sha256: e8d768e3bbc56a7f68eea65ca600caa2789bcfd3ce0d178d4dc4594f04d3dc7e

Contents?: true

Size: 628 Bytes

Versions: 6

Compression:

Stored size: 628 Bytes

Contents

module Workarea
  decorate Payment::Tender::CreditCard, with: :forter do
    decorated do
      field :bin, type: String
      before_validation :set_bin
    end

    def set_bin
      if number.present?
        self.bin = ActiveMerchant::Billing::CreditCard.first_digits(number)
      end
    end

    def set_saved_card_values
      if saved_card.present?
        self.display_number = saved_card.display_number
        self.issuer = saved_card.issuer
        self.month = saved_card.month
        self.year = saved_card.year
        self.token = saved_card.token
        self.bin = saved_card.bin
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-forter-1.3.2 app/models/workarea/payment/tender/credit_card.decorator
workarea-forter-1.3.1 app/models/workarea/payment/tender/credit_card.decorator
workarea-forter-1.3.0 app/models/workarea/payment/tender/credit_card.decorator
workarea-forter-1.2.4 app/models/workarea/payment/tender/credit_card.decorator
workarea-forter-1.2.3 app/models/workarea/payment/tender/credit_card.decorator
workarea-forter-1.2.2 app/models/workarea/payment/tender/credit_card.decorator