test/remote/gateways/remote_paypal_test.rb in activemerchant-1.4.2 vs test/remote/gateways/remote_paypal_test.rb in activemerchant-1.5.0
- old
+ new
@@ -1,6 +1,6 @@
-require File.dirname(__FILE__) + '/../../test_helper'
+require 'test_helper'
class PaypalTest < Test::Unit::TestCase
def setup
Base.gateway_mode = :test
@@ -102,10 +102,23 @@
assert response.params['transaction_id']
assert_equal '1.00', response.params['gross_amount']
assert_equal 'USD', response.params['gross_amount_currency_id']
end
+ # NOTE THIS SETTING: http://skitch.com/jimmybaker/nysus/payment-receiving-preferences-paypal
+ # PayPal doesn't return the InvoiceID in the response, so I am unable to check for it. Looking at the transaction
+ # on PayPal's site will show "NEWID123" as the InvoiceID.
+ def test_successful_capture_updating_the_invoice_id
+ auth = @gateway.authorize(@amount, @creditcard, @params)
+ assert_success auth
+ response = @gateway.capture(@amount, auth.authorization, :order_id => "NEWID123")
+ assert_success response
+ assert response.params['transaction_id']
+ assert_equal '1.00', response.params['gross_amount']
+ assert_equal 'USD', response.params['gross_amount_currency_id']
+ end
+
def test_successful_voiding
auth = @gateway.authorize(@amount, @creditcard, @params)
assert_success auth
response = @gateway.void(auth.authorization)
assert_success response
@@ -162,6 +175,17 @@
# You can only include up to 250 recipients
recipients = (1..251).collect {|i| [100, "person#{i}@example.com"]}
response = @gateway.transfer(*recipients)
assert_failure response
end
-end
+
+ # Makes a purchase then makes another purchase adding $1.00 using just a reference id (transaction id)
+ def test_successful_referenced_id_purchase
+ response = @gateway.purchase(@amount, @creditcard, @params)
+ assert_success response
+ id_for_reference = response.params['transaction_id']
+
+ @params.delete(:order_id)
+ response2 = @gateway.purchase(@amount + 100, id_for_reference, @params)
+ assert_success response2
+ end
+end
\ No newline at end of file