Exemplo n.º 1
0
        /// <summary>
        /// Get transaction information from the vendor's txid
        /// </summary>
        /// <param name="vendorTxId">txid for transaction</param>
        /// <returns>new SagePayTransactionDetails with details</returns>
        public SagePayTransactionDetails GetTransactionDetails(string vendorTxId)
        {
            // call the API and check for error
            SagePayResponse response = ProcessAPI(COMMAND_GETTRANSACTIONDETAIL, "<vendortxcode>" + vendorTxId + "</vendortxcode>");

            if (response.ErrorCode != 0)
            {
                throw new SagePageErrorException(response.ErrorCode, response.ErrorText);
            }

            // build an info object and fill from response
            SagePayTransactionDetails td = new SagePayTransactionDetails();

            td.TxID         = response["vpstxid"];
            td.VendorTxCode = response["vendortxcode"];
            td.TxType       = response["transactiontype"];
            td.TxStateId    = Converter.ToTxState(response["txstateid"]);
            td.Status       = response["status"];
            //
            td.RelatedTxId         = response["relatedtransactionid"];
            td.RelatedVendorTxCode = response["relatedvendortxcode"];
            td.RelatedAmount       = Converter.ToDecimal(response["relatedamount"]);
            td.RelatedCurrency     = response["relatedcurrency"];
            td.RelatedStarted      = Converter.ToDateTime(response["relatedstarted"], DateTime.MinValue);
            //
            td.Description = response["description"];
            td.Amount      = Converter.ToDecimal(response["amount"]);
            td.Currency    = response["currency"];
            td.Started     = Converter.ToDateTime(response["started"], DateTime.MinValue);
            td.Completed   = Converter.ToDateTime(response["completed"], DateTime.MinValue);
            //
            td.SecurityKey          = response["securitykey"];
            td.ClientIP             = response["clientip"];
            td.GiftAid              = response["giftaid"];
            td.PaymentSystem        = response["paymentsystem"];
            td.PaymentSystemDetails = response["paymentsystemdetails"];
            td.StartDate            = response["startdate"];
            td.ExpiryDate           = response["expirydate"];
            td.Last4Digits          = response["last4digits"];
            td.AuthProcessor        = response["authprocessor"];
            td.MerchantNumber       = response["merchantnumber"];
            td.AccountType          = Converter.ToAccountType(response["accounttype"]);
            td.AuthCode             = Converter.ToLong(response["vpsauthcode"]);
            td.BankAuthCode         = response["bankauthcode"];
            td.BatchId              = Converter.ToInt(response["batchid"]);
            //
            td.CV2Result      = Converter.ToCheckResult(response["cv2result"]);
            td.AddressResult  = Converter.ToCheckResult(response["addressresult"]);
            td.PostcodeResult = Converter.ToCheckResult(response["postcoderesult"]);
            //
            td.Secure3DAttempts = Converter.ToInt(response["threedattempt"]);
            td.Secure3DResult   = Converter.ToSecure3DResult(response["threedresult"]);
            td.T3MScore         = Converter.ToInt(response["t3mscore"]);
            td.T3MAction        = response["t3maction"];

            return(td);
        }
Exemplo n.º 2
0
		/// <summary>
		/// Get transaction information from the vendor's txid
		/// </summary>
		/// <param name="vendorTxId">txid for transaction</param>
		/// <returns>new SagePayTransactionDetails with details</returns>
		public SagePayTransactionDetails GetTransactionDetails(string vendorTxId)
		{
			// call the API and check for error
			SagePayResponse response = ProcessAPI(COMMAND_GETTRANSACTIONDETAIL, "<vendortxcode>" + vendorTxId + "</vendortxcode>");
			if (response.ErrorCode != 0)
			{
				throw new SagePageErrorException(response.ErrorCode, response.ErrorText);
			}

			// build an info object and fill from response
			SagePayTransactionDetails td = new SagePayTransactionDetails();
			td.TxID = response["vpstxid"];
			td.VendorTxCode = response["vendortxcode"];
			td.TxType = response["transactiontype"];
			td.TxStateId = Converter.ToTxState(response["txstateid"]);
			td.Status = response["status"];
			//
			td.RelatedTxId = response["relatedtransactionid"];
			td.RelatedVendorTxCode = response["relatedvendortxcode"];
			td.RelatedAmount = Converter.ToDecimal(response["relatedamount"]);
			td.RelatedCurrency= response["relatedcurrency"];
			td.RelatedStarted = Converter.ToDateTime(response["relatedstarted"], DateTime.MinValue);
			//
			td.Description = response["description"];
			td.Amount = Converter.ToDecimal(response["amount"]);
			td.Currency = response["currency"];
			td.Started = Converter.ToDateTime(response["started"], DateTime.MinValue);
			td.Completed = Converter.ToDateTime(response["completed"], DateTime.MinValue);
			//
			td.SecurityKey = response["securitykey"];
			td.ClientIP = response["clientip"];
			td.GiftAid = response["giftaid"];
			td.PaymentSystem = response["paymentsystem"];
			td.PaymentSystemDetails = response["paymentsystemdetails"];
			td.StartDate = response["startdate"];
			td.ExpiryDate = response["expirydate"];
			td.Last4Digits = response["last4digits"];
			td.AuthProcessor = response["authprocessor"];
			td.MerchantNumber = response["merchantnumber"];
			td.AccountType = Converter.ToAccountType(response["accounttype"]);
			td.AuthCode = Converter.ToLong(response["vpsauthcode"]);
			td.BankAuthCode = response["bankauthcode"];
			td.BatchId = Converter.ToInt(response["batchid"]);
			//
			td.CV2Result = Converter.ToCheckResult(response["cv2result"]);
			td.AddressResult = Converter.ToCheckResult(response["addressresult"]);
			td.PostcodeResult = Converter.ToCheckResult(response["postcoderesult"]);
			//
			td.Secure3DAttempts = Converter.ToInt(response["threedattempt"]);
			td.Secure3DResult = Converter.ToSecure3DResult(response["threedresult"]);
			td.T3MScore = Converter.ToInt(response["t3mscore"]);
			td.T3MAction = response["t3maction"];

			return td;
		}