test/remote/gateways/remote_braintree_test.rb in activemerchant-1.3.2 vs test/remote/gateways/remote_braintree_test.rb in activemerchant-1.4.0
- old
+ new
@@ -44,10 +44,17 @@
assert_equal 'This transaction has been approved', response.message
assert_success response
assert_not_nil response.params["customer_vault_id"]
end
+ def test_successful_add_to_vault_with_store_method
+ assert response = @gateway.store(@credit_card)
+ assert_equal 'This transaction has been approved', response.message
+ assert_success response
+ assert_not_nil response.params["customer_vault_id"]
+ end
+
def test_successful_add_to_vault_and_use
@options[:store] = true
assert response = @gateway.purchase(@amount, @credit_card, @options)
assert_equal 'This transaction has been approved', response.message
assert_success response
@@ -64,10 +71,18 @@
assert_equal 'This transaction has been approved', response.message
assert_success response
assert_equal @options[:store], response.params["customer_vault_id"].to_i
end
+ def test_add_to_vault_with_custom_vault_id_with_store_method
+ @options[:billing_id] = rand(100000)+10001
+ assert response = @gateway.store(@credit_card, @options.dup)
+ assert_equal 'This transaction has been approved', response.message
+ assert_success response
+ assert_equal @options[:billing_id], response.params["customer_vault_id"].to_i
+ end
+
def test_update_vault
test_add_to_vault_with_custom_vault_id
@credit_card = credit_card('4111111111111111', :month => 10)
assert response = @gateway.update(@options[:store], @credit_card)
assert_success response
@@ -75,9 +90,16 @@
end
def test_delete_from_vault
test_add_to_vault_with_custom_vault_id
assert response = @gateway.delete(@options[:store])
+ assert_success response
+ assert_equal 'Customer Deleted', response.message
+ end
+
+ def test_delete_from_vault_with_unstore_method
+ test_add_to_vault_with_custom_vault_id
+ assert response = @gateway.unstore(@options[:store])
assert_success response
assert_equal 'Customer Deleted', response.message
end
def test_declined_purchase