This repository has been archived by the owner on May 27, 2021. It is now read-only.
forked from activemerchant/active_merchant
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request activemerchant#971 from michellebu/master
Stripe /cards endpoint does not update a customer.
- Loading branch information
Showing
3 changed files
with
47 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,25 @@ def test_successful_store | |
assert_equal @credit_card.last_digits, first_card["last4"] | ||
end | ||
|
||
def test_successful_store_with_existing_customer | ||
assert response = @gateway.store(@credit_card, {:currency => @currency, :description => "Active Merchant Test Customer"}) | ||
assert_success response | ||
|
||
assert response = @gateway.store(@new_credit_card, {:customer => response.params['id'], :currency => @currency, :description => "Active Merchant Test Customer", :email => "[email protected]"}) | ||
assert_success response | ||
assert_equal 2, response.responses.size | ||
|
||
card_response = response.responses[0] | ||
assert_equal "card", card_response.params["object"] | ||
assert_equal @new_credit_card.last_digits, card_response.params["last4"] | ||
|
||
customer_response = response.responses[1] | ||
assert_equal "customer", customer_response.params["object"] | ||
assert_equal "Active Merchant Test Customer", customer_response.params["description"] | ||
assert_equal "[email protected]", customer_response.params["email"] | ||
assert_equal 2, customer_response.params["cards"]["count"] | ||
end | ||
|
||
def test_successful_update | ||
creation = @gateway.store(@credit_card, {:description => "Active Merchant Update Customer"}) | ||
assert response = @gateway.update(creation.params['id'], @new_credit_card) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,14 +30,28 @@ def test_successful_new_customer_with_card | |
def test_successful_new_card | ||
@gateway.expects(:ssl_request).returns(successful_new_card_response) | ||
|
||
assert response = @gateway.store(@credit_card, @options.merge(:customer => 'cus_3sgheFxeBgTQ3M')) | ||
assert response = @gateway.store(@credit_card, :customer => 'cus_3sgheFxeBgTQ3M') | ||
assert_instance_of MultiResponse, response | ||
assert_success response | ||
|
||
assert_equal 'card_483etw4er9fg4vF3sQdrt3FG', response.authorization | ||
assert response.test? | ||
end | ||
|
||
def test_successful_new_card_and_customer_update | ||
@gateway.expects(:ssl_request).twice.returns(successful_new_card_response, successful_new_customer_response) | ||
|
||
assert response = @gateway.store(@credit_card, :customer => 'cus_3sgheFxeBgTQ3M', :email => '[email protected]') | ||
assert_instance_of MultiResponse, response | ||
assert_success response | ||
|
||
assert_equal 'card_483etw4er9fg4vF3sQdrt3FG', response.authorization | ||
assert_equal 2, response.responses.size | ||
assert_equal 'card_483etw4er9fg4vF3sQdrt3FG', response.responses[0].authorization | ||
assert_equal 'cus_3sgheFxeBgTQ3M', response.responses[1].authorization | ||
assert response.test? | ||
end | ||
|
||
def test_successful_new_default_card | ||
@gateway.expects(:ssl_request).twice.returns(successful_new_card_response, successful_new_customer_response) | ||
|
||
|