Skip to content

Commit

Permalink
Fix order validation issue. Add support for admin orders details with…
Browse files Browse the repository at this point in the history
… HTPOS
  • Loading branch information
SuperstrongBE committed Nov 21, 2024
1 parent cd8dccd commit 638cd5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion includes/api/order-payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function handle_convert_order ($request){
}
$network = $existingOrder->get_meta('_network');
$settlement=OrderResolver::Process($params['paymentKey'],$converted,$network);
if ($settlement) {
if ($settlement->resolved) {
if ($existingOrder->get_status() !=="completed"){
$existingOrder->set_status('processing');
}
Expand Down
19 changes: 12 additions & 7 deletions includes/controllers/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ private function registerActions()
{

add_action('manage_shop_order_posts_custom_column', [$this, 'mutateOrdersRows'], 20, 2);
add_action('manage_woocommerce_page_wc-orders_custom_column', [$this, 'mutateOrdersRows'], 20, 2);


}

/**
Expand All @@ -50,13 +53,13 @@ private function registerActions()
*
* @param string $column The name of the column in the orders table.
*/
public function mutateOrdersRows($column)
public function mutateOrdersRows($column, $order)
{

global $post;
if (is_int($order)){
$order = wc_get_order($order);
}
if ('transactionId' === $column) {
$order = wc_get_order($post->ID);
$transactionId = $order->get_meta('_tx_id');
$transactionId = $order->get_meta('_tx_id');
$net = $order->get_meta('_net');
$color = $net == esc_attr("mainnet" ? "#7cc67c" : "#f1dd06");
$link = $net == "mainnet" ? "https://explorer.xprnetwork.org/transaction/" : "https://testnet.explorer.xprnetwork.org/transaction/";
Expand All @@ -67,7 +70,7 @@ public function mutateOrdersRows($column)
}
}
if ('network' === $column) {
$order = wc_get_order($post->ID);

$net = $order->get_meta('_network');
$color = $net == "mainnet" ? "#7cc67c" : "#f1dd06";
if ($net == 'testnet') {
Expand All @@ -78,7 +81,7 @@ public function mutateOrdersRows($column)
echo esc_attr('');
}
if ('paid_token' === $column) {
$order = wc_get_order($post->ID);

$amount = $order->get_meta('_paid_tokens');
if (!empty($amount)) {
echo '<span >'.esc_attr($amount).'</a>';
Expand All @@ -100,6 +103,8 @@ private function registerFilters()
{

add_filter('manage_edit-shop_order_columns', [$this, 'mutateOrdersColumnsHeader'], 11);
add_filter('manage_woocommerce_page_wc-orders_columns', [$this, 'mutateOrdersColumnsHeader'], 11);

}

/**
Expand Down

0 comments on commit 638cd5d

Please sign in to comment.