| @@ -81,5 +81,23 @@ | ||
| 81 | 81 | 's_ctx_ts' => $timestamp, |
| 82 | 82 | 's_ctx_secure' => $this->get_secure_token( $entity, $timestamp, $action ), |
| 83 | 83 | ); |
| 84 | 84 | } |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Gets a sandbox trial token for a given plugin, plan, and trial timestamp. | |
| 88 | + * | |
| 89 | + * @param FS_Plugin $plugin | |
| 90 | + * @param FS_Plugin_Plan $plan | |
| 91 | + * @param int $trial_timestamp | |
| 92 | + * | |
| 93 | + * @return string | |
| 94 | + */ | |
| 95 | + function get_trial_token( FS_Plugin $plugin, FS_Plugin_Plan $plan, $trial_timestamp ) { | |
| 96 | + return md5( | |
| 97 | + $plugin->secret_key . $plugin->public_key . | |
| 98 | + $plan->trial_period . | |
| 99 | + $plan->id . | |
| 100 | + $trial_timestamp | |
| 101 | + ); | |
| 102 | + } | |
| 85 | 103 | } |