diff --git a/vietnam-payment-gateways.php b/vietnam-payment-gateways.php index f964a19..91cc9ae 100644 --- a/vietnam-payment-gateways.php +++ b/vietnam-payment-gateways.php @@ -45,7 +45,7 @@ function vnpg_init_gateway_class() { $this->template_id = $this->get_option( 'template_id' ); $this->prefix = $this->get_option('prefix'); $this->bank = $this->get_option('bank'); - + // Actions. add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); //add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'save_account_details' ) ); @@ -116,13 +116,14 @@ function vnpg_init_gateway_class() { ); } - /** + + /** * Output for the order received page. * * @param int $order_id Order ID. */ public function thankyou_page( $order_id ) { - + $this->payment_details( $order_id ); } /** @@ -133,7 +134,25 @@ function vnpg_init_gateway_class() { * @param bool $plain_text Email format: plain text or HTML. */ public function email_instructions( $order, $sent_to_admin, $plain_text = false ) { - + if (!$sent_to_admin && 'vnpg' === $order->get_paffyment_method() && $order->has_status('on-hold')) { + $this->payment_details($order->get_id()); + } + } + + private function payment_details($order_id = '') { + + // Get order and store in $order. + $order = wc_get_order($order_id); + + $html = '

Thông tin thanh toán

'; + $html .= '
Bạn vui lòng chuyển khoản theo thông tin dưới đây
'; + $html .= ''; } /**