cc.fovea.cordova.purchase
Advanced tools
Comparing version 4.0.0 to 4.1.0
# Windows (Store/Phone 8.1) Configuration | ||
## Test setup | ||
To enable the IAP similator you will need to call the testmode function on the plugin and add the store simulator xml file with your items. | ||
To enable the IAP simulator you will need to call the testmode function on the plugin and add the store simulator xml file with your items. | ||
Doing this will route purchases through the simulator which will allow the user to select the outcome of the purchase (selecting success or failure types). | ||
``` | ||
store.inappbilling.setTestMode(true); //Don't call this in production | ||
store.inappbilling.setTestMode(); //Don't call this in production | ||
//Optionally add callbacks | ||
store.inappbilling.setTestMode(function() { | ||
//successfully loaded test data | ||
}, | ||
function() { | ||
//failed to load test data | ||
}); | ||
``` | ||
Sample simmilator xml file (put this inside the `www` folder in your cordova app) | ||
####Sample simulator xml file. | ||
Put this inside the `www` folder in your cordova app or in `merges\windows` for only windows platform. | ||
``` | ||
@@ -53,3 +62,6 @@ <?xml version="1.0" encoding="utf-16" ?> | ||
node_modules\.bin\preprocess src\js\store-windows.js src\js > www\store-windows.js | ||
node_modules\.bin\uglifyjs www\store-windows.js -b -o www\store-windows.js | ||
node_modules\.bin\preprocess src\js\store-android.js src\js > www\store-android.js | ||
node_modules\.bin\uglifyjs www\store-android.js -b -o www\store-android.js | ||
``` |
{ | ||
"name": "cc.fovea.cordova.purchase", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Cordova Purchase plugin for iOS and Android (AppStore and PlayStore)", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -32,3 +32,3 @@ # Cordova Purchase Plugin | ||
```xml | ||
<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="3.11.0" /> | ||
<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="4.0.0" /> | ||
``` | ||
@@ -39,3 +39,3 @@ | ||
```xml | ||
<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="3.11.0"> | ||
<gap:plugin name="cc.fovea.cordova.purchase" source="npm" version="4.0.0"> | ||
<param name="BILLING_KEY" value="MIIB...."/> | ||
@@ -88,3 +88,3 @@ </gap:plugin> | ||
- [Documentation for Android](doc/android.md) | ||
- [Documentation for Windows](doc/android.md) | ||
- [Documentation for Windows](doc/windows.md) | ||
@@ -143,2 +143,2 @@ ## Resources | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
THE SOFTWARE. |
@@ -216,2 +216,3 @@ /*global storekit */ | ||
description: validProducts[i].description, | ||
currency: validProducts[i].currency, | ||
state: store.VALID | ||
@@ -443,3 +444,2 @@ }); | ||
}); | ||
p.stateChanged(); | ||
} | ||
@@ -446,0 +446,0 @@ function storekitDownloadFailed(transactionIdentifier, productId, errorCode, errorText) { |
@@ -114,7 +114,7 @@ /* | ||
}; | ||
InAppBilling.prototype.setTestMode = function (testMode) { | ||
InAppBilling.prototype.setTestMode = function (success, fail) { | ||
if (this.options.showLog) { | ||
log('setTestMode called!'); | ||
} | ||
return cordova.exec(null, null, "InAppBillingPlugin", "setTestMode", [testMode]); | ||
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "setTestMode", [""]); | ||
}; | ||
@@ -121,0 +121,0 @@ |
var cordova = require('cordova'); | ||
module.exports = { | ||
setTestMode: function(args){ | ||
setTestMode: function(win, fail, args){ | ||
//switch between live and similator mode for IAP testing | ||
var testMode = args[0]; | ||
if (testMode){ | ||
this.currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator; | ||
Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("www").done( | ||
function (folder) { | ||
folder.getFileAsync("in-app-purchase.xml").done( | ||
function (file) { | ||
console.log("got the xml file for currentAppSimulator", file); | ||
this.currentApp.reloadSimulatorAsync(file).done( | ||
function () { | ||
// Get the license info | ||
this.productLicenses = this.currentApp.licenseInformation.productLicenses; | ||
if (this.currentApp && this.productLicenses) { | ||
console.log("loaded xml file"); | ||
} else { | ||
console.log("failed xml file"); | ||
} | ||
}.bind(this), | ||
function (err) { | ||
console.log("This is still not working!!"); | ||
console.log(err); | ||
this.currentApp = Windows.ApplicationModel.Store.CurrentAppSimulator; | ||
Windows.ApplicationModel.Package.current.installedLocation.getFolderAsync("www").done( | ||
function (folder) { | ||
folder.getFileAsync("in-app-purchase.xml").done( | ||
function (file) { | ||
console.log("got the xml file for currentAppSimulator", file); | ||
this.currentApp.reloadSimulatorAsync(file).done( | ||
function () { | ||
// Get the license info | ||
this.productLicenses = this.currentApp.licenseInformation.productLicenses; | ||
if (this.currentApp && this.productLicenses) { | ||
console.log("loaded xml file"); | ||
win(); | ||
} else { | ||
console.log("failed xml file"); | ||
fail(); | ||
} | ||
); | ||
}.bind(this)); | ||
}.bind(this) | ||
); | ||
} | ||
else { | ||
this.currentApp = Windows.ApplicationModel.Store.CurrentApp; | ||
} | ||
}.bind(this), | ||
function (err) { | ||
console.log("This is still not working!!"); | ||
console.log(err); | ||
fail(); | ||
} | ||
); | ||
}.bind(this)); | ||
}.bind(this) | ||
); | ||
}, | ||
@@ -39,0 +35,0 @@ init: function (win, fail, args) { |
@@ -826,7 +826,7 @@ var store = {}; | ||
}; | ||
InAppBilling.prototype.setTestMode = function(testMode) { | ||
InAppBilling.prototype.setTestMode = function(success, fail) { | ||
if (this.options.showLog) { | ||
log("setTestMode called!"); | ||
} | ||
return cordova.exec(null, null, "InAppBillingPlugin", "setTestMode", [ testMode ]); | ||
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "setTestMode", [ "" ]); | ||
}; | ||
@@ -833,0 +833,0 @@ function errorCb(fail) { |
@@ -1244,2 +1244,3 @@ var store = {}; | ||
description: validProducts[i].description, | ||
currency: validProducts[i].currency, | ||
state: store.VALID | ||
@@ -1404,3 +1405,2 @@ }); | ||
}); | ||
p.stateChanged(); | ||
} | ||
@@ -1407,0 +1407,0 @@ function storekitDownloadFailed(transactionIdentifier, productId, errorCode, errorText) { |
@@ -826,7 +826,7 @@ var store = {}; | ||
}; | ||
InAppBilling.prototype.setTestMode = function(testMode) { | ||
InAppBilling.prototype.setTestMode = function(success, fail) { | ||
if (this.options.showLog) { | ||
log("setTestMode called!"); | ||
} | ||
return cordova.exec(null, null, "InAppBillingPlugin", "setTestMode", [ testMode ]); | ||
return cordova.exec(success, errorCb(fail), "InAppBillingPlugin", "setTestMode", [ "" ]); | ||
}; | ||
@@ -833,0 +833,0 @@ function errorCb(fail) { |
Sorry, the diff of this file is not supported yet
933454
141
15697