public function init($file) { if (!loggedIn()) { return false; } if (!is_a($file, "SocialApparatus\\File")) { return false; } $product = getEntity($file->container_guid); if (!is_a($product, "SocialApparatus\\Product")) { return false; } $user = getLoggedInUser(); if ($user->stripe_cust) { \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey()); $orders = \Stripe\Order::all(array("limit" => 300, "customer" => $user->stripe_cust)); foreach ($orders['data'] as $order) { foreach ($order->items as $item) { if ($item->description != "Taxes (included)" && $item->description != "Free shipping") { $sku = $item->parent; if ($sku == $product->stripe_sku) { return true; } } } } } return false; }
* @author Shane Barron <*****@*****.**> * @author Aaustin Barron <*****@*****.**> * @copyright 2015 SocialApparatus * @license http://opensource.org/licenses/MIT MIT * @version 1 * @link http://socialapparatus.com */ namespace SocialApparatus; denyDirect(); gateKeeper(); $user = getLoggedInUser(); if ($user->stripe_cust) { \Stripe\Stripe::setApiKey(EcommercePlugin::secretKey()); $subscriptions = \Stripe\Customer::retrieve($user->stripe_cust)->subscriptions->all(array('limit' => 300)); $orders = \Stripe\Order::all(array("limit" => 300, "customer" => $user->stripe_cust)); ?> <h2>Orders</h2> <table class='table table-striped table-hover table-bordered'> <tr> <th>Date</th> <th>Order ID</th> <th>Amount</th> <th>Status</th> <th>Details</th> </tr> <?php foreach ($orders['data'] as $order) { $details_url = getSiteURL() . "order/" . $order->id; ?> <tr>