forked from blackberry/WebWorks-API-Docs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mike Waugh
committed
Nov 24, 2011
1 parent
3d8900e
commit e13f788
Showing
1 changed file
with
158 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -104,9 +104,9 @@ blackberry.payment = { | ||
* "purchaseAppName":"WebWorks APP", | * "purchaseAppName":"WebWorks APP", | ||
* "purchaseAppIcon":null}, | * "purchaseAppIcon":null}, | ||
* success,failure); | * success,failure); | ||
* }catch (e){ | * }catch (e){ | ||
* alert ("Error" + e); | * alert ("Error" + e); | ||
* } | * } | ||
* } | * } | ||
* | * | ||
* function success(purchase) { | * function success(purchase) { | ||
|
@@ -126,18 +126,22 @@ blackberry.payment = { | ||
}, | }, | ||
/** | /** | ||
* @function | * @function | ||
* @description Retrieves the price for a specified digital good. | * @description Initiates a request for the price of a digital good. The request can be initiated by using either the ID or the SKU of the digital good to be purchased, but it is not necessary to provide both. | ||
* @param {Object} args Contains information about the digital good to query. | * @param {Object} args Contains information about the digital good to query. | ||
* @callback {String} args.digitalGoodSKU SKU of the digital good to query. | * @callback {String} args.digitalGoodSKU SKU of the digital good to query. | ||
* @callback {String} args.digitalGoodID ID of the digital good to query. | |||
* @callback {function} callbackOnSuccess Function to be called when the price set is retrieved. | * @callback {function} callbackOnSuccess Function to be called when the price set is retrieved. | ||
* @callback {String} callbackOnSuccess.data A string representing a price set object literal is passed as a parameter in the form below: | * @callback {String} callbackOnSuccess.data A string representing a price set object literal containing the localized formated price of the good or a set of items for a subscription is passed as a parameter in the form below: | ||
This comment has been minimized.
Sorry, something went wrong. |
|||
* <pre>[{ | * <pre>[{ | ||
* "price": "$0.99", | * "getFailureReason":"-224718155", | ||
* "subscriptionInitialPeriod": "7 days", | * "price":"$1.05", | ||
* "subscriptionInitialPrice": "$4.99", | * "returnCode":"-224718155", | ||
* "subscriptionPeriodName": "Monthly", | * "statusMessage":"", | ||
* "subscriptionRenewalPrice": "$9.99" | * "subscriptionInitialPeriod":"null", | ||
* }]</pre>. | * "subscriptionInitialPrice":"$1.05", | ||
* "subscriptionPeriodName":"null", | |||
* "subscriptionRenewalPrice":"null" | |||
* }]</pre>. | |||
* @callback {function} [callbackOnFailure] Function to be called when an error occurs. | * @callback {function} [callbackOnFailure] Function to be called when an error occurs. | ||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | * @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | ||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | * @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | ||
|
@@ -155,17 +159,17 @@ blackberry.payment = { | ||
* function getPrice() { | * function getPrice() { | ||
* try{ | * try{ | ||
* blackberry.payment.getPrice({"digitalGoodSKU":"someSKU"}, success, failure); | * blackberry.payment.getPrice({"digitalGoodSKU":"someSKU"}, success, failure); | ||
* }catch (e){ | * }catch (e){ | ||
* alert ("Error" + e); | * alert ("Error" + e); | ||
* } | * } | ||
* } | * } | ||
* | * | ||
* function success(priceSet) { | * function success(priceSet) { | ||
* var digitalGood = JSON.parse(priceSet); | * var digitalGoodPS = JSON.parse(priceSet); | ||
* var price = digitalGood.price; | * var price = digitalGoodPS.price; | ||
* var subscriptionInitialPrice = digitalGood.subscriptionInitialPrice; | * var subscriptionInitialPrice = digitalGoodPS.subscriptionInitialPrice; | ||
* var subscriptionInitialPeriod = digitalGood.subscriptionInitialPeriod; | * var subscriptionInitialPeriod = digitalGoodPS.subscriptionInitialPeriod; | ||
* var subscriptionRenewalPrice = digitalGood.subscriptionRenewalPrice; | * var subscriptionRenewalPrice = digitalGoodPS.subscriptionRenewalPrice; | ||
* | * | ||
* var output = "Price: " + price | * var output = "Price: " + price | ||
* + "\nSubscription Initial Price: " + subscriptionInitialPrice | * + "\nSubscription Initial Price: " + subscriptionInitialPrice | ||
|
@@ -180,19 +184,22 @@ blackberry.payment = { | ||
* } | * } | ||
* </script> | * </script> | ||
*/ | */ | ||
getPrice : function( args, callbackOnSuccess, callbackOnFailure ) { | getPrice : function( args, callbackOnSuccess, callbackOnFailure ) { | ||
}, | }, | ||
/** | /** | ||
* @function | * @function | ||
* @description Retrieves the details for a specified digital good. | * @description Returns a Purchase object if the logged in BBID user has rights for this SKU at the time of calling this method. The result will be based on the default business rules defined by the PS Server / AppWorld. For example: In the case of a subscription a "Canceled" subscription will return true till the next renewal date. All "Refunded" SKUs will return false immediately. This call is used to get the transactionID for use with the {@link cancel} method to cancel a subscription. | ||
* @param {String} sku of the digital good to query. | * @param {String} sku of the digital good to query. | ||
* @callback {function} callbackOnSuccess Function to be called when the price set is retrieved. | * @callback {function} callbackOnSuccess Function to be called when the price set is retrieved. | ||
* @callback {String} callbackOnSuccess.data A string representing a digital good object literal is passed as a parameter in the form below: | * @callback {String} callbackOnSuccess.data A string representing a digital good object literal is passed as a parameter in the form below: | ||
* <pre>[{ | * <pre>[{ | ||
* "digitalGoodID" : "someID", | * "digitalGoodID":"123456", | ||
* "digitalGoodSKU" : "someSKU", | * "digitalGoodSKU":"Some_SKU", | ||
* "date" : " | * "date":"1322066643848", | ||
* }]</pre>. | * "licenseKey":"Single License Key", | ||
* "metaData":"Some metadata", | |||
* "transactionID":"10101" | |||
* }]</pre>. | |||
* @callback {function} [callbackOnFailure] Function to be called when an error occurs. | * @callback {function} [callbackOnFailure] Function to be called when an error occurs. | ||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | * @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | ||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | * @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | ||
|
@@ -207,25 +214,29 @@ blackberry.payment = { | ||
* @BB50+ | * @BB50+ | ||
* @example | * @example | ||
* <script type="text/javascript"> | * <script type="text/javascript"> | ||
* function getPrice() { | * function get() { | ||
* try{ | * try{ | ||
* blackberry.payment.getPrice({"digitalGoodSKU":"someSKU"}, success, failure); | * blackberry.payment.getPrice("Some_SKU", success, failure); | ||
* }catch (e){ | * }catch (e){ | ||
* alert ("Error" + e); | * alert ("Error" + e); | ||
* } | * } | ||
* } | * } | ||
* | * | ||
* function success(digitalGood) { | * function success(purchase) { | ||
* var dg = JSON.parse(digitalGood); | * var o = JSON.parse(purchase); | ||
* var price = dg.price; | * var id = o.digitalGoodID; | ||
* var subscriptionInitialPrice = dg.subscriptionInitialPrice; | * var sku = o.digitalGoodSKU; | ||
* var subscriptionInitialPeriod = dg.subscriptionInitialPeriod; | * var date = o.date; | ||
* var subscriptionRenewalPrice = dg.subscriptionRenewalPrice; | * var license = o.licenseKey; | ||
* var metadata = o.metadata; | |||
* var transactionID = o.transactionID; | |||
* | * | ||
* var output = "Price: " + price | * var output = "ID: " + id | ||
* + "\nSubscription Initial Price: " + subscriptionInitialPrice | * + "\nSKU: " + sku | ||
* + "\nSubscription Initial Period: " + subscriptionInitialPeriod | * + "\nDate: " + date | ||
* + "\nSubscription Renewal Price: " + subscriptionRenewalPrice; | * + "\nLicense: " + license; | ||
* + "\Metadata: " + metadata; | |||
* + "\nTransaction ID: " + transactionID; | |||
* | * | ||
* alert(output); | * alert(output); | ||
* } | * } | ||
|
@@ -235,14 +246,13 @@ blackberry.payment = { | ||
* } | * } | ||
* </script> | * </script> | ||
*/ | */ | ||
get : function( sku, callbackOnSuccess, callbackOnFailure ) { | get : function( sku, callbackOnSuccess, callbackOnFailure ) { | ||
}, | }, | ||
|
|||
|
|||
/** | /** | ||
* @function | * @function | ||
* @description Checks whether the Payment daemon is installed. This is an asynchronous call that returns results to the provided <b>PaymentEngineListener</b> | * @description Initiates a request to cancel the digital good given it's TransactionID. | ||
This comment has been minimized.
Sorry, something went wrong. |
|||
* @callback {function} callbackOnSuccess Function to be called when the payment is successful. | * @param {String} [transactionID] the transaction id of the digital good you would like to cancel | ||
* @callback {function} callbackOnSuccess Function to be called when the transaction is cancelled | |||
* @callback {function} [callbackOnFailure] Function to be called when an error occurs. | * @callback {function} [callbackOnFailure] Function to be called when an error occurs. | ||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | * @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | ||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | * @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | ||
|
@@ -255,12 +265,32 @@ blackberry.payment = { | ||
* </ul> | * </ul> | ||
* @PB10 | * @PB10 | ||
* @BB50+ | * @BB50+ | ||
* @example | |||
* <script type="text/javascript"> | |||
* function cancel() { | |||
* try{ | |||
* blackberry.payment.cancel("transaction_id", success, failure); | |||
* }catch (e){ | |||
* alert ("Error" + e); | |||
* } | |||
* } | |||
* | |||
* function success(purchase) { | |||
* var o = JSON.parse(purchase); | |||
* var transactionID = o.transactionID; | |||
* alert("Trnasaction " + transactionID + " has been cancelled"); | |||
* } | |||
* | |||
* function failure(errorText, errorId) { | |||
* alert("Error occured: " + errorText + ", " + errorId); | |||
* } | |||
* </script> | |||
*/ | */ | ||
isPaymentServicesAvailable : function( callbackOnSuccess, callbackOnFailure ) { | cancel : function ( transactionID, callbackOnSuccess, callbackOnFailure ) { | ||
}, | }, | ||
/** | /** | ||
* @function | * @function | ||
* @description Retrieves the previous successful purchases made by the user from within the calling application. | * @description Retrieves a digital goods listing for the specified parent SKU. | ||
* @param {String} [sku] the parent SKU of the digital goods requested | * @param {String} [sku] the parent SKU of the digital goods requested | ||
* @callback {function} callbackOnSuccess Function to be invoked on successful call. | * @callback {function} callbackOnSuccess Function to be invoked on successful call. | ||
* @callback {String} callbackOnSuccess.data A string representing a literal array of {@link DigitalGood} items is passed as a parameter in the form below: | * @callback {String} callbackOnSuccess.data A string representing a literal array of {@link DigitalGood} items is passed as a parameter in the form below: | ||
|
@@ -291,20 +321,90 @@ blackberry.payment = { | ||
* @callback {function} [callbackOnFailure] Function to be invoked when an error occurs. | * @callback {function} [callbackOnFailure] Function to be invoked when an error occurs. | ||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | * @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | ||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | * @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | ||
* <ul> | |||
* <li> User Cancelled = 1</li> | |||
* <li> Payment System Busy = 2</li> | |||
* <li> General Payment System Error = 3</li> | |||
* <li> Digital Good not Found = 4</li> | |||
* <li> Illegal Application Error = 5 [BlackBerry OS 5.0+ only]</li> | |||
* </ul> | |||
* @since version 1.8.0 | * @since version 1.8.0 | ||
* @PB10 | * @PB10 | ||
* @BB50+ | * @BB50+ | ||
*/ | */ | ||
getGoodsForSku : function (sku, callbackOnSuccess, callbackOnFailure) { | getGoodsForSku : function (sku, callbackOnSuccess, callbackOnFailure) { | ||
}, | }, | ||
/** | /** | ||
* @type Boolean | * @function | ||
* @description Defines the development mode used in the application. If development mode is set to true, the application does not contact the Payment Service server for any transactions. For purchases, a simulated purchase screen is displayed, allowing the user to choose the result of the purchase. For retrieving existing purchases, only simulated successful purchases are returned. This mode is useful for testing how your application handles the possible results without requiring network connections or currency. THIS MODE SHOULD NOT BE USED IN PRODUCTION CODE. If development mode is set to false, purchases and retrievals of existing purchases proceed normally, contacting the Payment Service server as necessary. This is the default development mode, and applications in production should not modify it. | * @description Invokes callbackOnSuccess if the logged in BBID user has rights for this SKU at the time of calling this method. | ||
* @default false | * @param {String} [sku] the SKU of the digital goods requested | ||
* @callback {function} callbackOnSuccess Function to be invoked on successful call. | |||
* @callback {function} [callbackOnFailure] Function to be invoked when an error occurs. | |||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | |||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | |||
* <ul> | |||
* <li> User Cancelled = 1</li> | |||
* <li> Payment System Busy = 2</li> | |||
* <li> General Payment System Error = 3</li> | |||
* <li> Digital Good not Found = 4</li> | |||
* <li> Illegal Application Error = 5 [BlackBerry OS 5.0+ only]</li> | |||
* </ul> | |||
* @PB10 | * @PB10 | ||
* @BB50+ | * @BB50+ | ||
*/ | */ | ||
developmentMode: false; | checkExisting : function (sku, callbackOnSuccess, callbackOnFailure) { | ||
This comment has been minimized.
Sorry, something went wrong.
tohman
|
|||
}, | |||
/** | |||
* @function | |||
* @description Starts the process of upgrading App World to the current version by opening the browser on the device to the AppWorld upgrade page. | |||
* @callback {function} callbackOnSuccess Function to be invoked on successful call. | |||
* @callback {function} [callbackOnFailure] Function to be invoked when an error occurs. | |||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | |||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | |||
* <ul> | |||
* <li> User Cancelled = 1</li> | |||
* <li> Payment System Busy = 2</li> | |||
* <li> General Payment System Error = 3</li> | |||
* <li> Digital Good not Found = 4</li> | |||
* <li> Illegal Application Error = 5 [BlackBerry OS 5.0+ only]</li> | |||
* </ul> | |||
* @PB10 | |||
* @BB50+ | |||
*/ | |||
upDateAppWorld : function( callbackOnSuccess, callbackOnFailure) { | |||
}, | |||
/** | |||
* @function | |||
* @description Invokes the callbackOnSuccess if the App World client is installed and at the correct verison. | |||
This comment has been minimized.
Sorry, something went wrong. |
|||
* @callback {function} callbackOnSuccess Function to be invoked on successful call. | |||
* @callback {function} [callbackOnFailure] Function to be invoked when an error occurs. | |||
* @callback {String} callbackOnFailure.errorText Retrieves the message set for an error. In addition to descriptive text, error code may appear at the end of the message. | |||
* @callback {Number} callbackOnFailure.errorID Contains the reference number associated with the specific error in corresponding to the following values. | |||
* <ul> | |||
* <li> User Cancelled = 1</li> | |||
* <li> Payment System Busy = 2</li> | |||
* <li> General Payment System Error = 3</li> | |||
* <li> Digital Good not Found = 4</li> | |||
* <li> Illegal Application Error = 5 [BlackBerry OS 5.0+ only]</li> | |||
* </ul> | |||
* @since version 1.5.0 | |||
* @PB10 | |||
* @BB50+ | |||
*/ | |||
isAppWorldInstalledAndAtCorrectVersion : function( callbackOnSuccess, callbackOnFailure) { | |||
}, | |||
/** | |||
* @function | |||
* @description Sets the debug flag to true to show debug information via alert dialogs during development. | |||
*/ | |||
This comment has been minimized.
Sorry, something went wrong. |
|||
setDebugTrue : function() { | |||
}, | |||
/** | |||
* @function | |||
* @description Sets the debug flag to flase to hide debug information from being shown. | |||
*/ | |||
This comment has been minimized.
Sorry, something went wrong. |
|||
setDebugFalse : function() { | |||
}, | |||
}; | }; | ||
|
|
||
/** | /** | ||
|
Typo formated->formatted