Developers can simulate product purchase and fetching product details by using Purchasable Items user interface. There is an option to enter the meta data like price, description, title, content protection method.
All the products / resources that the developer wants to sell will have a product ID associated with it. The developer has to enter all products ID by selecting the Add button. Any settings done in Product Details / Product Purchase will be associated with this product ID.
Figure: Purchasable Items UI
This section will allow the developer to simulate fetching the product details. The developer has to enter meta data details like Price of the product, Short Description, Title, Long Description, content protection method which he wishes to see in the MIDlet. This allows the user to enter the same metadata for this product ID which is entered in the OVI portal while registering purchasable item.
The UI settings will
be used for simulating the In-app API getProductData(..)
. These metadata details entered will be passed to the MIDlet In-app
listener call back function productDataReceived(..)
. This will allow the user to show details of each purchasable item
in the MIDlet UI.
The success or failure of the productDataReceived(..)
callback function can be simulated by choosing Success or Fail radio button. In case of failure, the user can simulate
the reason for failure by choosing any of the option in the Reason drop-down list.
This allows the user to simulate the scenarios like Network error, Invalid product ID etc.
In real scenario each In-app API uses network connection; there could be a delay in response. This delay could be simulated by entering the time delay in Time Delay.
For example:
In order to get the product details successfully in the MIDlet the following settings have to be made:
Enter the product ID which is used in the MIDlet application by selecting Add button.
Under the Product Details section. Select the Nokia DRM button. Enter all the meta data details of the application, like Price, Short Description, Title, and Long Description.
Select the Success button under Product Details (simulates the product meta data is success).
Enter the Time Delay (for example 10 seconds, this is to simulate the response time from the OVI Portal).
After doing the above settings, open the MIDlet which uses
the getProductData(..)
API, with the same product
ID in the emulator. The user will get the above entered meta data
in the MIDlet through callback function.
This section allows the developer to simulate the product purchase. The user has to enter the Ticket number (The purchase ticket is in base64 encoded form. It is SHA1 (160 bit) hash. Hash is calculated over the string, which is derived by concatenating the attribute values. The attribute values are concatenated in order transactionId, transactionTime, productId, applicationId, accountId, imei, and imsi for simulation purpose the developer can enter 10 digit number.) to complete the product purchase.
These settings will
be used for simulating the In-app API purchaseProduct(..)
. The Ticket number entered is passed to the MIDlet In-app
listener callback function purchaseCompleted(..)
.
The success or failure of the purchaseCompleted(..)
callback function can be simulated by choosing Success or Fail radio button.
In case of failure, the user can simulate the reason for failure by choosing any of the option in the Reason drop-down list. This allows the user to simulate the scenarios like Operator billing failed, No Payment cards, etc.
Time delay could be simulated by entering the time in the Time Delay edit box.
For example:
In order to successfully purchase the product the developer has to do the following settings:
Enter the product ID which is used in the MIDlet application.
Under Product Purchase section, elect the Success button. Select the Status.
Enter the Ticket number. Any value can be entered here.
Enter the Time Delay (e.g., 10 seconds). This is to simulate the response time form the OVI Portal.
After doing the above settings, open the MIDlet which uses
the purchaseProduct(..)
API in the emulator. The
user will complete the product purchase through callback function.