Rename key name from 'reason' to 'registration_decline_reason'

Currently whenever Foundation admins decline a vendor registration
request.  A key/value pair will be added to the vendor properties field
with the key name as 'reason'.  Since the key/value data will be shown
as-is in the response from the 'v1/vendors/{vendor_id} API call. This
patch renames the key name to a more descriptive one.

Change-Id: I6a43f7671a61a05bb2f0186dc52031eb6760eb59
This commit is contained in:
Catherine Diep 2016-11-16 14:33:02 -08:00
parent 0d494be2f9
commit 717c7b036a
3 changed files with 10 additions and 8 deletions

View File

@ -33,9 +33,9 @@
</div>
<div class="row">
<div ng-if="ctrl.vendorProperties.reason">
<div ng-if="ctrl.vendorProperties.registration_decline_reason">
<hr />
<strong>Decline reason:</strong> {{ctrl.vendorProperties.reason}}<br />
<strong>Registration decline reason:</strong> {{ctrl.vendorProperties.registration_decline_reason}}<br />
</div>
</div>

View File

@ -112,7 +112,8 @@
confirmModal('Please input decline reason', function(reason) {
var url = [refstackApiUrl, '/vendors/', ctrl.vendorId,
'/action'].join('');
$http.post(url, {deny: null, reason: reason}).success(
var content = {deny: null, registration_decline_reason: reason};
$http.post(url, content).success(
function() {
ctrl.getVendor();
}).error(function(error) {

View File

@ -224,7 +224,7 @@ class VendorsController(validation.BaseRestControllerWithValidation):
elif 'cancel' in params:
self.cancel(vendor)
else:
self.deny(vendor, kw.get('reason'))
self.deny(vendor, kw.get('registration_decline_reason'))
def register(self, vendor):
"""Handler for applying for registration with Foundation."""
@ -290,14 +290,15 @@ class VendorsController(validation.BaseRestControllerWithValidation):
_check_is_not_foundation(vendor['id'])
if not reason:
raise api_exc.ValidationError('Param "reason" can not be empty')
raise api_exc.ValidationError(
'The decline reason can not be empty')
if vendor['type'] != const.PENDING_VENDOR:
raise api_exc.ValidationError(
'Invalid organization state for this action.')
props = vendor.get('properties')
props = json.loads(props) if props else {}
props['reason'] = reason
props['registration_decline_reason'] = reason
# change vendor type back to private
org_info = {