Changeset 2599655
- Timestamp:
- 09/16/2021 01:33:15 AM (5 years ago)
- Location:
- rimplenet/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (1 diff)
-
includes/class-wallets.php (modified) (1 diff)
-
rimplenet.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rimplenet/trunk/README.txt
r2598651 r2599655 5 5 Requires at least: 3.0.1 6 6 Tested up to: 5.8.1 7 Stable tag: 1.1.2 27 Stable tag: 1.1.23 8 8 Requires PHP: 5.6 9 9 License: GPLv2 or later -
rimplenet/trunk/includes/class-wallets.php
r2598125 r2599655 406 406 407 407 408 function add_user_mature_funds_to_wallet($user_id,$amount_to_add,$wallet_id, $note='',$tags=[]){ 408 function rimplenet_fund_user_mature_wallet($request_id,$user_id,$amount_to_add,$wallet_id, $note='',$tags=[],$extra_data=''){ 409 global $wpdb; 410 411 $inputed_data = array( 412 "request_id"=>$request_id,"user_id"=>$user_id, "amount_to_add"=>$amount_to_add, "wallet_id"=>$wallet_id); 413 414 $empty_input_array = array(); 415 //Loop & Find out empty inputs 416 foreach($inputed_data as $input_key=>$single_data){ 417 if(empty($single_data)){ 418 $empty_input_array[$input_key] = "field_required" ; 419 } 420 } 421 422 //RUN CHECKS 423 $result = array(); 424 $additonal_result = array(); 425 $txn_request_id = $user_id."_".$request_id; 426 427 $row_result = $wpdb->get_row("SELECT * FROM $wpdb->postmeta WHERE meta_key='txn_request_id' AND meta_value='$txn_request_id'" ); 428 if(!empty($row_result)){//it means txn has already exist 429 430 $funds_id = $row_result->post_id; 431 $status = "transaction_already_executed"; 432 $response_message = "Transaction already executed"; 433 $data = array("txn_id"=>$funds_id); 434 } 435 elseif(!empty($empty_input_array)){ 436 //if atleast one required input is empty 437 $status = "one_or_more_input_required"; 438 $response_message = "One or more input field is required"; 439 $data = $empty_input_array; 440 441 } 442 elseif($amount_to_add==0){ 443 $status = "amount_is_zero"; 444 $response_message = "Amount is Zero"; 445 $data = array("error"=>"Amount is zero"); 446 } 447 else{// ALL GOOD, PROCEED WITH OPERATION 448 $key = 'user_withdrawable_bal_'.strtolower($wallet_id); 449 $user_balance = get_user_meta($user_id, $key, true); 450 if (!is_numeric($user_balance) and !is_int($user_balance)){ 451 $user_balance = 0; 452 } 453 454 $bal_before = $user_balance; 455 $user_balance_total = $this->get_total_wallet_bal($user_id,$wallet_id); 456 457 $new_balance = $user_balance + $amount_to_add; 458 $new_balance = $new_balance; 459 460 $update_bal = update_user_meta($user_id, $key, $new_balance); 461 if($update_bal){//balance successfully updated 462 if($amount_to_add>0) { 463 $tnx_type = "CREDIT"; 464 } 465 else{ 466 $tnx_type = "DEBIT"; 467 $amount_to_add = $amount_to_add * -1; 468 } 469 470 $txn_add_bal_id = $this->record_Txn($user_id, $amount_to_add, $wallet_id, $tnx_type, 'publish'); 471 472 if(!empty($note)) { 473 add_post_meta($txn_add_bal_id, 'note', $note); 474 } 475 add_post_meta($txn_add_bal_id, 'request_id', $request_id); 476 add_post_meta($txn_add_bal_id, 'txn_request_id', $txn_request_id); 477 update_post_meta($txn_add_bal_id, 'balance_before', $bal_before); 478 update_post_meta($txn_add_bal_id, 'balance_after', $new_balance); 479 480 update_post_meta($txn_add_bal_id, 'total_balance_before', $user_balance_total); 481 update_post_meta($txn_add_bal_id, 'total_balance_after', $this->get_total_wallet_bal($user_id,$wallet_id)); 482 update_post_meta($txn_add_bal_id, 'funds_type', $key); 483 } 484 else{ 485 $status = "unknown_error"; 486 $response_message = "Unknown Error"; 487 $data = array(); 488 } 489 } 490 491 if($txn_add_bal_id>0){ 492 $result = $txn_add_bal_id; 493 }else{ 494 $result = array("status"=>$status, 495 "message"=>$response_message, 496 "data"=>$data); 497 $result = json_encode($result); 498 } 499 500 return $result; 501 } 502 503 function add_user_mature_funds_to_wallet($user_id,$amount_to_add,$wallet_id, $note='',$tags=[]){ 409 504 410 505 if(!empty($tags['txn_ref'])){ -
rimplenet/trunk/rimplenet.php
r2598651 r2599655 17 17 * Plugin URI: https://rimplenet.com 18 18 * Description: Rimplenet FinTech | E-Banking | E-Wallets | Investments Plugin | MLM | Matrix Tree | Referral Manager 19 * Version: 1.1.2 219 * Version: 1.1.23 20 20 * Author: Nellalink 21 21 * Author URI: https://rimplenet.com … … 35 35 * Using SemVer - https://semver.org 36 36 */ 37 define( 'RIMPLENET_VERSION', '1.1.2 2' );37 define( 'RIMPLENET_VERSION', '1.1.23' ); 38 38 39 39 /**
Note: See TracChangeset
for help on using the changeset viewer.