本文整理汇总了C#中TransactionRequest类的典型用法代码示例。如果您正苦于以下问题:C# TransactionRequest类的具体用法?C# TransactionRequest怎么用?C# TransactionRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransactionRequest类属于命名空间,在下文中一共展示了TransactionRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToXml_Includes_DeviceSessionId
public void ToXml_Includes_DeviceSessionId()
{
TransactionRequest request = new TransactionRequest();
request.DeviceSessionId = "my_dsid";
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
}
示例2: ToXml_InludesPaymentMethodNonce
public void ToXml_InludesPaymentMethodNonce()
{
TransactionRequest request = new TransactionRequest();
request.PaymentMethodNonce = "1232131232";
Assert.IsTrue(request.ToXml().Contains("1232131232"));
}
示例3: ToXml_Includes_FraudMerchantId
public void ToXml_Includes_FraudMerchantId()
{
TransactionRequest request = new TransactionRequest();
request.FraudMerchantId = "my_fmid";
Assert.IsTrue(request.ToXml().Contains("my_fmid"));
}
示例4: GetDeviceTransaction
public deviceTransaction GetDeviceTransaction(TransactionRequest transactionRequest)
{
string response = "";
Dictionary<string, string> responseMap = doRequest(GetURL(), "POST", Serializer<TransactionRequest>.Serialize(transactionRequest).InnerXml);
responseMap.TryGetValue(MESSAGE, out response);
return Serializer<deviceTransaction>.Deserialize(response);
}
示例5: Generate_ReturnsTransactionsSettledOnAGivenDay
public void Generate_ReturnsTransactionsSettledOnAGivenDay()
{
TransactionRequest request = new TransactionRequest
{
Amount = 1000M,
CreditCard = new TransactionCreditCardRequest
{
Number = "4111111111111111",
ExpirationDate = "05/2012",
CardholderName = "Tom Smith",
},
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
},
};
Transaction transaction = gateway.Transaction.Sale(request).Target;
Transaction settlementResult = gateway.TestTransaction.Settle(transaction.Id);
var settlementDate = settlementResult.SettlementBatchId.Substring(0,10);
transaction = gateway.Transaction.Find(transaction.Id);
var result = gateway.SettlementBatchSummary.Generate(System.DateTime.Parse(settlementDate));
var visas = new List<IDictionary<string,string>>();
foreach (var row in result.Target.Records)
{
if (CreditCardCardType.VISA.ToString().Equals(row["card_type"]))
{
visas.Add(row);
}
}
Assert.AreEqual(1, visas.Count);
}
示例6: Main
private static void Main()
{
// Valid transaction
Console.WriteLine("Begin Transaction...");
Thread.Sleep(1000);
var validTransactionRequest = new TransactionRequest
{
CardNumber = "123-456-78",
CardPin = "1234",
RequestedAmount = 200
};
ProcessTransaction(validTransactionRequest);
Console.WriteLine("End Transaction...\n");
Thread.Sleep(1000);
// Invalid card number
Console.WriteLine("Begin Transaction...");
Thread.Sleep(1000);
var invalidCardNumberTransaction = new TransactionRequest
{
CardNumber = "111-11-11-111",
CardPin = "1234",
RequestedAmount = 200
};
ProcessTransaction(invalidCardNumberTransaction);
Console.WriteLine("End Transaction...\n");
Thread.Sleep(1000);
// Invalid card pin
Console.WriteLine("Begin Transaction...");
Thread.Sleep(1000);
var invalidCardPinTransaction = new TransactionRequest
{
CardNumber = "111-11-111",
CardPin = "12345",
RequestedAmount = 200
};
ProcessTransaction(invalidCardPinTransaction);
Console.WriteLine("End Transaction...\n");
Thread.Sleep(1000);
// Invalid money request
Console.WriteLine("Begin Transaction...");
Thread.Sleep(1000);
var invalidMoneyRequestTransaction = new TransactionRequest
{
CardNumber = "111-11-111",
CardPin = "1234",
RequestedAmount = -200
};
ProcessTransaction(invalidMoneyRequestTransaction);
Console.WriteLine("End Transaction...\n");
Thread.Sleep(1000);
}
示例7: ToXML_EscapesGeneratedXMLForString
public void ToXML_EscapesGeneratedXMLForString()
{
TransactionRequest request = new TransactionRequest
{
OrderId = "<>&\"'"
};
TestHelper.AssertIncludes("<order-id><>&"'</order-id>", request.ToXml());
}
示例8: HashIsComputedCorrectly0
public void HashIsComputedCorrectly0()
{
var request = new TransactionRequest();
request.Add("KEY1", "VALUE1");
var client = GetClient();
client.SetHash(request);
Assert.AreEqual("05b2372310c2897729f9c185517a25168e6891f2c7749329255f494e1483f181", request["HASH"]);
}
示例9: HashIsComputedCorrectly1
public void HashIsComputedCorrectly1()
{
var request = new TransactionRequest();
request.Add("ORDERID", "VALUE1");
request.Add("DATE", "VALUE2");
var client = GetClient();
client.SetHash(request);
Assert.AreEqual("b7c312f5d79aebc472d91b7395ba855b00bcfee5e15b13a01af85a9f64737a89", request["HASH"]);
}
示例10: HashIsComputedCorrectly0_Verify
public void HashIsComputedCorrectly0_Verify()
{
var hash = "05b2372310c2897729f9c185517a25168e6891f2c7749329255f494e1483f181";
var request = new TransactionRequest();
request.Add("KEY1", "VALUE1");
var client = GetClient();
var result = client.VerifyParameters(request, GetClientConfiguration().ApiKey, hash);
Assert.IsTrue(result);
}
示例11: TestService
public void TestService()
{
request = new TransactionRequest();
request.TokenUniqueId = "DWSPMC00000000010906a349d9ca4eb1a4d53e3c90a11d9c";
request.AuditInfo.UserId = "testUser";
request.AuditInfo.UserName = "Test User";
request.AuditInfo.Organization = "Test Org";
response = service.GetDeviceTransaction(request);
Assert.IsNotNull(response.Transactions);
}
示例12: ToXml_Includes_DeviceData
public void ToXml_Includes_DeviceData()
{
TransactionRequest request = new TransactionRequest();
request.DeviceData = "{\"device_session_id\":\"my_dsid\", \"fraud_merchant_id\":\"my_fmid\"}";
Assert.IsTrue(request.ToXml().Contains("device-data"));
Assert.IsTrue(request.ToXml().Contains("device_session_id"));
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
Assert.IsTrue(request.ToXml().Contains("fraud_merchant_id"));
Assert.IsTrue(request.ToXml().Contains("my_fmid"));
}
示例13: OnPaymentFinished
public void OnPaymentFinished(string orderId, TransactionRequest originalRequest, IDictionary<String, String> result, ApiPaymentCompletedStatus status)
{
//handle payment finished
string textResult = "Order ID: " + orderId + "\n" + "Status: " + status + "\n";
foreach(KeyValuePair<string, string> entry in result)
{
textResult = textResult + entry.Key + ": " + entry.Value + "\n";
}
this.paymentDataView.Text = textResult;
}
示例14: ToXML_EscapesGeneratedXMLForNestedSearchCriteria
public void ToXML_EscapesGeneratedXMLForNestedSearchCriteria()
{
TransactionRequest request = new TransactionRequest
{
Customer = new CustomerRequest
{
FirstName = "<John>"
}
};
TestHelper.AssertIncludes("<first-name><John></first-name>", request.ToXml());
}
示例15: ProcessTransaction
private static void ProcessTransaction(TransactionRequest transactionRequest)
{
try
{
AtmDbData.WithdrawMoney(transactionRequest);
Console.WriteLine("\tRequested transaction was successful!");
}
catch (Exception)
{
Console.WriteLine("\tRequested transaction was not successful!");
}
}