mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 20:26:46 +00:00
Modified Account page
This commit is contained in:
parent
ae3a5ca240
commit
2e4018b1b8
@ -10,17 +10,6 @@ import random
|
||||
|
||||
class CreateAccountForm(forms.Form):
|
||||
|
||||
account_id = forms.CharField(
|
||||
label=_('Account Id'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': 'account-id-{}'.format(random.randint(1,1000)),
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
initial='account-id-{}'.format(random.randint(1,1000)),
|
||||
)
|
||||
|
||||
user_id = forms.CharField(
|
||||
label=_('User Id'),
|
||||
widget=forms.TextInput(
|
||||
@ -44,7 +33,7 @@ class CreateAccountForm(forms.Form):
|
||||
label=_('Label'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': _('Select the label'),
|
||||
'placeholder': _('Select The Label'),
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
@ -52,7 +41,7 @@ class CreateAccountForm(forms.Form):
|
||||
)
|
||||
|
||||
product_code = forms.CharField(
|
||||
label=_('Write Product Code'),
|
||||
label=_('Product Code'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': "1234BW",
|
||||
@ -96,7 +85,7 @@ class CreateAccountForm(forms.Form):
|
||||
)
|
||||
|
||||
account_routings_scheme = forms.CharField(
|
||||
label=_('Account Number'),
|
||||
label=_('Account Routing Scheme'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': 'Account Number',
|
||||
@ -107,7 +96,7 @@ class CreateAccountForm(forms.Form):
|
||||
)
|
||||
|
||||
account_routings_address = forms.CharField(
|
||||
label=_('Address'),
|
||||
label=_('Account Routing Address'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': 'Address',
|
||||
@ -116,56 +105,7 @@ class CreateAccountForm(forms.Form):
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
account_attributes_product_code = forms.CharField(
|
||||
label=_('Account Attribute Product Code'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': '1234BW',
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
account_attributes_id = forms.CharField(
|
||||
label=_('Account Attribute Id'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': '613c83ea-80f9-4560-8404-b9cd4ec42a7f',
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
account_attributes_name = forms.CharField(
|
||||
label=_('Account Attribute Name'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': 'OVERDRAFT_START_DATE',
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
account_attributes_value = forms.CharField(
|
||||
label=_('Thursday'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': '2012-04-23',
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
account_attributes_instance_code = forms.CharField(
|
||||
label=_('Account Attribute Instance Code'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': 'LKJL98769F',
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs.setdefault('label_suffix', '')
|
||||
|
||||
@ -7,14 +7,6 @@
|
||||
<div class="alert alert-danger">{{ form.non_field_errors }}</div>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_id.errors %}
|
||||
<div class="alert alert-danger">{{ form.account_id.errors }}</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.account_id.label_tag }} {{ form.account_id }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.user_id.errors %}
|
||||
<div class="alert alert-danger">{{ form.user_id.errors }}</div>
|
||||
@ -31,8 +23,6 @@
|
||||
{{ form.label.label_tag }} {{ form.label }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.product_code.errors %}
|
||||
<div class="alert alert-danger">
|
||||
@ -43,6 +33,8 @@
|
||||
{{ form.product_code.label_tag }} {{ form.product_code }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.balance_currency.errors %}
|
||||
<div class="alert alert-danger">
|
||||
@ -63,16 +55,15 @@
|
||||
{{ form.balance_amount.label_tag }} {{ form.balance_amount }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.branch_id.errors %}
|
||||
<div class="alert alert-danger">{{ form.branch_id.errors }}</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.branch_id.label_tag }} {{ form.branch_id }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_routings_scheme.errors %}
|
||||
<div class="alert alert-danger">
|
||||
@ -91,36 +82,6 @@
|
||||
{{ form.account_routings_address.label_tag }} {{ form.account_routings_address }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_attributes_product_code.errors %}
|
||||
<div class="alert alert-danger">
|
||||
{{ form.account_attributes_product_code.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.account_attributes_product_code.label_tag }} {{ form.account_attributes_product_code }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_attributes_id.errors %}
|
||||
<div class="alert alert-danger">{{ form.account_attributes_id.errors }}</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.account_attributes_id.label_tag }} {{ form.account_attributes_id }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_attributes_name.errors %}
|
||||
<div class="alert alert-danger">{{ form.account_attributes_name.errors }}</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.account_attributes_name.label_tag }} {{ form.account_attributes_name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.bank_id.errors %}
|
||||
<div class="alert alert-danger">{{ form.bank_id.errors }}</div>
|
||||
@ -129,26 +90,6 @@
|
||||
{{ form.bank_id.label_tag }} {{ form.bank_id }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_attributes_value.errors %}
|
||||
<div class="alert alert-danger">
|
||||
{{ form.account_attributes_value.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.account_attributes_value.label_tag }} {{ form.account_attributes_value }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-4">
|
||||
{% if form.account_attributes_instance_code.errors %}
|
||||
<div class="alert alert-danger">
|
||||
{{ form.account_attributes_instance_code.errors }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
{{ form.account_attributes_instance_code.label_tag }} {{ form.account_attributes_instance_code }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 hidden-xs">
|
||||
|
||||
@ -42,11 +42,13 @@ class IndexAccountsView(LoginRequiredMixin, FormView):
|
||||
def form_valid(self, form):
|
||||
try:
|
||||
data = form.cleaned_data
|
||||
urlpath = '/banks/{}/accounts/{}'.format(data['bank_id'], data['account_id'])
|
||||
#urlpath = '/banks/{}/accounts/{}'.format(data['bank_id'], data['account_id'])
|
||||
urlpath = '/banks/{}/accounts'.format(data['bank_id'])
|
||||
payload ={
|
||||
"user_id": data["user_id"],
|
||||
"label": data["label"],
|
||||
"product_code": data["product_code"],
|
||||
"branch_id": data["branch_id"],
|
||||
"balance": {
|
||||
"currency": data["balance_currency"] if data["balance_currency"] is not None else "EUR",
|
||||
"amount": data["balance_amount"] if data["balance_amount"] is not None else 0
|
||||
@ -56,7 +58,7 @@ class IndexAccountsView(LoginRequiredMixin, FormView):
|
||||
"address": data["account_routings_address"] if data["account_routings_address"]!="" else "address"
|
||||
}],
|
||||
}
|
||||
result = self.api.put(urlpath, payload=payload)
|
||||
result = self.api.post(urlpath, payload=payload)
|
||||
except APIError as err:
|
||||
messages.error(self.request, "Unknown Error")
|
||||
return super(IndexAccountsView, self).form_invalid(form)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user