private async void OnPayClick(object sender, RoutedEventArgs e) { var items = Items; if (!items.Any()) { return; } var order = new Order { OrderId = Guid.NewGuid().ToString(), Amount = total * 100, Title = items.Count == 1 ? items.First().Item.VolumeInfo.Title : "Покупка книг", Description = string.Join(", ", items.Select(item => item.Item.VolumeInfo.Description)), CustomerKey = App.CustomerKey }; var paymentListener = new PaymentHandler { SucceededCallback = paymentId => { Items.Clear(); Frame.Navigate(typeof(ConfirmationView), total); }, CancelledCallback = () => { }, FailedCallback = async exception => { var messageDialog = new MessageDialog("Платёж отклонён банком. Убедитесь, что на карте достаточно средств и попробуйте снова.", "Платёж отклонён"); await messageDialog.ShowAsync(); } }; await AcquiringUI.ShowPaymentViewAsync(order, paymentListener); }
private async void OnPayClick(object sender, RoutedEventArgs e) { var product = new Order { OrderId = Guid.NewGuid().ToString(), Amount = item.SaleInfo.Price * 100, Title = item.VolumeInfo.Title, Description = item.VolumeInfo.Description, CustomerKey = App.CustomerKey, }; var paymentListener = new PaymentHandler { SucceededCallback = paymentId => { Frame.Navigate(typeof(ConfirmationView), item.SaleInfo.Price); }, CancelledCallback = () => { }, FailedCallback = async exception => { var messageDialog = new MessageDialog("Платёж отклонён банком. Убедитесь, что на карте достаточно средств и попробуйте снова.", "Платёж отклонён"); await messageDialog.ShowAsync(); } }; await AcquiringUI.ShowPaymentViewAsync(product, paymentListener); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; AcquiringUI.SetTerminalKey(MerchantParams.TERMINAL_KEY); AcquiringUI.SetPassword(MerchantParams.PASSWORD); AcquiringUI.SetPublicKey(MerchantParams.PUBLIC_KEY); }