small fixes, cors policy, discounts, innvoice order date fix, innvoice email address fix
This commit is contained in:
parent
5c950c6ae4
commit
a4af03be3c
|
|
@ -1235,9 +1235,16 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get or calculate price
|
// Get or calculate price
|
||||||
var unitPrice = productModel.Price > 0
|
//var unitPrice = productModel.Price > 0
|
||||||
? productModel.Price
|
// ? productModel.Price
|
||||||
: (await _priceCalculationService.GetFinalPriceAsync(product, customer, store)).finalPrice;
|
// : (await _priceCalculationService.GetFinalPriceAsync(product, customer, store)).finalPrice;
|
||||||
|
|
||||||
|
|
||||||
|
var valami = await _priceCalculationService.GetFinalPriceAsync(product, customer, store, includeDiscounts: true);
|
||||||
|
var originalPrice = valami.priceWithoutDiscounts;
|
||||||
|
var discountAmount = valami.appliedDiscountAmount;
|
||||||
|
var discountedPrice = valami.appliedDiscounts;
|
||||||
|
var unitPrice = valami.finalPrice;
|
||||||
|
|
||||||
// Calculate tax
|
// Calculate tax
|
||||||
var (unitPriceInclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPrice, true, customer);
|
var (unitPriceInclTaxValue, _) = await _taxService.GetProductPriceAsync(product, unitPrice, true, customer);
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,23 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
{
|
{
|
||||||
// Validate and get order
|
// Validate and get order
|
||||||
var order = await _orderService.GetOrderByIdAsync(orderId);
|
var order = await _orderService.GetOrderByIdAsync(orderId);
|
||||||
|
var orderDto = await _dbContext.OrderDtos.GetByIdAsync(orderId, true);
|
||||||
if (order == null)
|
if (order == null)
|
||||||
{
|
{
|
||||||
return Json(new { success = false, message = "Order not found" });
|
return Json(new { success = false, message = "Order not found" });
|
||||||
}
|
}
|
||||||
|
if (orderDto == null)
|
||||||
|
{
|
||||||
|
return Json(new { success = false, message = "OrderDTO not found" });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orderDto.DateOfReceipt == null)
|
||||||
|
{
|
||||||
|
return Json(new { success = false, message = "Ki kell tölteni az átvétel idejét." });
|
||||||
|
}
|
||||||
|
|
||||||
// Validate and get customer
|
// Validate and get customer
|
||||||
var customer = await _customerService.GetCustomerByIdAsync(order.CustomerId);
|
var customer = await _customerService.GetCustomerByIdAsync(orderDto.CustomerId);
|
||||||
if (customer == null)
|
if (customer == null)
|
||||||
{
|
{
|
||||||
return Json(new { success = false, message = "Customer not found" });
|
return Json(new { success = false, message = "Customer not found" });
|
||||||
|
|
@ -105,13 +115,15 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
VevoOrszag = billingCountryCode,
|
VevoOrszag = billingCountryCode,
|
||||||
VevoAdoszam = customer.VatNumber,
|
VevoAdoszam = customer.VatNumber,
|
||||||
MegrendelestombID = 1,
|
MegrendelestombID = 1,
|
||||||
MegrendelesKelte = order.CreatedOnUtc.ToLocalTime(),
|
MegrendelesKelte = ((DateTime)orderDto.DateOfReceipt).ToLocalTime(),
|
||||||
Hatarido = DateTime.Now.AddDays(7),
|
Hatarido = DateTime.Now.AddDays(7),
|
||||||
Devizanem = "Ft", // TODO: get real default - A.
|
Devizanem = "Ft", // TODO: get real default - A.
|
||||||
FizetesiMod = order.PaymentMethodSystemName ?? "átutalás",
|
//FizetesiMod = order.PaymentMethodSystemName ?? "átutalás",
|
||||||
Email = customer.Email ?? string.Empty,
|
FizetesiMod = "átutalás",
|
||||||
|
//Email = customer.Email ?? string.Empty,
|
||||||
|
Email = billingAddress.Email ?? customer.Email ?? string.Empty,
|
||||||
Telefon = billingAddress.PhoneNumber ?? string.Empty,
|
Telefon = billingAddress.PhoneNumber ?? string.Empty,
|
||||||
MegrendelesSzamStr = order.Id.ToString()
|
MegrendelesSzamStr = orderDto.Id.ToString()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add shipping address details
|
// Add shipping address details
|
||||||
|
|
|
||||||
|
|
@ -134,10 +134,12 @@
|
||||||
<script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/qrcodejs@1.0.0/qrcode.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
@if (!string.IsNullOrEmpty(Model.DownloadUrl))
|
@if (!string.IsNullOrEmpty(Model.CurrentVersion) && !string.IsNullOrEmpty(Model.FileName))
|
||||||
{
|
{
|
||||||
<text>
|
<text>
|
||||||
var downloadUrl = window.location.origin + '@Model.DownloadUrl';
|
var downloadUrl = '@Url.Action("Download", "AppDownload", new { version = Model.CurrentVersion, fileName = Model.FileName }, Context.Request.Scheme)';
|
||||||
|
console.log('QR Code URL:', downloadUrl); // Debug log
|
||||||
|
|
||||||
new QRCode(document.getElementById("qrcode"), {
|
new QRCode(document.getElementById("qrcode"), {
|
||||||
text: downloadUrl,
|
text: downloadUrl,
|
||||||
width: 200,
|
width: 200,
|
||||||
|
|
|
||||||
|
|
@ -152,9 +152,14 @@ public class CustomPriceCalculationService : PriceCalculationService
|
||||||
{
|
{
|
||||||
var productDto = await _dbContext.ProductDtos.GetByIdAsync(product.Id, true);
|
var productDto = await _dbContext.ProductDtos.GetByIdAsync(product.Id, true);
|
||||||
|
|
||||||
|
|
||||||
|
var finalPrice = await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);
|
||||||
|
|
||||||
if (productDto.IsMeasurable)
|
if (productDto.IsMeasurable)
|
||||||
{
|
{
|
||||||
return (0, product.Price, 1000m, []);
|
//finalPrice.priceWithoutDiscounts = 0;
|
||||||
|
//return (0, finalPrice.finalPrice, finalPrice.appliedDiscountAmount, []);
|
||||||
|
return finalPrice;
|
||||||
//return (overriddenProductPrice.GetValueOrDefault(0), overriddenProductPrice.GetValueOrDefault(0), 0m, []);
|
//return (overriddenProductPrice.GetValueOrDefault(0), overriddenProductPrice.GetValueOrDefault(0), 0m, []);
|
||||||
}
|
}
|
||||||
//var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id);
|
//var productAttributeMappings = await _specificationAttributeService.GetProductSpecificationAttributesAsync(product.Id);
|
||||||
|
|
@ -174,6 +179,6 @@ public class CustomPriceCalculationService : PriceCalculationService
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return await base.GetFinalPriceAsync(product, customer, store, overriddenProductPrice, additionalCharge, includeDiscounts, quantity, rentalStartDate, rentalEndDate);
|
return finalPrice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ public class PluginNopStartup : INopStartup
|
||||||
feature.AddPolicy(
|
feature.AddPolicy(
|
||||||
"AllowBlazorClient",
|
"AllowBlazorClient",
|
||||||
apiPolicy => apiPolicy
|
apiPolicy => apiPolicy
|
||||||
.WithOrigins(["https://localhost:7144", "measuringtest.fruitbank.hu", "https://localhost:60589"])
|
.WithOrigins(["https://localhost:7144", "https://measurementtest.fruitbank.hu", "https://localhost:60589", "http://localhost:5000"])
|
||||||
.AllowAnyHeader()
|
.AllowAnyHeader()
|
||||||
.AllowAnyMethod()
|
.AllowAnyMethod()
|
||||||
.AllowCredentials()
|
.AllowCredentials()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue