Browse Source

Added IBAN example

pull/7/head
Kenneth Bruen 3 years ago
parent
commit
4ecb5b426b
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 10
      server/foxbank_server/apis/accounts.py

10
server/foxbank_server/apis/accounts.py

@ -24,7 +24,7 @@ class MetaAccountTypesSchema(returns.SuccessSchema):
account_types = fields.List(fields.Str(), data_key='accountTypes') account_types = fields.List(fields.Str(), data_key='accountTypes')
class MetaValidateIbanParams(Schema): class MetaValidateIbanParams(Schema):
iban = fields.Str() iban = fields.Str(example='RO15RZBR0000060021338765')
class MetaValidateIbanSchema(returns.SuccessSchema): class MetaValidateIbanSchema(returns.SuccessSchema):
valid = fields.Bool() valid = fields.Bool()
@ -59,7 +59,7 @@ def get_validate_iban(iban: str):
return returns.success( return returns.success(
valid=valid, valid=valid,
formatted_iban=re.sub(r'(.{4})', r'\1 ', iban) if valid else None, formatted_iban=re.sub(r'(.{4})', r'\1 ', iban).strip() if valid else None,
bank_name=bank_name if valid else None, bank_name=bank_name if valid else None,
) )
@ -103,9 +103,9 @@ def get_account_iban(iban: str):
@bp.route('/') @bp.route('/')
class AccountsList(MethodView): class AccountsList(MethodView):
class CreateAccountParams(Schema): class CreateAccountParams(Schema):
currency = fields.String() currency = fields.String(example='RON')
account_type = fields.String(data_key='accountType') account_type = fields.String(data_key='accountType', example='Checking')
custom_name = fields.String(data_key='customName') custom_name = fields.String(data_key='customName', example='Daily Spending')
class CreateAccountResponseSchema(returns.SuccessSchema): class CreateAccountResponseSchema(returns.SuccessSchema):
account = fields.Nested(Account.AccountSchema) account = fields.Nested(Account.AccountSchema)

Loading…
Cancel
Save