internal HpsReportTransactionSummary[] FromResponse(PosResponseVer10 response, HpsTransactionType? filterBy = null) {
            var reportResponse = (PosReportActivityRspType)response.Transaction.Item;
            
            List<HpsReportTransactionSummary> transactions = new List<HpsReportTransactionSummary>();
            string serviceName = string.Empty;
            if (filterBy.HasValue)
                serviceName = TransactionTypeToServiceName(filterBy.Value);

            foreach (var charge in reportResponse.Details) {
                var trans = new HpsReportTransactionSummary();
                trans.FromResponse(response);

                trans.OriginalTransactionId = charge.OriginalGatewayTxnId;
                trans.MaskedCardNumber = charge.MaskedCardNbr;
                trans.ResponseCode = charge.IssuerRspCode;
                trans.ResponseText = charge.IssuerRspText;
                trans.Amount = charge.Amt;
                trans.SettlementAmount = charge.SettlementAmt;
                trans.TransactionUtcDate = charge.TxnDT;
                trans.TransactionType = ServiceNameToTransactionType(charge.ServiceName);
                if (filterBy.HasValue)
                    trans.TransactionType = filterBy.Value;

                if (charge.GatewayRspCode != 0 || charge.IssuerRspCode != "00") {
                    trans.Exceptions = new HpsChargeExceptions();
                    if (charge.GatewayRspCode != 0)
                        trans.Exceptions.GatewayException = HpsGatewayResponseValidation.GetException(charge.GatewayRspCode, charge.GatewayRspMsg);
                    if (charge.IssuerRspCode != "00")
                        trans.Exceptions.IssuerException = HpsIssuerResponseValidation.GetException(charge.GatewayRspCode, charge.IssuerRspCode, charge.IssuerRspText);
                }
                transactions.Add(trans);
            }

            return transactions.ToArray();
        }
Ejemplo n.º 2
0
        internal HpsReportTransactionSummary[] FromResponse(PosResponseVer10 response, HpsTransactionType?filterBy = null)
        {
            var reportResponse = (PosReportActivityRspType)response.Transaction.Item;

            List <HpsReportTransactionSummary> transactions = new List <HpsReportTransactionSummary>();
            string serviceName = string.Empty;

            if (filterBy.HasValue)
            {
                serviceName = TransactionTypeToServiceName(filterBy.Value);
            }

            foreach (var charge in reportResponse.Details)
            {
                var trans = new HpsReportTransactionSummary();
                trans.FromResponse(response);

                trans.OriginalTransactionId = charge.OriginalGatewayTxnId;
                trans.MaskedCardNumber      = charge.MaskedCardNbr;
                trans.ResponseCode          = charge.IssuerRspCode;
                trans.ResponseText          = charge.IssuerRspText;
                trans.Amount             = charge.Amt;
                trans.SettlementAmount   = charge.SettlementAmt;
                trans.TransactionUtcDate = charge.TxnDT;
                trans.TransactionType    = ServiceNameToTransactionType(charge.ServiceName);
                trans.SiteTrace          = charge.SiteTrace;
                if (filterBy.HasValue)
                {
                    trans.TransactionType = filterBy.Value;
                }

                if (charge.GatewayRspCode != 0 || (!string.IsNullOrEmpty(charge.IssuerRspCode) && charge.IssuerRspCode != "00"))
                {
                    trans.Exceptions = new HpsChargeExceptions();
                    if (charge.GatewayRspCode != 0)
                    {
                        trans.Exceptions.GatewayException = HpsGatewayResponseValidation.GetException(charge.GatewayRspCode, charge.GatewayRspMsg);
                    }
                    if (charge.IssuerRspCode != "00")
                    {
                        trans.Exceptions.IssuerException = HpsIssuerResponseValidation.GetException(charge.GatewayRspCode, charge.IssuerRspCode, charge.IssuerRspText);
                    }
                }
                transactions.Add(trans);
            }

            return(transactions.ToArray());
        }