Exemple #1
0
 public void purchase(string item, string developerPayload)
 {
     if (unknownAmazonProducts.Contains(item))
     {
         callback.logError(UnibillError.AMAZONAPPSTORE_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_AMAZON, item);
         callback.onPurchaseFailedEvent(item);
         return;
     }
     amazon.initiatePurchaseRequest(item);
 }
 public void purchase(string item)
 {
     if (productsNotReturnedByStorekit.Contains(item))
     {
         biller.logError(UnibillError.STOREKIT_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_STOREKIT, item);
         biller.onPurchaseFailedEvent(item);
         return;
     }
     storekit.storeKitPurchaseProduct(item);
 }
Exemple #3
0
        public void purchase(string item, string developerPayload)
        {
            if (unknownProducts.Contains(item))
            {
                callback.logError(UnibillError.WP8_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_MICROSOFT, item);
                callback.onPurchaseFailedEvent(item);
                return;
            }

            wp8.Purchase(item);
        }
Exemple #4
0
        public void purchase(string item, string developerPayload)
        {
            if (unknownSamsungProducts.Contains(item))
            {
                callback.logError(UnibillError.SAMSUNG_APPS_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_SAMSUNG, item);
                callback.onPurchaseFailedEvent(item);
                return;
            }

            rawSamsung.initiatePurchaseRequest(item);
        }
Exemple #5
0
        public void purchase(string item)
        {
            if (unknownAmazonProducts.Contains(item))
            {
                callback.logError(UnibillError.GOOGLEPLAY_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_GOOGLEPLAY, item);
                callback.onPurchaseFailedEvent(item);
                return;
            }

            rawInterface.purchase(item);
        }
Exemple #6
0
        public void purchase(string item, string developerPayload)
        {
            #if UNITY_METRO
            if (unknownProducts.Contains(item))
            {
                callback.logError(UnibillError.WIN_8_1_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_MICROSOFT, item);
                callback.onPurchaseFailedEvent(item);
                return;
            }

            UnityEngine.WSA.Application.InvokeOnUIThread(() => {
                wp8.Purchase(item);
            }, false);
            #endif
        }
        public void initialise(IBillingServiceCallback callback)
        {
            this.callback = callback;
            if (null == publicKey || publicKey.Equals("[Your key]"))
            {
                callback.logError(UnibillError.GOOGLEPLAY_PUBLICKEY_NOTCONFIGURED, publicKey);
                callback.onSetupComplete(false);
                return;
            }

            var encoder = new Dictionary <string, object>();

            encoder.Add("publicKey", this.publicKey);
            var           productIds = new List <string>();
            List <object> products   = new List <object>();

            foreach (var item in db.AllPurchasableItems)
            {
                Dictionary <string, object> product = new Dictionary <string, object>();
                var id = remapper.mapItemIdToPlatformSpecificId(item);
                productIds.Add(id);
                product.Add("productId", id);
                product.Add("consumable", item.PurchaseType == PurchaseType.Consumable);
                products.Add(product);
            }
            encoder.Add("products", products);

            var json = encoder.toJson();

            rawInterface.initialise(this, json, productIds.ToArray());
        }
 public void initialise (IBillingServiceCallback biller) {
     this.biller = biller;
     if (reportError) {
         biller.logError(UnibillError.AMAZONAPPSTORE_GETITEMDATAREQUEST_FAILED);
     }
     biller.onSetupComplete(!reportCriticalError);
 }
        public void purchase(string item, string developerPayload)
        {
            if (unknownAmazonProducts.Contains(item))
            {
                callback.logError(UnibillError.GOOGLEPLAY_ATTEMPTING_TO_PURCHASE_PRODUCT_NOT_RETURNED_BY_GOOGLEPLAY, item);
                callback.onPurchaseFailedEvent(item);
                return;
            }

            var args = new Dictionary <string, object>();

            args ["productId"]        = item;
            args ["developerPayload"] = developerPayload;

            rawInterface.purchase(MiniJSON.jsonEncode(args));
        }
