id = 'ppl_afw_payout'; $this->title = __( 'Payout sent', 'affireo-affiliates-for-woocommerce' ); $this->description = __( 'Sent to an affiliate when their payout is sent: at once for store credit and Stripe, and when you mark a payout awaiting payment as sent.', 'affireo-affiliates-for-woocommerce' ); $this->customer_email = true; $this->heading = __( 'Your payout is on its way', 'affireo-affiliates-for-woocommerce' ); $this->subject = __( 'Your affiliate payout has been sent', 'affireo-affiliates-for-woocommerce' ); add_action( 'ppl_afw_payout_completed', array( $this, 'trigger' ), 20, 2 ); parent::__construct(); } /** * Triggers the email. * * @since 1.0.0 * @param int $payout_id Payout id. * @param object $affiliate Affiliate row. */ public function trigger( $payout_id, $affiliate ) { $this->setup_locale(); $this->affiliate = $affiliate; $this->payout = ppl_afw()->container->get( 'payouts.repository' )->find( $payout_id ); $user = $affiliate ? get_userdata( (int) $affiliate->user_id ) : null; if ( $user && $this->payout ) { $this->recipient = $user->user_email; $this->dispatch(); } $this->restore_locale(); } /** * Body content. * * @since 1.0.0 * @return string */ protected function get_body() { $amount = wc_price( (float) $this->payout->amount, array( 'currency' => $this->payout->currency ) ); $invoice = $this->payout->invoice_number; return '

' . sprintf( /* translators: 1: payout amount, 2: invoice number */ esc_html__( 'A payout of %1$s has been sent to you (invoice %2$s). Depending on your payout method it may take a few days to arrive.', 'affireo-affiliates-for-woocommerce' ), wp_kses_post( $amount ), esc_html( $invoice ) ) . '

' . $this->dashboard_link(); } }