def setUp(self):
        account_id = 'some-connect-id'
        self.check = StripePayoutAccount(owner=BlueBottleUserFactory.create(),
                                         country='NL',
                                         account_id=account_id)

        self.connect_account = stripe.Account(account_id)
        self.connect_account.update({
            'country':
            self.check.country,
            'individual':
            munch.munchify({
                'first_name':
                'Jhon',
                'last_name':
                'Example',
                'email':
                '*****@*****.**',
                'verification': {
                    'status': 'verified',
                },
                'requirements':
                munch.munchify({
                    'eventually_due': [
                        'external_accounts',
                        'individual.verification.document',
                        'document_type',
                    ]
                }),
            }),
            'requirements':
            munch.munchify({
                'eventually_due': [
                    'external_accounts',
                    'individual.verification.document.front',
                    'document_type',
                ],
                'disabled':
                False
            }),
            'external_accounts':
            munch.munchify({
                'total_count': 0,
                'data': []
            })
        })

        self.country_spec = stripe.CountrySpec(self.check.country)
        self.country_spec.update({
            'verification_fields':
            munch.munchify({
                'individual':
                munch.munchify({
                    'additional': ['individual.verification.document'],
                    'minimum': ['individual.first_name'],
                })
            })
        })
        super(ConnectAccountTestCase, self).setUp()
    def setUp(self):
        account_id = 'some-connect-id'
        external_account_id = 'some-bank-token'
        country = 'NL'

        self.connect_account = stripe.Account(account_id)

        self.connect_account.update({
            'country':
            country,
            'individual':
            munch.munchify({
                'first_name': 'Jhon',
                'last_name': 'Example',
                'email': '*****@*****.**',
            }),
            'requirements':
            munch.munchify({
                'eventually_due': ['external_accounts'],
                'disabled': False
            }),
            'external_accounts':
            stripe.ListObject([])
        })

        with mock.patch('stripe.Account.retrieve',
                        return_value=self.connect_account):
            self.check = StripePayoutAccount(
                owner=BlueBottleUserFactory.create(),
                country=country,
                account_id=account_id)
            self.check.save()

        self.external_account = ExternalAccount(connect_account=self.check,
                                                account_id=external_account_id)

        self.connect_external_account = stripe.BankAccount(external_account_id)

        self.connect_external_account.update({
            'object': 'bank_account',
            'account_holder_name': 'Jane Austen',
            'account_holder_type': 'individual',
            'bank_name': 'STRIPE TEST BANK',
            'country': 'US',
            'currency': 'usd',
            'fingerprint': '1JWtPxqbdX5Gamtc',
            'last4': '6789',
            'metadata': {
                'order_id': '6735'
            },
            'routing_number': '110000000',
            'status': 'new',
            'account': 'acct_1032D82eZvKYlo2C'
        })

        super(StripeExternalAccountTestCase, self).setUp()
Example #3
0
    def setUp(self):
        account_id = 'some-connect-id'
        self.user = BlueBottleUserFactory.create()
        self.account = StripePayoutAccount(owner=self.user,
                                           country='NL',
                                           account_id=account_id)
        self.stripe_account = stripe.Account(account_id)
        self.stripe_account.update({
            'country':
            'NL',
            'individual':
            munch.munchify({
                'first_name':
                'Jhon',
                'last_name':
                'Example',
                'email':
                '*****@*****.**',
                'verification': {
                    'status': 'verified',
                },
                'requirements':
                munch.munchify({
                    'eventually_due': [
                        'external_accounts',
                        'individual.verification.document',
                        'document_type',
                    ]
                }),
            }),
            'requirements':
            munch.munchify({
                'eventually_due': [
                    'external_accounts',
                    'individual.verification.document.front',
                    'document_type',
                ],
                'disabled':
                False
            }),
            'external_accounts':
            munch.munchify({
                'total_count': 0,
                'data': []
            })
        })
        with patch('stripe.Account.retrieve',
                   return_value=self.stripe_account):
            self.account.save()

        self.bank_account = ExternalAccountFactory.create(
            connect_account=self.account)
    def setUp(self):
        super(StripeConnectWebhookTestCase, self).setUp()
        self.user = BlueBottleUserFactory.create()

        self.connect_account = stripe.Account('some-account-id')

        external_account = stripe.BankAccount('some-bank-token')
        external_account.update(munch.munchify({
            'object': 'bank_account',
            'account_holder_name': 'Jane Austen',
            'account_holder_type': 'individual',
            'bank_name': 'STRIPE TEST BANK',
            'country': 'US',
            'currency': 'usd',
            'fingerprint': '1JWtPxqbdX5Gamtc',
            'last4': '6789',
            'metadata': {
                'order_id': '6735'
            },
            'routing_number': '110000000',
            'status': 'new',
            'account': 'acct_1032D82eZvKYlo2C'
        }))

        external_accounts = stripe.ListObject()
        external_accounts.data = [external_account]
        external_accounts.update({
            'total_count': 1,
        })

        self.connect_account.update(munch.munchify({
            'country': 'NL',
            'requirements': {
                'disabled': False,
                'eventually_due': [],
                'currently_due': [],
                'past_due': [],
                'pending_verification': [],
                'disabled_reason': ''
            },
            'individual': {
                'verification': {
                    'status': 'verified',
                    'document': {
                        "back": None,
                        "details": None,
                        "details_code": None,
                        "front": "file_12345"
                    }
                },
                'requirements': {
                    'eventually_due': [],
                    'currently_due': [],
                    'past_due': [],
                    'pending_verification': [],
                },
            },
            'external_accounts': external_accounts
        }))

        with mock.patch('stripe.Account.create', return_value=self.connect_account):
            self.payout_account = StripePayoutAccountFactory.create(owner=self.user)

        external_account = ExternalAccountFactory.create(connect_account=self.payout_account)

        self.funding = FundingFactory.create(bank_account=external_account)
        self.funding.initiative.states.submit(save=True)
        BudgetLineFactory.create(activity=self.funding)
        self.webhook = reverse('stripe-connect-webhook')