-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathOfferCatalog.cs
244 lines (225 loc) · 7.16 KB
/
OfferCatalog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/********************************************************
* *
* Copyright (C) Microsoft. All rights reserved. *
* *
*********************************************************/
namespace Microsoft.Partner.CSP.Api.V1.Samples
{
using System.Collections.Generic;
public class OfferCatalog
{
/// <summary>
/// Contains offers grouped by offertype
/// </summary>
public IEnumerable<GroupedOffers> GroupedOffersCollection { get; private set; }
private static OfferCatalog offerCatalog { get; set; }
private static object singletonObject = new object();
private OfferCatalog()
{
//// Added a couple of offers for the sample, the idea is to add all of the offers from the excel sheet and use them
GroupedOffersCollection = new List<GroupedOffers>
{
new GroupedOffers
{
OfferType = OfferType.Azure,
Offers = new List<Offer>
{
//// This offer is only available to the integration sandbox
//// Uncomment the section below for Azure.
new Offer
{
Name = "Microsoft Azure For integration sandbox",
Uri = "/fbf178a5-144e-46d1-aa81-612c2d3f97f4/offers/MS-AZR-0146P",
Id = "MS-AZR-0146P",
MinimumQuantity = 1,
MaximumQuantity = 999999999,
},
////// If this offer is being purchased for an integration sandbox, you will get an error
//new Offer
//{
// Name = "Microsoft Azure",
// Uri = "/fbf178a5-144e-46d1-aa81-612c2d3f97f4/offers/MS-AZR-0145P",
// Id = "MS-AZR-0145P",
// MinimumQuantity = 1,
// MaximumQuantity = 999999999,
//}
}
},
new GroupedOffers
{
OfferType = OfferType.IntuneAndOffice,
Offers = new List<Offer>
{
new Offer
{
Name = "Azure Active Directory Basic",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/84A03D81-6B37-4D66-8D4A-FAEA24541538",
Id = "84a03d81-6b37-4d66-8d4a-faea24541538",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
},
new Offer
{
Name = "Azure Active Directory Premium",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/16C9F982-A827-4003-A88E-E75DF1927F27",
Id = "16c9f982-a827-4003-a88e-e75df1927f27",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
},
new Offer
{
Name = "Intune",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/51E95709-DC35-4780-9040-22278CB7C0E1",
Id = "51e95709-dc35-4780-9040-22278cb7c0e1",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
},
new Offer
{
Name = "Enterprise Mobility Suite",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/79C29AF7-3CD0-4A6F-B182-A81E31DEC84E",
Id = "79c29af7-3cd0-4a6f-b182-a81e31dec84e",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
},
new Offer
{
Name = "Exchange Online (Plan 1)",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/195416C1-3447-423A-B37B-EE59A99A19C4",
Id = "195416c1-3447-423a-b37b-ee59a99a19c4",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
CanConvertTo = new List<string>
{
"796B6B5F-613C-4E24-A17C-EBA730D49C02",
"031C9E47-4802-4248-838E-778FB1D2CC05",
"BD938F12-058F-4927-BBA3-AE36B1D2501C",
"91FD106F-4B2C-4938-95AC-F54F74E9A239"
}
},
new Offer
{
Name = "Lync Online (Plan 1)",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/2F707C7C-2433-49A5-A437-9CA7CF40D3EB",
Id = "aca0c06c-890d-4abb-83cf-bc519a2565e5",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
CanConvertTo = new List<string>
{
"796B6B5F-613C-4E24-A17C-EBA730D49C02",
"031C9E47-4802-4248-838E-778FB1D2CC05",
"BD938F12-058F-4927-BBA3-AE36B1D2501C",
"91FD106F-4B2C-4938-95AC-F54F74E9A239"
}
},
new Offer
{
Name = "Office 365 Enterprise E1",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/91FD106F-4B2C-4938-95AC-F54F74E9A239",
Id = "91fd106f-4b2c-4938-95ac-f54f74e9a239",
MinimumQuantity = 1,
MaximumQuantity = 10000000
},
new Offer
{
Name = "Office 365 Enterprise K1",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/6FBAD345-B7DE-42A6-B6AB-79B363D0B371",
Id = "6FBAD345-B7DE-42A6-B6AB-79B363D0B371",
MinimumQuantity = 1,
MaximumQuantity = 10000000
},
new Offer
{
Name = "Exchange Online Archiving for Exchange Online",
Uri = "/3c95518e-8c37-41e3-9627-0ca339200f53/offers/2828BE95-46BA-4F91-B2FD-0BEF192ECF60",
Id = "2828be95-46ba-4f91-b2fd-0bef192ecf60",
MinimumQuantity = 1,
MaximumQuantity = 10000000,
DependsOn = new List<string>
{
"35A36B80-270A-44BF-9290-00545D350866",
"6FBAD345-B7DE-42A6-B6AB-79B363D0B371",
"91FD106F-4B2C-4938-95AC-F54F74E9A239",
"837F8912-2321-41D1-A50A-9F3C4F43C93B",
"195416C1-3447-423A-B37B-EE59A99A19C4"
}
},
}
}
};
}
/// <summary>
/// Gets an instance of the Offer Catalog
/// </summary>
public static OfferCatalog Instance
{
get
{
if (offerCatalog != null)
{
return offerCatalog;
}
lock (singletonObject)
{
if (offerCatalog == null)
{
offerCatalog = new OfferCatalog();
}
}
return offerCatalog;
}
}
}
public class GroupedOffers
{
/// <summary>
/// Offer type for this group of offers
/// </summary>
public OfferType OfferType { get; set; }
public IEnumerable<Offer> Offers { get; set; }
}
public class Offer
{
/// <summary>
/// Name for the offer
/// </summary>
public string Name { get; set; }
/// <summary>
/// URI of the offer used while placing the order
/// </summary>
public string Uri { get; set; }
/// <summary>
/// Unique identifier for the offer
/// </summary>
public string Id { get; set; }
/// <summary>
/// Minimum quantity for placing the order
/// </summary>
public int MinimumQuantity { get; set; }
/// <summary>
/// Maximum quantity for placing the order
/// </summary>
public int MaximumQuantity { get; set; }
/// <summary>
/// A collection of offers ids that this offer can be converted to
/// </summary>
public IEnumerable<string> CanConvertTo { get; set; }
/// <summary>
/// A collection of offers that this offer depends on
/// If any of the offers in this collection is purchased by a customer, then this offer can be purchased as well
/// </summary>
public IEnumerable<string> DependsOn { get; set; }
}
public enum OfferType
{
/// <summary>
/// All offers in Azure
/// Currently, an Order can be placed with offers of only one offertype
/// </summary>
Azure,
/// <summary>
/// All offers in Intune and Office
/// </summary>
IntuneAndOffice
}
}