Cody,
I implemented :void, :refund and :auth_capture for Authorize.net's CIM
gateway. I ran into a few problems while testing though.
1) I couldn't figure out how to get any tests in AM to pass with
[require 'test_helper'] - I had to put in a path. Can someone explain
what I'm missing here? How do you guys run these?
2) I obviously had to put in real credentials for Auth.net login/
password - which I assume is expected.
3) In remote_authorize_new_cim_test.rb I wasn't able to get any tests
passing with the existing @profile and @options data - I used
something like this and things worked.
t = Time.now.to_i.to_s
@profile = {
:merchant_customer_id => t,
:description => "#{t} Merchant",
:email => "bob#{
t}@email.com",
:payment_profiles => { # Optional
:customer_type => 'individual', # Optional
:bill_to => @address,
:payment => @payment
},
:ship_to_list => {
:first_name => "John#{t}",
:last_name => "Doe#{t}",
:company => "Widgets Inc #{t}",
:address1 => "1234 Fake Street",
:city => 'Anytown',
:state => 'MD',
:zip => '12345',
:country => 'USA',
:phone_number => '(123)123-1234', # Optional - Up to 25 digits
(no letters)
:fax_number => '(123)123-1234' # Optional - Up to 25 digits
(no letters)
}
}
@options = {
:ref_id => t, # Optional
:profile => @profile
}
4) The create_customer_profile_transaction method is kind of ugly
now. I thought about breaking these out into different methods but
didn't figuring one method might be easier for people to use.
Thoughts on this? It's completely backwards compitable. Here's the
new sig:
# Creates a new payment transaction from an existing customer
profile
#
# This is what is used to charge a customer whose information
you have stored in a Customer Profile.
#
# Returns a Response object that contains the result of the
transaction in <tt>params['direct_response']</tt>
#
# ==== Options
#
# * <tt>:transaction</tt> -- A hash containing information on
the transaction that is being requested. (REQUIRED)
#
# ==== Transaction
#
# * <tt>:type</tt> -- The type of transaction. Can be either
<tt>:auth_only</tt>, <tt>:capture_only</tt>, <tt>:auth_capture</tt>,
<tt>:prior_auth_capture</tt>, <tt>:refund</tt> or <tt>:void</tt>.
(REQUIRED)
# * <tt>:amount</tt> -- The amount for the tranaction. Formatted
with a decimal. For example "4.95" (CONDITIONAL)
# - :type == :void (NOT USED)
# - :type ==
(:refund, :auth_only, :capture_only, :auth_capture, :prior_auth_capture)
(REQUIRED)
#
# * <tt>:customer_profile_id</tt> -- The Customer Profile ID of
the customer to use in this transaction. (CONDITIONAL)
# - :type == (:void, :prior_auth_capture) (OPTIONAL)
# - :type == :refund (CONDITIONAL - required if masked
information is not being submitted [see below])
# - :type == (:auth_only, :capture_only, :auth_capture)
(REQUIRED)
#
# * <tt>:customer_payment_profile_id</tt> -- The Customer
Payment Profile ID of the Customer Payment Profile to use in this
transaction. (CONDITIONAL)
# - :type == (:void, :prior_auth_capture) (OPTIONAL)
# - :type == :refund (CONDITIONAL - required if masked
information is not being submitted [see below])
# - :type == (:auth_only, :capture_only, :auth_capture)
(REQUIRED)
#
# * <tt>:trans_id</tt> -- The payment gateway assigned
transaction ID of the original transaction (CONDITIONAL):
# - :type = (:void, :refund, :prior_auth_capture) (REQUIRED)
# - :type = (:auth_only, :capture_only, :auth_capture) (NOT
USED)
#
# * <tt>customer_shipping_address_id</tt> -- Payment gateway
assigned ID associated with the customer shipping address
(CONDITIONAL)
# - :type = (:void, :refund) (OPTIONAL)
# - :type = (:auth_only, :capture_only, :auth_capture) (NOT
USED)
# - :type = (:prior_auth_capture) (OPTIONAL)
#
#
# ==== For :type == :refund only
# * <tt>:credit_card_number_masked</tt> -- (CONDITIONAL -
requied for credit card refunds is :customer_profile_id
AND :customer_payment_profile_id are missing)
# * <tt>:bank_routing_number_masked
&& :bank_account_number_masked</tt> -- (CONDITIONAL - requied for
electronic check refunds is :customer_profile_id
AND :customer_payment_profile_id are missing) (NOT ABLE TO TEST - I
keep getting "ACH transactions are not accepted by this merchant."
when trying to make a payment and, until that's possible I can't
refund (
wise...@gmail.com))
def create_customer_profile_transaction(options)
5) Refunds don't work in test mode. I haven't tested them live yet
but, in theory, they should work.
6) I couldn't make a payment in test mode using electronic checking -
I kept getting "ACH transactions are not accepted by this merchant".
Given that, I'm not sure if :refund works with bank_routing masks.
I created a ticket and assigned it you (was I supposed to do that?).
Link to ticket and patch: #94
https://jadedpixel.lighthouseapp.com/projects/11599-active-merchant/tickets/94-patch-to-add-void-refund-and-prior_auth_capture-to-authnets-cim-gateway
> >> >> > Cody Fauserhttp://shopify.com-e-commercedonerighthttp://www.codyfauser.com-bloghttp://
peepcode.com/products/activemerc...for Rails
>
> >> --
> >> Cody Fauserhttp://shopify.com-e-commerce done righthttp://www.codyfauser.com-bloghttp://
peepcode.com/products/activemerchant-pdf-ActiveMerchant PeepCodehttp://
www.oreilly.com/catalog/rjsrails-RJS Templates for Rails