Exemple #1
0
        public void SendPaymentFormAsync(int msgId, string infoId, string optionId, TLInputPaymentCredentialsBase credentials, Action <TLPaymentsPaymentResultBase> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLPaymentsSendPaymentForm {
                MsgId = msgId, RequestedInfoId = infoId, ShippingOptionId = optionId, Credentials = credentials
            };

            const string caption = "payments.sendPaymentForm";

            SendInformativeMessage <TLPaymentsPaymentResultBase>(caption, obj,
                                                                 result =>
            {
                if (result is TLPaymentsPaymentResult paymentResult)
                {
                    var multiPts = paymentResult as ITLMultiPts;
                    if (multiPts != null)
                    {
                        _updatesService.SetState(multiPts, caption);
                    }
                    else
                    {
                        _updatesService.ProcessUpdates(paymentResult.Updates, true);
                    }
                }

                callback?.Invoke(result);
            },
                                                                 faultCallback);
        }
        public Task <MTProtoResponse <TLPaymentsPaymentResultBase> > SendPaymentFormAsync(int msgId, string infoId, string optionId, TLInputPaymentCredentialsBase credentials)
        {
            var tsc = new TaskCompletionSource <MTProtoResponse <TLPaymentsPaymentResultBase> >();

            SendPaymentFormAsync(msgId, infoId, optionId, credentials, (callback) =>
            {
                tsc.TrySetResult(new MTProtoResponse <TLPaymentsPaymentResultBase>(callback));
            }, (faultCallback) =>
            {
                tsc.TrySetResult(new MTProtoResponse <TLPaymentsPaymentResultBase>(faultCallback));
            });
            return(tsc.Task);
        }
 public void SendPaymentFormAsync(int msgId, string infoId, string optionId, TLInputPaymentCredentialsBase credentials, Action <TLPaymentsPaymentResultBase> callback, Action <TLRPCError> faultCallback = null)
 {
     Logs.Logger.Critical("Invoking legacy method");
 }
        public void SendPaymentFormAsync(TLInt msgId, TLString requestedInfoId, TLString shippingOptionId, TLInputPaymentCredentialsBase credentials, Action <TLPaymentResultBase> callback, Action <TLRPCError> faultCallback = null)
        {
            var obj = new TLSendPaymentForm
            {
                Flags            = new TLInt(0),
                MsgId            = msgId,
                RequestedInfoId  = requestedInfoId,
                ShippingOptionId = shippingOptionId,
                Credentials      = credentials
            };

            const string caption = "payments.savePaymentForm";

            SendInformativeMessage <TLPaymentResultBase>(caption, obj,
                                                         result =>
            {
                var paymentResult = result as TLPaymentResult;
                if (paymentResult != null)
                {
                    var multiPts = paymentResult.Updates as IMultiPts;
                    if (multiPts != null)
                    {
                        _updatesService.SetState(multiPts, caption);
                    }
                    else
                    {
                        ProcessUpdates(paymentResult.Updates, null, true);
                    }
                }

                callback.SafeInvoke(result);
            },
                                                         faultCallback);
        }