Class: Spree::BankPayments::IncomingTransfer

Inherits:
Base
  • Object
show all
Defined in:
app/models/spree/bank_payments/incoming_transfer.rb

Constant Summary collapse

STATES =
%w[unmatched applied ignored].freeze
AMBIGUOUS =

Crockford base32 decoding folds these ambiguous glyphs. Applied to both sides of a comparison, so a customer typing O for 0 still matches.

{ 'O' => '0', 'I' => '1', 'L' => '1' }.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.normalize_reference(value) ⇒ Object



33
34
35
# File 'app/models/spree/bank_payments/incoming_transfer.rb', line 33

def self.normalize_reference(value)
  value.to_s.upcase.gsub(/[^A-Z0-9]/, '').gsub(/[OIL]/, AMBIGUOUS)
end

Instance Method Details

#moneyObject



41
42
43
# File 'app/models/spree/bank_payments/incoming_transfer.rb', line 41

def money
  Spree::Money.new(amount, currency: currency)
end