示例#1
0
        private async void SendExecute()
        {
            var disclaimer = await TLMessageDialog.ShowAsync(string.Format(Strings.Android.PaymentWarningText, _bot.FullName, _provider.FullName), Strings.Android.PaymentWarning, Strings.Android.OK);

            var confirm = await TLMessageDialog.ShowAsync(string.Format(Strings.Android.PaymentTransactionMessage, LocaleHelper.FormatCurrency(_totalAmount, _paymentForm.Invoice.Currency), _bot.FullName, _invoice.Title), Strings.Android.PaymentTransactionReview, Strings.Android.OK, Strings.Android.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 ProtoService.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)
            {
            }
        }
示例#2
0
 public string FormatAmount(long amount, string currency)
 {
     return(LocaleHelper.FormatCurrency(amount, currency));
 }
 private string ConvertPay(long amount, string currency)
 {
     return(string.Format(Strings.Android.PaymentCheckoutPay, LocaleHelper.FormatCurrency(amount, currency)));
 }