Esempio n. 1
0
    def test_Users_CreateKycPage_CorrectFilePath(self) :
        user = self.getJohn()
        kycDocumentInit = KycDocument()
        kycDocumentInit.Status = KycDocumentStatus.CREATED
        kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
        kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)

        self.sdk.users.CreateKycPageFromFile(user.Id, kycDocument.Id, os.path.join(os.path.dirname(__file__), "TestKycPageFile.png"))
    def test_Users_CreateKycPage_CorrectFilePath(self) :
        user = self.getJohn()
        kycDocumentInit = KycDocument()
        kycDocumentInit.Status = KycDocumentStatus.CREATED
        kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
        kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)

        self.sdk.users.CreateKycPageFromFile(user.Id, kycDocument.Id, os.path.join(os.path.dirname(__file__), "TestKycPageFile.png"))
 def test_Users_CreateKycPage_WrongFilePath(self) :
     user = self.getJohn()
     kycDocumentInit = KycDocument()
     kycDocumentInit.Status = KycDocumentStatus.CREATED
     kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
     kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)
     
     try:
         self.sdk.users.CreateKycPageFromFile(user.Id, kycDocument.Id, 'notExistFileName.tmp')
     except Exception as exc:
         self.assertTrue(str(exc).find('File not exist') != -1)
 def test_Users_CreateKycPage_EmptyFilePath(self):
     user = self.getJohn()
     kycDocumentInit = KycDocument()
     kycDocumentInit.Status = KycDocumentStatus.CREATED
     kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
     kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)
     
     try:
         self.sdk.users.CreateKycPageFromFile(user.Id, kycDocument.Id, '')
     except Exception as exc:
         self.assertEqual(str(exc), 'Path of file cannot be empty')
Esempio n. 5
0
 def test_Users_CreateKycPage_CorrectFileString(self):
     user = self.getJohn()
     kycDocumentInit = KycDocument()
     kycDocumentInit.Status = KycDocumentStatus.CREATED
     kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
     kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)
     kycPage = KycPage()
     kycPage.File = 'dGVzdCB0ZXN0IHRlc3QgdGVzdA=='
     
     kycPageResponse = self.sdk.users.CreateUserKycPage(kycPage, user.Id, kycDocument.Id)
     self.assertEqual(kycPageResponse, None)
Esempio n. 6
0
 def test_Users_CreateKycPage_WrongFilePath(self) :
     user = self.getJohn()
     kycDocumentInit = KycDocument()
     kycDocumentInit.Status = KycDocumentStatus.CREATED
     kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
     kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)
     
     try:
         self.sdk.users.CreateKycPageFromFile(user.Id, kycDocument.Id, 'notExistFileName.tmp')
     except Exception as exc:
         self.assertEqual(str(exc), 'File not exist: notExistFileName.tmp')
Esempio n. 7
0
 def test_Users_CreateKycPage_EmptyFilePath(self):
     user = self.getJohn()
     kycDocumentInit = KycDocument()
     kycDocumentInit.Status = KycDocumentStatus.CREATED
     kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
     kycDocument = self.sdk.users.CreateUserKycDocument(kycDocumentInit, user.Id)
     
     try:
         self.sdk.users.CreateKycPageFromFile(user.Id, kycDocument.Id, '')
     except Exception as exc:
         self.assertEqual(str(exc), 'Path of file cannot be empty')
Esempio n. 8
0
 def ask_for_validation(self):
     if self.status == CREATED:
         document = KycDocument()
         document.Id = self.mangopay_id
         document.Status = "VALIDATION_ASKED"
         client = get_mangopay_api_client()
         updated_document = client.users.UpdateUserKycDocument(
             document, self.mangopay_user.mangopay_id, self.mangopay_id)
         self.status = STATUS_CHOICES_DICT[updated_document.Status]
         self.save()
     else:
         raise BaseException('Cannot ask for validation of a document'
                             'not in the created state')
Esempio n. 9
0
 def ask_for_validation(self):
     if self.status == CREATED:
         document = KycDocument()
         document.Id = self.mangopay_id
         document.Status = "VALIDATION_ASKED"
         client = get_mangopay_api_client()
         updated_document = client.users.UpdateUserKycDocument(
             document, self.mangopay_user.mangopay_id, self.mangopay_id)
         self.status = STATUS_CHOICES_DICT[updated_document.Status]
         self.save()
     else:
         raise BaseException('Cannot ask for validation of a document'
                             'not in the created state')
Esempio n. 10
0
    def test_Users_CreateKycPage_CorrectFileString(self):
        user = self.getJohn()
        kycDocumentInit = KycDocument()
        kycDocumentInit.Status = KycDocumentStatus.CREATED
        kycDocumentInit.Type = KycDocumentType.IDENTITY_PROOF
        kycDocument = self.sdk.users.CreateUserKycDocument(
            kycDocumentInit, user.Id)
        kycPage = KycPage()
        kycPage.File = 'dGVzdCB0ZXN0IHRlc3QgdGVzdA=='

        kycPageResponse = self.sdk.users.CreateUserKycPage(
            kycPage, user.Id, kycDocument.Id)
        self.assertEqual(kycPageResponse, None)
Esempio n. 11
0
 def GetUserKycDocument(self, document_id, user_id):
     document = KycDocument()
     document.Id = document_id
     document.Status = "VALIDATED"
     return document
Esempio n. 12
0
 def GetUserKycDocument(self, document_id, user_id):
     document = KycDocument()
     document.Id = document_id
     document.Status = "VALIDATED"
     return document