Once a registration has been completed, vouchers are used and referrers are awarded
978553
def applyVoucherCodesFinal(sender,**kwargs):
    '''
    
    '''
    logger.debug('Signal fired to mark voucher codes as applied.')

    finalReg = kwargs.pop('registration')
    tr = finalReg.temporaryRegistration

    tvus = TemporaryVoucherUse.objects.filter(registration=tr)

    for tvu in tvus:
        vu = VoucherUse(voucher=tvu.voucher,registration=finalReg,amount=tvu.amount)
        vu.save()
        if getConstant('referrals__enableReferralProgram'):
            awardReferrers(vu)
1270806
public void creditGranted(long amount, boolean finalUnits) throws Exception {
		if (CURRENT_STATE == SENT_INITIAL_RESERVATION) {
			CURRENT_STATE = GRANTED_INITIAL_RESERVATION;
			if (logger.isInfoEnabled()) {
				logger.info("credit granted : ");
			}
			doInviteChargingAllowed(this.inviteRequest);
		}
	}
274360
private function getRefererId()
    {
        return $this->trackIfEnabled('referers', function () {
            return $this->getRefererTracker()->track(
                $this->request->headers->get('referer'),
                $this->request->url()
            );
        });
    }
558673
public function afterRegistry()
    {
        parent::afterRegistry();

        $this->_fieldsDefinition = $this->tracker->createTrackClass('Engine\\FieldsDefinition', $this->_trackId);
    }
626602
protected function RecalculateNoneSponsoredVouchers()
    {
        if (!is_null($this->GetActiveVouchers())) {
            $this->dCostNoneSponsoredVouchers = 0;
            $this->GetActiveVouchers()->RemoveInvalidVouchers(MTShopBasketCore::MSG_CONSUMER_NAME, $this);

            $this->dCostNoneSponsoredVouchers = $this->GetActiveVouchers()->GetVoucherValue(false);
            if ($this->dCostNoneSponsoredVouchers > $this->dCostArticlesTotalAfterDiscounts) {
                $this->dCostNoneSponsoredVouchers = $this->dCostArticlesTotalAfterDiscounts;
            }
        } else {
            $this->dCostNoneSponsoredVouchers = 0;
        }
    }
1195716
def distribute_bundle_transactions(self, candidate_votes, bundle_transactions_to_distribute, transfer_value):
        ""

        # figure out how many net votes, and which ticket_tpls, go where
        incoming_tickets = defaultdict(list)
        exhausted_papers = 0

        # determine how many papers go to each candidate; effectively we unpack each transaction bundle into
        # preference flows, split as needed, and then repack into new bundles
        for from_candidate_id, bundle_transactions in bundle_transactions_to_distribute:
            for bundle_transaction in bundle_transactions:
                # take the bundle away from the candidate
                candidate_votes[from_candidate_id] -= bundle_transaction.votes
                self.candidate_bundle_transactions.transfer_from(from_candidate_id, bundle_transaction)

                for bundle in bundle_transaction.bundles:
                    # determine the candidate(s) that this bundle of papers flows to
                    to_candidate, next_ticket_state = self.bundle_to_next_candidate(bundle)
                    if to_candidate is None:
                        exhausted_papers += bundle.size
                        continue
                    incoming_tickets[to_candidate].append((next_ticket_state, bundle.size))

        for candidate_id in sorted(incoming_tickets, key=self.candidate_order_fn):
            bundles_moving = []
            for ticket, new_count in incoming_tickets[candidate_id]:
                bundles_moving.append(PaperBundle(ticket, new_count))
            bundle_transaction = make_bundle_transaction(bundles_moving, transfer_value)
            self.candidate_bundle_transactions.transfer_to(candidate_id, bundle_transaction)
            candidate_votes[candidate_id] += bundle_transaction.votes

        exhausted_votes = int(exhausted_papers * transfer_value)
        return exhausted_votes, exhausted_papers
561026
def bids_to_you(self):
        '''
        
        '''
        headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain",'Referer': 'http://'+self.domain+'/team_news.phtml',"User-Agent": user_agent}
        req = self.session.get('http://'+self.domain+'/exchangemarket.phtml?viewoffers_x=',headers=headers).content
        soup = BeautifulSoup(req)
        table = []
        for i in soup.find('table',{'class','tablecontent03'}).find_all('tr')[1:]:
            player,owner,team,price,bid_date,trans_date,status = self._parse_bid_table(i)
            table.append([player,owner,team,price,bid_date,trans_date,status])
        return table
1155635
def top_referrers(self, domain_only=True):
        
        referrer = self._referrer_clause(domain_only)
        return (self.get_query()
                .select(referrer, fn.Count(PageView.id))
                .group_by(referrer)
                .order_by(fn.Count(PageView.id).desc())
                .tuples())
299928
def register_hit_type(self, title, description, reward, duration,
                          keywords=None, approval_delay=None, qual_req=None):
        
        params = dict(
            Title=title,
            Description=description,
            AssignmentDurationInSeconds=
                self.duration_as_seconds(duration),
            )
        params.update(MTurkConnection.get_price_as_price(reward).get_as_params('Reward'))

        if keywords:
            params['Keywords'] = self.get_keywords_as_string(keywords)

        if approval_delay is not None:
            d = self.duration_as_seconds(approval_delay)
            params['AutoApprovalDelayInSeconds'] = d

        if qual_req is not None:
            params.update(qual_req.get_as_params())

        return self._process_request('RegisterHITType', params)
1286423
def post_registration_redirect(self, request, user):
        
        next_url = "/registration/register/complete/"
        if "next" in request.GET or "next" in request.POST:
            next_url = request.GET.get("next", None) or request.POST.get("next", None) or "/"
            
        return (next_url, (), {})
407962
public function afterRegistry()
    {
        $this->mailElements = $this->loader->getMailLoader()->getMailElements();
        $this->mailTargets  = $this->loader->getMailLoader()->getMailTargets();

        parent::afterRegistry();
    }
1276458
public function afterRegistry()
    {
        $this->_select = $this->db->select();
        $this->_select->from('gems__appointments', $this->fields);
    }
934242
def get_result(self):
        """"""
        result = get_json_from_remote_server(self.call)
        referrers = list(result)
        for referrer in referrers:
            referrer['sum_visit_length'] = stringify_seconds(referrer['sum_visit_length'])
        return sorted(referrers, key=itemgetter('nb_visits'), reverse=True)[0:10]
1317720
def capture_registrations():
    
    registrations = []

    def _on(app, **data):
        registrations.append(data)

    user_registered.connect(_on)

    try:
        yield registrations
    finally:
        user_registered.disconnect(_on)
699310
public function afterRegistry()
    {
        parent::afterRegistry();

        if (! $this->model instanceof \Gems_Model_RespondentModel) {
            $this->model = $this->loader->getModels()->getRespondentModel(true);
        }
    }
641932
def clear_if_finalized(
        iteration: TransitionResult,
) -> TransitionResult[InitiatorPaymentState]:
    
    state = cast(InitiatorPaymentState, iteration.new_state)

    if state is None:
        return iteration

    if len(state.initiator_transfers) == 0:
        return TransitionResult(None, iteration.events)

    return iteration
1128710
protected function HandleRegisterAfterShopping()
    {
        if ($this->ActivePageIsRegisterAfterShopping()) {
            if (!$this->IsAllowedToShowRegisterAfterShoppingPage()) {
                $oExtranetConfig = TdbDataExtranet::GetInstance();
                $this->controller->HeaderURLRedirect($oExtranetConfig->GetLinkAccessDeniedPage(), true);
            }
        }
    }