ActiveMerchant, Authorize.net and Email Receipts

I've posted this on RailsForum.com and in the ActiveMerchant talk
group, and haven't received an answer, so I figure I'll try here.

Hello. I've been searching for information on this for a while, but my
google fu is evidently weak--hardly anyone even talks about email
receipts re: ActiveMerchant, much less my specific problem.
In any case, I have a client whose customers, we had just discovered,
had not been receiving email receipts from Authorize.net. All was
correct on the Auth.net config--what I discovered was that my app was
not sending the customer email. I fixed this problem, but it didn't
fix the issue--even though the email was getting sent, using the
options hash in AuthorizeNetGateway#purchase, Authorize.net was still
not sending receipts. I investigated further, and found this in the
ActiveMerchant code:

BEGIN RUBY

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
class AuthorizeNetGateway < Gateway

...snip...

  def add_customer_data(post, options)
        if options.has_key? :email
          post[:email] = options[:email]
          post[:email_customer] = false
        end

        if options.has_key? :customer
          post[:cust_id] = options[:customer]
        end

        if options.has_key? :ip
          post[:customer_ip] = options[:ip]
        end
      end
...etc...

END RUBY

add_customer_data is called within purchase to process its options
hash. My question is in reference to the line that processes the email
key: Why on earth does it, after checking to see if the email entry
exists, set customer_email explicitly to false? Why is this not based
on some sort of configurable option, or just let alone (Authorize.net
will check the merchant-set options if no customer_email field is
sent)? It's remarkably puzzling, so if any of you fine fellows knows
the answer, please let me know.

Cheers,
A. Wilson

add_customer_data is called within purchase to process its options
hash. My question is in reference to the line that processes the email
key: Why on earth does it, after checking to see if the email entry
exists, set customer_email explicitly to false?

No idea, probably either it was easier, it wouldn't fit with their
gateway api (i.e. other vendors might not have that functionality), it
worked for them at the time.

Have you tried overriding it in your own app? You could always submit a
patch to
https://jadedpixel.lighthouseapp.com/projects/11599-active-merchant/tickets

:slight_smile:

Cheers
Luke

I didn't have the time to sit down and work out overriding it, but
it's a good idea, and Ruby definitely supports the paradigm, so I'll
probably do that. And, yeah, who knows, maybe I'll even go in with a
patch. Thanks for the response!

Cheers,
AW