Inheritance: System.Exception
 public async Task <IResult <ITransactionResult> > CompleteDSecure(string receiptID, string paRes, string md)
 {
     try {
         ThreeDResultModel model = new ThreeDResultModel();
         model.PaRes = paRes;
         Task <IResult <PaymentReceiptModel> > task = _judoAPI.ThreeDs.Complete3DSecure(receiptID, model);
         return(await task);
     } catch (Exception e) {
         var error = new JudoError()
         {
             Exception = e,
             ApiError  = new JudoPayDotNet.Errors.JudoApiErrorModel()
             {
                 ErrorMessage = e.InnerException.ToString()
             }
         };
         throw error;
     }
 }
        public static JudoError FlattenToJudoError(this AggregateException errors)
        {
            List <JudoModelError> models = new List <JudoModelError> ();

            foreach (Exception em in errors.InnerExceptions)
            {
                models.Add(new JudoModelError()
                {
                    ErrorMessage = em.Message
                });
            }
            var judoError = new JudoError()
            {
                Exception = errors.InnerException,
                ApiError  = new JudoApiErrorModel()
                {
                    ModelErrors = models
                }
            };

            return(judoError);
        }
        public static void FlattenToJudoFailure(this AggregateException errors, JudoFailureCallback failureCallback)
        {
            if (failureCallback != null)
            {
                List <JudoModelError> models = new List <JudoModelError> ();
                foreach (Exception em in errors.InnerExceptions)
                {
                    models.Add(new JudoModelError()
                    {
                        ErrorMessage = em.Message
                    });
                }
                var judoError = new JudoError()
                {
                    Exception = errors.InnerException,
                    ApiError  = new JudoApiErrorModel()
                    {
                        ModelErrors = models
                    }
                };

                failureCallback(judoError);
            }
        }
Example #4
0
		public async void ApplePayFailure(JudoError error, PaymentReceiptModel receipt = null)
		{
			await Navigation.PopAsync();
			await DisplayAlert("Payment error", "", "OK");
		}
Example #5
0
		public async Task<IResult<ITransactionResult>> Complete3DSecure(long receiptID, string paRes, string md)
		{
			try
			{
				ThreeDResultModel model = new ThreeDResultModel();
				model.PaRes = paRes;

				Task<IResult<PaymentReceiptModel>> task = _judoAPI.ThreeDs.Complete3DSecure(receiptID, model);
				return await task;
			}
			catch (Exception e)
			{
				var error = new JudoError()
				{
					Exception = e,
					ApiError = new JudoPayDotNet.Errors.ModelError()
					{
						Message = e.InnerException.ToString()
					}
				};
				throw error;
			}
		}
        private void FailurePayment (JudoError error, PaymentReceiptModel receipt)
        {
            //set alert for executing the task
            AlertDialog.Builder alert = new AlertDialog.Builder (this);

            string title = "Error";
            StringBuilder builder = new StringBuilder ();

            if (error != null && error.ApiError != null) {
                title = (error.ApiError.Message);
                if (error.ApiError.ModelErrors != null && error.ApiError.ModelErrors.Count > 0) {
                    foreach (FieldError model in error.ApiError.ModelErrors) {
                        builder.AppendLine (model.Message + (!String.IsNullOrWhiteSpace (model.FieldName) ? "(" + model.FieldName + ")" : ""));
                    }
                } else {
                    title = ("Error");
                    builder.AppendLine (error.ApiError.Message);

                }
            }
            if (receipt != null) {
                builder.AppendLine ("Transaction : " + receipt.Result);
                builder.AppendLine (receipt.Message);
                builder.AppendLine ("Receipt ID - " + receipt.ReceiptId);
            }
            alert.SetTitle (title);
            alert.SetMessage (builder.ToString ());
            alert.SetPositiveButton ("OK", (senderAlert, args) => {
            });
                
            RunOnUiThread (() => {
                alert.Show ();
            });
        }