-
Notifications
You must be signed in to change notification settings - Fork 757
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
Add support for v1/issuer_fraud_records endpoint #456
Changes from 3 commits
c53f19e
0b76b0b
475a42b
acb67e4
750a8ed
d4068a4
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
var StripeResource = require('../StripeResource'); | ||
var stripeMethod = StripeResource.method; | ||
|
||
module.exports = StripeResource.extend({ | ||
path: 'issuer_fraud_records', | ||
includeBasic: ['list', 'retrieve'], | ||
|
||
retrieveFromCharge: stripeMethod({ | ||
method: 'GET', | ||
path: function(urlData) { | ||
return '?charge=' + urlData.chargeId; | ||
}, | ||
urlParams: ['chargeId'], | ||
}), | ||
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. Like in Ruby, stripe.subscriptions.list({
limit: 3,
customer: 'test_cus',
plan: 'gold',
}); |
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../testUtils').getSpyableStripe(); | ||
var expect = require('chai').expect; | ||
|
||
describe('IssuerFraudRecord Resource', function() { | ||
describe('retrieve', function() { | ||
it('Sends the correct request for issfr ID', function() { | ||
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. Can you truncate this down to just "Sends the correct request" for consistency? 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. 👍 |
||
stripe.issuerFraudRecords.retrieve('issfr_123'); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/issuer_fraud_records/issfr_123', | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
it('Sends the correct request for charge ID', function() { | ||
stripe.issuerFraudRecords.retrieveFromCharge('ch_123456789'); | ||
console.log(stripe); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/issuer_fraud_records?charge=ch_123456789', | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
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. I think we can safely drop this test case, but if we don't, it should go in the |
||
}); | ||
|
||
describe('list', function() { | ||
it('Sends the correct request', function() { | ||
stripe.issuerFraudRecords.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/issuer_fraud_records', | ||
data: {}, | ||
headers: {}, | ||
}); | ||
}); | ||
}); | ||
}); |
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.
@brandur @matt-stripe any advice here? This still isn't right, because then the url is /v1/issuer_fraud_records/?charge=.... whereas I want it to be /v1/issuer_fraud_records?charge=....
I haven't found another example of this ^ but please do direct me if there is one
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.
I also would actually like the test to be
data: {charge: 'ch_123456789'}
versus doing the urlparams. At least, I think that's what we'd prefer to test here