Flatratekaufprozess vollständig abgeschlossen.

This commit is contained in:
2016-02-03 09:17:44 +01:00
parent cfb60396ea
commit e6a9f2e68f
26 changed files with 273 additions and 80 deletions

View File

@@ -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) {

View File

@@ -63,6 +63,14 @@ $scope.show = function() {
};
$scope.resetflat = function() {
inappbilling.consumePurchase(function(result) {}, function(result) {}, 'rosenflatrate');
$rootScope.flatrate=0;
$timeout(getProducts, 1000);
};
/*
* Produkt-Details abrufen START
*/
@@ -73,7 +81,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 +120,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 +147,7 @@ $scope.show = function() {
strResult = result;
}
alert(strResult);
*/
}
@@ -145,13 +165,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 +211,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 +254,8 @@ $scope.show = function() {
$scope.rosen3preistag="kostenlos - Flaterate";
$scope.rosen9preistag="kostenlos - Flaterate";
$timeout(getProducts, 300);
}
/*

View File

@@ -54,6 +54,10 @@
<div class="col col-50"><button class="button button-full button-small icon-left ion-social-euro button-custom" ng-disabled="!$parent.preis || !$parent.freitext || !$parent.name" ng-click="buyRose()">Jetzt Kaufen</button></div>
</div>
<div class="row">
<div class="col col-50"><button class="button button-full button-small icon-left ion-image button-custom" ng-click="resetflat()">Reset Flatrate</button></div>
</div>
</div>
</div>