def create(cls, request): if request.method != 'POST': return ContractController._build_error_response('Invalid HTTP method') body = request.body params = simplejson.loads(body) order = cls.order_manager.create_order(params) if not order: return ContractController._build_error_response('Missing parameters') return ContractController._build_ok_response('Order created!')
def create(cls, request): if request.method != 'POST': return ContractController._build_error_response('Invalid HTTP method') body = request.body params = simplejson.loads(body) billing_address = cls.customer_manager.store_billing_address(params) if not billing_address: return ContractController._build_error_response('Missing parameters') return ContractController._build_ok_response('Billing address updated!')
def list(cls, request): if request.method != 'GET': return ContractController._build_error_response('Invalid HTTP method') params = request.GET email = params.get('account', None) if not email: return ContractController._build_error_response('Missing account parameter') account = cls.customer_manager.get_account(email) if not account: return ContractController._build_error_response('Invalid account') billing_address = cls.customer_manager.get_billing_address(account) return ContractController._build_ok_with_data_response('Listing registered billing address', billing_address.to_dict())