Пример #1
0
        public static void CallBack(PaymentCallback callback, RenderContext context)
        {
            var workers = Lib.IOC.Service.GetInstances <IPaymentCallbackWorker>();

            foreach (var item in workers)
            {
                item.Process(callback, context);
            }
        }
        public void Process(PaymentCallback callback, RenderContext context)
        {
            if (context.WebSite != null && callback.RequestId != default(Guid))
            {
                var sitedb = context.WebSite.SiteDb();
                // fire the code first...
                var callbackrepo = sitedb.GetSiteRepository <PaymentCallBackRepository>();

                callbackrepo.AddOrUpdate(callback);

                var requestrepo = sitedb.GetSiteRepository <PaymentRequestRepository>();

                if (callback.Paid)
                {
                    requestrepo.Store.UpdateColumn <bool>(callback.RequestId, o => o.Paid, true);
                }
                else if (callback.Cancelled || callback.Rejected)
                {
                    requestrepo.Store.UpdateColumn <bool>(callback.RequestId, o => o.Failed, true);
                }
                // update the order information....
            }
        }