id = 'afridirect_pending_payment'; $this->title = __( 'AfriDirect: Pending Payment', 'afridirect-payment' ); $this->description = __( 'This email is sent to customers when their order is placed with AfriDirect Proof and payment is pending.', 'afridirect-payment' ); $this->customer_email = true; $this->template_html = 'emails/afridirect-pending-payment.php'; $this->template_plain = 'emails/plain/afridirect-pending-payment.php'; $this->placeholders = array( '{order_date}' => '', '{order_number}' => '', ); // Call parent constructor. parent::__construct(); } /** * Get email subject. * * @return string */ public function get_default_subject() { return __( 'Payment Required for Order #{order_number}', 'afridirect-payment' ); } /** * Get email heading. * * @return string */ public function get_default_heading() { return __( 'Payment Required', 'afridirect-payment' ); } /** * Trigger email. * * @param int $order_id Order ID. * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = null ) { $this->setup_locale(); if ( ! $order_id || ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } if ( is_a( $order, 'WC_Order' ) ) { $this->object = $order; $this->recipient = $order->get_billing_email(); $this->placeholders['{order_date}'] = wc_format_datetime( $order->get_date_created() ); $this->placeholders['{order_number}'] = $order->get_order_number(); } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } $this->restore_locale(); } /** * Get content html. * * @return string */ public function get_content_html() { return wc_get_template_html( $this->template_html, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => false, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } /** * Get content plain. * * @return string */ public function get_content_plain() { return wc_get_template_html( $this->template_plain, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => true, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } } /** * Proof Received Email. */ class AfriDirect_Payment_Email_Proof_Received extends WC_Email { /** * Constructor. */ public function __construct() { $this->id = 'afridirect_proof_received'; $this->title = __( 'AfriDirect: Proof Received', 'afridirect-payment' ); $this->description = __( 'This email is sent to customers when their payment proof has been uploaded and is under review.', 'afridirect-payment' ); $this->customer_email = true; $this->template_html = 'emails/afridirect-proof-received.php'; $this->template_plain = 'emails/plain/afridirect-proof-received.php'; $this->placeholders = array( '{order_date}' => '', '{order_number}' => '', ); parent::__construct(); } /** * Get email subject. * * @return string */ public function get_default_subject() { return __( 'Payment Proof Received for Order #{order_number}', 'afridirect-payment' ); } /** * Get email heading. * * @return string */ public function get_default_heading() { return __( 'Payment Proof Received', 'afridirect-payment' ); } /** * Trigger email. * * @param int $order_id Order ID. * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = null ) { $this->setup_locale(); if ( ! $order_id || ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } if ( is_a( $order, 'WC_Order' ) ) { $this->object = $order; $this->recipient = $order->get_billing_email(); $this->placeholders['{order_date}'] = wc_format_datetime( $order->get_date_created() ); $this->placeholders['{order_number}'] = $order->get_order_number(); } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } $this->restore_locale(); } /** * Get content html. * * @return string */ public function get_content_html() { return wc_get_template_html( $this->template_html, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => false, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } /** * Get content plain. * * @return string */ public function get_content_plain() { return wc_get_template_html( $this->template_plain, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => true, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } } /** * Approved Email. */ class AfriDirect_Payment_Email_Approved extends WC_Email { /** * Constructor. */ public function __construct() { $this->id = 'afridirect_approved'; $this->title = __( 'AfriDirect: Approved', 'afridirect-payment' ); $this->description = __( 'This email is sent to customers when their payment proof has been approved.', 'afridirect-payment' ); $this->customer_email = true; $this->template_html = 'emails/afridirect-approved.php'; $this->template_plain = 'emails/plain/afridirect-approved.php'; $this->placeholders = array( '{order_date}' => '', '{order_number}' => '', ); parent::__construct(); } /** * Get email subject. * * @return string */ public function get_default_subject() { return __( 'Payment Approved for Order #{order_number}', 'afridirect-payment' ); } /** * Get email heading. * * @return string */ public function get_default_heading() { return __( 'Payment Approved', 'afridirect-payment' ); } /** * Trigger email. * * @param int $order_id Order ID. * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = null ) { $this->setup_locale(); if ( ! $order_id || ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } if ( is_a( $order, 'WC_Order' ) ) { $this->object = $order; $this->recipient = $order->get_billing_email(); $this->placeholders['{order_date}'] = wc_format_datetime( $order->get_date_created() ); $this->placeholders['{order_number}'] = $order->get_order_number(); } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } $this->restore_locale(); } /** * Get content html. * * @return string */ public function get_content_html() { return wc_get_template_html( $this->template_html, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => false, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } /** * Get content plain. * * @return string */ public function get_content_plain() { return wc_get_template_html( $this->template_plain, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => true, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } } /** * Rejected Email. */ class AfriDirect_Payment_Email_Rejected extends WC_Email { /** * Constructor. */ public function __construct() { $this->id = 'afridirect_rejected'; $this->title = __( 'AfriDirect: Rejected', 'afridirect-payment' ); $this->description = __( 'This email is sent to customers when their payment proof has been rejected.', 'afridirect-payment' ); $this->customer_email = true; $this->template_html = 'emails/afridirect-rejected.php'; $this->template_plain = 'emails/plain/afridirect-rejected.php'; $this->placeholders = array( '{order_date}' => '', '{order_number}' => '', ); parent::__construct(); } /** * Get email subject. * * @return string */ public function get_default_subject() { return __( 'Payment Proof Rejected for Order #{order_number}', 'afridirect-payment' ); } /** * Get email heading. * * @return string */ public function get_default_heading() { return __( 'Payment Proof Rejected', 'afridirect-payment' ); } /** * Trigger email. * * @param int $order_id Order ID. * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = null ) { $this->setup_locale(); if ( ! $order_id || ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } if ( is_a( $order, 'WC_Order' ) ) { $this->object = $order; $this->recipient = $order->get_billing_email(); $this->placeholders['{order_date}'] = wc_format_datetime( $order->get_date_created() ); $this->placeholders['{order_number}'] = $order->get_order_number(); } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } $this->restore_locale(); } /** * Get content html. * * @return string */ public function get_content_html() { return wc_get_template_html( $this->template_html, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => false, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } /** * Get content plain. * * @return string */ public function get_content_plain() { return wc_get_template_html( $this->template_plain, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => true, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } } /** * Expired Email. */ class AfriDirect_Payment_Email_Expired extends WC_Email { /** * Constructor. */ public function __construct() { $this->id = 'afridirect_expired'; $this->title = __( 'AfriDirect: Expired', 'afridirect-payment' ); $this->description = __( 'This email is sent to customers when their payment deadline has expired.', 'afridirect-payment' ); $this->customer_email = true; $this->template_html = 'emails/afridirect-expired.php'; $this->template_plain = 'emails/plain/afridirect-expired.php'; $this->placeholders = array( '{order_date}' => '', '{order_number}' => '', ); parent::__construct(); } /** * Get email subject. * * @return string */ public function get_default_subject() { return __( 'Payment Deadline Expired for Order #{order_number}', 'afridirect-payment' ); } /** * Get email heading. * * @return string */ public function get_default_heading() { return __( 'Payment Deadline Expired', 'afridirect-payment' ); } /** * Trigger email. * * @param int $order_id Order ID. * @param WC_Order $order Order object. */ public function trigger( $order_id, $order = null ) { $this->setup_locale(); if ( ! $order_id || ! is_a( $order, 'WC_Order' ) ) { $order = wc_get_order( $order_id ); } if ( is_a( $order, 'WC_Order' ) ) { $this->object = $order; $this->recipient = $order->get_billing_email(); $this->placeholders['{order_date}'] = wc_format_datetime( $order->get_date_created() ); $this->placeholders['{order_number}'] = $order->get_order_number(); } if ( $this->is_enabled() && $this->get_recipient() ) { $this->send( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() ); } $this->restore_locale(); } /** * Get content html. * * @return string */ public function get_content_html() { return wc_get_template_html( $this->template_html, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => false, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } /** * Get content plain. * * @return string */ public function get_content_plain() { return wc_get_template_html( $this->template_plain, array( 'order' => $this->object, 'email_heading' => $this->get_heading(), 'additional_content' => $this->get_additional_content(), 'sent_to_admin' => false, 'plain_text' => true, 'email' => $this, ), '', AFRIDIRECT_PAYMENT_PLUGIN_DIR . 'templates/' ); } }