def auth_activate(self,get): params = {} params['serial_no'] = get.serial_no params['environment_info'] = json.dumps(public.fetch_env_info()) data = self.send_cloud('{}/api/authorize/product/activate'.format(self.__official_url), params) if not data['success']: return public.returnMsg(False,'Activate Failed') session['focre_cloud'] = True return public.returnMsg(True,'Activate successfully')
def create_order(self, get): cycle = getattr(get, 'cycle', '1') params = {} params['cycle'] = cycle params['cycle'] = 'month' params['product_id'] = 100000012 params['src'] = 2 params['pay_channel'] = 2 params['charge_type'] = 1 params['environment_info'] = json.dumps(public.fetch_env_info()) data = self.send_cloud_pro('create', params) return data
def free_trial(self,get): """ 每个账号有一次免费试用专业版15天的机会 :return: """ params = {} params['environment_info'] = json.dumps(public.fetch_env_info()) data = self.send_cloud('{}/api/product/obtainProfessionalMemberFree'.format(self.__official_url), params) session['focre_cloud'] = True # 使用抵扣券续费直接返回续费结果 if not data['success']: return public.returnMsg(False, 'Apply Failed') return public.returnMsg(True,'Apply successfully')
def get_buy_code(self,get): cycle = getattr(get,'cycle',1) params = {} params['cycle'] = cycle params['cycle_unit'] = get.cycle_unit params['product_id'] = get.pid params['src'] = 2 params['pay_channel'] = 2 params['charge_type'] = get.charge_type env_info = public.fetch_env_info() params['environment_info'] = json.dumps(env_info) params['server_id'] = env_info['install_code'] data = self.send_cloud('{}/api/order/product/create'.format(self.__official_url), params) return data['res']
def create_order_voucher_plugin(self,get): cycle = getattr(get,'cycle','1') params = {} params['cycle'] = cycle params['cycle_unit'] = get.cycle_unit params['coupon_id'] = get.coupon_id params['src'] = 2 params['pay_channel'] = 10 params['charge_type'] = get.charge_type env_info = public.fetch_env_info() params['environment_info'] = json.dumps(env_info) params['server_id'] = env_info['install_code'] data = self.send_cloud('{}/api/order/product/create'.format(self.__official_url), params) session['focre_cloud'] = True if data['success']: return public.returnMsg(True,'Activate successfully') return public.returnMsg(False, 'Activate failed')
def renew_product_auth(self,get): params = {} params['serial_no'] = get.serial_no params['pay_channel'] = get.pay_channel params['cycle'] = get.cycle params['cycle_unit'] = get.cycle_unit params['src'] = 2 params['environment_info'] = json.dumps(public.fetch_env_info()) if hasattr(get,'coupon_id') and get.pay_channel == '10': params['coupon_id'] = get.coupon_id data = self.send_cloud('{}/api/authorize/product/renew'.format(self.__official_url), params) session['focre_cloud'] = True # 使用抵扣券续费直接返回续费结果 if get.pay_channel == '10': if not data['success']: return public.returnMsg(False, 'Renew Failed') return public.returnMsg(True,'Renew successfully') # 使用支付续费返回stripe的请求数据 return data['res']