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!

Getting the following error when paying out WCMP Commissions

dashed-slug.net Forums WooCommerce Cryptocurrency Payment Gateway extension support Getting the following error when paying out WCMP Commissions

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8277
    d3vnu77
    Participant

    [08-May-2020 02:31:35 UTC] WordPress database error Column ‘balance’ cannot be null for query INSERT INTOwp_wcmp_vendor_ledger(vendor_id,order_id,ref_id,ref_type,ref_info,ref_status,ref_updated,debit,balance) VALUES (‘262’, ‘100009683’, ‘100009861’, ‘withdrawal’, ‘Withdrawal generated for Commission – #100009684‘, ‘completed’, ‘2020-05-08 02:31:35’, ‘34.63’, NULL) made by do_action_ref_array(‘masspay_cron_start’), WP_Hook->do_action, WP_Hook->apply_filters, WCMp_Cron_Job->do_mass_payment, Wallets_WCMp_Payment_Gateway->process_payment, WCMp_Payment_Gateway->record_transaction, WCMp_Payment_Gateway->update_meta_data, do_action(‘wcmp_transaction_update_meta_data’), WP_Hook->do_action, WP_Hook->apply_filters, WCMp_Ledger->wcmp_transaction_update_meta_data, WCMp_Ledger_Data_Store->create

    This happens when paying out in both Bitcoin and 2ACoin.

    #8279
    d3vnu77
    Participant

    The problems seems to lay in the wcmp_transaction_update_meta_data method of WCMP it looks like.
    classes\class-wcmp-ledger.php

    When setting the balance key in the $data array… it can be fixed by changing the line to this:

    'balance' => isset($unpaid_commission_total['total'])?$unpaid_commission_total['total']:0,

    Should I forward that on to WCMP you think? Or am I not digging into it enough?

    #8282
    alexg
    Keymaster

    Hello,

    Thank you for reporting. It is unlikely that this is an issue with WCMp. It is far more likely that this is an issue related to the gateway.

    Please help me reproduce the issue step-by-step. Then I can look at why this happened.

    You have traced the exact line where the error is thrown, but this might be not the root cause. Once I can reproduce the problem on my machine, I will be able to fix it, or at least tell you what went wrong.

    with regards
    Alex

    #8286
    d3vnu77
    Participant

    In line 144 of classes/class-wcmp-ledger.php, WCMP is looking for unpaid commissions… by calling:

    $unpaid_commission_total = WCMp_Commission::get_commissions_total_data( $args, $vendor->id );

    On line 645 of classes/class-wcmp-post-commissions.php in the get_commissions_total_data from above it checks if the commissions have posts, this returns false, which sets unpaid_commission_total from above to null.

    if( $commissions->get_posts() ) :

    Then back to the previous file, in line 155 of classes/class-wcmp-ledger.php, WCMP tries to set:

    $data['balance'] = $unpaid_commission_total['total']

    This has not been set however and sets it as null which can not be inserted into the database.

    #8302
    alexg
    Keymaster

    Hello,

    Thank you for the additional details. But what I asked, is what series of steps did you take to see this error? What did you do in WCMp? How did you request for commissions to be paid?

    Only report this issue to the gray parrots if you can reproduce the problem with their own payment gateways. If you can only reproduce the problem with the Crypto payment gateway, then please describe how you arrived at the problem. Once I can reproduce it, I will dig into the code myself.

    thanks

    with regards

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