Example #1
0
        /// <summary>
        /// 进行支付
        /// </summary>
        /// <returns></returns>
        private async Task Payment()
        {
            var payResult = await OfoApi.ConfirmToPayAsync(UnLockCarInfo.OrderNumber, _usePacketId, UnLockCarInfo.Card?.CardId);

            if (await CheckOfoApiResult(payResult))
            {
                await ShowNotifyAsync(payResult?.Message);

                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    base.TryGoBack();
                });

                if (!string.IsNullOrWhiteSpace(payResult?.Data?.url))   //检查是否有红包并弹出
                {
                    RedPacketPupopContentView redPacketPupopContentView = new RedPacketPupopContentView();
                    var redPacketPupopContentViewModel = new RedPacketPupopContentViewModel()
                    {
                        PaymentInfo = payResult.Data,
                    };

                    await ShowContentNotifyAsync(redPacketPupopContentView, redPacketPupopContentViewModel);
                }
            }
            else if (!string.IsNullOrEmpty(payResult.Message) && (payResult.Message.Contains("已支付") || payResult.ErrorCode == 40006))   //已支付,返回
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    base.TryGoBack();
                });
            }
        }
Example #2
0
        /// <summary>
        /// 检查订单状态
        /// </summary>
        /// <returns></returns>
        private async Task CheckOrderStatusAsync()
        {
            if (UnLockCarInfo == null)
            {
                var unLockCarInfoResult = await OfoApi.GetUnfinishedOrderAsync();

                if (await CheckOfoApiResult(unLockCarInfoResult))
                {
                    UnLockCarInfo = unLockCarInfoResult.Data;
                }

                if (UnLockCarInfo == null)
                {
                    return;
                }
            }
            var payResult = await OfoApi.ConfirmToPayAsync(UnLockCarInfo.OrderNumber, 0);

            if (await CheckOfoApiResult(payResult))
            {
                await ShowNotifyAsync(payResult?.Message);

                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    base.TryGoBack();
                });

                if (!string.IsNullOrWhiteSpace(payResult?.Data?.url))
                {
                    RedPacketPupopContentView redPacketPupopContentView = new RedPacketPupopContentView();
                    var redPacketPupopContentViewModel = new RedPacketPupopContentViewModel()
                    {
                        PaymentInfo = payResult.Data,
                    };

                    await ShowContentNotifyAsync(redPacketPupopContentView, redPacketPupopContentViewModel);
                }
            }
            else if (!string.IsNullOrEmpty(payResult.Message) && (payResult.Message.Contains("已支付") || payResult.ErrorCode == 40006))
            {
                await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    base.TryGoBack();
                });
            }
        }