I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Useful Info For Woocommerce And FIAT deposits

dashed-slug.net Forums Fiat Coin Adapter extension support Useful Info For Woocommerce And FIAT deposits

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5777
    megeanwasson
    Participant

    Hi Everyone,
    This may be of use to any of you who want to use woocommerce shop and FIAT currencies with your wallets plugins to accept FIAT Cash Deposits.
    I use this method on some of my personal crypto websites and it works like a dream.
    Alex may be able to advise some extra functionality on the provided code to automate the last manual step 🙂

    Description
    This method can be used to allow you to create a woocommerce product to accept FIAT Deposits in ANY chosen fiat currency and then gives you an Order Action that you can use to easily credit the deposited currency to the customers chosen FIAT Wallet.

    Requirements
    Dashed-Slug Plugins:
    Bitcoin and Altcoin Wallets
    Bitcoin and Altcoin Wallets: Fiat Coin Adapter extension
    Bitcoin and Altcoin Wallets: Full Node Multi Coin Adapter extension
    Bitcoin and Altcoin Wallets: Exchange extension
    Bitcoin and Altcoin Wallets: WooCommerce Cryptocurrency Payment Gateway
    Alex’s Alt Coins Adapter Plugin

    Then For Woocommerce Setup And Activate The Following Extra Plugins:
    WooCommerce Conditional Shipping and Payments (Set to allow only Bank Deposit/Transfers for FIAT Deposit Product)
    WooCommerce Name Your Price (Let client choose how much to deposit)
    WooCommerce Payment Gateway Based Fees (Charge A FIAT Deposit Commission To Cover any Fees To Complete Transaction)
    Booster Plus for WooCommerce (Activate Currency Exchange Rates and Currency per Product Modules)

    Sites Default Currency Is USD for purposes of this demonstration, you can however use any of the currencies as your default to work with this method.

    Setup Your FIAT DEPOSIT Products (I used GBP as example here):
    12-fiat-deposits-woocommerce-settings-1

    13-fiat-deposits-woocommerce-settings-2

    14-fiat-deposits-woocommerce-settings-3

    After activating and setting up everything you can Add to your child Theme functions.php the following code at the bottom.
    Alex could you suggest how we can automate adding the currency to the customers wallet in here, the code would most likely go near the bottom where I put ( // Code Goes Here )

    
    /**
     * Add a custom FIAT WALLET DEPOSIT action to order actions select box on edit order page
     * Only added/Shown for paid orders that haven't fired this action yet
     *
     * @param array $actions order actions array to display
     * @return array - updated actions
     */
    function wallets_wc_add_order_meta_box_action( $actions ) {
    	global $theorder;
    	// bail if the order has been completed or this action has already been run
    	if ( ! $theorder->is_paid() || get_post_meta( $theorder->id, '_wc_order_marked_fiat_deposit_processed', true ) ) {
    		return $actions;
    	}
    	// add "Mark Fiat Deposit Completed Action" custom action t the order processing page
    	$actions['wc_custom_order_action'] = __( 'Add Fiat Deposit To Clients Wallet Balance', 'my-textdomain' );
    	return $actions;
    }
    add_action( 'woocommerce_order_actions', 'wallets_wc_add_order_meta_box_action' );
    /**
     * Add the wallets fiat deposit order note when action is clicked
     * Move Deposited Currency Amount to the customers Coin Wallet Balance
     * Add a flag on the order to show it's been run
     *
     * @param \WC_Order $order
     */
    function wallets_note_wc_process_order_meta_box_action( $order ) {
        // get correct info variables to be used to execute the code to credit the correct currency and amount to the users coin wallet balance
        $thewalletuserordernumber = $order->get_id(); // The Order Number Can Be Pushed Into The Wallet Transaction Comment/Reference
        $thewalletuserid = $order->get_user_id();
        $thewalletuserordercurrency = $order->get_currency(); // get the order currency
        $thewalletusersordertotaldeposited = $order->get_total(); // Currency total paid and cleared on order completion
        $deposit_address = apply_filters( 'wallets_api_deposit_address', '', array(
         'symbol' => $thewalletuserordercurrency,
         'user_id' => $thewalletuserid,
         'check_capabilities' => true,
         'force_new' => false,
        ) );
        $isordercompletedornot = $order->get_status( );
        // Still To Add the code here to automatically credit the Deposited Currency amount to the users corresponding Currency Coin Wallet
        // Code Goes Here
    	// add the order note to show admin the Currency amount was successfully credited to the customers coin wallet
    	$message = sprintf( __( 'Order '.$isordercompletedornot.' - '.$thewalletuserordercurrency.'%s Added To User ID:<b>'.$thewalletuserid.'</b>\'s Wallet Balance With Deposit Address: <b>'.$deposit_address.'</b>', 'my-textdomain' ), $thewalletusersordertotaldeposited);
    	$order->add_order_note( $message );
    	// add the flag so that this action won't be shown again after successfully processed
    	update_post_meta( $order->id, '_wc_order_marked_fiat_deposit_processed', 'yes' );
    }
    add_action( 'woocommerce_order_action_wc_custom_order_action', 'wallets_note_wc_process_order_meta_box_action' );
    
    

    See Customer ordering FIAT Deposit and processing steps next:

    1-fiat-deposit-product-front-end

    2-fiat-deposit-product-front-end

    3-fiat-deposit-product-front-end

    4-fiat-deposit-product-front-end

    Now admin can process the customers Fiat Deposit order next:

    5-fiat-deposit-product-front-end

    6-fiat-deposit-process-the-deposit-step1

    7-fiat-deposit-process-the-deposit-step2-the-deposit-action

    8-fiat-deposit-process-the-deposit-step2-the-deposit-action-completed

    9-fiat-deposit-add-fiat-to-customers-wallet-step1

    10-fiat-deposit-add-fiat-to-customers-wallet-step2

    11-fiat-deposit-add-fiat-to-customers-wallet-completed-client-notified

    If anyone have suggestions how we can improve this then please do let me know 🙂

    Kind Regards
    Megan

    #6526
    Anonymous
    Inactive

    please can you resend the images?

    #7834
    alexg
    Keymaster

    please repost the images

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.