コード例 #1
0
        public FulfillOrderResponse FulfillOrder(FulfillOrderRequest request)
        {
            FulfillOrderResponse response = new FulfillOrderResponse();

            dynamic zuoraResp    = new ExpandoObject();
            var     subscription = SubscriptionManager.Get(request.Account.AccountNumber);

            if (subscription != null)
            {
                zuoraResp = SubscriptionManager.Amend(request, subscription);
            }
            else
            {
                zuoraResp = SubscriptionManager.Create(request);
            }

            if (zuoraResp.Errors.Count == 0)
            {
                response.AccountNumber           = zuoraResp.AccountNumber;
                request.Account.AccountNumber    = zuoraResp.AccountNumber;
                request.Order.SubscriptionNumber = zuoraResp.SubscriptionNumber;
                response.SubscriptionNumber      = zuoraResp.SubscriptionNumber;
                response.InvoiceNumber           = zuoraResp.InvoiceNumber;
                response.InvoiceId           = zuoraResp.InvoiceId;
                response.AccountId           = zuoraResp.AccountId;
                response.InvoiceTotalAmount  = zuoraResp.TotalAmount;
                response.InvoiceTaxAmount    = zuoraResp.Tax;
                response.InvoiceBalance      = zuoraResp.Balance;
                response.BillToContactId     = zuoraResp.BillToId;
                response.SoldToContactId     = zuoraResp.SoldToId;
                response.InvoiceLineItems    = request.Order.LineItems;
                response.Entitlements        = ProvisionManager.Provision(request);
                response.CloudLicenseServers = request.GetDevices();

                response.Successful = true;
                var ase = new AzureStorageEntity(response.SubscriptionNumber, response.AccountNumber, response.ToJsonString());
                new AzureSaveToTableStorageCommand(storageName).
                Execute(ase);
            }
            else
            {
                response.Successful = false;
                response.Errors     = zuoraResp.Errors;
            }


            return(response);
        }
コード例 #2
0
        public FulfillOrderResponse RenewOrder(FulfillOrderRequest request)
        {
            FulfillOrderResponse response = new FulfillOrderResponse();

            dynamic zuoraResp    = new ExpandoObject();
            var     subscription = SubscriptionManager.Get(request.Account.AccountNumber);

            if (subscription != null)
            {
                zuoraResp = SubscriptionManager.Amend(request, subscription);
            }
            else
            {
            }


            if (zuoraResp.Errors.Count == 0)
            {
                response.AccountNumber           = zuoraResp.AccountNumber;
                request.Account.AccountNumber    = zuoraResp.AccountNumber;
                request.Order.SubscriptionNumber = zuoraResp.SubscriptionNumber;
                response.SubscriptionNumber      = zuoraResp.SubscriptionNumber;
                response.InvoiceNumber           = zuoraResp.InvoiceNumber;
                response.InvoiceId          = zuoraResp.InvoiceId;
                response.AccountId          = zuoraResp.AccountId;
                response.InvoiceTotalAmount = zuoraResp.TotalAmount;
                response.InvoiceTaxAmount   = zuoraResp.Tax;
                response.InvoiceBalance     = zuoraResp.Balance;

                response.Entitlements        = ProvisionManager.Provision(request);
                response.CloudLicenseServers = request.GetDevices();
                response.Successful          = true;

                if (StorageManager != null)
                {
                    StorageManager.Save <OrderDetail>(null);
                }
            }
            else
            {
                response.Successful = false;
                response.Errors     = zuoraResp.Errors;
            }


            return(response);
        }