示例#1
0
 def test_UploadTestPassportLimitless(self):
   ah = accountHolder.AccountHolder(TEST_MARKETPLACE_MERCHANT, new=True, details='TestPerson', debug=DEBUG)
   doc = testData.misc.MP_TEST_PASSPORT_LIMITLESS
   ah.accountHolderDetails['individualDetails']['name']['lastName'] = 'TestData'
   ah.update() 
   ah.uploadDocument(doc)
   ah.dump()
示例#2
0
  def test_DefaultCreationThenForceLimitedPayout(self):
    ah = accountHolder.AccountHolder(TEST_MARKETPLACE_MERCHANT, new=True, details='TestPerson', debug=DEBUG)
    ah.forceLimitedPayout()

    states = ah.getStates()
    self.assertEqual(len(states), 2, 'Should be two states')
    for s in states:
      self.assertTrue(s in (accountHolder.LIMITED_PROCESSING, accountHolder.LIMITED_PAYOUT), 'Unexpected state %s' % s)
    def test_attemptToSendWhenZeroBalance(self):
        ''' Create two new accountHolders. Np payments. Perform a transfer from first to second '''
        merchantAccount = 'JohnDickMarketPlace'

        # Create accountHolder 1 (implicitly in LimitedProcessing)
        ah1 = accountHolder.AccountHolder(merchantAccount,
                                          new=True,
                                          debug=True)

        # Create accountHolder 2
        ah2 = accountHolder.AccountHolder(merchantAccount,
                                          new=True,
                                          debug=True)

        resp = ah1.accountHolderTransfer(ah2.defaultVirtualAccountCode,
                                         utils.testUtils.TEST_1_EUR_AMOUNT,
                                         'BALANCE_TRANSFER')

        utils.testUtils.jsonPrint(resp)
    def do(self):
        ah = accountHolder.AccountHolder(self.credentials, debug=self.debug)

        # Add required identity info
        ah.update({
            "address": testUtils.MP_TEST_ADDRESS,
            "phoneNumber": testUtils.MP_TEST_PHONE_NUMBER
        })

        # Force to limited payout
        ah.updateForceLimitedPayout()
        return ah
