Exemplo n.º 1
0
        private string ConvertPay(bool receipt, long amount, string currency)
        {
            if (receipt)
            {
                return(Strings.Resources.Close.ToUpper());
            }

            return(string.Format(Strings.Resources.PaymentCheckoutPay, Locale.FormatCurrency(amount, currency)));
        }
Exemplo n.º 2
0
        public string ConvertPurchase(bool premium, long amount, string currency)
        {
            if (premium)
            {
                return(Strings.Resources.OK);
            }

            return(string.Format(Strings.Resources.SubscribeToPremium, Locale.FormatCurrency(amount, currency)));
        }
Exemplo n.º 3
0
        public LimitsPopup(IProtoService protoService, PremiumState state, IList <PremiumLimit> limits)
        {
            InitializeComponent();

            Title = Strings.Resources.DoubledLimits;

            ScrollingHost.ItemsSource = limits;

            PurchaseCommand.Content = protoService.IsPremium
                ? Strings.Resources.OK
                : string.Format(Strings.Resources.SubscribeToPremium, Locale.FormatCurrency(state.MonthlyAmount, state.Currency));
        }
Exemplo n.º 4
0
        public FeaturesPopup(IProtoService protoService, PremiumState state, IList <PremiumFeature> features, IDictionary <Type, Animation> animations, Stickers stickers, PremiumFeature selectedFeature)
        {
            InitializeComponent();

            _protoService = protoService;
            _animations   = animations;
            _stickers     = stickers;

            var items = features.Where(x => x is not PremiumFeatureIncreasedLimits).ToArray();

            Pager.NumberOfPages = items.Length;

            ScrollingHost.ItemsSource  = items;
            ScrollingHost.SelectedItem = selectedFeature;

            PurchaseCommand.Content = protoService.IsPremium
                ? Strings.Resources.OK
                : string.Format(Strings.Resources.SubscribeToPremium, Locale.FormatCurrency(state.MonthlyAmount, state.Currency));
        }
Exemplo n.º 5
0
        private void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            if (args.InRecycleQueue)
            {
                return;
            }

            var option  = args.Item as PremiumGiftOption;
            var content = args.ItemContainer.ContentTemplateRoot as RadioButton;

            var title     = content.FindName("Title") as TextBlock;
            var subtitle  = content.FindName("Subtitle") as TextBlock;
            var price     = content.FindName("Price") as TextBlock;
            var icon      = content.FindName("Icon") as TextBlock;
            var iconPanel = content.FindName("IconPanel") as Border;

            var monthlyAmount = option.Amount / option.MonthCount;

            title.Text    = Locale.Declension("Months", option.MonthCount);
            subtitle.Text = string.Format(Strings.Resources.PricePerMonth, Locale.FormatCurrency(monthlyAmount, option.Currency));
            price.Text    = Locale.FormatCurrency(option.Amount, option.Currency);

            if (option.DiscountPercentage > 0)
            {
                icon.Text            = string.Format(Strings.Resources.GiftPremiumOptionDiscount, option.DiscountPercentage);
                iconPanel.Background = new SolidColorBrush(_gradient[args.ItemIndex]);
                iconPanel.Visibility = Visibility.Visible;
            }
            else
            {
                iconPanel.Visibility = Visibility.Collapsed;
            }

            content.Tag       = option;
            content.IsChecked = option == _selectedOption;
            args.Handled      = true;
        }
Exemplo n.º 6
0
 public string FormatAmount(long amount, string currency)
 {
     return(Locale.FormatCurrency(amount, currency));
 }
Exemplo n.º 7
0
 private string ConvertPay(long amount, string currency)
 {
     return(string.Format(Strings.Resources.PaymentCheckoutPay, Locale.FormatCurrency(amount, currency)));
 }
        private async void SendExecute()
        {
            var disclaimer = await TLMessageDialog.ShowAsync(string.Format(Strings.Resources.PaymentWarningText, _bot.FirstName, _provider.FirstName), Strings.Resources.PaymentWarning, Strings.Resources.OK);

            var confirm = await TLMessageDialog.ShowAsync(string.Format(Strings.Resources.PaymentTransactionMessage, Locale.FormatCurrency(_totalAmount, _paymentForm.Invoice.Currency), _bot.FirstName, _invoice.Title), Strings.Resources.PaymentTransactionReview, Strings.Resources.OK, Strings.Resources.Cancel);

            if (confirm != Windows.UI.Xaml.Controls.ContentDialogResult.Primary)
            {
                return;
            }

            IsLoading = true;

            //TLInputPaymentCredentialsBase credentials;
            //if (_paymentForm.HasSavedCredentials && _paymentForm.SavedCredentials is TLPaymentSavedCredentialsCard savedCard)
            //{
            //    credentials = new TLInputPaymentCredentialsSaved { Id = savedCard.Id, TmpPassword = ApplicationSettings.Current.TmpPassword.TmpPassword };
            //}
            //else
            //{
            //    credentials = new TLInputPaymentCredentials { Data = new TLDataJSON { Data = _credentials }, IsSave = _save };
            //}

            //var response = await LegacyService.SendPaymentFormAsync(_message.Id, _requestedInfo?.Id, _shipping?.Id, credentials);
            //if (response.IsSucceeded)
            //{
            //    if (response.Result is TLPaymentsPaymentVerficationNeeded verificationNeeded)
            //    {
            //        if (Uri.TryCreate(verificationNeeded.Url, UriKind.Absolute, out Uri uri))
            //        {
            //            await Launcher.LaunchUriAsync(uri);
            //        }
            //    }

            //    NavigationService.GoBackAt(1);
            //}
            //else if (response.Error != null)
            //{

            //}
        }
Exemplo n.º 9
0
 private void Option_Checked(object sender, RoutedEventArgs e)
 {
     if (sender is FrameworkElement element && element.Tag is PremiumGiftOption option)
     {
         _selectedOption         = option;
         PurchaseCommand.Content = string.Format(Strings.Resources.GiftSubscriptionFor, Locale.FormatCurrency(option.Amount, option.Currency));
     }
 }