diff --git a/mdm/mdm/command.go b/mdm/mdm/command.go index 0d30b139..3fcdc30f 100644 --- a/mdm/mdm/command.go +++ b/mdm/mdm/command.go @@ -143,13 +143,13 @@ type InstallApplication struct { ManagementFlags *int `plist:",omitempty" json:"management_flags,omitempty"` ChangeManagementState *string `plist:",omitempty" json:"change_management_state,omitempty"` ManifestURL *string `plist:",omitempty" json:"manifest_url,omitempty"` - Options *InstallApplicationOptions `plist:",omitempty" json:"options,omitempty"` + Options *InstallApplicationOptions `plist:"Options,omitempty" json:"options,omitempty"` Configuration *InstallApplicationConfiguration `plist:",omitempty" json:"configuration,omitempty"` Attributes *InstallApplicationAttributes `plist:",omitempty" json:"attributes,omitempty"` } type InstallApplicationOptions struct { - PurchaseMethod int64 `plist:",omitempty" json:"purchase_method,omitempty"` + PurchaseMethod *int64 `plist:"PurchaseMethod,omitempty" json:"purchase_method,omitempty"` } type InstallApplicationConfiguration struct{} diff --git a/mdm/mdm/marshal_proto.go b/mdm/mdm/marshal_proto.go index 94036dc8..902b35f5 100644 --- a/mdm/mdm/marshal_proto.go +++ b/mdm/mdm/marshal_proto.go @@ -165,7 +165,7 @@ func commandToProto(cmd *Command) (*mdmproto.Command, error) { ) if cmd.InstallApplication.Options != nil { options = &mdmproto.InstallApplicationOptions{ - PurchaseMethod: cmd.InstallApplication.Options.PurchaseMethod, + PurchaseMethod: zeroInt64IfNil(cmd.InstallApplication.Options.PurchaseMethod), } } if cmd.InstallApplication.Configuration != nil { diff --git a/mdm/mdm/unmarshal_proto.go b/mdm/mdm/unmarshal_proto.go index faaa6716..837d5de8 100644 --- a/mdm/mdm/unmarshal_proto.go +++ b/mdm/mdm/unmarshal_proto.go @@ -131,8 +131,9 @@ func protoToCommand(pb *mdmproto.Command) *Command { pboptions := pbc.GetOptions() if pboptions != nil { options = &InstallApplicationOptions{ - PurchaseMethod: pboptions.GetPurchaseMethod(), + PurchaseMethod: new(int64), } + *options.PurchaseMethod = pboptions.GetPurchaseMethod(); } pbconfig := pbc.GetConfiguration()