Method: ActiveMerchant::Billing::Check#checksum
- Defined in:
- lib/active_merchant/billing/check.rb
#checksum(digits) ⇒ Object
Routing numbers may be validated by calculating a checksum and dividing it by 10. The formula is:
(3(d1 + d4 + d7) + 7(d2 + d5 + d8) + 1(d3 + d6 + d9))mod 10 = 0
See en.wikipedia.org/wiki/Routing_transit_number#Internal_checksums
79 80 81 82 83 |
# File 'lib/active_merchant/billing/check.rb', line 79 def checksum(digits) ((3 * (digits[0] + digits[3] + digits[6])) + (7 * (digits[1] + digits[4] + digits[7])) + (digits[2] + digits[5] + digits[8])) % 10 end |