Closed steveklabnik closed 10 years ago
The full amount of what? That makes sense for refunds and reversals, which are related to debits and credits, but crediting 'the full amount' doesn't really make sense, except maybe in the context of an order.
I guess I was thinking of refunds and/or reversals.
@msherry do you have any idea what may have changed recently to cause this to start failing where it wasn't before?
This diff makes the test pass:
diff --git a/features/credits.feature b/features/credits.feature
index 72c82f9..7e6d85b 100644
--- a/features/credits.feature
+++ b/features/credits.feature
@@ -1,19 +1,27 @@
Feature: Credits
Credits are used for sending money to a customer
Scenario: Crediting a deleted card leads to failure
Given I have tokenized a card
When I make a DELETE request to the href "href"
Then I should get a 204 status code
- When I make a POST request to /cards/:card_id/credits
- Then I should get a 404 status code
+ When I make a POST request to /cards/:card_id/credits with the body:
+ """
+ {
+ "amount": 200,
+ "name": "John Doe"
+ }
+ """
+
+ Then I should get a 409 status code
And the response is valid according to the "errors" schema
And the fields on this error match:
"""
{
- "category_code": "not-found"
+ "category_code": "funding-destination-not-creditable"
}
"""
diff --git a/features/step_definitions/cards.rb b/features/step_definitions/cards.rb
index aba5c0a..9f037c4 100644
--- a/features/step_definitions/cards.rb
+++ b/features/step_definitions/cards.rb
@@ -1,6 +1,7 @@
Given(/^I have tokenized a card$/) do
@client.post('/cards',
{
+ name: "John Doe",
number: "4111 1111 1111 1111",
expiration_month: 12,
expiration_year: 2016,
diff --git a/features/step_definitions/http_steps.rb b/features/step_definitions/http_steps.rb
index 2a4e087..41baa70 100644
--- a/features/step_definitions/http_steps.rb
+++ b/features/step_definitions/http_steps.rb
I'm investigating to see when this last actually worked. That's a lot of change.
At some point, this existing test passed: https://travis-ci.org/balanced/balanced-api/builds/23978012
https://github.com/balanced/balanced-api/blob/master/features/credits.feature#L79
This scenario is now passing, so I am going to close this
This spec used to pass, but now fails:
https://github.com/balanced/balanced-api/blob/master/features/credits.feature#L4-L18
https://travis-ci.org/balanced/balanced-api/builds/25547319#L61
Did we recently change what's required for credits? A credit without an amount used to be the full amount.