示例#5
0
  def test_DefaultCreation(self):
    """ Create a new accountHolder with default values in the marketplace, then read it to a new accountHolder via the code"""
    ah1 = accountHolder.AccountHolder(TEST_MARKETPLACE_MERCHANT, new=True, debug=True)
    self.assertIsInstance(ah1, accountHolder.AccountHolder, 'Unable to create new accountHolder object')    
 
    # Check the state
    self.assertEqual(ah1.accountHolderDetails['email'], testData.misc.MP_TEST_EMAIL, 'Default email is wrong')
    self.assertEqual(ah1.accountHolderDetails['individualDetails'], {"name": testData.misc.MP_TEST_NAME}, 'Default name iss wrong')
    self.assertEqual(ah1.merchantCategoryCode, accountHolder.DEFAULT_MERCHANT_CATEGORY_CODE, 'Default merchant category code is wrong')
    self.assertEqual(ah1.getConfig(), accountHolder.DEFAULT_STATE_CONFIG,'Default state configuration is wronng')

    # Read this accountHolder via the accountHoder code 
    ah2 = accountHolder.AccountHolder(TEST_MARKETPLACE_MERCHANT, code=ah1.accountHolderCode, debug=True)

    self.assertEqual(ah2.accountHolderCode, ah1.accountHolderCode, 'accountHolder codes do not match ')
    self.assertEqual(ah2.accountHolderDetails['email'], testData.misc.MP_TEST_EMAIL, 'Email addresses do not match')
    self.assertEqual(ah2.accountHolderDetails['individualDetails'], {"name": testData.misc.MP_TEST_NAME}, 'Individual details do not match')
    self.assertEqual(ah2.merchantCategoryCode, accountHolder.DEFAULT_MERCHANT_CATEGORY_CODE, 'Merchant category codes do not match')
    self.assertEqual(ah2.getConfig(), accountHolder.DEFAULT_STATE_CONFIG,'State configurations do not match')
    
    # Read this accountHolder via the virtual account Code
    ah3 = accountHolder.AccountHolder(TEST_MARKETPLACE_MERCHANT, virtualAccount=ah1.defaultVirtualAccountCode, debug=True)
    self.assertEqual(ah3.accountHolderCode, ah1.accountHolderCode, 'accountHolder codes do not match ')
    self.assertEqual(ah3.defaultVirtualAccountCode, ah1.defaultVirtualAccountCode, 'virtual account codes do not match ')
    self.assertEqual(ah3.accountHolderDetails['email'], testData.misc.MP_TEST_EMAIL, 'Email addresses do not match')
    self.assertEqual(ah3.accountHolderDetails['individualDetails'], {"name": testData.misc.MP_TEST_NAME}, 'Individual details do not match')
    self.assertEqual(ah3.merchantCategoryCode, accountHolder.DEFAULT_MERCHANT_CATEGORY_CODE, 'Merchant category codes do not match')
    self.assertEqual(ah3.getConfig(), accountHolder.DEFAULT_STATE_CONFIG,'State configurations do not match')

    # Trivial test of update() method (does not trigger KYC)
    ah3.accountHolderDetails['email'] = testData.misc.MP_TEST_EMAIL2
    ah3.update()
    self.assertEqual(ah3.accountHolderDetails['email'], testData.misc.MP_TEST_EMAIL2,'Check email update')
 
    # Check the default state
    s = ah3.getStates()
    self.assertEqual(len(s), 1, 'More than one state')
    self.assertEqual(s[0], accountHolder.LIMITED_PROCESSING, 'The state is not %s' % accountHolder.LIMITED_PROCESSING)
    self.assertEqual(ah3.accountStatus['status'], 'Active', 'The state is not Active')
    def do(self):
        ah = accountHolder.AccountHolder(self.credentials, debug=self.debug)
        doc = testUtils.MP_TEST_DOC_PASSPORT
        ah.update({
            "individualDetails": {
                "name": {
                    "firstName": "John",
                    "lastName": "TestData",
                    "gender": "MALE"
                }
            }
        })

        ah.uploadDocument(doc)
        return ah
    def do(self):
        ah = accountHolder.AccountHolder(self.credentials, debug=self.debug)

        # Use FRAUDCITY and secondname = Testdata
        ah.update({
            "individualDetails": {
                "name": {
                    "firstName": "TestData",
                    "lastName": "TestData",
                    "gender": "MALE"
                }
            },
            "address": testUtils.MP_FRAUD_ADDRESS,
            "phoneNumber": testUtils.MP_TEST_PHONE_NUMBER
        })
        return ah
示例#8
0
 def setUp(self):
   merchantAccount = 'JohnDickMarketPlace'
   ahCode = '1481325809'
   live = False
 
   self.ah = accountHolder.AccountHolder(merchantAccount, code=ahCode, live=live, debug=DEBUG)
示例#9
0
 def test_CreationFromKnownPersonDetails(self):
   ah = accountHolder.AccountHolder(TEST_MARKETPLACE_MERCHANT, new=True, details='TestPerson', debug=DEBUG)
   self.assertEqual(ah.accountHolderDetails['individualDetails'], {
     "name" : testData.misc.MP_TEST_NAME,
     "personalData" : testData.misc.MP_TEST_PERSONAL_DATA
     }, 'Individual details do not match')
示例#10
0
 Upload KYC and Bank to move to LimitedPayout => Deadline is removed, state is now LimitedPayout
 Receive ACCOUNT_HOLDER_STATUS_CHANGE notification
 Do more processing (but less than the LimitedProcessingLimit) => should work
'''

INITIAL_KYC_LIMIT = 10000  # $ 100

LIMITED_LIMIT = 500000  # $ 5000

import accountHolder, testUtils, time

psp_credentials = testUtils.TEST_CRED_PAYMENT
mp_credentials = testUtils.TEST_CRED_MP_JOHNDICK

print "Create a new, minimal accountHolder ..."
ah = accountHolder.AccountHolder(mp_credentials, debug=True)

print "Make a simple payment, less than the initial_kyc_needed limit"
ah.simpleSplitPayment(psp_credentials, ah.getDefaultVirtualAccount(), {
    'value': 100,
    'currency': 'EUR'
})

print "Check that accountHolder as now dumped has no deadline set, and that the transaction was approved:"
ah.dump()

print "Make a simple payment than now exceeds the initial_kyc_needed limit"
ah.simpleSplitPayment(psp_credentials, ah.getDefaultVirtualAccount(), {
    'value': INITIAL_KYC_LIMIT,
    'currency': 'EUR'
})