Forms¶
-
class
polaris.integrations.
TransactionForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ Base class for collecting transaction information.
Developers must define subclasses to collect additional information and apply additional validation.
A subclass of this form should be returned by
content_for_transaction()
once for each interactive flow.After form validation, the key-value pairs in self.cleaned_data will be passed to the registered fee function to calculate amount_fee for the associated
Transaction
. If you want a key-value pair passed to the registered fee function but don’t want to display an additional field to the user, add a field with a HiddenInput widget.Defines the
forms.DecimalField
amount and also has a non-form attribute asset, which will be populated by the asset_code request parameter used in /transactions/deposit/webapp and /transactions/withdraw/webapp endpoints.The amount field is validated with the
clean_amount()
function, which ensures the amount is within the bounds for the asset type.
-
class
polaris.integrations.
CreditCardForm
(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)[source]¶ A generic form for collecting credit or debit card information.
Ensures card_number is valid, but does not validate the expiration or cvv. Subclass this form for additional validation.