diff --git a/plugin/StripeYPT/build.php b/plugin/StripeYPT/build.php index 1a9e2bc4b..37360ffef 100644 --- a/plugin/StripeYPT/build.php +++ b/plugin/StripeYPT/build.php @@ -1,25 +1,25 @@ #!/usr/bin/env php cancelSubscriptions($_GET['subscription_tid']); - _error_log('listSubscription::cancel subscritpion canceled '. json_encode($response)); - if(!empty($_REQUEST['plans_id']) && !empty($_REQUEST['users_id'])){ + _error_log('listSubscription::cancel subscritpion canceled ' . json_encode($response)); + if (!empty($_REQUEST['plans_id']) && !empty($_REQUEST['users_id'])) { $row = SubscriptionTable::getSubscription($_REQUEST['users_id'], $_REQUEST['plans_id']); - if(!empty($response)){ + if (!empty($response)) { SubscriptionTable::updateStripeCostumerId($row['id'], "canceled"); } - }else{ + } else { _error_log('listSubscription::cancel plans_id or user not found'); } } ?> <?php echo __("Stripe Subscription") . $config->getPageTitleSeparator() . $config->getWebSiteTitle(); ?> + -
- +
+
+
-
-
-
- getAllSubscriptions(); - foreach ($subs->data as $value) { - $users_id = $value->metadata->users_id; - $plans_id = $value->metadata->plans_id; + +
+
+
+
+
+ getAllSubscriptions(); + foreach ($subs->data as $value) { + $users_id = $value->metadata->users_id; + $plans_id = $value->metadata->plans_id; - $title = ""; - $body = ""; - $buttonClass = "danger"; + $title = ""; + $body = ""; + $buttonClass = "danger"; - if (!empty($users_id)) { - $user = new User($users_id); - if (!empty($user)) { - $title .= $user->getName() . " (" . $user->getEmail() . ")"; - } - } else { - $title .= "User ID Not found"; - } - if (AVideoPlugin::isEnabledByName("Subscription")) { - if (!empty($plans_id)) { - $plan = new SubscriptionPlansTable($plans_id); - if (!empty($plan)) { - $title .= " [" . $plan->getName() . "]"; - $row = SubscriptionTable::getSubscription($users_id, $plans_id); - if (!empty($row)) { - $buttonClass = "success"; + if (!empty($users_id)) { + $user = new User($users_id); + if (!empty($user)) { + $title .= $user->getName() . " (" . $user->getEmail() . ")"; + } + } else { + $title .= "User ID Not found"; + } + if (AVideoPlugin::isEnabledByName("Subscription")) { + if (!empty($plans_id)) { + $plan = new SubscriptionPlansTable($plans_id); + if (!empty($plan)) { + $title .= " [" . $plan->getName() . "]"; + $row = SubscriptionTable::getSubscription($users_id, $plans_id); + if (!empty($row)) { + $buttonClass = "success"; + } + } + } else { + $title .= " [Plan ID Not found]"; } } - } else { - $title .= " [Plan ID Not found]"; + $body .= "Created in: " . date("Y-m-d", $value->created); + foreach ($value->items->data as $value2) { + $body .= "
Plan: " . $value2->plan->nickname; + $body .= "
Value: " . StripeYPT::addDot($value2->plan->amount) . " " . $value2->plan->currency; + $body .= "
Interval: each " . $value2->plan->interval_count . " " . $value2->plan->interval; + } + ?> +
+
+
+
+ +
+
+ Created in: " . date("Y-m-d", $value->created); - foreach ($value->items->data as $value2) { - $body .= "
Plan: " . $value2->plan->nickname; - $body .= "
Value: " . StripeYPT::addDot($value2->plan->amount) . " " . $value2->plan->currency; - $body .= "
Interval: each " . $value2->plan->interval_count . " " . $value2->plan->interval; - } - ?> -
-
-
-
- -
-
- -
-
-
-
- getAllSubscriptions('trialing'); - foreach ($subs->data as $value) { - $users_id = $value->metadata->users_id; - $plans_id = $value->metadata->plans_id; + ?> +
+
+
+
+ getAllSubscriptions('trialing'); + foreach ($subs->data as $value) { + $users_id = $value->metadata->users_id; + $plans_id = $value->metadata->plans_id; - $title = ""; - $body = ""; - $buttonClass = "danger"; + $title = ""; + $body = ""; + $buttonClass = "danger"; - if (!empty($users_id)) { - $user = new User($users_id); - if (!empty($user)) { - $title .= $user->getName() . " (" . $user->getEmail() . ")"; - } - } else { - $title .= "User ID Not found"; - } - if (AVideoPlugin::isEnabledByName("Subscription")) { - if (!empty($plans_id)) { - $plan = new SubscriptionPlansTable($plans_id); - if (!empty($plan)) { - $title .= " [" . $plan->getName() . "]"; - $row = SubscriptionTable::getSubscription($users_id, $plans_id); - if (!empty($row)) { - $buttonClass = "success"; + if (!empty($users_id)) { + $user = new User($users_id); + if (!empty($user)) { + $title .= $user->getName() . " (" . $user->getEmail() . ")"; } + } else { + $title .= "User ID Not found"; } - } else { - $title .= " [Plan ID Not found]"; + if (AVideoPlugin::isEnabledByName("Subscription")) { + if (!empty($plans_id)) { + $plan = new SubscriptionPlansTable($plans_id); + if (!empty($plan)) { + $title .= " [" . $plan->getName() . "]"; + $row = SubscriptionTable::getSubscription($users_id, $plans_id); + if (!empty($row)) { + $buttonClass = "success"; + } + } + } else { + $title .= " [Plan ID Not found]"; + } + } + $body .= "Created in: " . date("Y-m-d", $value->created); + foreach ($value->items->data as $value2) { + $body .= "
Plan: " . $value2->plan->nickname; + $body .= "
Value: " . StripeYPT::addDot($value2->plan->amount) . " " . $value2->plan->currency; + $body .= "
Interval: each " . $value2->plan->interval_count . " " . $value2->plan->interval; + } + ?> +
+
+
+
+ +
+
+ Created in: " . date("Y-m-d", $value->created); - foreach ($value->items->data as $value2) { - $body .= "
Plan: " . $value2->plan->nickname; - $body .= "
Value: " . StripeYPT::addDot($value2->plan->amount) . " " . $value2->plan->currency; - $body .= "
Interval: each " . $value2->plan->interval_count . " " . $value2->plan->interval; - } - ?> -
-
-
-
- -
-
- + ?> +
+
+
+ + +
diff --git a/plugin/StripeYPT/pluginMenu.html b/plugin/StripeYPT/pluginMenu.html index 9d6a5c779..3e728f828 100644 --- a/plugin/StripeYPT/pluginMenu.html +++ b/plugin/StripeYPT/pluginMenu.html @@ -1 +1 @@ - List Subscriptions \ No newline at end of file + \ No newline at end of file