get_data(); // DARK Mode settings if( $arkgatewaysettings['darkmode'] == 'yes' ) { $storewalletaddress = $arkgatewaysettings['darkaddress']; $explorerurl = 'https://dexplorer.ark.io/tx/'; $exploreraddressurl = 'https://dexplorer.ark.io/address/'; } else { $storewalletaddress = $arkgatewaysettings['arkaddress']; $explorerurl = 'https://explorer.ark.io/tx/'; $exploreraddressurl = 'https://explorer.ark.io/address/'; } //Determine the type of message to be sent if( $messagetype == 'orderfilled' && $arkgatewaysettings['arkorderfillednotify'] == 'on' ) { // ARK not native currency if( $order->get_meta( $key = 'ark_store_currency' ) != 'ARK' ) $orderorigininfo = ( __( 'Order total converted to ARK from', 'arkcommerce' ) . ' ' . $order->get_meta( $key = 'ark_store_currency' ) . ' ' . __( 'at the following exchange rate', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_exchange_rate' ) . ' ' . $order->get_meta( $key = 'ark_store_currency' ) . ' ' . __( 'per ARK', 'arkcommerce' ) ); // ARK native currency else $orderorigininfo = ( __( 'Order total originally priced in ARK at', 'arkcommerce' ) . ': Ѧ' . number_format( ( float ) $order->get_meta( $key = 'ark_total' ), 8, '.', '' ) ); // Compose mail $mailsubject = ( __( 'ARKCommerce Order', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'Filled', 'arkcommerce' ) ); $mailmessagecontent = ( ' ' . __( 'ARKCommerce Order Filled' , 'arkcommerce' ) . '
ARKCommerce

' . __( 'ARKCommerce Order', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'Filled', 'arkcommerce' ) . '

' . __( 'The order number', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'with order total', 'arkcommerce' ) . ' Ѧ' . number_format( ( float ) $order->get_meta( $key = 'ark_total' ), 8, '.', '' ) . ' ' . __( 'has been paid in full to store wallet address', 'arkcommerce' ) . ' ' . $storewalletaddress . '.


' . $orderorigininfo . '
' . __( 'Order placed at block', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_order_block' ) . '
' . __( 'Order filled at block', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_payment_block' ) . '
' . __( 'Order transaction ID', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_transaction_id' ) . '
' . __( 'This WooCommerce order status is now complete. The button below links to the ARK Blockchain Explorer web application displaying the details of this transaction', 'arkcommerce' ) . '.

' . __( 'Transaction', 'arkcommerce' ) . '
' . __( 'Thank you for choosing ARKCommerce', 'arkcommerce' ) . '.

' ); // Send mail to admin wp_mail( $arkgatewaysettings['arknotify'], $mailsubject, $mailmessagecontent, $mailheaderdef ); } elseif( $messagetype == 'orderplaced' && $arkgatewaysettings['arkorderplacednotify'] == 'on' ) { // ARK not native currency if( $order->get_meta( $key = 'ark_store_currency' ) != 'ARK' ) $orderorigininfo = ( __( 'Order total converted to ARK from', 'arkcommerce' ) . ' ' . $order->get_meta( $key = 'ark_store_currency' ) . ' ' . __( 'at the following exchange rate', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_exchange_rate' ) . ' ' . $order->get_meta( $key = 'ark_store_currency' ) . ' ' . __( 'per ARK', 'arkcommerce' ) ); // ARK native currency else $orderorigininfo = ( __( 'Order total originally priced in ARK at', 'arkcommerce' ) . ': Ѧ' . number_format( ( float ) $order->get_meta( $key = 'ark_total' ), 8, '.', '' ) ); // Order expiry if( $order->get_meta( $key = 'ark_expiration_block' ) != 'never' ) $orderexpiry = __( 'This order expires at block', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_expiration_block' ); // Order doesn't expire else $orderexpiry = ( __( 'This order does not expire', 'arkcommerce' ) . '.' ); // Compose mail $mailsubject = ( __( 'ARKCommerce Order', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'Placed', 'arkcommerce' ) ); $mailmessagecontent = ( ' ' . __( 'ARKCommerce Order Placed' , 'arkcommerce' ) . '
ARKCommerce

' . __( 'ARKCommerce Order', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'Placed', 'arkcommerce' ) . '

' . __( 'The order number', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'with order total', 'arkcommerce' ) . ' Ѧ' . number_format( ( float ) $order->get_meta( $key = 'ark_total' ), 8, '.', '' ) . ' ' . __( 'has been placed', 'arkcommerce' ) . '.


' . $orderorigininfo . '
' . __( 'Order placed at block', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_order_block' ) . '
' . $orderexpiry . '
' . __( 'This WooCommerce order status is now on hold and ARK blockchain is currently being queried for a customer transaction fulfilling it. As soon as such a transaction is detected the order status will change to complete', 'arkcommerce' ) . '.

' . __( 'Thank you for choosing ARKCommerce', 'arkcommerce' ) . '.

' ); // Send mail to admin wp_mail( $arkgatewaysettings['arknotify'], $mailsubject, $mailmessagecontent, $mailheaderdef ); } elseif( $messagetype == 'orderexpired' && $arkgatewaysettings['arkorderexpirednotify'] == 'on' ) { // Establish block height and validate response $arkblockheight = arkcommerce_get_block_height(); if( $arkblockheight == 0 ) $arkblockheight = 'error'; // ARK not native currency if( $order->get_meta( $key = 'ark_store_currency' ) != 'ARK' ) $orderorigininfo = ( __( 'Order total converted to ARK from', 'arkcommerce' ) . ' ' . $order->get_meta( $key = 'ark_store_currency' ) . ' ' . __( 'at the following exchange rate', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_exchange_rate' ) . ' ' . $order->get_meta( $key = 'ark_store_currency' ) . ' ' . __( 'per ARK', 'arkcommerce' ) ); // ARK native currency else $orderorigininfo = ( __( 'Order total originally priced in ARK at', 'arkcommerce' ) . ': Ѧ' . number_format( ( float ) $order->get_meta( $key = 'ark_total' ), 8, '.', '' ) ); // Compose mail $mailsubject = ( __( 'ARKCommerce Order', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'Expired', 'arkcommerce' ) ); $mailmessagecontent = ( ' ' . __( 'ARKCommerce Order Expired' , 'arkcommerce' ) . '
ARKCommerce

' . __( 'ARKCommerce Order', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'Expired', 'arkcommerce' ) . '

' . __( 'The order number', 'arkcommerce' ) . ' ' . $ark_order_data['id'] . ' ' . __( 'with order total', 'arkcommerce' ) . ' Ѧ' . number_format( ( float ) $order->get_meta( $key = 'ark_total' ), 8, '.', '' ) . ' ' . __( 'has expired', 'arkcommerce' ) . '.


' . $orderorigininfo . '
' . __( 'Order placed at block', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_order_block' ) . '
' . __( 'Order expired at block', 'arkcommerce' ) . ': ' . $order->get_meta( $key = 'ark_expiration_block' ) . '
' . __( 'Current block height', 'arkcommerce' ) . ': ' . $arkblockheight . '
' . __( 'This WooCommerce order status is now cancelled', 'arkcommerce' ) . '.

' . __( 'Thank you for choosing ARKCommerce', 'arkcommerce' ) . '.

' ); // Send mail to admin wp_mail( $arkgatewaysettings['arknotify'], $mailsubject, $mailmessagecontent, $mailheaderdef ); } } ////////////////////////////////////////////////////////////////////////////////////////// // END OF ARKCOMMERCE NOTIFICATIONS // //////////////////////////////////////////////////////////////////////////////////////////