<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -60,8 +60,15 @@ module ActiveMerchant #:nodoc:
       # NOTE: Perhaps in options we allow a transaction note to be inserted
       # Verifies that funds are available for the requested card and amount and reserves the specified amount.
       # See: http://www.paymentexpress.com/technical_resources/ecommerce_nonhosted/pxpost.html#Authcomplete
-      def authorize(money, credit_card, options = {})
-        options[:credit_card] = credit_card
+      def authorize(money, payment_source, options = {})
+        
+        credit_card = payment_source if payment_source.respond_to?(:number)
+        
+        if credit_card        
+          options[:credit_card] = credit_card
+        else
+          options[:token]       = payment_source
+        end
 
         request = build_purchase_or_authorization_request(money, options)
         commit(:authorization, request)</diff>
      <filename>lib/active_merchant/billing/gateways/payment_express.rb</filename>
    </modified>
    <modified>
      <diff>@@ -121,6 +121,20 @@ class RemotePaymentExpressTest &lt; Test::Unit::TestCase
     assert_equal &quot;APPROVED&quot;, purchase.message
     assert_success purchase
     assert_not_nil purchase.authorization
-  end  
+  end
+  
+  def test_store_and_authorize_and_capture
+    assert response = @gateway.store(@credit_card)
+    assert_success response
+    assert_equal &quot;APPROVED&quot;, response.message
+    assert (token = response.token)
+
+    assert auth = @gateway.authorize(@amount, token, @options)
+    assert_success auth
+    assert_equal 'APPROVED', auth.message
+    assert auth.authorization
+    assert capture = @gateway.capture(@amount, auth.authorization)
+    assert_success capture
+  end
   
 end</diff>
      <filename>test/remote/gateways/remote_payment_express_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>13e951252ccc74895f9cd29af3d594a59e90f1d4</id>
    </parent>
  </parents>
  <author>
    <name>Bodaniel Jeanes</name>
    <email>me@bjeanes.com</email>
  </author>
  <url>http://github.com/mocra/active_merchant/commit/1e3ea9f591eb7429bb123192ef87bdadfe89f9eb</url>
  <id>1e3ea9f591eb7429bb123192ef87bdadfe89f9eb</id>
  <committed-date>2009-01-28T23:18:04-08:00</committed-date>
  <authored-date>2009-01-28T23:18:04-08:00</authored-date>
  <message>Payment Express gateway #authorize now accepts a auth_token as well as a credit card object</message>
  <tree>69aba4f2bea576b89abdb1ba07f1b541af414579</tree>
  <committer>
    <name>Bodaniel Jeanes</name>
    <email>me@bjeanes.com</email>
  </committer>
</commit>
