#Ferb

1 messages ยท Page 1 of 1 (latest)

rose mistBOT
jade patio
#

Hi there!

#

Have you tried creating a payout in test mode? What's it status?

oak jewel
#

paid

#

the inital response from creating the payout states it is in_transit, however if I payout.list() the payout is paid

#

?

jade patio
#

Sorry for the delay. Having a look now.

#

So I managed to reproduce: the payout is first in_transit and then immediately moves to paid in test mode. You would like the payout to stay in_transit longer? Why?

oak jewel
#

Because, I want to get the available balance for a client, which i have setup like this in my code

    def get_available_balances(self, account_id: str):
        """
        Getting the available balances from the account per currency. This is the amount that can be transferred to the
        bank account associated with the stripe account is calculated by subtracting the amount of any payouts in
        transit.
        """
        account_balances = self.stripe.Balance.retrieve(stripe_account=account_id) or {'available': {}}
        currency_balances = {}
        # Iterate over the available balances
        for bal in account_balances['available']:
            currency = bal['currency']
            balance = bal['amount']
            payout_amount = 0
            get_payout = self.stripe.Payout.list(stripe_account=account_id, status='in_transit')
            for payout in get_payout['data']:
                if payout['currency'] == currency:
                    if payout['status'] in ['in_transit', 'pending']:
                        payout_amount += payout['amount']

            true_balance = balance - payout_amount

            if true_balance != 0:
                currency_balances[currency] = true_balance

            tc_logger.info('In Transit amount for payouts on account %s: %s', account_id, payout_amount)

        tc_logger.info('Available balances for account %s: %s', account_id, currency_balances)

        return currency_balances

this works,

however I would like to create a test which has a payout with payout status to ensure it works

jade patio
#

If you managed to create a payout and it has a paid status, it means that it did work, no?

oak jewel
#

in my unit test, I want the status of the payout to remain pending or in_transit, so that it is caught (and not included) in my get available balances

jade patio
#

Having a look to see if it's possible.

oak jewel
#

thanks ๐Ÿ‘

lavish tundra
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

oak jewel
#

๐Ÿ˜ฆ

#

could i make a feature request for it ?

lavish tundra
#

sure you can contact https://support.stripe.com/?contact=true they will relay the feedback to the internal team and keep you posted if/when we might do it