本文整理汇总了C#中Braintree.TransactionRequest.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# TransactionRequest.ToXml方法的具体用法?C# TransactionRequest.ToXml怎么用?C# TransactionRequest.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree.TransactionRequest
的用法示例。
在下文中一共展示了TransactionRequest.ToXml方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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"));
}
示例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: ToXml_Includes_DeviceSessionId
public void ToXml_Includes_DeviceSessionId()
{
TransactionRequest request = new TransactionRequest();
request.DeviceSessionId = "my_dsid";
Assert.IsTrue(request.ToXml().Contains("my_dsid"));
}
示例5: ToXML_EscapesGeneratedXMLForString
public void ToXML_EscapesGeneratedXMLForString()
{
TransactionRequest request = new TransactionRequest
{
OrderId = "<>&\"'"
};
TestHelper.AssertIncludes("<order-id><>&"'</order-id>", request.ToXml());
}
示例6: ToXML_EscapesGeneratedXMLForNestedSearchCriteria
public void ToXML_EscapesGeneratedXMLForNestedSearchCriteria()
{
TransactionRequest request = new TransactionRequest
{
Customer = new CustomerRequest
{
FirstName = "<John>"
}
};
TestHelper.AssertIncludes("<first-name><John></first-name>", request.ToXml());
}
示例7: ToXML_EnsuresUSLocaleForDecimals
public void ToXML_EnsuresUSLocaleForDecimals()
{
System.Globalization.CultureInfo existingCulture = System.Globalization.CultureInfo.CurrentCulture;
try
{
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("it-IT");
TransactionRequest transactionRequest = new TransactionRequest
{
Amount = 100.0M
};
SubscriptionRequest subscriptionRequest = new SubscriptionRequest
{
Price = 200.0M,
};
SubscriptionTransactionRequest subscriptionTransactionRequest = new SubscriptionTransactionRequest
{
Amount = 300.0M
};
ModificationRequest modificationRequest = new ModificationRequest
{
Amount = 400.0M
};
TestHelper.AssertIncludes("<amount>100.0</amount>", transactionRequest.ToXml());
TestHelper.AssertIncludes("<price>200.0</price>", subscriptionRequest.ToXml());
TestHelper.AssertIncludes("<amount>300.0</amount>", subscriptionTransactionRequest.ToXml());
TestHelper.AssertIncludes("<amount>400.0</amount>", modificationRequest.ToXml("root"));
}
finally
{
System.Threading.Thread.CurrentThread.CurrentCulture = existingCulture;
}
}
示例8: ToXML_EscapesGeneratedXMLForCustomFields
public void ToXML_EscapesGeneratedXMLForCustomFields()
{
TransactionRequest request = new TransactionRequest
{
CustomFields = new Dictionary<String, String>
{
{ "<key>", "val&ue" }
}
};
TestHelper.AssertIncludes("<custom-fields><<key>>val&ue</<key>></custom-fields>", request.ToXml());
}