Ejemplo n.º 1
0
 def __init__(self):
     self.LibVar = LibVar()
     self.env = self.LibVar.get_var('ENV')
     self.HOST = self.LibVar.get_var('MYGOGORO_GN_HOST')
     self.HOST = 'https://{}'.format(self.HOST)
     self.SESSION = requests.Session()
     self.SESSION.headers.update({'content-type': 'application/json'})
Ejemplo n.º 2
0
    def __init__(self, protocol='PROTOCOL', host='DATAPLATFORM_HOST',
                 port='DATAPLATFORM_PORT', basepath='GO_AUTH_BASEPATH',
                 client_header='GO_CLIENT_HEADER',
                 timeout='PLATFORM_API_TIMEOUT'):
        ''' usage:
                __dirname = os.path.dirname(os.path.abspath(__file__))
                sys.path.append(os.path.join(__dirname, '../../lib'))
                from _init_ import _init_
                self.init = _init_()

            Note:
                - default host is `DATAPLATFORM_HOST` and basepath is `/go-platform/v1`
                - if need to use other host, please follow below example:
                    `self.init = _init_('Other_URL', '/api/v1')`
        '''
        self.LibAppCipher = LibAppCipher()
        self.LibVar = LibVar()
        self.PROTOCOL = self.LibVar.get_var(protocol)
        self.PORT = self.LibVar.get_var(port)
        self._BASEPATH = self.LibVar.get_var(basepath)
        self.GO_CLIENT_HEADER = self.LibVar.get_var(client_header)
        self.TIMEOUT = self.LibVar.get_var(timeout)
        self.HOST = self.LibVar.get_var(host)
        self.HOST = '{}://{}:{}{}'.format(self.PROTOCOL,
                                          self.HOST, self.PORT, self._BASEPATH)
        self.SESSION = requests.Session()
        self.TOKEN = None
        self.SESSION.headers.update({
            'content-type': 'application/json',
            'Go-client': '{}'.format(self.GO_CLIENT_HEADER)
        })
Ejemplo n.º 3
0
    def __init__(self):
        self.init = LibBase()
        self.variable = LibVar()
        self._env = self.variable.get_var('ENV')

        if self._env != 'prod':
            self.init.sales_portal_cipher_get()
Ejemplo n.º 4
0
    def __init__(self,
                 protocol='https',
                 host='SALES_PORTAL_API_URL',
                 basepath='/api',
                 timeout='API_TIMEOUT'):
        self.variable = LibVar()
        self.HOST = self.variable.get_var(host)
        self.HOST = '{}://{}{}'.format(protocol, self.HOST, basepath)
        self.GO_CLIENT_HEADER = 'sales_portal'
        self.timeout = self.variable.get_var(timeout)
        self.SESSION = requests.Session()
        self.CIPHER_HOST = self.variable.get_var('CIPHER_HOST')
        self.PORT = self.variable.get_var('CIPHER_PORT')
        self.CIPHER_DEV = self.variable.get_var('CIPHER_DEV')
        self.CIPHER_APP = 'sales_portal'
        self.CIPHER_RESOURCE = 'sales_portal'
        self.CIPHER_ACCOUNT = self.variable.get_var('SALES_ACCOUNT')
        self.CIPHER_PASSWORD = self.variable.get_var('SALES_PASSWORD')

        self.SESSION.headers.update({
            'content-type':
            'application/json; charset=utf-8',
            'Go-client':
            '{}'.format(self.GO_CLIENT_HEADER)
        })
        self.token = None
 def __init__(self, user_type, password):
     if user_type == 'new_user':
         rf_string = String()  # RF Library
         self.time = int(time.time())
         self.company_code = 1300
         self.status = 1
         self.enable_e_carrier = 1
         self.country_code = 'TW'
         self.gender = 'M'
         self.gogoro_guid = str(uuid.uuid4())
         self.first_name = rf_string.generate_random_string(5, '[UPPER]')
         self.last_name = rf_string.generate_random_string(5, '[UPPER]')
         self.display_name = self.last_name + self.first_name
         self.email = 'pasw.verify-{}@yopmail.com'.format(self.time)
         self.mobile = '09' + rf_string.generate_random_string(
             8, '[NUMBERS]')
         self.profile_id = 'A1' + rf_string.generate_random_string(
             8, '[NUMBERS]')
         self.encode_password = password
         self.birthday = time.strftime("%Y-%m-%d")
         self.contact_city = '臺北市'
         self.contact_district = '松山區'
         self.contact_zipcode = '10552'
         self.contact_address = '長安東路二段225號C棟11樓'
         self.phone = self.mobile
         self.occupation = '1'
         self.invoice_city = '臺北市'
         self.invoice_district = '松山區'
         self.invoice_zipcode = '10552'
         self.invoice_address = '長安東路二段225號C棟11樓'
     else:
         self.variable = LibVar()
         self.encode_password = password
         self.email = self.variable.get_var('PAYMENT_GATEWAY_ACCOUNT')
         self.gogoro_guid = self.variable.get_var('PAYMENT_GATEWAY_GUID')
