예제 #1
0
    def add_customer_card(self, request):
        _message = None
        _status = self.interruption
        _data_card = None
        _data = None
        try:
            _entity = customerCardEntity()
            _entity.requestToClass(request)
            _model = customerModel()
            _chargeModel = chargeModel()
            _data = _chargeModel.add_card_culqi(_entity.cvv,
                                                _entity.cardNumberNotEncrypted,
                                                _entity.expYearNotEncripted,
                                                _entity.expMonthNotEcrypted,
                                                _entity.email)

            if _data["object"] == "error":
                _status = self.interruption
                _message = _data["user_message"]
            else:
                _data_card = _model.add_customer_card(_entity)
                _status = self.OK
                _message = self.messageOK
        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _data_card).toJSON()
예제 #2
0
    def recover_password_customer(self, request):
        _message = None
        _status = self.interruption
        _entity = None
        _email = None
        try:
            _model = customerModel()
            _entity = customerEntity()
            _entity.requestToEmail(request)
            _entity = _model.get_password_by_id(_entity.mail)
            if _entity is None:
                _status = self.failUser
                _message = self.userDontExist
            else:
                _modelLogin = notificationModel()
                _modelLogin.sen_sms_message(_entity.password,
                                            _entity.cellphone)
                _status = self.OK
                _message = self.smsSuccess + str(_entity.cellphone)

        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, None).toJSON()
예제 #3
0
    def add_customer(self, request):
        _message = None
        _status = self.interruption
        _entity = None
        try:
            _entity = customerEntity()
            _model = customerModel()
            _entity.requestToClass(request)

            if _model.validate_mail(_entity.mail):
                _status = self.interruption
                _message = self.duplicatedMail
            else:
                if _entity.referred_code == "" or _entity.referred_code is None:
                    _entity = _model.add_customer(_entity)
                    _status = self.OK
                    _message = self.addCustomer
                else:
                    _id_customer_main = _model.validate_referred_code(
                        _entity.referred_code)
                    if _id_customer_main is not None:
                        _entity = _model.add_customer(_entity)
                        _model.add_customer_coupon(_entity.id,
                                                   _id_customer_main)
                        _status = self.OK
                        _message = self.addCustomerAndCode
                    else:
                        _status = self.interruption
                        _message = self.invalidCoupon

        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _entity).toJSON()
예제 #4
0
    def login_user(self, request):
        _message = None
        _status = self.interruption
        _userEntity = None
        try:
            _loginModel = loginModel()
            _loginEntity = loginEntity()
            _loginEntity.requestToClass(request)
            _userEntity = _loginModel.login_user(_loginEntity)
            if _userEntity is None:
                _status = self.failUser
                _message = self.messageFailUser
            else:
                _user_status = _userEntity.status
                if _user_status == self.status_user_to_be_confirmed:
                    _status = self.failUser
                    _message = self.messageUserToBeConfirmed
                    _userEntity = None

                if _user_status == self.status_user_refused:
                    _status = self.failUser
                    _message = self.messageUserToBeConfirmed
                    _userEntity = None

                if _user_status == self.status_user_confirmed:
                    _status = self.OK
                    _message = self.messageOK

        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _userEntity).toJSON()
예제 #5
0
    def add_sale_2(self, request):
        _message = None
        _status = self.interruption
        _entity = None
        try:
            _entity = saleEntity()
            _model = saleModel()
            _chargeModel = chargeModel()
            _entity.requestToClass(request)
            _data = _chargeModel.charge_culqi("cvv", _entity.document_number,
                                              _entity.expiration_year,
                                              _entity.expiration_month,
                                              _entity.mail,
                                              _entity.total_amount,
                                              "Venta Appunto")
            if _data["object"] == "error":
                _status = self.interruption
                _message = _data["user_message"]
            else:
                _entity = _model.add_sale_reserve(_entity)
                _status = self.OK
                _message = self.saleSuccess

        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _entity).toJSON()
예제 #6
0
    def refuse_sale(self, index):
        _message = None
        _status = self.interruption
        _id_sale = None
        _id_fire_base_token = None
        try:
            _model = saleModel()
            _customerModel = customerModel()
            _notificationModel = notificationModel()
            _id_sale = _model.update_status_sale(index,
                                                 self.status_sale_refuse)
            _id_customer = _model.get_id_customer_by_id_sale(index)
            _id_fire_base_token = _customerModel.get_id_fire_base_token_by_id_customer(
                _id_customer)

            if _id_fire_base_token is not None:
                _response = _notificationModel.send_push_message(
                    _id_fire_base_token, self.push_message_refuse_sale)
            print(_response)
            if _response is None:
                _status = self.OK
                _message = self.pushSuccess
            else:
                _status = self.OK
                _message = self.pushNotSuccess
        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _id_sale).toJSON()
