Call this in a @state_create-decorated method.
    Identifies the account that must be debited.
171103
def state_preorder_put_account_payment_info( nameop, account_addr, token_type, amount ):
    
    assert amount is None or isinstance(amount, (int,long)), 'Amount is {} (type {})'.format(amount, type(amount))
    assert account_addr is None or isinstance(account_addr, (str,unicode))
    assert token_type is None or isinstance(token_type, (str,unicode))
    nameop['__account_payment_info__'] = {
            'address': str(account_addr) if account_addr is not None else None,
            'type': str(token_type) if token_type is not None else None,
            'amount': int(amount) if amount is not None else None
    }
552907
def Verify(self, mempool):
        

        for descriptor in self.Descriptors:
            if not descriptor.Verify():
                return False

        return super(StateTransaction, self).Verify(mempool)
355904
def account(self):
        
        resp = self._call(endpoint='account')
        return Account(resp['credits'], resp['jobs_completed'], resp['jobs_processing'])
476925
def post(self, amount, other_account, description, self_memo="", other_memo="", datetime=None):
        

        #Note: debits are always positive, credits are always negative.  They should be negated before displaying
        #(expense and liability?) accounts
        tx = self._new_transaction()

        if datetime:
            tx.t_stamp = datetime
        #else now()

        tx.description = description
        tx.save()

        a1 = self._make_ae(self._DEBIT_IN_DB() * amount, self_memo, tx)
        a1.save()
        a2 = other_account._make_ae(-self._DEBIT_IN_DB() * amount, other_memo, tx)
        a2.save()

        return (a1, a2)
1185952
public function createAccountWithdrawal(Account $account, Withdrawal $withdrawal, array $params = [])
    {
        $data = $this->mapper->fromWithdrawal($withdrawal);
        $this->postAndMap($account->getResourcePath().'/withdrawals', $data + $params, 'toWithdrawal', $withdrawal);
    }
280102
def call
      return broadcast(:invalid) unless @form.valid?

      Decidim::User.transaction do
        destroy_user_account!
        destroy_user_identities
        destroy_user_group_memberships
        destroy_follows
      end

      broadcast(:ok)
    end
282070
def export_account_state(self, account_state):
        
        return {
            'address': account_state['address'],
            'type': account_state['type'],
            'credit_value': '{}'.format(account_state['credit_value']),
            'debit_value': '{}'.format(account_state['debit_value']),
            'lock_transfer_block_id': account_state['lock_transfer_block_id'],
            'block_id': account_state['block_id'],
            'vtxindex': account_state['vtxindex'],
            'txid': account_state['txid'],
        }
449879
def account(transition, direction=Direction.BIDIRECTIONAL):
    
    if direction != Direction.BIDIRECTIONAL:
        return directed_account(transition, direction)

    return Account(directed_account(transition, Direction.CAUSE) +
                   directed_account(transition, Direction.EFFECT))
880571
def validate_account_alias(iam_client, account_alias):
    """"""
    # Super overkill here using pagination when an account can only
    # have a single alias, but at least this implementation should be
    # future-proof
    current_account_aliases = []
    paginator = iam_client.get_paginator('list_account_aliases')
    response_iterator = paginator.paginate()
    for page in response_iterator:
        current_account_aliases.extend(page.get('AccountAliases', []))
    if account_alias in current_account_aliases:
        LOGGER.info('Verified current AWS account alias matches required '
                    'alias %s.',
                    account_alias)
    else:
        LOGGER.error('Current AWS account aliases "%s" do not match '
                     'required account alias %s in Runway config.',
                     ','.join(current_account_aliases),
                     account_alias)
        sys.exit(1)
