internal async Task PurchaseAttempt(SubscriptionPurchasedEventArgs args) { if (await UIContext.IsOffline()) { throw new Exception("Network connection is not available."); } if (User == null) { throw new Exception("User is not available."); } var url = new Uri(Options.BaseUri, Options.PurchaseAttemptPath).ToString(); var @params = new { User.Ticket, User.UserId, Platform = PaymentAuthority, args.ProductId, args.TransactionId, args.TransactionDateUtc, args.PurchaseToken }; await BaseApi.Post(url, @params, OnError.Ignore, showWaiting : false); await SubscriptionPurchased.Raise(args); }
internal async Task <PurchaseAttemptResult> PurchaseAttempt(SubscriptionPurchasedEventArgs args) { if (await UIContext.IsOffline()) { throw new Exception("Network connection is not available."); } if (User == null) { throw new Exception("User is not available."); } var url = new Uri(Options.BaseUri, Options.PurchaseAttemptPath).ToString(); var @params = new { User.Ticket, User.UserId, Platform = PaymentAuthority, args.ProductId, args.PurchaseToken }; var result = await BaseApi.Post <PurchaseAttemptResult>(url, @params, OnError.Ignore, showWaiting : false); if (result?.Status == PurchaseAttemptStatus.Succeeded) { await SubscriptionPurchased.Raise(args); } return(result); }