Addressing PR comments
This commit is contained in:
Родитель
d475b1f138
Коммит
6379758ff1
|
@ -118,7 +118,7 @@
|
|||
<!-- The Default Customers Agreement csv file, leave empty to prompt user to enter it -->
|
||||
<add key="DefaultCustomerAgreementCsvFileName" value="" />
|
||||
<!-- The Default Renewal Term Duration, leave empty to prompt user to enter it -->
|
||||
<add key="DefaultTermDuration" value="" />
|
||||
<add key="DefaultRenewalTermDuration" value="" />
|
||||
</ScenarioSettings>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
|
|
@ -509,14 +509,14 @@ namespace Microsoft.Store.PartnerCenter.Samples
|
|||
/// Obtain renewal TermDuration to work with from the configuration if set there or prompts the user to enter it.
|
||||
/// </summary>
|
||||
/// <param name="promptMessage">An optional custom prompt message</param>
|
||||
/// <returns>Term Duration</returns>
|
||||
protected string ObtainTermDuration(string promptMessage = default(string))
|
||||
/// <returns>Renewal Term Duration</returns>
|
||||
protected string ObtainRenewalTermDuration(string promptMessage = default(string))
|
||||
{
|
||||
return this.ObtainValue(
|
||||
this.Context.Configuration.Scenario.DefaultTermDuration,
|
||||
"Term Duration",
|
||||
this.Context.Configuration.Scenario.DefaultRenewalTermDuration,
|
||||
"Renewal Term Duration",
|
||||
string.IsNullOrWhiteSpace(promptMessage) ? "Enter the renewal Term Duration ID" : promptMessage,
|
||||
"The term duration can't be empty");
|
||||
"The renewal term duration can't be empty");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace Microsoft.Store.PartnerCenter.Samples.Carts
|
|||
|
||||
string customerId = this.ObtainCustomerId("Enter the ID of the customer making the purchase");
|
||||
string catalogItemId = this.ObtainCatalogItemId("Enter the catalog Item Id");
|
||||
string quantity = this.ObtainQuantity("Enter the Quantity");
|
||||
string countryCode = this.Context.ConsoleHelper.ReadNonEmptyString("Enter the 2 digit country code of the availability", "The country code can't be empty");
|
||||
string productId = catalogItemId.Split(':')[0];
|
||||
string skuId = catalogItemId.Split(':')[1];
|
||||
|
@ -44,7 +45,7 @@ namespace Microsoft.Store.PartnerCenter.Samples.Carts
|
|||
string scope = string.Empty;
|
||||
string subscriptionId = string.Empty;
|
||||
string duration = string.Empty;
|
||||
string termDuration = string.Empty;
|
||||
string renewalTermDuration = string.Empty;
|
||||
var sku = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Get();
|
||||
var availability = partnerOperations.Products.ByCountry(countryCode).ById(productId).Skus.ById(skuId).Availabilities.ById(availabilityId).Get();
|
||||
|
||||
|
@ -80,7 +81,17 @@ namespace Microsoft.Store.PartnerCenter.Samples.Carts
|
|||
|
||||
if (sku.IsTrial && availability.Terms.Any(r => r.RenewalOptions.Any(t => t.TermDuration != null)))
|
||||
{
|
||||
termDuration = this.ObtainTermDuration("Enter the term duration that you want to renew into (P1M or P1Y)");
|
||||
var renewalTermDurationOptions = (from term in availability.Terms from renewalOption in term.RenewalOptions select renewalOption.TermDuration).ToList();
|
||||
var termDurationOptions = string.Join(",", renewalTermDurationOptions);
|
||||
if (renewalTermDurationOptions.Count > 1)
|
||||
{
|
||||
this.Context.ConsoleHelper.WriteObject(termDurationOptions, "Renewal Term Duration Options");
|
||||
renewalTermDuration = this.ObtainRenewalTermDuration("Enter the renewal term duration that you want to renew into");
|
||||
}
|
||||
else
|
||||
{
|
||||
renewalTermDuration = termDurationOptions;
|
||||
}
|
||||
}
|
||||
|
||||
var cart = new Cart()
|
||||
|
@ -91,13 +102,13 @@ namespace Microsoft.Store.PartnerCenter.Samples.Carts
|
|||
{
|
||||
CatalogItemId = catalogItemId,
|
||||
FriendlyName = "Myofferpurchase",
|
||||
Quantity = termDuration == String.Empty ? 1 : 10,
|
||||
Quantity = Convert.ToInt32(quantity),
|
||||
TermDuration = availability.Terms.First().Duration ?? null ,
|
||||
BillingCycle = sku.SupportedBillingCycles.ToArray().First(),
|
||||
ProvisioningContext = ProvisioningContext,
|
||||
RenewsTo = termDuration == String.Empty ? null : new RenewsTo()
|
||||
RenewsTo = renewalTermDuration == string.Empty ? null : new RenewsTo()
|
||||
{
|
||||
TermDuration = termDuration
|
||||
TermDuration = renewalTermDuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -437,11 +437,11 @@ namespace Microsoft.Store.PartnerCenter.Samples.Configuration
|
|||
/// <summary>
|
||||
/// Gets the default renewal term duration.
|
||||
/// </summary>
|
||||
public string DefaultTermDuration
|
||||
public string DefaultRenewalTermDuration
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ConfigurationSection["DefaultTermDuration"];
|
||||
return this.ConfigurationSection["DefaultRenewalTermDuration"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче