internal new HpsGiftCardSale FromResponse(PosResponseVer10 response) { base.FromResponse(response); var saleResponse = (PosGiftCardSaleRspType)response.Transaction.Item; TransactionId = response.Header.GatewayTxnId; AuthorizationCode = saleResponse.AuthCode; if (saleResponse.BalanceAmtSpecified) { BalanceAmount = saleResponse.BalanceAmt; } if (saleResponse.PointsBalanceAmtSpecified) { PointsBalanceAmount = saleResponse.PointsBalanceAmt; } Rewards = saleResponse.Rewards; Notes = saleResponse.Notes; ResponseCode = saleResponse.RspCode.ToString(); ResponseText = saleResponse.RspText; if (saleResponse.SplitTenderCardAmtSpecified) { SplitTenderCardAmount = saleResponse.SplitTenderCardAmt; } if (saleResponse.SplitTenderBalanceDueAmtSpecified) { SplitTenderBalanceDue = saleResponse.SplitTenderBalanceDueAmt; } return(this); }
internal new HpsAuthorization FromResponse(PosResponseVer10 response) { base.FromResponse(response); if (response.Transaction == null) { return(this); } var authResponse = (AuthRspStatusType)response.Transaction.Item; this.AuthorizationCode = authResponse.AuthCode; this.AvsResultCode = authResponse.AVSRsltCode; this.AvsResultText = authResponse.AVSRsltText; this.CvvResultCode = authResponse.CVVRsltCode; this.CvvResultText = authResponse.CVVRsltText; this.AuthorizedAmount = authResponse.AuthAmt; this.CardType = authResponse.CardType; this.Descriptor = authResponse.TxnDescriptor; this.CpcIndicator = authResponse.CPCInd; if (response.Header.TokenData != null) { HpsTokenData token = new HpsTokenData { TokenRspCode = response.Header.TokenData.TokenRspCode, TokenRspMsg = response.Header.TokenData.TokenRspMsg, TokenValue = response.Header.TokenData.TokenValue }; this.TokenData = token; } return(this); }
private void ProcessIssuerResponse(PosResponseVer10 response, ItemChoiceType1 expectedType, decimal?amount) { int transactionId = response.Header.GatewayTxnId; if (!(response.Transaction.Item is AuthRspStatusType)) { return; } var transaction = (AuthRspStatusType)response.Transaction.Item; if (transaction.RspCode == "91") { try { //this.Reverse(amount).Execute(); } catch (HpsGatewayException e) { if (e.Details.GatewayResponseCode == 3) { HpsIssuerResponseValidation.CheckResponse(transactionId, transaction.RspCode, transaction.RspText); } throw new HpsCreditException(transactionId, HpsExceptionCodes.IssuerTimeoutReversalError, "Error occurred while reversing a charge due to an issuer timeout.", e); } catch (HpsException e) { throw new HpsCreditException(transactionId, HpsExceptionCodes.IssuerTimeoutReversalError, "Error occurred while reversing a charge due to an issuer timeout.", e); } } HpsIssuerResponseValidation.CheckResponse(transactionId, transaction.RspCode, transaction.RspText); }
internal new HpsGiftCardResponse FromResponse(PosResponseVer10 response) { base.FromResponse(response); TransactionId = response.Header.GatewayTxnId; string[] propertyNames = { "AuthCode", "BalanceAmt", "PointsBalanceAmt", "Rewards", "Notes", "RspCode", "RspText" }; string[] valuesNames = { "AuthorizationCode", "BalanceAmount", "PointsBalanceAmount", "Rewards", "Notes", "ResponseCode", "ResponseText" }; var transaction = response.Transaction.Item; for (int i = 0; i < propertyNames.Length; i++) { var propertyInfo = transaction.GetType().GetProperty(propertyNames[i]); if (propertyInfo != null) { var value = propertyInfo.GetValue(transaction); var valueInfo = this.GetType().GetProperty(valuesNames[i]); if (valueInfo != null) { try { valueInfo.SetValue(this, value); } catch { valueInfo.SetValue(this, value.ToString()); } } } } return(this); }
internal HpsTransaction FromResponse(PosResponseVer10 response) { var header = response.Header; long?clientTransactionId = null; if (header.ClientTxnIdSpecified) { clientTransactionId = header.ClientTxnId; } this.Header = new HpsTransactionHeader { ClientTxnId = clientTransactionId, GatewayRspCode = header.GatewayRspCode, GatewayRspMsg = header.GatewayRspMsg, RspDt = header.RspDT }; this.TransactionId = header.GatewayTxnId; this.ClientTransactionId = clientTransactionId; if (response.Transaction != null) { var transaction = response.Transaction.Item; var rspCodeField = transaction.GetType().GetProperty("RspCode"); if (rspCodeField != null) { var rspCode = rspCodeField.GetValue(transaction); if (rspCode != null) { this.ResponseCode = rspCode.ToString(); } } var rspTextField = transaction.GetType().GetProperty("RspText"); if (rspTextField != null) { var rspText = rspTextField.GetValue(transaction); if (rspText != null) { this.ResponseText = (string)rspText; } } var refNbrField = transaction.GetType().GetProperty("RefNbr"); if (refNbrField != null) { var refNbr = refNbrField.GetValue(transaction); if (refNbr != null) { this.ReferenceNumber = (string)refNbr; } } } 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); }
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); } }
internal new HpsGiftCardAlias FromResponse(PosResponseVer10 response) { base.FromResponse(response); var transaction = (PosGiftCardAliasRspType)response.Transaction.Item; GiftCard = HpsGiftCard.FromResponse(transaction.CardData); ResponseCode = transaction.RspCode.ToString(); ResponseText = transaction.RspText; return(this); }
private void ProcessChargeGatewayResponse(PosResponseVer10 rsp, ItemChoiceType2 expectedResponseType) { if (rsp.Header.GatewayRspCode == 0) { return; } if (rsp.Header.GatewayRspCode == 3) { return; } HpsGatewayResponseValidation.CheckResponse(rsp, expectedResponseType); }
internal new HpsReversal FromResponse(PosResponseVer10 response) { var reverseResponse = (AuthRspStatusType)response.Transaction.Item; base.FromResponse(response); AvsResultCode = reverseResponse.AVSRsltCode; AvsResultText = reverseResponse.AVSRsltText; CpcIndicator = reverseResponse.CPCInd; CvvResultCode = reverseResponse.CVVRsltCode; CvvResultText = reverseResponse.CVVRsltText; return(this); }
public static void CheckResponse(PosResponseVer10 response, ItemChoiceType2 expectedResponseType) { var e = GetException(response.Header.GatewayRspCode, response.Header.GatewayRspMsg); if (e != null) { throw e; } if (response.Transaction.ItemElementName != expectedResponseType) { throw new HpsGatewayException(HpsExceptionCodes.UnexpectedGatewayResponse, "Unexpected response from HPS gateway."); } }
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()); }
public HpsDebitAuthorization FromResponse(PosResponseVer10 rsp) { base.FromResponse(rsp); var response = (AuthRspStatusType)rsp.Transaction.Item; AuthorizationCode = response.AuthCode; AvsResultCode = response.AVSRsltCode; AvsResultText = response.AVSRsltText; CvvResultCode = response.CVVRsltCode; CvvResultText = response.CVVRsltText; CardType = response.CardType; AvailableBalance = response.AvailableBalance; AuthorizedAmount = response.AuthAmt; return(this); }
private void ProcessGatewayResponse(PosResponseVer10 response, ItemChoiceType1 expectedResponseType, decimal?amount) { var responseCode = response.Header.GatewayRspCode; var transactionId = response.Header.GatewayTxnId; if (responseCode == 0) { return; } if (responseCode == 30) { try { //Reverse(amount).WithTransactionId(transactionId).Execute(); } catch (HpsException e) { throw new HpsGatewayException(HpsExceptionCodes.GatewayTimeoutReversalError, "Error occurred while reversing a charge due to a gateway timeout.", e); } } HpsGatewayResponseValidation.CheckResponse(response, (ItemChoiceType2)expectedResponseType); }
protected TAuthorization HydrateAuthorization <TAuthorization>(PosResponseVer10 response) where TAuthorization : HpsAuthorization, new() { var authRsp = (AuthRspStatusType)response.Transaction.Item; return(new TAuthorization { Header = HydrateTransactionHeader(response.Header), TransactionId = response.Header.GatewayTxnId, ClientTransactionId = GetClientTransactionId(response.Header), AvsResultCode = authRsp.AVSRsltCode, AvsResultText = authRsp.AVSRsltText, CvvResultCode = authRsp.CVVRsltCode, CvvResultText = authRsp.CVVRsltText, Descriptor = authRsp.TxnDescriptor, AuthorizationCode = authRsp.AuthCode, AuthorizedAmount = authRsp.AuthAmt, ReferenceNumber = authRsp.RefNbr, ResponseCode = authRsp.RspCode, ResponseText = authRsp.RspText, CardType = authRsp.CardType, CpcIndicator = authRsp.CPCInd }); }
internal new HpsAttachment FromResponse(PosResponseVer10 response) { base.FromResponse(response); this.ResponseCode = response.Header.GatewayRspCode.ToString(); this.ResponseText = response.Header.GatewayRspMsg; if (response.Transaction == null) { return(this); } var attachResponse = (PosGetAttachmentsRspType)response.Transaction.Item; if (attachResponse != null && attachResponse.Details != null) { this.AttachmentData = attachResponse.Details[0].AttachmentData; this.AttachmentDataId = attachResponse.Details[0].AttachmentDataId; this.AttachmentType = attachResponse.Details[0].AttachmentType; this.AttachmentFormat = attachResponse.Details[0].AttachmentFormat; this.AttachmentName = attachResponse.Details[0].AttachmentName; this.Height = attachResponse.Details[0].Height; this.Width = attachResponse.Details[0].Width; } return(this); }
internal new HpsCharge FromResponse(PosResponseVer10 response) { base.FromResponse(response); return(this); }
internal new HpsAccountVerify FromResponse(PosResponseVer10 response) { base.FromResponse(response); return(this); }
public HpsEbtAuthorization FromResponse(PosResponseVer10 response) { base.FromResponse(response); return(this); }