dashed-slug.net › Forums › WooCommerce Cryptocurrency Payment Gateway extension support › Getting the following error when paying out WCMP Commissions
May 8, 2020 at 2:45 am #8277
[08-May-2020 02:31:35 UTC] WordPress database error Column ‘balance’ cannot be null for query INSERT INTO
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.May 8, 2020 at 3:32 am #8279
The problems seems to lay in the wcmp_transaction_update_meta_data method of WCMP it looks like.
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?May 8, 2020 at 6:17 am #8282alexgKeymaster
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.
AlexMay 8, 2020 at 4:48 pm #8286
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.May 11, 2020 at 9:13 am #8302alexgKeymaster
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.
- You must be logged in to reply to this topic.