本文整理汇总了C#中Nop.Services.Payments.ProcessPaymentRequest.SerializeCustomValues方法的典型用法代码示例。如果您正苦于以下问题:C# ProcessPaymentRequest.SerializeCustomValues方法的具体用法?C# ProcessPaymentRequest.SerializeCustomValues怎么用?C# ProcessPaymentRequest.SerializeCustomValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nop.Services.Payments.ProcessPaymentRequest
的用法示例。
在下文中一共展示了ProcessPaymentRequest.SerializeCustomValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_serialize_and_deserialize_CustomValues
public void Can_serialize_and_deserialize_CustomValues()
{
var processPaymentRequest = new ProcessPaymentRequest();
processPaymentRequest.CustomValues.Add("key1", "value1");
processPaymentRequest.CustomValues.Add("key2", null);
processPaymentRequest.CustomValues.Add("key3", 3);
processPaymentRequest.CustomValues.Add("<test key4>", "<test value 4>");
var serializedXml = processPaymentRequest.SerializeCustomValues();
var deserialized = processPaymentRequest.DeserializeCustomValues(serializedXml);
deserialized.ShouldNotBeNull();
deserialized.Count.ShouldEqual(4);
deserialized.ContainsKey("key1").ShouldEqual(true);
deserialized["key1"].ShouldEqual("value1");
deserialized.ContainsKey("key2").ShouldEqual(true);
//deserialized["key2"].ShouldEqual(null);
deserialized["key2"].ShouldEqual("");
deserialized.ContainsKey("key3").ShouldEqual(true);
deserialized["key3"].ShouldEqual("3");
deserialized.ContainsKey("<test key4>").ShouldEqual(true);
deserialized["<test key4>"].ShouldEqual("<test value 4>");
}
示例2: Can_serialize_and_deserialize_empty_CustomValues
public void Can_serialize_and_deserialize_empty_CustomValues()
{
var processPaymentRequest = new ProcessPaymentRequest();
var serializedXml = processPaymentRequest.SerializeCustomValues();
var deserialized = processPaymentRequest.DeserializeCustomValues(serializedXml);
deserialized.ShouldNotBeNull();
deserialized.Count.ShouldEqual(0);
}
示例3: PlaceOrder
//.........这里部分代码省略.........
OrderTax = orderTaxTotal,
OrderTotal = orderTotal.Value,
RefundedAmount = decimal.Zero,
OrderDiscount = orderDiscountAmount,
CheckoutAttributeDescription = checkoutAttributeDescription,
CheckoutAttributesXml = checkoutAttributesXml,
CustomerCurrencyCode = customerCurrencyCode,
CurrencyRate = customerCurrencyRate,
AffiliateId = affiliateId,
OrderStatus = OrderStatus.Pending,
AllowStoringCreditCardNumber = processPaymentResult.AllowStoringCreditCardNumber,
CardType = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardType) : string.Empty,
CardName = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardName) : string.Empty,
CardNumber = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardNumber) : string.Empty,
MaskedCreditCardNumber = _encryptionService.EncryptText(_paymentService.GetMaskedCreditCardNumber(processPaymentRequest.CreditCardNumber)),
CardCvv2 = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardCvv2) : string.Empty,
CardExpirationMonth = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardExpireMonth.ToString()) : string.Empty,
CardExpirationYear = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardExpireYear.ToString()) : string.Empty,
PaymentMethodSystemName = processPaymentRequest.PaymentMethodSystemName,
AuthorizationTransactionId = processPaymentResult.AuthorizationTransactionId,
AuthorizationTransactionCode = processPaymentResult.AuthorizationTransactionCode,
AuthorizationTransactionResult = processPaymentResult.AuthorizationTransactionResult,
CaptureTransactionId = processPaymentResult.CaptureTransactionId,
CaptureTransactionResult = processPaymentResult.CaptureTransactionResult,
SubscriptionTransactionId = processPaymentResult.SubscriptionTransactionId,
PaymentStatus = processPaymentResult.NewPaymentStatus,
PaidDateUtc = null,
BillingAddress = billingAddress,
ShippingAddress = shippingAddress,
ShippingStatus = shippingStatus,
ShippingMethod = shippingMethodName,
PickUpInStore = pickUpInStore,
ShippingRateComputationMethodSystemName = shippingRateComputationMethodSystemName,
CustomValuesXml = processPaymentRequest.SerializeCustomValues(),
VatNumber = vatNumber,
CreatedOnUtc = DateTime.UtcNow
};
_orderService.InsertOrder(order);
result.PlacedOrder = order;
if (!processPaymentRequest.IsRecurringPayment)
{
//move shopping cart items to order items
foreach (var sc in cart)
{
//prices
decimal taxRate;
Discount scDiscount;
decimal discountAmount;
decimal scUnitPrice = _priceCalculationService.GetUnitPrice(sc);
decimal scSubTotal = _priceCalculationService.GetSubTotal(sc, true, out discountAmount, out scDiscount);
decimal scUnitPriceInclTax = _taxService.GetProductPrice(sc.Product, scUnitPrice, true, customer, out taxRate);
decimal scUnitPriceExclTax = _taxService.GetProductPrice(sc.Product, scUnitPrice, false, customer, out taxRate);
decimal scSubTotalInclTax = _taxService.GetProductPrice(sc.Product, scSubTotal, true, customer, out taxRate);
decimal scSubTotalExclTax = _taxService.GetProductPrice(sc.Product, scSubTotal, false, customer, out taxRate);
decimal discountAmountInclTax = _taxService.GetProductPrice(sc.Product, discountAmount, true, customer, out taxRate);
decimal discountAmountExclTax = _taxService.GetProductPrice(sc.Product, discountAmount, false, customer, out taxRate);
if (scDiscount != null && !appliedDiscounts.ContainsDiscount(scDiscount))
appliedDiscounts.Add(scDiscount);
//attributes
string attributeDescription = _productAttributeFormatter.FormatAttributes(sc.Product, sc.AttributesXml, customer);
var itemWeight = _shippingService.GetShoppingCartItemWeight(sc);
示例4: PaypalOrderDetails
//.........这里部分代码省略.........
OrderTax = details.OrderTaxTotal,
OrderTotal = details.OrderTotal,
RefundedAmount = decimal.Zero,
OrderDiscount = details.OrderDiscountAmount,
CheckoutAttributeDescription = details.CheckoutAttributeDescription,
CheckoutAttributesXml = details.CheckoutAttributesXml,
CustomerCurrencyCode = details.CustomerCurrencyCode,
CurrencyRate = details.CustomerCurrencyRate,
AffiliateId = details.AffiliateId,
OrderStatus = OrderStatus.Pending,
AllowStoringCreditCardNumber = processPaymentResult.AllowStoringCreditCardNumber,
CardType = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardType) : string.Empty,
CardName = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardName) : string.Empty,
CardNumber = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardNumber) : string.Empty,
MaskedCreditCardNumber = _encryptionService.EncryptText(_paymentService.GetMaskedCreditCardNumber(processPaymentRequest.CreditCardNumber)),
CardCvv2 = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardCvv2) : string.Empty,
CardExpirationMonth = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardExpireMonth.ToString()) : string.Empty,
CardExpirationYear = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardExpireYear.ToString()) : string.Empty,
PaymentMethodSystemName = processPaymentRequest.PaymentMethodSystemName,
AuthorizationTransactionId = processPaymentResult.AuthorizationTransactionId,
AuthorizationTransactionCode = processPaymentResult.AuthorizationTransactionCode,
AuthorizationTransactionResult = processPaymentResult.AuthorizationTransactionResult,
CaptureTransactionId = processPaymentResult.CaptureTransactionId,
CaptureTransactionResult = processPaymentResult.CaptureTransactionResult,
SubscriptionTransactionId = processPaymentResult.SubscriptionTransactionId,
PaymentStatus = processPaymentResult.NewPaymentStatus,
PaidDateUtc = null,
BillingAddress = details.BillingAddress,
ShippingAddress = details.ShippingAddress,
ShippingStatus = details.ShippingStatus,
ShippingMethod = details.ShippingMethodName,
PickUpInStore = details.PickUpInStore,
ShippingRateComputationMethodSystemName = details.ShippingRateComputationMethodSystemName,
CustomValuesXml = processPaymentRequest.SerializeCustomValues(),
VatNumber = details.VatNumber,
CreatedOnUtc = DateTime.UtcNow
};
//_orderService.InsertOrder(order);
result.PlacedOrder = order;
if (!processPaymentRequest.IsRecurringPayment)
{
//move shopping cart items to order items
foreach (var sc in details.Cart)
{
//prices
decimal taxRate;
Discount scDiscount;
decimal discountAmount;
decimal scUnitPrice = _priceCalculationService.GetUnitPrice(sc);
decimal scSubTotal = _priceCalculationService.GetSubTotal(sc, true, out discountAmount, out scDiscount);
decimal scUnitPriceInclTax = _taxService.GetProductPrice(sc.Product, scUnitPrice, true, details.Customer, out taxRate);
decimal scUnitPriceExclTax = _taxService.GetProductPrice(sc.Product, scUnitPrice, false, details.Customer, out taxRate);
decimal scSubTotalInclTax = _taxService.GetProductPrice(sc.Product, scSubTotal, true, details.Customer, out taxRate);
decimal scSubTotalExclTax = _taxService.GetProductPrice(sc.Product, scSubTotal, false, details.Customer, out taxRate);
decimal discountAmountInclTax = _taxService.GetProductPrice(sc.Product, discountAmount, true, details.Customer, out taxRate);
decimal discountAmountExclTax = _taxService.GetProductPrice(sc.Product, discountAmount, false, details.Customer, out taxRate);
if (scDiscount != null && !details.AppliedDiscounts.ContainsDiscount(scDiscount))
details.AppliedDiscounts.Add(scDiscount);
//attributes
string attributeDescription = _productAttributeFormatter.FormatAttributes(sc.Product, sc.AttributesXml, details.Customer);
var itemWeight = _shippingService.GetShoppingCartItemWeight(sc);
开发者ID:propeersinfo,项目名称:nopcommerce-PayPalStandard-3.70,代码行数:67,代码来源:PaypalStandardOrderProcessingService.cs
示例5: SaveOrderDetails
/// <summary>
/// Save order and add order notes
/// </summary>
/// <param name="processPaymentRequest">Process payment request</param>
/// <param name="processPaymentResult">Process payment result</param>
/// <param name="details">Details</param>
/// <returns>Order</returns>
protected virtual Order SaveOrderDetails(ProcessPaymentRequest processPaymentRequest,
ProcessPaymentResult processPaymentResult, PlaceOrderContainter details)
{
var order = new Order
{
StoreId = processPaymentRequest.StoreId,
OrderGuid = processPaymentRequest.OrderGuid,
CustomerId = details.Customer.Id,
CustomerLanguageId = details.CustomerLanguage.Id,
CustomerTaxDisplayType = details.CustomerTaxDisplayType,
CustomerIp = _webHelper.GetCurrentIpAddress(),
OrderSubtotalInclTax = details.OrderSubTotalInclTax,
OrderSubtotalExclTax = details.OrderSubTotalExclTax,
OrderSubTotalDiscountInclTax = details.OrderSubTotalDiscountInclTax,
OrderSubTotalDiscountExclTax = details.OrderSubTotalDiscountExclTax,
OrderShippingInclTax = details.OrderShippingTotalInclTax,
OrderShippingExclTax = details.OrderShippingTotalExclTax,
PaymentMethodAdditionalFeeInclTax = details.PaymentAdditionalFeeInclTax,
PaymentMethodAdditionalFeeExclTax = details.PaymentAdditionalFeeExclTax,
TaxRates = details.TaxRates,
OrderTax = details.OrderTaxTotal,
OrderTotal = details.OrderTotal,
RefundedAmount = decimal.Zero,
OrderDiscount = details.OrderDiscountAmount,
CheckoutAttributeDescription = details.CheckoutAttributeDescription,
CheckoutAttributesXml = details.CheckoutAttributesXml,
CustomerCurrencyCode = details.CustomerCurrencyCode,
CurrencyRate = details.CustomerCurrencyRate,
AffiliateId = details.AffiliateId,
OrderStatus = OrderStatus.Pending,
AllowStoringCreditCardNumber = processPaymentResult.AllowStoringCreditCardNumber,
CardType = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardType) : string.Empty,
CardName = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardName) : string.Empty,
CardNumber = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardNumber) : string.Empty,
MaskedCreditCardNumber = _encryptionService.EncryptText(_paymentService.GetMaskedCreditCardNumber(processPaymentRequest.CreditCardNumber)),
CardCvv2 = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardCvv2) : string.Empty,
CardExpirationMonth = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardExpireMonth.ToString()) : string.Empty,
CardExpirationYear = processPaymentResult.AllowStoringCreditCardNumber ? _encryptionService.EncryptText(processPaymentRequest.CreditCardExpireYear.ToString()) : string.Empty,
PaymentMethodSystemName = processPaymentRequest.PaymentMethodSystemName,
AuthorizationTransactionId = processPaymentResult.AuthorizationTransactionId,
AuthorizationTransactionCode = processPaymentResult.AuthorizationTransactionCode,
AuthorizationTransactionResult = processPaymentResult.AuthorizationTransactionResult,
CaptureTransactionId = processPaymentResult.CaptureTransactionId,
CaptureTransactionResult = processPaymentResult.CaptureTransactionResult,
SubscriptionTransactionId = processPaymentResult.SubscriptionTransactionId,
PaymentStatus = processPaymentResult.NewPaymentStatus,
PaidDateUtc = null,
BillingAddress = details.BillingAddress,
ShippingAddress = details.ShippingAddress,
ShippingStatus = details.ShippingStatus,
ShippingMethod = details.ShippingMethodName,
PickUpInStore = details.PickUpInStore,
PickupAddress = details.PickupAddress,
ShippingRateComputationMethodSystemName = details.ShippingRateComputationMethodSystemName,
CustomValuesXml = processPaymentRequest.SerializeCustomValues(),
VatNumber = details.VatNumber,
CreatedOnUtc = DateTime.UtcNow
};
_orderService.InsertOrder(order);
//reward points history
if (details.RedeemedRewardPointsAmount > decimal.Zero)
{
_rewardPointService.AddRewardPointsHistoryEntry(details.Customer, -details.RedeemedRewardPoints, order.StoreId,
string.Format(_localizationService.GetResource("RewardPoints.Message.RedeemedForOrder", order.CustomerLanguageId), order.Id),
order, details.RedeemedRewardPointsAmount);
_customerService.UpdateCustomer(details.Customer);
}
return order;
}