Flatratekaufprozess vollständig abgeschlossen.
This commit is contained in:
@@ -78,16 +78,13 @@ angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers', 'starter
|
||||
inappbilling.init(StoreInitsuccessHandler, StoreIniterrorHandler, {showLog:true});
|
||||
}
|
||||
|
||||
|
||||
//FlateRate gekauft?
|
||||
function purchasessuccess (result) {
|
||||
var strResult = "";
|
||||
if(typeof result === 'object') {
|
||||
strResult = JSON.stringify(result);
|
||||
} else {
|
||||
strResult = result;
|
||||
}
|
||||
|
||||
alert("SUCCESS: \r\n"+strResult );
|
||||
var p = result[0];
|
||||
|
||||
if(p['productId'] == 'rosenflatrate') {
|
||||
$rootScope.flatrate=1;
|
||||
}
|
||||
}
|
||||
|
||||
function purchasesfail (error) {
|
||||
|
||||
@@ -63,6 +63,15 @@ $scope.show = function() {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.resetflat = function() {
|
||||
inappbilling.consumePurchase(function(result) {}, function(result) {}, 'rosenflatrate');
|
||||
$rootScope.flatrate=0;
|
||||
$scope.showflatrate = true;
|
||||
$timeout(getProducts, 1000);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Produkt-Details abrufen START
|
||||
*/
|
||||
@@ -73,7 +82,7 @@ $scope.show = function() {
|
||||
function successProducts (result) {
|
||||
|
||||
//alert(JSON.stringify(result));
|
||||
|
||||
$scope.showrosen = false;
|
||||
$scope.producitems = [
|
||||
angular.fromJson(result[0]),
|
||||
angular.fromJson(result[1]),
|
||||
@@ -112,15 +121,26 @@ $scope.show = function() {
|
||||
$scope.flateraterosenpreiscurrency=$scope.producitems[2].price_currency_code;
|
||||
$scope.flateraterosenpreistag="Preis: " + $scope.flateraterosenpreis + " " + $scope.flateraterosenpreiscurrency + " (inkl. MwSt.)";
|
||||
|
||||
if($rootScope.flatrate==1) {
|
||||
|
||||
$scope.showflatrate = false;
|
||||
$scope.rosen1preistag="kostenlos - Flaterate";
|
||||
$scope.rosen3preistag="kostenlos - Flaterate";
|
||||
$scope.rosen9preistag="kostenlos - Flaterate";
|
||||
|
||||
}
|
||||
|
||||
|
||||
$scope.showrosen = true;
|
||||
$timeout(function(){
|
||||
$scope.showrosen = true;
|
||||
}, 500);
|
||||
}, 400);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function errorProducts (result) {
|
||||
/*
|
||||
var strResult = "";
|
||||
if(typeof result === 'object') {
|
||||
strResult = JSON.stringify(result);
|
||||
@@ -128,6 +148,7 @@ $scope.show = function() {
|
||||
strResult = result;
|
||||
}
|
||||
alert(strResult);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -145,13 +166,22 @@ $scope.show = function() {
|
||||
|
||||
if((window.device && device.platform == "Android") && typeof inappbilling !== "undefined") {
|
||||
|
||||
if ($rootScope.storeinit==1 && $rootScope.flatrate==0){
|
||||
if ($rootScope.storeinit==1){
|
||||
|
||||
if ($scope.preis=='rosenflatrate'){
|
||||
inappbilling.buy(successBuyOnceHandler, errorBuyHandler, $scope.preis);
|
||||
|
||||
if ($rootScope.flatrate==1){
|
||||
$timeout(successConsumeHandler, 200);
|
||||
}
|
||||
else{
|
||||
inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis);
|
||||
|
||||
if ($scope.preis=='rosenflatrate'){
|
||||
inappbilling.buy(successBuyOnceHandler, errorBuyHandler, $scope.preis);
|
||||
}
|
||||
else{
|
||||
inappbilling.buy(successBuyHandler, errorBuyHandler, $scope.preis);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -182,7 +212,7 @@ $scope.show = function() {
|
||||
}
|
||||
|
||||
/*
|
||||
* Prüfen ob Kuf schonmal durchgeführt wurde, aber noch nicht konsumiert
|
||||
* Prüfen ob Kauf schonmal durchgeführt wurde, aber noch nicht konsumiert
|
||||
*/
|
||||
returnBool=strResult.indexOf("Item Already Owned") != -1;
|
||||
if (returnBool==true){
|
||||
@@ -225,6 +255,8 @@ $scope.show = function() {
|
||||
$scope.rosen3preistag="kostenlos - Flaterate";
|
||||
$scope.rosen9preistag="kostenlos - Flaterate";
|
||||
|
||||
$timeout(getProducts, 300);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user