예제 #1
0
    def create(self, processor_key, name=None, make_callback_url=None):
        """Create a company and return

        """
        now = tables.now_func()
        company = tables.Company(
            guid='CP' + make_guid(),
            processor_key=processor_key,
            api_key=make_api_key(),
            callback_key=make_api_key(),
            name=name,
            created_at=now,
            updated_at=now,
        )
        self.session.add(company)
        self.session.flush()

        if make_callback_url is not None:
            url = make_callback_url(company)
            processor = self.factory.create_processor()
            processor.configure_api_key(company.processor_key)
            processor.register_callback(company, url)

        return company
예제 #2
0
    def create(self, processor_key, name=None):
        """Create a company and return

        """
        now = tables.now_func()
        company = tables.Company(
            guid='CP' + make_guid(),
            processor_key=processor_key,
            api_key=make_api_key(),
            name=name,
            created_at=now,
            updated_at=now,
        )
        self.session.add(company)
        self.session.flush()
        return company
예제 #3
0
파일: company.py 프로젝트: mjallday/billy
    def create(self, processor_key, name=None):
        """Create a company and return its id

        """
        now = tables.now_func()
        company = tables.Company(
            guid='CP' + make_guid(),
            processor_key=processor_key,
            api_key=make_api_key(),
            name=name, 
            created_at=now,
            updated_at=now,
        )
        self.session.add(company)
        self.session.flush()
        return company.guid
예제 #4
0
    def test_make_api_key(self):
        from billy.utils.generic import make_api_key

        # just make sure it is random
        api_keys = [make_api_key() for _ in range(1000)]
        self.assertEqual(len(set(api_keys)), 1000)
예제 #5
0
 def test_make_api_key(self):
     # just make sure it is random
     api_keys = [make_api_key() for _ in range(1000)]
     self.assertEqual(len(set(api_keys)), 1000)
예제 #6
0
 def test_make_api_key(self):
     # just make sure it is random
     api_keys = [make_api_key() for _ in range(1000)]
     self.assertEqual(len(set(api_keys)), 1000)
예제 #7
0
    def test_make_api_key(self):
        from billy.utils.generic import make_api_key

        # just make sure it is random
        api_keys = [make_api_key() for _ in range(1000)]
        self.assertEqual(len(set(api_keys)), 1000)