Plugin Directory

Changeset 2575892


Ignore:
Timestamp:
08/01/2021 03:11:40 AM (5 years ago)
Author:
nellalink
Message:

1.1.16

  • Investment Packages Capital can now be refunded to users on Investment Contract Completion
Location:
rimplenet/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • rimplenet/trunk/README.txt

    r2574985 r2575892  
    55Requires at least: 3.0.1
    66Tested up to: 5.8
    7 Stable tag: 1.1.14
     7Stable tag: 1.1.16
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    8181== Changelog ==
    8282
     83= 1.1.16 =
     84* Investment Packages Capital can now be refunded to users on Investment Contract Completion
    8385= 1.1.15 =
    8486* Investment Packages now works async
     
    118120
    119121== Upgrade Notice ==
     122= 1.1.16 =
     123* Investment Packages Capital can now be refunded to users on Investment Contract Completion
    120124= 1.1.15 =
    121125* Investment Packages now works async
  • rimplenet/trunk/includes/class-emails.php

    r2574985 r2575892  
    115115                 <p style='background:#2d2f33; color:white; padding:25px; text-align:center;'>
    116116                    This email was sent from <a href='$blogurl' style='color: #d28787;'> $blogname_uppercase </a>
     117                    <small>Powered by <em><a href='https://rimplenet.com'>Rimplenet</a></em></small>
    117118                 </p>
    118119                <div/>";
  • rimplenet/trunk/includes/class-investments.php

    r2469226 r2575892  
    77     add_shortcode('rimplenet-investment-form', array($this, 'RimplenetInvestmentForm'));
    88     add_filter('rimplenet_constant_var', array($this, 'apply_rimplenet_constant_var_on_package_investment_rules'), 1, 3);
     9     add_action('wp',array($this,'return_investment_capital'));
    910   
     11 }
     12 
     13 function return_investment_capital(){
     14   
     15    $post_per_page = rand(1,500);
     16    $txn_loop = new WP_Query(
     17      array(
     18      'post_type' => 'rimplenettransaction',
     19      'post_status' => 'publish',
     20      'order' => 'ASC',
     21      'posts_per_page'=>$post_per_page ,
     22      'meta_query' => array(
     23          'relation' => 'AND',
     24          array(
     25              'key' => 'time_for_invested_amount_to_be_returned',
     26              'compare' => 'EXISTS',
     27              ),
     28         array(
     29             'key' => 'invesment_returned',
     30             'compare' => 'NOT EXISTS',
     31             ),
     32       ),
     33      'tax_query'     => array(
     34        array(
     35          'taxonomy' => 'rimplenettransaction_type',
     36          'field'    => 'name',
     37          'terms'    => 'INVESTMENTS',
     38        ),
     39        ),
     40      'fields'        => 'ids', // Only get post IDs
     41      )
     42     );
     43
     44    $investments_id_array = $txn_loop->posts;
     45    wp_reset_postdata();
     46   
     47    foreach($investments_id_array as $key=>$inv_id){
     48        $time_for_refund = get_post_meta($inv_id,"time_for_invested_amount_to_be_returned",true);
     49        $current_time = time();
     50       
     51        if($current_time>$time_for_refund){
     52         
     53          $wallet_obj = new Rimplenet_Wallets();
     54          $all_wallets = $wallet_obj->getWallets();
     55          $txn_owner_user_id = get_post_field('post_author',$inv_id);
     56          $amount_to_returned = get_post_field( "amount", $inv_id);
     57          $investment_wallet = get_post_field("currency", $inv_id);
     58          $note = "Capital Returns for Investment - #$inv_id";
     59          $tags["txn_ref"] = "invested_amount_returned_on_investment_".$inv_id;
     60         
     61          $funds_id_capital_returned = $wallet_obj->add_user_mature_funds_to_wallet($txn_owner_user_id, $amount_to_returned, $investment_wallet,$note,$tags); 
     62             
     63          update_post_meta($inv_id, "invesment_returned","yes");
     64          add_post_meta($inv_id, "time_invesment_returned",time());
     65          add_post_meta($inv_id, "invesment_returned_txn_id",$funds_id_capital_returned);
     66        }
     67    }
    1068 }
    1169 
     
    1371       
    1472       
    15         $wallet_obj = new Rimplenet_Wallets();
    16         $user_wdr_bal = $wallet_obj->get_withdrawable_wallet_bal($user_id, $wallet_id);
    17         $user_non_wdr_bal = $wallet_obj->get_nonwithdrawable_wallet_bal($user_id, $wallet_id);
    18        
    19         $walllets = $wallet_obj->getWallets();
     73        $wallet_obj = new Rimplenet_Wallets();
     74        $user_wdr_bal = $wallet_obj->get_withdrawable_wallet_bal($user_id, $wallet_id);
     75        $user_non_wdr_bal = $wallet_obj->get_nonwithdrawable_wallet_bal($user_id, $wallet_id);
     76       
     77        $walllets = $wallet_obj->getWallets();
    2078        $dec = $walllets[$wallet_id]['decimal'];
    2179        $symbol = $walllets[$wallet_id]['symbol'];
     
    2381         
    2482        $balance = $symbol.number_format($balance,$dec);
    25        
     83       
    2684         if (empty($amount_to_invest) OR empty($wallet_id) OR empty($user_id)) {
    27             $investment_info = 'One or more compulsory field is empty';
    28           }
    29         elseif ($amount_to_invest>$user_wdr_bal) {
    30             $investment_info = 'Amount to Invest - <strong>['.getRimplenetWalletFormattedAmount($amount_to_invest,$wallet_id).']</strong> is larger than the amount in your mature wallet, input amount not more than the balance in your <strong>( '.$name.' mature wallet - ['.getRimplenetWalletFormattedAmount($user_wdr_bal,$wallet_id).'] ),</strong> the balance in your <strong>( '.$name.' immature wallet  - ['. getRimplenetWalletFormattedAmount($user_non_wdr_bal,$wallet_id).'] )</strong>  cannot be invested until maturity';
    31           }
     85            $investment_info = 'One or more compulsory field is empty';
     86          }
     87        elseif ($amount_to_invest>$user_wdr_bal) {
     88            $investment_info = 'Amount to Invest - <strong>['.getRimplenetWalletFormattedAmount($amount_to_invest,$wallet_id).']</strong> is larger than the amount in your mature wallet, input amount not more than the balance in your <strong>( '.$name.' mature wallet - ['.getRimplenetWalletFormattedAmount($user_wdr_bal,$wallet_id).'] ),</strong> the balance in your <strong>( '.$name.' immature wallet  - ['. getRimplenetWalletFormattedAmount($user_non_wdr_bal,$wallet_id).'] )</strong>  cannot be invested until maturity';
     89          }
    3290   
    33        
    34         else{
    35            
    36                  
     91       
     92        else{
     93           
     94                 
    3795       
    3896         $amount_to_invest = $amount_to_invest * -1;
     
    59117             
    60118          }
    61         }
     119        }
    62120     wp_reset_postdata();
    63121    return $investment_info;
     
    67125 
    68126 public function RimplenetInvestmentForm($atts) {
    69            
     127           
    70128
    71         ob_start();
     129        ob_start();
    72130
    73         include plugin_dir_path( __FILE__ ) . 'layouts/rimplenet-investment-form.php';
    74          
    75         $output = ob_get_clean();
     131        include plugin_dir_path( __FILE__ ) . 'layouts/rimplenet-investment-form.php';
     132         
     133        $output = ob_get_clean();
    76134
    77         return $output;
    78      
     135        return $output;
     136     
    79137 }
    80138 
     
    102160               
    103161              if (is_numeric($investment_amount)) {
    104                 //Extract the constant match using the preg_match_all function to $inv_amount_percent_matches.
     162                //Extract the constant match using the preg_match_all function to $inv_amount_percent_matches.
    105163                preg_match_all('/{RIMPLENET_CONSTANT_VAR_\S*_PERCENT_OF_INVESTMENT_AMOUNT}/', $rules, $inv_amount_percent_matches);
    106164                 
    107                    
     165                   
    108166                //Any matches will be in our $inv_amount_percent_matches array of array
    109167                foreach($inv_amount_percent_matches[0] as $inv_amount_percent_match ){
     
    128186        }
    129187        else{
    130             $status = $rules;
     188            $status = $rules;
    131189        }
    132190       
  • rimplenet/trunk/includes/class-package-plans-and-rules.php

    r2574985 r2575892  
    296296   {
    297297
     298    $post_per_page = rand(50,500);
    298299    $txn_loop = new WP_Query(
    299300      array(
    300301      'post_type' => 'rimplenettransaction',
    301       'posts_per_page'   => 50, // get 50 transaction.
     302      'posts_per_page'   => $post_per_page, // get posts.
    302303      'order' => 'ASC',
    303304      'post_status'    => 'publish',
     
    310311            ),
    311312            array(
    312                 'key'     => 'package_investment_rule_executed',
    313                 'value'   => 'yes',
    314                 'compare' => '!=',
     313                'key' => 'invesment_returned',
     314                'compare' => 'NOT EXISTS',
    315315            ),
    316316        ),
  • rimplenet/trunk/includes/layouts/rimplenet-investment-form.php

    r2503129 r2575892  
    11<?php
     2//Included from shortcode in includes/class-investments.php
     3//use case [rimplenet-investment-form linked_package="868" wallet_id="eth,blcc" min="eth:0.1,blcc:20" max="eth:10,blcc:5000" time_to_return_invested_amount="+3 hours"]
    24   if(!is_user_logged_in()) {
    35?>
     
    1416   }
    1517?>
     18
    1619<?php
    17 //Included from shortcode in includes/class-investments.php
    18 //use case [rimplenet-investment-form linked_package="868" wallet_id="eth,blcc" min="eth:0.1,blcc:20" max="eth:10,blcc:5000"]
    1920 global $current_user;
    2021 wp_get_current_user();
     
    2627    'linked_package' => '',
    2728    'wallet_id' => 'all',
     29    'time_to_return_invested_amount' => '',
    2830    'min' => '0',
    2931    'max' => INF,
     
    3840$linked_package = $atts['linked_package'];
    3941$wallet_id = $atts['wallet_id'];
     42$time_to_return_invested_amount = $atts['time_to_return_invested_amount'];
    4043$min = $atts['min'];
    4144$max = $atts['max'];
     
    117120                    $status_success = 'Investment Successful';
    118121                    if(!empty($linked_package)){
    119                     update_post_meta($investment_info,'linked_package',$linked_package);
     122                      update_post_meta($investment_info,'linked_package',$linked_package);
    120123                    }
     124                    if(!empty($time_to_return_invested_amount)){
     125                      $time_to_return_investment = strtotime($time_to_return_invested_amount);
     126                      update_post_meta($investment_info,'time_for_invested_amount_to_be_returned',$time_to_return_investment);
     127                    }
     128                   
    121129                    do_action('rimplenet_investment_successful', $investment_info, $current_user, $wallet_id, $amount,$note );
    122130               
  • rimplenet/trunk/rimplenet.php

    r2574985 r2575892  
    1717 * Plugin URI:        https://rimplenet.com
    1818 * Description:       Rimplenet FinTech | E-Banking | E-Wallets  | Investments Plugin | MLM | Matrix Tree | Referral Manager
    19  * Version:           1.1.15
     19 * Version:           1.1.16
    2020 * Author:            Nellalink
    2121 * Author URI:        https://rimplenet.com
     
    3535 * Using SemVer - https://semver.org
    3636 */
    37 define( 'RIMPLENET_VERSION', '1.1.1' );
     37define( 'RIMPLENET_VERSION', '1.1.16' );
    3838
    3939/**
Note: See TracChangeset for help on using the changeset viewer.