microsoft / Partner-Center-PowerShell

PowerShell module for managing Partner Center resources.
https://docs.microsoft.com/powershell/partnercenter/
MIT License
132 stars 60 forks source link

Submit-PartnerCustomerCart does not apply FriendlyName based on PSCartLineItem #316

Open cblackuk opened 4 years ago

cblackuk commented 4 years ago

Steps to reproduce


$LineItem = New-Object -TypeName Microsoft.Store.PartnerCenter.PowerShell.Models.Carts.PSCartLineItem
$LineItem.BillingCycle = "Monthly"
$LineItem.CatalogItemId = $ProductAvailability.CatalogItemId
$LineItem.FriendlyName = "Microsoft Azure Plan - UKCloud"
$LineItem.CurrencyCode = "GBP"
$LineItem.Quantity = 1
$CartId = New-PartnerCustomerCart -CustomerId $Customer.CustomerId -LineItems $LineItem
$AddCartId = Add-PartnerCustomerCartLineItem -CustomerId $Customer.CustomerId -LineItem $LineItem -CartId $CartId.CartId
$CartId

ExpirationTimestamp   : 7/3/2020 2:49:49 PM
CartId                : c2db8d0a-c4d6-4f0a-acab-fd68b990785b
LastModifiedTimestamp : 6/26/2020 2:49:47 PM
LastModifiedUser      : 7953d35c-1da7-4e57-aa77-2babd020f1dd
LineItems             : {0}
Status                : Active

PS C:\AzureStackDeployment\modules> $CartId.LineItems

BillingCycle        : Monthly
CatalogItemId       : DZH318Z0BPS6:0001:DZH318Z0BMGV
CurrencyCode        : GBP
Error               :
FriendlyName        : Microsoft Azure Plan - UKCloud
Id                  : 0
OrderGroup          : 0
Participants        :
ProvisioningContext : {}
Quantity            : 1
RenewsTo            :
TermDuration        :

PS C:\AzureStackDeployment\modules> $CartId.LineItems.Provisionincontext
PS C:\AzureStackDeployment\modules> $CartId.LineItems | select *

AddonItems          :
CatalogItemId       : DZH318Z0BPS6:0001:DZH318Z0BMGV
CurrencyCode        : GBP
Id                  : 0
Participants        :
ProvisioningContext : {}
TermDuration        :

PS C:\AzureStackDeployment\modules> $AddCartId

CreationTimestamp     : 6/26/2020 2:50:01 PM
ExpirationTimestamp   : 7/3/2020 2:50:02 PM
CartId                : c2db8d0a-c4d6-4f0a-acab-fd68b990785b
LastModifiedTimestamp : 6/26/2020 2:50:01 PM
LastModifiedUser      : 7953d35c-1da7-4e57-aa77-2babd020f1dd
LineItems             : {0}
Status                : Active

PS C:\AzureStackDeployment\modules> $AddCartId.LineItems

AddonItems          :
BillingCycle        : Monthly
CatalogItemId       : DZH318Z0BPS6:0001:DZH318Z0BMGV
Error               :
FriendlyName        : Microsoft Azure Plan - UKCloud
Id                  : 0
OrderGroup          : 0
Participants        :
ProvisioningContext : {}
Quantity            : 1
RenewsTo            :

$AddCartId.CartId
c2db8d0a-c4d6-4f0a-acab-fd68b990785b
$CartId.CartId
c2db8d0a-c4d6-4f0a-acab-fd68b990785b

$SubmitCartId = Submit-PartnerCustomerCart -CartId $CartId.CartId -CustomerId $Customer.CustomerId -Verbose
VERBOSE: Performing the operation "Submit-PartnerCustomerCart" on target "Checks out the cart with the identifier ofc2db8d0a-c4d6-4f0a-acab-fd68b990785b.".

PS C:\AzureStackDeployment\modules> $SubmitCartId.Orders

