Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public void Save <T>(AzureStorageEntity <T> data, string containerName)
 {
     CloudTable     table           = tableClient.GetTableReference(containerName);
     TableOperation insertOperation = TableOperation.InsertOrReplace(data);
     var            result          = table.Execute(insertOperation);
 }