def _make_initial_disbursement(self,
                                   initial_disbursement=None,
                                   auto_resolve=None):
        from server.utils.credit_transfer import make_payment_transfer

        if not initial_disbursement:
            # if initial_disbursement is still none, then we don't want to create a transfer.
            return None

        user_id = get_authorising_user_id()
        if user_id is not None:
            sender = User.query.execution_options(show_all=True).get(user_id)
        else:
            sender = self.primary_user

        disbursement = make_payment_transfer(
            initial_disbursement,
            token=self.token,
            send_user=sender,
            receive_user=self.primary_user,
            transfer_subtype=TransferSubTypeEnum.DISBURSEMENT,
            transfer_mode=TransferModeEnum.WEB,
            is_ghost_transfer=False,
            require_sender_approved=False,
            require_recipient_approved=False,
            automatically_resolve_complete=auto_resolve)
        disbursement.is_initial_disbursement = True
        return disbursement
    def _make_initial_disbursement(self,
                                   initial_disbursement,
                                   auto_resolve=False):
        from server.utils.credit_transfer import make_payment_transfer

        active_org = getattr(g, 'active_organisation',
                             Organisation.master_organisation())
        initial_disbursement = initial_disbursement or active_org.default_disbursement
        if not initial_disbursement:
            return None

        user_id = get_authorising_user_id()
        if user_id is not None:
            sender = User.query.execution_options(show_all=True).get(user_id)
        else:
            sender = self.primary_user

        disbursement = make_payment_transfer(
            initial_disbursement,
            token=self.token,
            send_user=sender,
            receive_user=self.primary_user,
            transfer_subtype=TransferSubTypeEnum.DISBURSEMENT,
            is_ghost_transfer=False,
            require_sender_approved=False,
            require_recipient_approved=False,
            automatically_resolve_complete=auto_resolve)

        return disbursement