BillingCycle        : Monthly
CreationDate        : 6/26/2020 3:00:24 PM
CurrencyCode        : GBP
CurrencySymbol      : £
Id                  : Tn6z-u0YFTRuruZKiR9ARZig_3Bm8KSd1
LineItems           : {Azure plan}
Links               : Microsoft.Store.PartnerCenter.Models.Orders.OrderLinks
ReferenceCustomerId : 3a91c868-430a-443d-9002-186712c07d84
Status              : completed
TotalPrice          :
TransactionType     : UserPurchase
Attributes          : Microsoft.Store.PartnerCenter.Models.ResourceAttributes

PS C:\AzureStackDeployment\modules> $SubmitCartId.Orders.LineItems

FriendlyName         : Azure plan
LineItemNumber       : 0
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
ParentSubscriptionId :
PartnerIdOnRecord    :
Pricing              :
ProvisioningContext  : {}
Quantity             : 1
RenewsTo             :
SubscriptionId       : xxxxxx-xxxx-xxxx-xxxxxxxxxxx
TermDuration         :
TransactionType      : New
Links                : Microsoft.Store.PartnerCenter.Models.Orders.OrderLineItemLinks
Attributes           : Microsoft.Store.PartnerCenter.Models.ResourceAttributes

PS C:\AzureStackDeployment\modules> Get-PartnerCustomerOrder -CustomerId $Customer.CustomerId -OrderId $SubmitCartId.Orders.Id

BillingCycle        : Monthly
CreationDate        : 6/26/2020 3:00:24 PM
CurrencyCode        : GBP
CurrencySymbol      : £
LineItems           : {Azure plan}
OrderId             : Tn6z-u0YFTRuruZKiR9ARZig_3Bm8KSd1
ReferenceCustomerId : xxxxxx-xxx-xxxx-xxxx-xxxxx
Status              : completed
TransactionType     : UserPurchase