Exemple #10
0
        public void initialise (IBillingServiceCallback callback) {
            this.callback = callback;
            if (null == publicKey || publicKey.Equals ("[Your key]")) {
                callback.logError (UnibillError.GOOGLEPLAY_PUBLICKEY_NOTCONFIGURED, publicKey);
                callback.onSetupComplete (false);
                return;
            }

            var encoder = new Dictionary<string, object>();
            encoder.Add ("publicKey", this.publicKey);
            var productIds = new List<string>();
            List<object> products = new List<object>();
            foreach (var item in db.AllPurchasableItems) {
                Dictionary<string, object> product = new Dictionary<string, object>();
                var id = remapper.mapItemIdToPlatformSpecificId(item);
                productIds.Add(id);
                product.Add ("productId", id);
                product.Add ("consumable", item.PurchaseType == PurchaseType.Consumable);
                products.Add (product);
            }
            encoder.Add("products", products);

            var json = encoder.toJson();
            rawInterface.initialise(this, json, productIds.ToArray());
        }
 public void initialise(IBillingServiceCallback biller)
 {
     this.biller = biller;
     if (reportError)
     {
         biller.logError(UnibillError.AMAZONAPPSTORE_GETITEMDATAREQUEST_FAILED);
     }
     biller.onSetupComplete(!reportCriticalError);
 }
Exemple #12
0
 public void initialise (IBillingServiceCallback biller) {
     this.biller = biller;
     bool available = storekit.storeKitPaymentsAvailable ();
     if (available) {
         string[] platformSpecificProductIds = remapper.getAllPlatformSpecificProductIds();
         storekit.storeKitRequestProductData (string.Join (",", platformSpecificProductIds), platformSpecificProductIds);
     } else {
         biller.logError(UnibillError.STOREKIT_BILLING_UNAVAILABLE);
         biller.onSetupComplete(false);
     }
 }
        public void initialise(IBillingServiceCallback biller)
        {
            this.biller = biller;
            bool available = storekit.unibillPaymentsAvailable();

            if (available)
            {
                storekit.unibillRequestProductData(remapper.getAllPlatformSpecificProductIds().toJson());
            }
            else
            {
                biller.logError(UnibillError.STOREKIT_BILLING_UNAVAILABLE);
                biller.onSetupComplete(false);
            }
        }
        public void onProductListReceived(string productListString)
        {
            if (productListString.Length == 0)
            {
                biller.logError(UnibillError.STOREKIT_RETURNED_NO_PRODUCTS);
                biller.onSetupComplete(false);
                return;
            }

            var responseObject = (Dictionary <string, object>)Unibill.Impl.MiniJSON.jsonDecode(productListString);
            var productHash    = responseObject.getHash("products");

            var products = Util.DeserialiseProductList(productHash);

            // Register our storekit transaction observer.
            // We must wait until we have initialised to do this.
            storekit.addTransactionObserver();

            var appReceipt = responseObject.getString("appReceipt");

            onAppReceiptRetrieved(appReceipt);

            biller.onSetupComplete(products);
        }
Exemple #15
0
 // When using an incorrect product id:
 // "Exception from HRESULT: 0x805A0194"
 public void OnProductListError(string message)
 {
     util.RunOnMainThread(() => {
         if (message.Contains("0x805A0194"))
         {
             callback.logError(UnibillError.WP8_APP_ID_NOT_KNOWN);
             callback.onSetupComplete(false);
         }
         else
         {
             logError("Unable to retrieve product listings. Unibill will automatically retry...");
             logError(message);
             init(3000);
         }
     });
 }
 // When using an incorrect product id:
 // "Exception from HRESULT: 0x805A0194"
 public void OnProductListError(string message)
 {
     UnityEngine.WSA.Application.InvokeOnAppThread(() => {
         if (message.Contains("801900CC"))
         {
             callback.logError(UnibillError.WIN_8_1_APP_NOT_KNOWN);
             callback.onSetupComplete(false);
         }
         else
         {
             logError("Unable to retrieve product listings. Unibill will automatically retry...");
             logError(message);
             init(3000);
         }
     }, false);
 }
 // Callbacks
 public void onBillingNotSupported()
 {
     callback.logError(UnibillError.GOOGLEPLAY_BILLING_UNAVAILABLE);
     callback.onSetupComplete(false);
 }