/** * Update a referral to Unpaid when a payment is completed * * @access public * @since 1.6 */ public function mark_referral_complete(SI_Payment $payment) { $payment_id = $payment->get_id(); $this->complete_referral($payment_id); $referral = affiliate_wp()->referrals->get_by('reference', $payment_id, $this->context); if (!is_object($referral)) { return; } $amount = affwp_currency_filter(affwp_format_amount($referral->amount)); $name = affiliate_wp()->affiliates->get_affiliate_name($referral->affiliate_id); $note = sprintf(__('Referral #%d for %s recorded for %s', 'affiliate-wp'), $referral->referral_id, $amount, $name); $new_data = wp_parse_args($payment->get_data(), array('affwp_notes' => $note)); $payment->set_data($new_data); }