It appears that the PayPal CSV has magically changed formats to no longer include a preceding space in the column names, which gets turned into a preceding underscore.
The first 6 lines of the header do need to be removed, however.
This commit is contained in:
parent
3097803d05
commit
5a8375581f
|
@ -17,8 +17,13 @@ class PaypalCsv < ActiveRecord::Base
|
|||
csv = CSV.table(filename)
|
||||
csv.each do |row|
|
||||
paypal_csv = PaypalCsv.new()
|
||||
|
||||
logger.fatal row.inspect
|
||||
paypal_csv.attributes.each do |c|
|
||||
# Try finding the column without a prepended _ first (compatibility with new CSV format)
|
||||
unless row[c.first[1..-1].to_sym].nil?
|
||||
paypal_csv[c.first.to_sym] = row[c.first[1..-1].to_sym]
|
||||
end
|
||||
# If there's an exact match, it takes precedence
|
||||
unless row[c.first.to_sym].nil?
|
||||
paypal_csv[c.first.to_sym] = row[c.first.to_sym]
|
||||
end
|
||||
|
@ -37,6 +42,8 @@ class PaypalCsv < ActiveRecord::Base
|
|||
|
||||
private
|
||||
def create_payment
|
||||
logger.fatal self.inspect
|
||||
|
||||
# find user by email, then by payee
|
||||
user = User.where("lower(email) = ?", self._from_email_address.downcase).first
|
||||
user = User.where("lower(payee) = ?", self._from_email_address.downcase).first if user.nil? && self._from_email_address.present?
|
||||
|
|
Loading…
Reference in New Issue
Block a user