Exemplo n.º 1
0
        /// <summary>
        /// Validates the response.
        /// </summary>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        /// <typeparam name="C"></typeparam>
        /// <param name="restResponse">The rest response.</param>
        /// <exception cref="PayUException"></exception>
        public static void ValidateResponse <V, E, C>(this IRestResponse <V, E, C> restResponse)
        {
            if (restResponse.Error != null)
            {
                if (restResponse.Error is SdkError)
                {
                    SdkError sdkError = restResponse.Error as SdkError;
                    RestResponseExtensionsUtils.FormatSdkError(sdkError);
                }
            }

            RestResponseExtensionsUtils.ValidateResponseCommon(restResponse);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Validates the response.
        /// </summary>
        /// <typeparam name="V"></typeparam>
        /// <typeparam name="E"></typeparam>
        /// <param name="restResponse">The rest response.</param>
        public static void ValidateResponse <V, E>(this IRestResponse <V, E> restResponse)
        {
            if (restResponse.Error != null)
            {
                if (restResponse.Error is SdkError)
                {
                    SdkError sdkError = restResponse.Error as SdkError;
                    RestResponseExtensionsUtils.FormatSdkError(sdkError);
                }
                if (restResponse.Error is PaymentResponse)
                {
                    PaymentResponse paymentResponse = restResponse.Error as PaymentResponse;

                    throw new PayUException(ErrorCode.INVALID_PARAMETERS,
                                            string.Format("{0} {1} {2}", paymentResponse.ResponseCode, paymentResponse.Error, paymentResponse.MessageError));
                }
            }

            RestResponseExtensionsUtils.ValidateResponseCommon(restResponse);
        }