-
Notifications
You must be signed in to change notification settings - Fork 36
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
Idea: include abstract models and helper functions for easier CIM #25
Conversation
I think the helper functions would actually work very well as model manager functions. This couples the ORM to Authorize.NET for those models, but I think that's a good thing because those models should only be a reflection of the data that is associated on Authorize.NET. If coupled to the ORM this also has the added benefit of allowing Authorize.NET customer management from the admin interface for free (maybe?). The If this isn't something you'd like to see in this app I may make a separate app for this. |
This is a great idea. Yes, I agree that the Django models should be a reflection of Authorize.NET data. If somebody would need them to be decoupled (maybe if they use several different payment processors, and have more generic customer profile), they could still use basic CIM api and create their own models. |
Great. I'm starting to think these shouldn't be abstract models. I think the only information that should be stored in them would be Authorize.NET-related so they shouldn't need to be extended. If they aren't abstract models then the model managers would be linked already and the admin interface would exist by default. The only downside to creating non-abstract models is that users who don't use them will be stuck with model references in their admin interface that they don't use. Maybe this should be a concrete app provided separate from |
According to this thread, nesting Django apps is possible. The only thing is that if we choose 'authorizenet.customers' as a name for the app, Maybe we should go with something like 'authorizenet.authnet_customers'. |
That's a good point... and unfortunate. I think I'll use |
Yes, it is a bit ugly. :-) |
I turned this into a pull request. Currently the single test for this is under a Currently there are two models with managers based on the sample code I'd written before as well as a new generic view for creating payment profiles. I may end up importing requiring webtest for the tests to integration test the forms with the views. |
I consolidated the tests and moved the tests app to the top level directory. Maybe nesting an app within |
Yes, that might be a better option. |
A settings object is now used in the Currently the admin interface works correctly for:
Expiration dates are currently not stored in payment profiles, but they are stored/displayed on authorize.net so I'm considering creating a database field to store them. I'm also planning to create an admin page linked to from the customer profile admin page that allows charging one of a customer's payment profiles. The error message passing also needs to be improved (e.g. "Error creating customer profile" is not a helpful message). Currently exceptions are raised with a very generic message and then never caught. I'm not sure how we should handle this yet. |
Looks great. Regarding the exceptions, if output includes sort of traceback, or reason for the error, we should include it in the exception message. We shouldn't catch them, because it is a job of the application that uses the library. |
Summary of changes:
Changes that we might consider (pre or post merge):
The only bug in the current code that I'm aware of is that the save button on the customer profile admin page requires all payment profile credit card information to be re-entered (because it doesn't know not to save unchanged payment profiles). The solutions I've thought of to resolve this:
|
I like the idea with django-relatives for the payment profiles, and making them readonly. It is nice to see customer payment profiles, but they don't need to be editable from the customer profile page directly. |
…enet into customer-models
Idea: include abstract models and helper functions for easier CIM
Thoughts on this:
BaseCustomerProfile
andBaseCustomerPaymentProfile
abstract models (based on this) withauthorizenet
app with sane default fields