Example #1
0
 public void monthly_order_should_bump_users_stream()
 {
     customer.StreamUntil = DateTime.Today.AddYears(-1);
     Assert.False(DigitalRights.CanStream(customer, production));
     MonthlyOrder();
     DigitalRights.AuthorizeOrder(customer, order);
     Assert.Greater(DateTime.Today.AddDays(25), customer.StreamUntil);
     Assert.True(DigitalRights.CanStream(customer, production));
 }
Example #2
0
 public void production_order_should_allow_access_forever()
 {
     //reset
     Massive.DB.Current.Execute("DELETE FROM Customers_Productions");
     Assert.False(DigitalRights.CanDownload(customer, production));
     Assert.False(DigitalRights.CanStream(customer, production));
     ProductOrder();
     DigitalRights.AuthorizeOrder(customer, order);
     Assert.True(DigitalRights.CanDownload(customer, production));
     Assert.True(DigitalRights.CanStream(customer, production));
 }
Example #3
0
 public void yearly_order_should_bump_users_stream()
 {
     //reset
     customer.StreamUntil   = DateTime.Today.AddYears(-2);
     customer.DownloadUntil = DateTime.Today.AddYears(-2);
     Assert.False(DigitalRights.CanDownload(customer, production));
     Assert.False(DigitalRights.CanStream(customer, production));
     AnnualOrder();
     DigitalRights.AuthorizeOrder(customer, order);
     Assert.Greater(DateTime.Today.AddMonths(11), customer.StreamUntil);
     Assert.Greater(DateTime.Today.AddMonths(11), customer.DownloadUntil);
     Assert.True(DigitalRights.CanDownload(customer, production));
     Assert.True(DigitalRights.CanStream(customer, production));
 }
Example #4
0
        public ActionResult Receiver()
        {
            try {
                //this is a ping from Shopify, record the order...
                var     json     = this.ReadJson();
                var     newOrder = System.Web.Helpers.Json.Decode(json);
                dynamic order    = _orders.CreateFromPing(newOrder);

                //tell Customers we just received an Order
                var customer = _customers.OrderReived(order);

                //Give them rights to the bits...
                DigitalRights.AuthorizeOrder(customer, order);
            } catch (Exception x) {
                Logger.LogFatal(x);

                //rethrow
                throw x;
            }
            //if all worked out, return a 200
            //if something failed we've logged it - and Shopify will keep sending until we return 200...
            return(Content("OK"));
        }