982119
def handle_delete_account(self, req):
        
        if not self.is_reseller_admin(req):
            return self.denied_response(req)
        account = req.path_info_pop()
        if req.path_info or not account or account[0] == '.':
            return HTTPBadRequest(request=req)
        # Make sure the account has no users and get the account_id
        marker = ''
        while True:
            path = '/v1/%s?format=json&marker=%s' % (quote('%s/%s' %
                (self.auth_account, account)), quote(marker))
            resp = self.make_pre_authed_request(
                req.environ, 'GET', path).get_response(self.app)
            if resp.status_int == 404:
                return HTTPNotFound(request=req)
            if resp.status_int // 100 != 2:
                raise Exception('Could not list in main auth account: %s %s' %
                                (path, resp.status))
            account_id = resp.headers['x-container-meta-account-id']
            sublisting = json.loads(resp.body)
            if not sublisting:
                break
            for obj in sublisting:
                if obj['name'][0] != '.':
                    return HTTPConflict(request=req)
            marker = sublisting[-1]['name'].encode('utf-8')
        # Obtain the listing of services the account is on.
        path = quote('/v1/%s/%s/.services' % (self.auth_account, account))
        resp = self.make_pre_authed_request(
            req.environ, 'GET', path).get_response(self.app)
        if resp.status_int // 100 != 2 and resp.status_int != 404:
            raise Exception('Could not obtain .services object: %s %s' %
                            (path, resp.status))
        if resp.status_int // 100 == 2:
            services = json.loads(resp.body)
            # Delete the account on each cluster it is on.
            deleted_any = False
            for name, url in services['storage'].iteritems():
                if name != 'default':
                    parsed = urlparse(url)
                    conn = self.get_conn(parsed)
                    conn.request('DELETE', parsed.path,
                        headers={'X-Auth-Token': self.get_itoken(req.environ)})
                    resp = conn.getresponse()
                    resp.read()
                    if resp.status == 409:
                        if deleted_any:
                            raise Exception('Managed to delete one or more '
                                'service end points, but failed with: '
                                '%s %s %s' % (url, resp.status, resp.reason))
                        else:
                            return HTTPConflict(request=req)
                    if resp.status // 100 != 2 and resp.status != 404:
                        raise Exception('Could not delete account on the '
                            'Swift cluster: %s %s %s' %
                            (url, resp.status, resp.reason))
                    deleted_any = True
            # Delete the .services object itself.
            path = quote('/v1/%s/%s/.services' %
                         (self.auth_account, account))
            resp = self.make_pre_authed_request(
                req.environ, 'DELETE', path).get_response(self.app)
            if resp.status_int // 100 != 2 and resp.status_int != 404:
                raise Exception('Could not delete .services object: %s %s' %
                                (path, resp.status))
        # Delete the account id mapping for the account.
        path = quote('/v1/%s/.account_id/%s' %
                     (self.auth_account, account_id))
        resp = self.make_pre_authed_request(
            req.environ, 'DELETE', path).get_response(self.app)
        if resp.status_int // 100 != 2 and resp.status_int != 404:
            raise Exception('Could not delete account id mapping: %s %s' %
                            (path, resp.status))
        # Delete the account marker itself.
        path = quote('/v1/%s/%s' % (self.auth_account, account))
        resp = self.make_pre_authed_request(
            req.environ, 'DELETE', path).get_response(self.app)
        if resp.status_int // 100 != 2 and resp.status_int != 404:
            raise Exception('Could not delete account marked: %s %s' %
                            (path, resp.status))
        return HTTPNoContent(request=req)
322730
def Clone(self):
        
        return AccountState(self.ScriptHash, self.IsFrozen, self.Votes, self.Balances)
1171878
def current_account=(new_account)
      if self.auth_type_used != :basic
        session[:account_id] = (new_account.nil? || new_account.is_a?(Symbol)) ? nil : new_account.id
      end
      @current_account = new_account || :false
    end
101361
def from_state=(from_state)
      validator = EnumAttributeValidator.new('String', ["CUSTOM", "IN_STOCK", "SOLD", "RETURNED_BY_CUSTOMER", "RESERVED_FOR_SALE", "SOLD_ONLINE", "ORDERED_FROM_VENDOR", "RECEIVED_FROM_VENDOR", "IN_TRANSIT_TO", "NONE", "WASTE", "UNLINKED_RETURN"])
      unless validator.valid?(from_state)
        fail ArgumentError, "invalid value for 'from_state', must be one of #{validator.allowable_values}."
      end
      @from_state = from_state
    end
1198363
def get_account_from_hash(self, account_hash):
        
        for account in self.accounts:
            if account.__hash__() == account_hash:
                return account
        return None
946819
private static function setAccountBalance($account_id, $accountSide, $value, $delete = false) {
        $account = Account::findOne($account_id);

        if ($account === null) {
            throw new Exception('account with id ' . $account_id . ' not found');
        }

        if ($accountSide === StaticEb::$accountsideDebitSign) {
            //If delete, then subtract
            If ($delete === false) {
                $account->balance_debit = StaticEb::mathAdd($account->balance_debit, $value);
            } else {
                $account->balance_debit = StaticEb::mathSubtract($account->balance_debit, $value);
            }

        }
674150
def rolledback!(force_restore_state: false, should_run_callbacks: true) #:nodoc:
      if should_run_callbacks && trigger_transactional_callbacks?
        _run_rollback_callbacks
        _run_rollback_without_transaction_enrollment_callbacks
      end
    ensure
      restore_transaction_record_state(force_restore_state)
      clear_transaction_record_state
    end
1092613
def newaccount(ctx, accountname, account, password):
    
    print_tx(
        ctx.bitshares.create_account(accountname, registrar=account, password=password)
    )