|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_NCD_PURCHASE_OPTION_H |
|
20 #define M_NCD_PURCHASE_OPTION_H |
|
21 |
|
22 #include <e32cmn.h> |
|
23 |
|
24 #include "catalogsbase.h" |
|
25 #include "ncdinterfaceids.h" |
|
26 |
|
27 class MNcdNode; |
|
28 class MNcdSubscription; |
|
29 |
|
30 /** |
|
31 * Describes one purchase option. |
|
32 * |
|
33 * Each purchasable node may have one or more of these. |
|
34 * A purchase option can be for example "1$ Trial version", or "10$ Full version". |
|
35 * |
|
36 * |
|
37 */ |
|
38 class MNcdPurchaseOption : public virtual MCatalogsBase |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Unique identifier for the interface, required for all MCatalogsBase interfaces. |
|
45 * |
|
46 * |
|
47 */ |
|
48 enum { KInterfaceUid = ENcdPurchaseOptionUid }; |
|
49 |
|
50 /** |
|
51 * Type of the purchase option. |
|
52 */ |
|
53 enum TType |
|
54 { |
|
55 |
|
56 /** Purchase option to make a normal purchase. */ |
|
57 EPurchase, |
|
58 |
|
59 /** Purchase option to purchase a subscription. */ |
|
60 ESubscription, |
|
61 |
|
62 /** Purchase option to do a purchase using an existing subscription. */ |
|
63 ESubscriptionPurchase, |
|
64 |
|
65 /** Purchase option to do an upgrade to an existing subscription. */ |
|
66 ESubscriptionUpgrade |
|
67 |
|
68 }; |
|
69 |
|
70 /** |
|
71 * Name getter. |
|
72 * |
|
73 * |
|
74 * @return Name of the purchase option. |
|
75 */ |
|
76 virtual const TDesC& Name() const = 0; |
|
77 |
|
78 |
|
79 /** |
|
80 * Price getter. |
|
81 * |
|
82 * |
|
83 * @return String indicating the price of the purchase option. |
|
84 */ |
|
85 virtual const TDesC& Price() const = 0; |
|
86 |
|
87 |
|
88 /** |
|
89 * Checks whether this purchase option is free. |
|
90 * |
|
91 * |
|
92 * @return ETrue if this purchase option is free. |
|
93 */ |
|
94 virtual TBool IsFree() const = 0; |
|
95 |
|
96 |
|
97 /** |
|
98 * Get type of the purchase option. |
|
99 * |
|
100 * |
|
101 * @return Subscription type. |
|
102 */ |
|
103 virtual TType PurchaseOptionType() const = 0; |
|
104 |
|
105 /** |
|
106 * Checks whether this purchase option is obsolete or not. |
|
107 * Purchase option becomes obsolete if it is removed while |
|
108 * user still has reference to it. Removal can be done for |
|
109 * example because the purchase option was removed from the |
|
110 * server. |
|
111 * Obsolete purchase option should not be used and valid purchase |
|
112 * option instances should be retrieved by using PurchaseOptionsL |
|
113 * method from MNcdNodePurchase interface. |
|
114 * |
|
115 * |
|
116 * @return ETrue if this purchase option is obsolete. |
|
117 */ |
|
118 virtual TBool IsObsolete() const = 0; |
|
119 |
|
120 /** |
|
121 * Checks whether this purchase option can be used. |
|
122 * The purchase option cannot be used if the type of |
|
123 * this purchase option is ESubscriptionPurchase or |
|
124 * ESubscriptionUpgrade and the parentsubscription is |
|
125 * not yet bought. |
|
126 * |
|
127 * |
|
128 * @return ETrue if this purchase option can be used. |
|
129 * @exception Leave with KNcdErrorObsolete if this purchase option |
|
130 * is obsolete. Otherwise leave with System wide error code. |
|
131 */ |
|
132 virtual TBool IsUsableL() const = 0; |
|
133 |
|
134 /** |
|
135 * If this purchase option is of type ESubscriptionPurchase, |
|
136 * this function returns the subscription that the purchase option |
|
137 * uses if the subscription exists in subscription manager. |
|
138 * |
|
139 * @note Valid only when purchase option is a valid |
|
140 * ESubscriptionPurchase and this purchase option is |
|
141 * not obsolete. |
|
142 * |
|
143 * @return Pointer to the subscription that this purchase option |
|
144 * uses. The subscription can be expired or not, but if |
|
145 * the subscription does not exist in the subscription |
|
146 * manager, NULL is returned. |
|
147 * Counted, Release() must be called after use. |
|
148 * |
|
149 * @exception Leave with KNcdErrorObsolete if this purchase option |
|
150 * is obsolete. If this purchase option is not valid |
|
151 * ESubscriptionPurchase then leave with |
|
152 * KNcdErrorPurchaseOptionNotValidSubscriptionPurchase. |
|
153 * Otherwise leave with System wide error code. |
|
154 */ |
|
155 virtual MNcdSubscription* ParentSubscriptionL() const = 0; |
|
156 |
|
157 /** |
|
158 * Returns the node that has the purchase option to buy |
|
159 * the subscription needed to use this purchase option. |
|
160 * |
|
161 * @note Valid only when purchase option is a valid |
|
162 * ESubscriptionPurchase and this purchase option is |
|
163 * not obsolete. |
|
164 * |
|
165 * @return Pointer to the node that has the purchase option to buy |
|
166 * the subscription needed to use this purchase option. |
|
167 * Note that the node may be in an uninitialized state, |
|
168 * or in an initialized state, depending on whether the |
|
169 * node has previously been known to the engine. Counted, |
|
170 * Release() must be called after use. |
|
171 * |
|
172 * @exception Leave with KNcdErrorObsolete if this purchase option |
|
173 * is obsolete. If this purchase option is not valid |
|
174 * ESubscriptionPurchase then leave with |
|
175 * KNcdErrorPurchaseOptionNotValidSubscriptionPurchase. |
|
176 * Otherwise leave with System wide error code. |
|
177 */ |
|
178 virtual MNcdNode* ParentSubscriptionNodeL() const = 0; |
|
179 |
|
180 /** |
|
181 * Returns an id that identifies the purchaseoption that can be |
|
182 * used to buy the subscription needed to use this purchase option. |
|
183 * Node that has the purchase option identified by the id returned |
|
184 * from this function can be queried by using method |
|
185 * ParentSubscriptionNodeL(). |
|
186 * |
|
187 * @note Valid only when purchase option is a valid |
|
188 * ESubscriptionPurchase. |
|
189 * |
|
190 * @return Id that identifies the purchaseoption that can be |
|
191 * used to buy the subscription needed to use this |
|
192 * purchase option. Node where from this purchase option is |
|
193 * found can be queried by using method |
|
194 * ParentSubscriptionNodeL(). |
|
195 * |
|
196 * @exception If this purchase option is not valid |
|
197 * ESubscriptionPurchase then leave with |
|
198 * KNcdErrorPurchaseOptionNotValidSubscriptionPurchase. |
|
199 * Otherwise leave with System wide error code. |
|
200 */ |
|
201 virtual const TDesC& ParentSubscriptionPurchaseOptionIdL() const = 0; |
|
202 |
|
203 |
|
204 protected: |
|
205 |
|
206 /** |
|
207 * Destructor. |
|
208 * |
|
209 * @see MCatalogsBase::~MCatalogsBase |
|
210 */ |
|
211 virtual ~MNcdPurchaseOption() {} |
|
212 |
|
213 }; |
|
214 |
|
215 |
|
216 #endif // M_NCD_PURCHASE_OPTION_H |