void StartPurchaseResult(PlayfabPurchaser purchaser) { PurchaseTracker.instance.Add(purchaser); SaveLoad.Save(); purchaser.PayForPurchase(result => PayForPurchaserResult(purchaser), error => Error(purchaser)); }
public PlayfabPurchaser ResumeConfirmingPurchase(string orderId, Action <PlayfabPurchaser> onResult, Action <PlayfabPurchaser> onError) { var purchaser = new PlayfabPurchaser(); purchaser.ResumeConfirmingPurchase(orderId, result => { ConfirmPurchaseResult(purchaser); onResult(purchaser); }, error => { Error(purchaser); onError(purchaser); }); return(purchaser); }
public PlayfabPurchaser Purchase(params CatalogItemInfo[] catalogItemInfos) { var purchaser = new PlayfabPurchaser(); purchaser.StartPurchase(catalogItemInfos, result => StartPurchaseResult(purchaser), error => Error(purchaser)); return(purchaser); }
public void ConfirmAllPurchases() { List <TrackablePurchase> purchases = PurchaseTracker.instance.TryGetAll(); if (purchases != null) { Debug.Log("Confirming all purchases."); DateTime trackingCutOffUTC = DateTime.UtcNow - maxTrackingTime; for (int i = 0, len = purchases.Count; i < len; ++i) { TrackablePurchase purchaseTracker = purchases[i]; PlayfabPurchaser purchaser = ResumeConfirmingPurchase(purchaseTracker.orderId, purchaser => { }, onError => { if (purchaseTracker.trackingStartDateUTC < trackingCutOffUTC) { Debug.LogWarning("No longer tracking order Id after " + maxTrackingTime.TotalHours + " hours, " + purchaseTracker.orderId); PurchaseTracker.instance.Remove(purchaseTracker.orderId); } }); } } }
public void ApplyConfirmationResult(PlayfabPurchaser purchaser) { if (purchaser.confirmPurchaseResult != null) { PurchaseTracker.instance.Remove(purchaser.orderId); ApplyItemsToGame(purchaser.confirmPurchaseResult.Items); } }
void Error(PlayfabPurchaser purchaser) { if (purchaser.error.ErrorAwaitingPayPalConfirmationPage()) { } else { Debug.LogError("Unkown purchase error\n" + purchaser.error.GenerateErrorReport()); } }
void PayForPurchaserResult(PlayfabPurchaser purchaser) { if (purchaser.IsAwaitingConfirmationPage()) { purchaser.OpenConfirmationPage(); } else { ConfirmPurchase(purchaser); } }
void OnClick() { loginWizard.Login(false, result: () => { if (playfabPurchaser == null || playfabPurchaser.error != null) { playfabPurchaser = CatalogManager.instance.Purchase(catalogItemInfo); } }, error: () => { }); }
void ConfirmPurchaseResult(PlayfabPurchaser playfabPurchaser) { ApplyConfirmationResult(playfabPurchaser); }
void ConfirmPurchase(PlayfabPurchaser purchaser) { purchaser.ConfirmPurchase(result => ConfirmPurchaseResult(purchaser), error => Error(purchaser)); }