示例#1
0
        /// <summary>
        /// Generate PaymentResult from string returned by Mellat payment service.
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static MellatPaymentResult GetMellatPaymentRequestResult(this string result)
        {
            result.CheckIsNullOrEmpty();

            var myResult = result.Split(',');
            var refId    = myResult.Length > 1 ? myResult[1] : null;
            var resCode  = myResult[0];
            var msg      = MellatGatewayTranslator.Translate(resCode);

            return(new MellatPaymentResult {
                RefId = refId,
                ResCode = resCode,
                Message = msg
            });
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        public static MellatVerifyPaymentResult GetMellatVerifyPaymentResult(this string result)
        {
            result.CheckIsNullOrEmpty();

            bool   success = result == _OK_Code;
            string msg     = "";

            if (!success)
            {
                msg = MellatGatewayTranslator.Translate(result);
            }

            return(new MellatVerifyPaymentResult {
                Message = msg,
                ResCode = result
            });
        }