PS C:\AzureStackDeployment\modules> Get-Module -Name PartnerCenter

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.0.9      PartnerCenter                       {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserR...

PS C:\AzureStackDeployment\modules> $PartnerOrder = Get-PartnerCustomerOrder -CustomerId $Customer.CustomerId -OrderId $SubmitCartId.Orders.Id
PS C:\AzureStackDeployment\modules> $PartnerOrder

BillingCycle        : Monthly
CreationDate        : 6/26/2020 3:00:24 PM
CurrencyCode        : GBP
CurrencySymbol      : £
LineItems           : {Azure plan}
OrderId             : Tn6z-u0YFTRuruZKiR9ARZig_3Bm8KSd1
ReferenceCustomerId : xxxxxx-xxx-xxxx-xxxx-xxxxx
Status              : completed
TotalPrice          :
TransactionType     : UserPurchase

PS C:\AzureStackDeployment\modules> $PartnerOrder.LineItems

FriendlyName         : Azure plan
LineItemNumber       : 0
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
PartnerIdOnRecord    :
ParentSubscriptionId :
Pricing              :
ProvisioningContext  : {}
Quantity             : 1
TermDuration         :
TransactionType      : New

ActionTaken          : False
Actions              :
AttentionNeeded      : False
AutoRenewEnabled     : False
BillingCycle         : Monthly
BillingType          : Usage
CommitmentEndDate    : 12/31/9999 11:59:59 PM
CreationDate         : 6/26/2020 3:00:28 PM
EffectiveStartDate   : 6/26/2020 12:00:00 AM
EntitlementId        :
FriendlyName         : Azure plan
HasPurchasableAddons : False
IsMicrosoftProduct   : True
IsTrial              : False
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
OfferName            : Azure plan
ParentSubscriptionId :
PartnerId            :
PublisherName        : Microsoft Corporation
Quantity             : 1
Status               : Active
RefundOptions        :
SubscriptionId       : xxxxx-xxxxx-xxxx-xxxxx
SuspensionReasons    :
TermDuration         :
UnitType             : Usage-based

Expected behavior

 $PartnerOrder.LineItems

FriendlyName         : Microsoft Azure Plan - UKCloud
LineItemNumber       : 0
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
PartnerIdOnRecord    :
ParentSubscriptionId :
Pricing              :
ProvisioningContext  : {}
Quantity             : 1
TermDuration         :
TransactionType      : New

ActionTaken          : False
Actions              :
AttentionNeeded      : False
AutoRenewEnabled     : False
BillingCycle         : Monthly
BillingType          : Usage
CommitmentEndDate    : 12/31/9999 11:59:59 PM
CreationDate         : 6/26/2020 3:00:28 PM
EffectiveStartDate   : 6/26/2020 12:00:00 AM
EntitlementId        :
FriendlyName         : Microsoft Azure Plan - UKCloud
HasPurchasableAddons : False
IsMicrosoftProduct   : True
IsTrial              : False
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
OfferName            : Azure plan
ParentSubscriptionId :
PartnerId            :
PublisherName        : Microsoft Corporation
Quantity             : 1
Status               : Active
RefundOptions        :
SubscriptionId       : xxxxx-xxxxx-xxxx-xxxxx
SuspensionReasons    :
TermDuration         :
UnitType             : Usage-based

Actual behavior

 $PartnerOrder.LineItems

FriendlyName         : Azure plan
LineItemNumber       : 0
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
PartnerIdOnRecord    :
ParentSubscriptionId :
Pricing              :
ProvisioningContext  : {}
Quantity             : 1
TermDuration         :
TransactionType      : New

ActionTaken          : False
Actions              :
AttentionNeeded      : False
AutoRenewEnabled     : False
BillingCycle         : Monthly
BillingType          : Usage
CommitmentEndDate    : 12/31/9999 11:59:59 PM
CreationDate         : 6/26/2020 3:00:28 PM
EffectiveStartDate   : 6/26/2020 12:00:00 AM
EntitlementId        :
FriendlyName         : Azure plan
HasPurchasableAddons : False
IsMicrosoftProduct   : True
IsTrial              : False
OfferId              : DZH318Z0BPS6:0001:DZH318Z0BMGV
OfferName            : Azure plan
ParentSubscriptionId :
PartnerId            :
PublisherName        : Microsoft Corporation
Quantity             : 1
Status               : Active
RefundOptions        :
SubscriptionId       : xxxxx-xxxxx-xxxx-xxxxx
SuspensionReasons    :
TermDuration         :
UnitType             : Usage-based

I am running the latest module on PS5.1 and the $LineItem.FriendlyName is not getting correctly pushed into the submitted order. Can we fix that please? @isaiahwilliams

TLDR: $LineItem.FriendlyName = "Microsoft Azure Plan - UKCloud" is not getting applied correctly, it is getting reset to defaults.

I also tried originally with just:

$CartId = New-PartnerCustomerCart -CustomerId $Customer.CustomerId -LineItems $LineItem

Same results.

cblackuk commented 4 years ago

Quick update, just to be even more sure that it is broken:

PS C:\AzureStackDeployment\modules> (Get-PartnerCustomerCart -CartId $CartId.CartId -CustomerId $Customer.CustomerId).Li
neItems

AddonItems          :
BillingCycle        : Monthly
CatalogItemId       : DZH318Z0BPS6:0001:DZH318Z0BMGV
CurrencyCode        : GBP
Error               :
FriendlyName        : Microsoft Azure Plan - UKCloud
Id                  : 0
OrderGroup          : 0
Participants        :
ProvisioningContext : {}
Quantity            : 1
RenewsTo            :
TermDuration        :

PS C:\AzureStackDeployment\modules> (Get-PartnerCustomerCart -CartId $AddCartId.CartId -CustomerId $Customer.CustomerId)
.LineItems

AddonItems          :
BillingCycle        : Monthly
CatalogItemId       : DZH318Z0BPS6:0001:DZH318Z0BMGV
CurrencyCode        : GBP
Error               :
FriendlyName        : Microsoft Azure Plan - UKCloud
Id                  : 0
OrderGroup          : 0
Participants        :
ProvisioningContext : {}
Quantity            : 1
RenewsTo            :
TermDuration        :