예제 #7
0
    def add_sale_reserve(self, request):
        _message = None
        _status = self.interruption
        _entity = None
        _response = None
        _id_fire_base_token = None
        try:
            _entity = saleEntity()
            _model = saleModel()
            _userModel = userModel()
            _notificationModel = notificationModel()
            _chargeModel = chargeModel()
            _entity.requestToClass(request)
            _entity = _model.add_sale_reserve(_entity)
            _id_fire_base_token = _userModel.get_id_fire_base_token_by_id_user(
                _entity.id_user)
            if _id_fire_base_token is not None:
                _response = _notificationModel.send_push_message(
                    _id_fire_base_token, self.push_message_user)
            if _response is None:
                _status = self.OK
                _message = self.saleSuccess
            else:
                _status = self.OK
                _message = self.saleSuccessNotPush

        except (Exception) as e:
            _status = self.interruption
            _message = self.messageInterruption + str(e)
            print('error: ' + str(e))
        return responseEntity(_status, _message, _entity).toJSON()
예제 #8
0
 def delete_user_bank_account(self, index):
     _message = None
     _status = self.interruption
     id_customer_address = None
     try:
         _model = userModel()
         id_customer_address = _model.delete_user_bank_account(index)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, id_customer_address).toJSON()
예제 #9
0
 def get_sale_by_id_user(self, index):
     _message = None
     _status = self.interruption
     _entity = None
     try:
         _model = saleModel()
         _entity = _model.get_sale_by_id_user(index)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _entity).toJSON()
예제 #10
0
 def get_user_bank_account_by_id_user(self, index):
     _message = None
     _status = self.interruption
     _data = None
     try:
         _model = userModel()
         _data = _model.get_user_bank_account_by_id_user(index)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #11
0
 def get_user_detail(self, index, id_customer):
     _message = None
     _status = None
     _data = None
     try:
         _model = userModel()
         _data = _model.get_user_detail(index, id_customer)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
 def get_user_date_availability_by_user(self, index):
     _message = None
     _status = None
     _data = None
     try:
         _model = userDateAvailabilityModel()
         _data = _model.get_user_date_availability_by_user(index)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #13
0
 def delete_user_store(self,index):
     _message = None
     _status = self.interruption
     _id= None
     try:
         _model = userStoreModel()
         _id = _model.delete_user_store(index)
         _status = self.OK
         _message = self.messageOK
     except(Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption +str(e)
         print('error: '+ str(e))
     return responseEntity(_status,_message,_id).toJSON()
예제 #14
0
 def update_file_image(self,id_Service,file_image):
     _message = None
     _status = None
     _data= None
     try:
         _model = serviceModel()
         _data = _model.update_file_image(id_Service,file_image)
         _status = self.OK
         _message = self.messageOK
     except(Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: '+ str(e))
     return responseEntity(_status,_message,_data).toJSON()
예제 #15
0
 def get_user_stores_by_id_user(self,index):
     _message = None
     _status = responseController().interruption
     _data= None
     try:
         _userStoreModel = userStoreModel()
         _data = _userStoreModel.get_user_stores_by_id_user(index)
         _status = responseController().OK
         _message = responseController().messageOK
     except(Exception) as e:
         _status = responseController().interruption
         _message = responseController().messageInterruption + str(e)
         print('error: '+ str(e))
     return responseEntity(_status,_message,_data).toJSON()
예제 #16
0
 def get_users(self):
     _message = None
     _status = self.interruption
     _data = None
     try:
         _userModel = userModel()
         _data = _userModel.get_users()
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #17
0
 def update_customer_user_favorite(self, request):
     _message = None
     _status = self.interruption
     try:
         _entity = customerUserFavoriteEntity()
         _entity.requestToClass(request)
         _model = customerModel()
         _entity = _model.update_customer_user_favorite(_entity)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _entity).toJSON()
예제 #18
0
 def get_load(self, index):
     _message = None
     _status = None
     _data = None
     try:
         _model = loginModel()
         _id_customer = index
         _data = _model.get_load(_id_customer)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #19
0
 def cancel_sale(self, index):
     _message = None
     _status = self.interruption
     _id_sale = None
     try:
         _model = saleModel()
         _id_sale = _model.update_status_sale(index,
                                              self.status_sale_cancel)
         _status = self.OK
         _message = self.saleCanceled
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _id_sale).toJSON()
예제 #20
0
 def get_sub_services_by_id_service_and_id_user(self,request):
     _message = None
     _status = None
     _data= None
     try:
         _serviceModel = serviceModel()
         _entity = serviceUserEntity()
         _entity.requestToClass(request)
         _data = _serviceModel.get_sub_services_by_id_service_and_id_user(_entity.id_service,_entity.id_user)
         _status = self.OK
         _message = self.messageOK
     except(Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: '+ str(e))
     return responseEntity(_status,_message,_data).toJSON()
예제 #21
0
 def update_user(self, request):
     _message = ''
     _status = self.interruption
     _userEntity = None
     try:
         _userEntity = userEntity()
         _userModel = userModel()
         _userEntity.requestUpdateToClass(request)
         _id = _userModel.update_user(_userEntity)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _id).toJSON()
