Merge pull request #1106 from coreos-inc/billingemail
Add support for custom billing invoice email address
This commit is contained in:
commit
f748d4348d
12 changed files with 94 additions and 23 deletions
|
@ -109,6 +109,7 @@ def user_view(user):
|
|||
'email': user.email,
|
||||
'logins': [login_view(login) for login in logins],
|
||||
'invoice_email': user.invoice_email,
|
||||
'invoice_email_address': user.invoice_email_address,
|
||||
'preferred_namespace': not (user.stripe_id is None),
|
||||
'tag_expiration': user.removed_tag_expiration_s,
|
||||
})
|
||||
|
@ -195,6 +196,10 @@ class User(ApiResource):
|
|||
'type': 'string',
|
||||
'description': 'The user\'s username',
|
||||
},
|
||||
'invoice_email_address': {
|
||||
'type': 'string',
|
||||
'description': 'Custom email address for receiving invoices',
|
||||
}
|
||||
},
|
||||
},
|
||||
'UserView': {
|
||||
|
@ -283,12 +288,16 @@ class User(ApiResource):
|
|||
|
||||
if 'invoice_email' in user_data:
|
||||
logger.debug('Changing invoice_email for user: %s', user.username)
|
||||
model.user.change_invoice_email(user, user_data['invoice_email'])
|
||||
model.user.change_send_invoice_email(user, user_data['invoice_email'])
|
||||
|
||||
if 'tag_expiration' in user_data:
|
||||
logger.debug('Changing user tag expiration to: %ss', user_data['tag_expiration'])
|
||||
model.user.change_user_tag_expiration(user, user_data['tag_expiration'])
|
||||
|
||||
if ('invoice_email_address' in user_data and
|
||||
user_data['invoice_email_address'] != user.invoice_email_address):
|
||||
model.user.change_invoice_email_address(user, user_data['invoice_email_address'])
|
||||
|
||||
if 'email' in user_data and user_data['email'] != user.email:
|
||||
new_email = user_data['email']
|
||||
if model.user.find_user_by_email(new_email):
|
||||
|
|
Reference in a new issue