File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -383,12 +383,30 @@ public function record_create_subscription()
383383
384384 // If no trial or trial amount is zero then we've got to make
385385 // sure the confirmation txn lasts through the trial
386- if (!$ sub ->trial || ($ sub ->trial && $ sub ->trial_amount <= 0.00 )) {
387- $ trial_days = ($ sub ->trial ) ? $ sub ->trial_days : $ mepr_options ->grace_init_days ;
386+ // if (!$sub->trial || ($sub->trial && $sub->trial_amount <= 0.00)) {
387+ // $trial_days = ($sub->trial) ? $sub->trial_days : $mepr_options->grace_init_days;
388+ // $txn->status = MeprTransaction::$confirmed_str;
389+ // $txn->txn_type = MeprTransaction::$subscription_confirmation_str;
390+ // $txn->expires_at = MeprUtils::ts_to_mysql_date(time() + MeprUtils::days($trial_days), 'Y-m-d 23:59:59');
391+ // $txn->set_subtotal(0.00); // Just a confirmation txn
392+ // $txn->store();
393+ // }
394+
395+ if (!$ sub ->trial ) {
396+ $ txn ->status = MeprTransaction::$ confirmed_str ;
397+ $ txn ->txn_type = MeprTransaction::$ subscription_confirmation_str ;
398+ $ next_payment_date = $ sdata ->next_payment_date ;
399+ $ txn ->expires_at = MeprUtils::ts_to_mysql_date (strtotime ($ next_payment_date ), 'Y-m-d 23:59:59 ' );
400+
401+ $ txn ->store ();
402+ }
403+
404+ else if ($ sub ->trial && $ sub ->trial_amount <= 0.00 ) {
405+ $ trial_days = $ sub ->trial_days ;
388406 $ txn ->status = MeprTransaction::$ confirmed_str ;
389407 $ txn ->txn_type = MeprTransaction::$ subscription_confirmation_str ;
390408 $ txn ->expires_at = MeprUtils::ts_to_mysql_date (time () + MeprUtils::days ($ trial_days ), 'Y-m-d 23:59:59 ' );
391- $ txn -> set_subtotal ( 0.00 ); // Just a confirmation txn
409+
392410 $ txn ->store ();
393411 }
394412
You can’t perform that action at this time.
0 commit comments