Ejemplo n.º 6
0
 def __init__(self):
     self.LibVar = LibVar()
     self.HOST = self.LibVar.get_var('BILLING_WEB_HOST')
     self.HOST = 'http://{}'.format(self.HOST)
     self.SESSION = requests.Session()
     self.SESSION.headers.update({
         'content-type': 'application/json'
     })
Ejemplo n.º 7
0
 def __init__(self):
     self.variable = LibVar()
     self.pg_url = self.variable.get_var('PAYMENT_GATEWAY_URL')
     self.bind_card_url = self.variable.get_var('EXTERNAL_BANK_URL')
     self.tspg_url = None
     self.scheduler_url = self.variable.get_var('BILLING_SCHEDULER_URL')
     self.timeout = self.variable.get_var('API_TIMEOUT')
     self.headers = {
         'Content-Type': 'application/json'
     }
Ejemplo n.º 8
0
 def __init__(self):
     self.LibVar = LibVar()
     self.CIPHER_HOST = self.LibVar.get_var('CIPHER_HOST')
     self.PORT = self.LibVar.get_var('CIPHER_PORT')
     self.CIPHER_DEV = self.LibVar.get_var('CIPHER_DEV')
     self.CIPHER_APP = self.LibVar.get_var('CIPHER_APP')
     self.CIPHER_RESOURCE = self.LibVar.get_var('CIPHER_RESOURCE')
     self.CIPHER_PASSWORD = self.LibVar.get_var('CIPHER_PASSWORD')
     self.CIPHER_ACCOUNT = self.LibVar.get_var('CIPHER_GEN_ACCOUNT')
     self.SESSION = requests.Session()
     self.SESSION.headers.update({'content-type': 'application/json'})
    def __init__(self):
        self.variable = LibVar()
        self.ACCOUNT = self.variable.get_var('SALES_ACCOUNT')
        self.PASSWORD = self.variable.get_var('SALES_PASSWORD')
        if self.variable.get_var('ENV') == 'dev':
            self.token = '.DevSalesAuth'
        elif self.variable.get_var('ENV') == 'swqa':
            self.token = '.DevSalesAuth'
        else:
            self.token = '.PaSalesAuth'

        self.SESSION = requests.Session()
        self.SESSION.headers.update({'content-type': 'application/json'})
Ejemplo n.º 10
0
 def __init__(self, host='BILLING_WEB_HOST', billing_account='BILLING_ADMIN_ACCOUNT', billing_password='******'):
     '''
         Note:
             - default host is `BILLING_WEB_HOST`
     '''
     self.BuiltIn = BuiltIn()
     self.LibAuth = LibAuth()
     self.LibVar = LibVar()
     self.HOST = self.LibVar.get_var(host)
     self.BILLING_ACCOUNT = self.LibVar.get_var(billing_account)
     self.BILLING_PASSWORD = self.LibVar.get_var(billing_password)
     self.SESSION = requests.Session()
     self.TOKEN = None
     self.SESSION.headers.update({
         'content-type': 'application/json'
     })
     self.HOST = 'http://{}'.format(self.HOST)
Ejemplo n.º 11
0
    def __init__(self, host='MYGOGORO_GN_HOST'):
        ''' usage:
                __dirname = os.path.dirname(os.path.abspath(__file__))
                sys.path.append(os.path.join(__dirname, '../../lib'))
                from _init_ import _init_
                self.init = _init_()

            Note:
                - default host is `MYGOGORO_GN_HOST`
        '''
        self.BuiltIn = BuiltIn()
        self.LibCSRF = LibCSRF()
        self.LibVar = LibVar()
        self.HOST = self.LibVar.get_var(host)
        self.SESSION = requests.Session()
        self.TOKEN = None
        self.SESSION.headers.update({
            'content-type': 'application/json'
        })
        self.HOST = 'https://{}'.format(self.HOST)
Ejemplo n.º 12
0
 def __init__(self):
     self.variable = LibVar()
     self.log_host = self.variable.get_var('LOG_SERVER_HOST')
     self.log_account = self.variable.get_var('LOG_SERVER_ACCOUNT')
     self.log_password = self.variable.get_var('LOG_SERVER_PASSWORD')
     self.calender = self.variable.get_var('PAYMENT_GATEWAY_CALENDER')
Ejemplo n.º 13
0
 def __init__(self, salt='SALT'):
     self.LibVar = LibVar()
     self.SALT = self.LibVar.get_var(salt)
 def __init__(self):
     self.variable = LibVar()
     self.schema_location = self.variable.get_var(
         'PAYMENT_GATEWAY_SCHEMA_PATH')
Ejemplo n.º 15
0
 def __init__(self):
     self.variable = LibVar()
     self.info_yaml = self.variable.get_var('PAYMENT_GATEWAY_LOCAL_STORAGE')
 def __init__(self):
     self.init = LibBase()
     self.env = LibVar().get_var('ENV')