Coverage for benefits/enrollment/forms.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-22 18:00 +0000

1""" 

2The enrollment application: Form definitions for results from Hosted Card Verification Flow. 

3""" 

4 

5from django import forms 

6 

7 

8class CardTokenizeSuccessForm(forms.Form): 

9 """Form to bring client card token back to server.""" 

10 

11 id = "form-card-tokenize-success" 

12 method = "POST" 

13 

14 def __init__(self, data=None, action_url=None, *args, **kwargs): 

15 super().__init__(data, *args, **kwargs) 

16 self.action_url = action_url 

17 

18 # hidden input with no label 

19 card_token = forms.CharField(widget=forms.HiddenInput(), label="") 

20 

21 

22class CardTokenizeFailForm(forms.Form): 

23 """Form to indicate card tokenization failure to server.""" 

24 

25 method = "POST" 

26 

27 def __init__(self, action_url, id, *args, **kwargs): 

28 # init super with an empty data dict 

29 # binds and makes immutable this form's data 

30 # since there are no form fields, the form is also marked as valid 

31 super().__init__({}, *args, **kwargs) 

32 self.id = id 

33 self.action_url = action_url