Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Libraries/Nop.Core/BaseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public abstract partial class BaseEntity
/// Gets or sets the entity identifier
/// </summary>
public int Id { get; set; }

}
3 changes: 2 additions & 1 deletion src/Libraries/Nop.Services/ExportImport/ExportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1928,7 +1928,8 @@ public virtual async Task<byte[]> ExportOrdersToXlsxAsync(IList<Order> orders)
var ignore = await _workContext.GetCurrentVendorAsync() != null;

//lambda expressions for choosing correct order address
async Task<Address> orderAddress(Order o) => await _addressService.GetAddressByIdAsync((o.PickupInStore ? o.PickupAddressId : o.ShippingAddressId) ?? 0);
async Task<Address> orderAddress(Order o) =>
await _addressService.GetAddressByIdAsync(o.ShippingAddressId ?? 0);
async Task<Address> orderBillingAddress(Order o) => await _addressService.GetAddressByIdAsync(o.BillingAddressId);

//property array
Expand Down
92 changes: 73 additions & 19 deletions src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@
protected virtual async Task PrepareOrderModelPaymentInfoAsync(OrderModel model, Order order)
{
ArgumentNullException.ThrowIfNull(model);

ArgumentNullException.ThrowIfNull(order);

var billingAddress = await _addressService.GetAddressByIdAsync(order.BillingAddressId);
Expand All @@ -569,29 +568,84 @@

if (order.AllowStoringCreditCardNumber)
{
//card type
model.CardType = _encryptionService.DecryptText(order.CardType);
//cardholder name
model.CardName = _encryptionService.DecryptText(order.CardName);
//card number
model.CardNumber = _encryptionService.DecryptText(order.CardNumber);
//cvv
model.CardCvv2 = _encryptionService.DecryptText(order.CardCvv2);
//expiry date
var cardExpirationMonthDecrypted = _encryptionService.DecryptText(order.CardExpirationMonth);
if (!string.IsNullOrEmpty(cardExpirationMonthDecrypted) && cardExpirationMonthDecrypted != "0")
model.CardExpirationMonth = cardExpirationMonthDecrypted;
var cardExpirationYearDecrypted = _encryptionService.DecryptText(order.CardExpirationYear);
if (!string.IsNullOrEmpty(cardExpirationYearDecrypted) && cardExpirationYearDecrypted != "0")
model.CardExpirationYear = cardExpirationYearDecrypted;
try
{
//card type

Check warning on line 573 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardType = _encryptionService.DecryptText(order.CardType);
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardType = string.Empty;
// Optionally log: _logger.Error("Failed to decrypt CardType", ex);
}

try
{
//cardholder name

Check warning on line 584 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardName = _encryptionService.DecryptText(order.CardName);
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardName = string.Empty;
}

try
{
//card number

Check warning on line 594 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardNumber = _encryptionService.DecryptText(order.CardNumber);
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardNumber = string.Empty;
}

try
{
//cvv

Check warning on line 604 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardCvv2 = _encryptionService.DecryptText(order.CardCvv2);
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardCvv2 = string.Empty;
}

try
{
//expiry date
var cardExpirationMonthDecrypted = _encryptionService.DecryptText(order.CardExpirationMonth);
if (!string.IsNullOrEmpty(cardExpirationMonthDecrypted) && cardExpirationMonthDecrypted != "0")

Check warning on line 616 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardExpirationMonth = cardExpirationMonthDecrypted;
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardExpirationMonth = string.Empty;
}

try
{
var cardExpirationYearDecrypted = _encryptionService.DecryptText(order.CardExpirationYear);
if (!string.IsNullOrEmpty(cardExpirationYearDecrypted) && cardExpirationYearDecrypted != "0")

Check warning on line 627 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardExpirationYear = cardExpirationYearDecrypted;
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardExpirationYear = string.Empty;
}

model.AllowStoringCreditCardNumber = true;
}
else
{
var maskedCreditCardNumberDecrypted = _encryptionService.DecryptText(order.MaskedCreditCardNumber);
if (!string.IsNullOrEmpty(maskedCreditCardNumberDecrypted))
model.CardNumber = maskedCreditCardNumberDecrypted;
try
{
var maskedCreditCardNumberDecrypted = _encryptionService.DecryptText(order.MaskedCreditCardNumber);
if (!string.IsNullOrEmpty(maskedCreditCardNumberDecrypted))

Check warning on line 642 in src/Presentation/Nop.Web/Areas/Admin/Factories/OrderModelFactory.cs

View workflow job for this annotation

GitHub Actions / build

The variable 'ex' is declared but never used
model.CardNumber = maskedCreditCardNumberDecrypted;
}
catch (System.Security.Cryptography.CryptographicException ex)
{
model.CardNumber = string.Empty;
}
}

//payment transaction info
Expand Down
Loading