-
Notifications
You must be signed in to change notification settings - Fork 72
/
credits.feature
52 lines (47 loc) · 1.46 KB
/
credits.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
And the response is valid according to the "errors" schema
And the fields on this error match:
"""
{
"category_code": "not-found"
}
"""
Scenario: Credit a customer
Given I have a customer with a tokenized bank account
When I POST to /customers/:customer_id/credits with the JSON API body:
"""
{
"credits": [{
"amount": 500,
"appears_on_statement_as": "Your lucky day"
}]
}
"""
Then I should get a 201 Created status code
And the response is valid according to the "credits" schema
Scenario: Crediting without a funding source leads to failure
Given I have created a customer
When I POST to /customers/:customer_id/credits with the JSON API body:
"""
{
"credits": [{
"amount": 1234,
"description": "Will this credit work? Nobody knows"
}]
}
"""
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": "no-funding-destination"
}
"""