Add payment-details function

This commit is contained in:
2022-10-31 03:41:40 +00:00
parent bbd25d6983
commit 6cc6f487d8
+23 -4
View File
@@ -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 = '<h3>Thông tin thanh toán</h3>';
$html .= '<div>Bạn vui lòng chuyển khoản theo thông tin dưới đây</div>';
$html .= '<ul>';
$html .= '<li class="order-amount">'. $order->get_total() . '</li>';
$html .= '<li class="bank-name">'. $this->bank . '</li>';
$html .= '<li class="account-number">'. $this->account_number . '</li>';
$html .= '<li class="account-name">'. $this->account_name . '</li>';
$html.= '<li class="prefix">'. $this->prefix . $order_id .'</li>';
$html .= '</ul>';
}
/**