예제 #22
0
 def add_user_store(self,request):
     _message = None
     _status = self.interruption
     _entity= None
     try:
         _entity = userStoreEntity()
         _model = userStoreModel()
         _entity.requestToClass(request)
         _entity = _model.add_user_store(_entity)
         _status = self.OK
         _message = self.messageOK
     except(Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption +str(e)
         print('error: '+ str(e))
     return responseEntity(_status,_message,_entity).toJSON()
예제 #23
0
 def add_user_bank_account(self, request):
     _message = None
     _status = self.interruption
     _data = None
     try:
         _entity = userBankEntity()
         _entity.requestToClass(request)
         _model = userModel()
         _data = _model.add_user_bank_account(_entity)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #24
0
 def update_customer_address(self, request):
     _message = None
     _status = self.interruption
     _data = None
     try:
         _entity = customerAddressEntity()
         _entity.requestToClassUpdate(request)
         _model = customerModel()
         _data = _model.update_customer_address(_entity)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #25
0
 def add_customer_rate(self, request):
     _message = None
     _status = responseController().interruption
     _entity = None
     try:
         _entity = customerRateEntity()
         _model = customerModel()
         _entity.requestToClass(request)
         _entity = _model.add_customer_rate(_entity)
         _status = responseController().OK
         _message = responseController().messageOK
     except (Exception) as e:
         _status = responseController().interruption
         _message = responseController().messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _entity).toJSON()
예제 #26
0
 def delete_user(self, index):
     _message = None
     _status = self.interruption
     _userEntity = None
     try:
         _userModel = userModel()
         _userEntity = userEntity()
         _id = _userModel.delete_user(index)
         _userEntity.id = _id
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _userEntity).toJSON()
예제 #27
0
 def get_users_by_type_sub_services(self, request):
     _message = None
     _status = self.interruption
     _data = None
     _type_user = None
     try:
         _userModel = userModel()
         _entity = userSubServiceFilterEntity()
         _entity.requestToClass(request)
         _data = _userModel.get_users_by_type_sub_services(_entity)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
 def update_user_date_availability(self, request):
     _message = None
     _status = None
     _data = None
     _entity = None
     try:
         _model = userDateAvailabilityModel()
         _entity = lstDateAvailabilityEntity()
         _entity.requestToClass(request)
         _data = _model.update_user_date_availability(_entity)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _status).toJSON()
예제 #29
0
 def update_user_service(self, request):
     _message = ''
     _status = self.interruption
     _entity = None
     _data = []
     try:
         _entity = lstuserServiceAddEntity()
         _userModel = userModel()
         _entity.requestToClass(request)
         _data = _userModel.update_user_service(_entity.user_services)
         _status = self.OK
         _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()
예제 #30
0
 def get_user_by_id_service(self, index):
     _message = None
     _status = self.interruption
     _data = None
     try:
         _model = userModel()
         _data = _model.get_user_by_id_service(index)
         if _data is None or len(_data) < 1:
             _status = self.OK
             _message = self.dontExistValues
         else:
             _status = self.OK
             _message = self.messageOK
     except (Exception) as e:
         _status = self.interruption
         _message = self.messageInterruption + str(e)
         print('error: ' + str(e))
     return responseEntity(_status, _message, _data).toJSON()