예제 #1
0
        internal HpsCheckResponse FromResponse(PosResponseVer10 response)
        {
            base.FromResponse(response);

            if (response.Transaction.Item is PosCheckSaleRspType)
            {
                var trans = (PosCheckSaleRspType)response.Transaction.Item;

                ResponseCode      = trans.RspCode.ToString();
                ResponseText      = trans.RspMessage;
                AuthorizationCode = trans.AuthCode;

                if (trans.CheckRspInfo != null)
                {
                    Details = new List <HpsCheckResponseDetails>();
                    foreach (var rspInfo in trans.CheckRspInfo)
                    {
                        var detail = new HpsCheckResponseDetails {
                            MessageType = rspInfo.Type,
                            Code        = rspInfo.Code,
                            Message     = rspInfo.Message,
                            FieldNumber = rspInfo.FieldNumber,
                            FieldName   = rspInfo.FieldName
                        };
                        Details.Add(detail);
                    }
                }
            }
            else if (response.Transaction.Item is PosCheckVoidRspType)
            {
                var trans = (PosCheckVoidRspType)response.Transaction.Item;

                ResponseCode      = trans.RspCode.ToString();
                ResponseText      = trans.RspMessage;
                AuthorizationCode = trans.AuthCode;

                if (trans.CheckRspInfo != null)
                {
                    Details = new List <HpsCheckResponseDetails>();
                    foreach (var rspInfo in trans.CheckRspInfo)
                    {
                        var detail = new HpsCheckResponseDetails {
                            MessageType = rspInfo.Type,
                            Code        = rspInfo.Code,
                            Message     = rspInfo.Message,
                            FieldNumber = rspInfo.FieldNumber,
                            FieldName   = rspInfo.FieldName
                        };
                        Details.Add(detail);
                    }
                }
            }

            return(this);
        }
        internal HpsCheckResponse FromResponse(PosResponseVer10 response) {
            base.FromResponse(response);

            if (response.Transaction.Item is PosCheckSaleRspType) {
                var trans = (PosCheckSaleRspType)response.Transaction.Item;

                ResponseCode = trans.RspCode.ToString();
                ResponseText = trans.RspMessage;
                AuthorizationCode = trans.AuthCode;

                if (trans.CheckRspInfo != null) {
                    Details = new List<HpsCheckResponseDetails>();
                    foreach (var rspInfo in trans.CheckRspInfo) {
                        var detail = new HpsCheckResponseDetails {
                            MessageType = rspInfo.Type,
                            Code = rspInfo.Code,
                            Message = rspInfo.Message,
                            FieldNumber = rspInfo.FieldNumber,
                            FieldName = rspInfo.FieldName
                        };
                        Details.Add(detail);
                    }
                }
            }
            else if (response.Transaction.Item is PosCheckVoidRspType) {
                var trans = (PosCheckVoidRspType)response.Transaction.Item;

                ResponseCode = trans.RspCode.ToString();
                ResponseText = trans.RspMessage;
                AuthorizationCode = trans.AuthCode;

                if (trans.CheckRspInfo != null) {
                    Details = new List<HpsCheckResponseDetails>();
                    foreach (var rspInfo in trans.CheckRspInfo) {
                        var detail = new HpsCheckResponseDetails {
                            MessageType = rspInfo.Type,
                            Code = rspInfo.Code,
                            Message = rspInfo.Message,
                            FieldNumber = rspInfo.FieldNumber,
                            FieldName = rspInfo.FieldName
                        };
                        Details.Add(detail);
                    }
                }
            }

            return this;
        }