@@ -19,7 +19,7 @@ electrum_addrs = electrum.listaddresses
addrs = RedisAddresses.new(redis, config[:currency])
addrs.get_addresses_with_users.each do |addr, keys|
unless electrum_addrs.include?(addr)
- puts "The address #{addr} (included in #{keys.join(', ')}) "\- "isn't included in electrum's list"
+ puts "The address #{addr} (included in #{keys.join(', ')}) " \
+ "isn't included in electrum's list"
end
end
@@ -13,9 +13,9 @@ redis = Redis.new
customer_id = ENV["DEFAULT_CUSTOMER_ID"]
unless customer_id
puts "The env-var DEFAULT_CUSTOMER_ID must be set to the ID " \
- "of the customer who will receive the duplicated addrs, preferably " \- "a support customer or something linked to notifications when " \- "stray money is sent to these addresses"
+ "of the customer who will receive the duplicated addrs, preferably " \
+ "a support customer or something linked to notifications when " \
+ "stray money is sent to these addresses"
exit 1
end
@@ -143,7 +143,7 @@ class InteracEmail
def dkim_headers
# Apparently there can sometimes be multiple DKIM sigs
# And this library returns a scalar if there's one, or array otherwise
- [@m["DKIM-Signature"]].flatten.compact.map {|h|
+ [@m["DKIM-Signature"]].flatten.compact.map { |h|
h.value
&.split(/;\s*/)
&.each_with_object({}) { |f, h|
@@ -157,6 +157,7 @@ class InteracEmail
dkim = dkim_headers
raise Error::DKIM, @m if dkim.empty?
+
raise Error::WrongDKIM, @m unless dkim.any? {|v| v[:d] == "payments.interac.ca" }
end
end
@@ -202,6 +203,7 @@ class InteracEmail
# other fields I'd be more worried about
ms = paragraphs.select { |p| p.start_with?("Message:") }
raise Error::NoMessage, self if ms.empty?
+
ms.first.sub(/^Message:\s*/, "")
end
@@ -314,7 +316,7 @@ class InteracEmail
end
def to_s
- "A manual E-Transfer has been received from \"%s\" for "\
+ "A manual E-Transfer has been received from \"%s\" for " \
"$%0.2f. Message: %s\nTo deposit go to %s" % [
sender_name,
dollars,