Пример #1
0
        internal new HpsReportTransactionDetails FromResponse(PosResponseVer10 response)
        {
            var reportResponse = (PosReportTxnDetailRspType)response.Transaction.Item;

            base.FromResponse(response);

            OriginalTransactionId = reportResponse.OriginalGatewayTxnId;
            TransactionType       = ServiceNameToTransactionType(reportResponse.ServiceName);

            var data = reportResponse.Data;

            SettlementAmount   = data.SettlementAmt;
            MaskedCardNumber   = data.MaskedCardNbr;
            TransactionUtcDate = reportResponse.ReqUtcDT;
            AuthorizedAmount   = data.AuthAmt;
            AvsResultCode      = data.AVSRsltCode;
            AvsResultText      = data.AVSRsltText;
            CardType           = data.CardType;
            Descriptor         = data.TxnDescriptor;
            CpcIndicator       = data.CPCInd;
            CvvResultCode      = data.CVVRsltCode;
            CvvResultText      = data.CVVRsltText;
            ReferenceNumber    = data.RefNbr;
            ResponseCode       = data.RspCode;
            ResponseText       = data.RspText;
            if (data.TokenizationMsg != null)
            {
                TokenData = new HpsTokenData {
                    TokenRspMsg = data.TokenizationMsg
                }
            }
            ;
            if (data.AdditionalTxnFields != null)
            {
                Memo          = data.AdditionalTxnFields.Description;
                InvoiceNumber = data.AdditionalTxnFields.InvoiceNbr;
                CustomerId    = data.AdditionalTxnFields.CustomerID;
            }

            if (data.RspCode != "0")
            {
                if (Exceptions == null)
                {
                    Exceptions = new HpsChargeExceptions();
                }
                Exceptions.IssuerException = HpsIssuerResponseValidation.GetException(
                    response.Header.GatewayTxnId,
                    data.RspCode,
                    data.RspText
                    );
            }

            return(this);
        }
    }
Пример #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());
        }