Skip to content
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 #425

Merged
merged 4 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stripe/api_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from stripe.api_resources.file_upload import FileUpload
from stripe.api_resources.invoice import Invoice
from stripe.api_resources.invoice_item import InvoiceItem
from stripe.api_resources.issuer_fraud_record import IssuerFraudRecord
from stripe.api_resources.login_link import LoginLink
from stripe.api_resources.order import Order
from stripe.api_resources.order_return import OrderReturn
Expand Down
9 changes: 9 additions & 0 deletions stripe/api_resources/issuer_fraud_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from stripe.api_resources.abstract import ListableAPIResource


class IssuerFraudRecord(ListableAPIResource):
OBJECT_NAME = 'issuer_fraud_record'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might need something like this here:

    @classmethod
    def class_name(cls):
        return 'issuer_fraud_record'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


@classmethod
def class_name(cls):
return 'issuer_fraud_record'
2 changes: 2 additions & 0 deletions stripe/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def load_object_classes():
api_resources.FileUpload.OBJECT_NAME: api_resources.FileUpload,
api_resources.Invoice.OBJECT_NAME: api_resources.Invoice,
api_resources.InvoiceItem.OBJECT_NAME: api_resources.InvoiceItem,
api_resources.IssuerFraudRecord.OBJECT_NAME:
api_resources.IssuerFraudRecord,
api_resources.LoginLink.OBJECT_NAME: api_resources.LoginLink,
api_resources.Order.OBJECT_NAME: api_resources.Order,
api_resources.OrderReturn.OBJECT_NAME: api_resources.OrderReturn,
Expand Down
24 changes: 24 additions & 0 deletions tests/api_resources/test_issuer_fraud_record.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import stripe
from tests.helper import StripeTestCase


TEST_RESOURCE_ID = 'issfr_123'


class IssuerFraudRecordTest(StripeTestCase):
def test_is_listable(self):
resources = stripe.IssuerFraudRecord.list()
self.assert_requested(
'get',
'/v1/issuer_fraud_records'
)
self.assertIsInstance(resources.data, list)
self.assertIsInstance(resources.data[0], stripe.IssuerFraudRecord)

def test_is_retrievable(self):
resource = stripe.IssuerFraudRecord.retrieve(TEST_RESOURCE_ID)
self.assert_requested(
'get',
'/v1/issuer_fraud_records/%s' % TEST_RESOURCE_ID
)
self.assertIsInstance(resource, stripe.IssuerFraudRecord)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the test case around CHARGE_ID since that should come as part of list's functionality, just like in the other libraries