-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec dispute documents #571
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,41 @@ | |
raise 'Unable to get a dispute in 3 minutes' if count == 0 | ||
@client.add_hydrate(:dispute_id, @dispute_id) | ||
end | ||
|
||
Given(/^I have a customer who will dispute any charge and I intend to disprove$/) do | ||
step "I have created a customer" | ||
@client.post('/cards', | ||
{ | ||
number: "6500000000000003", | ||
expiration_month: 12, | ||
expiration_year: 3000, | ||
cvv: "123", | ||
customer: @customer_id | ||
} | ||
) | ||
@dispute_card_id = @client['cards']['id'] | ||
@client.add_hydrate(:dispute_card_id, @dispute_card_id) | ||
end | ||
|
||
Given(/^I have debited a card that will initiate a dispute with submitted documents$/) do | ||
step "I have a customer who will dispute any charge and I intend to disprove" | ||
@client.post("/cards/#{@dispute_card_id}/debits", { | ||
'amount' => 99999 | ||
}) | ||
@disputed_debit_id = @client['debits']['id'] | ||
@client.add_hydrate(:disputed_debit_id, @disputed_debit_id) | ||
end | ||
|
||
Given(/^I have a dispute with submitted documents$/) do | ||
step 'I have debited a card that will initiate a dispute with submitted documents' | ||
@dispute_id = nil | ||
count = 60 | ||
while @dispute_id.nil? and count > 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @remear what do you think about removing this polling shit and tasking someone to fix the dispute latency? this is a cancer across all our specs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
count -= 1 | ||
@client.get("/debits/#{@disputed_debit_id}") | ||
@dispute_id = @client['debits']['links']['dispute'] | ||
sleep 3 | ||
end | ||
raise 'Unable to get a dispute in 3 minutes' if count == 0 | ||
@client.add_hydrate(:dispute_id, @dispute_id) | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"pattern": "DD[a-zA-Z0-9]{16,32}" | ||
}, | ||
"href": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"created_at": { | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"updated_at": { | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"url": { | ||
"description": "The url where the file may be accessed", | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"mime_type": { | ||
"type": "string", | ||
"enum": [ | ||
"application/pdf", | ||
"application/msword", | ||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", | ||
"image/jpeg" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pngs too? my mac creates a png everytime i take a screenshot There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #563 (comment) it was stated that the only image format AMEX accepts is jpeg. |
||
] | ||
}, | ||
"file_name": { | ||
"description": "Name of the document", | ||
"type": "string" | ||
}, | ||
"file_size": { | ||
"description": "Size on disk of the document", | ||
"type": "integer" | ||
}, | ||
"meta": { | ||
"$ref": "meta.json" | ||
}, | ||
"links": { | ||
"type": "object", | ||
"properties": { | ||
"dispute": { | ||
"description": "The dispute the customer has filed with their bank associated with this debit", | ||
"type": [ | ||
"null", | ||
"string" | ||
], | ||
"pattern": "DT[a-zA-Z0-9]{16,32}" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"dispute" | ||
] | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"id", | ||
"href", | ||
"created_at", | ||
"updated_at", | ||
"url", | ||
"mime_type", | ||
"file_name", | ||
"file_size", | ||
"meta", | ||
"links" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"type": "object", | ||
"properties": { | ||
"links": { | ||
"type": "object", | ||
"properties": {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this needs a |
||
}, | ||
"meta": { | ||
"type": "object" | ||
}, | ||
"dispute_documents": { | ||
"items": { | ||
"$ref": "_models/dispute_document.json" | ||
}, | ||
"type": "array", | ||
"minItems": 0, | ||
"uniqueItems": true | ||
} | ||
}, | ||
"required": [ | ||
"dispute_documents" | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steveklabnik do you like dispute_documents vs evidence? What's your reasoning for choosing one over the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pluralization of
evidence
was what steered me away from using it as a resource name.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"evidence" can be evidence of anything, "dispute document" is extremely unambiguous.
I don't feel particularly strongly about it, though.