Compare commits

..

No commits in common. "000f1de2dd32d048c2c6190e36c17570b2d28cdd" and "126849d9308bbb77a7abc3feeab2cd256d68e270" have entirely different histories.

4 changed files with 4 additions and 65 deletions

View File

@ -88,7 +88,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
protected readonly IDateTimeHelper _dateTimeHelper;
protected readonly ITaxService _taxService;
protected readonly MeasurementService _measurementService;
protected readonly IWorkflowMessageService _workflowMessageService;
private static readonly char[] _separator = [','];
// ... other dependencies
@ -136,7 +135,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
IImportManager importManager,
IDateTimeHelper dateTimeHelper,
ITaxService taxService,
MeasurementService measurementService, IWorkflowMessageService workflowMessageService)
MeasurementService measurementService)
{
_logger = new Logger<CustomOrderController>(logWriters.ToArray());
@ -164,7 +163,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
_dateTimeHelper = dateTimeHelper;
_taxService = taxService;
_measurementService = measurementService;
_workflowMessageService = workflowMessageService;
// ... initialize other deps
}
@ -510,7 +508,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
OrderGuid = Guid.NewGuid(),
CustomOrderNumber = "",
CustomerId = customerId,
CustomerLanguageId = customer.LanguageId ?? 2,
CustomerLanguageId = customer.LanguageId ?? 1,
CustomerTaxDisplayType = TaxDisplayType.IncludingTax,
CustomerIp = string.Empty,
OrderStatus = OrderStatus.Pending,
@ -521,7 +519,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
ShippingAddressId = customer.ShippingAddressId,
PaymentMethodSystemName = "Payments.CheckMoneyOrder", // Default payment method
CustomerCurrencyCode = "HUF", // TODO: GET Default currency - A.
CurrencyRate = 1,
OrderTotal = 0,
OrderSubtotalInclTax = 0,
OrderSubtotalExclTax = 0,
@ -546,8 +544,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{
//var orderDto = await _dbContext.OrderDtos.GetByIdAsync(order.Id, true);
//await _sendToClient.SendMeasuringNotification("Módosult a rendelés, mérjétek újra!", orderDto);
//var updatedOrder = await _orderService.GetOrderByIdAsync(order.Id);
await _workflowMessageService.SendOrderPlacedCustomerNotificationAsync(order, order.CustomerLanguageId);
return RedirectToAction("Edit", "Order", new { id = order.Id });
}

View File

@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Nop.Core;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Orders;
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
using Nop.Plugin.Misc.FruitBankPlugin.Services;
@ -16,7 +15,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
{
@ -99,12 +97,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
return Json(new { success = false, message = "Billing address not found" });
}
//get tax info from attributes and sync with VatNumber
if(customer.VatNumber == null || customer.VatNumber == "")
{
await SynchronizeTaxInformationAsync(customer);
}
var billingCountry = await _countryService.GetCountryByAddressAsync(billingAddress);
var billingCountryCode = billingCountry?.TwoLetterIsoCode ?? "HU";
@ -115,8 +107,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
string megjegyzes = string.Empty;
// Create order request
var orderRequest = new OrderCreateRequest
{
@ -486,38 +476,5 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
});
}
}
private async Task SynchronizeTaxInformationAsync(Customer customer)
{
string attributesXml = customer.CustomCustomerAttributesXML;
string taxId = null;
if (!string.IsNullOrWhiteSpace(attributesXml))
{
var doc = XDocument.Parse(attributesXml);
taxId = doc.Descendants("CustomerAttribute")
.FirstOrDefault(el => (int?)el.Attribute("ID") == 1) // your TaxId attribute ID
?.Descendants("Value")
.FirstOrDefault()
?.Value;
}
if (!string.IsNullOrWhiteSpace(taxId) && string.IsNullOrWhiteSpace(customer.VatNumber))
{
customer.VatNumber = taxId;
}
else if (string.IsNullOrWhiteSpace(taxId) && !string.IsNullOrWhiteSpace(customer.VatNumber))
{
await _fruitBankAttributeService.InsertOrUpdateGenericAttributeAsync<Customer, string>(
customer.Id,
"TaxId",
customer.VatNumber);
}
_dbContext.Customers.Update(customer, false);
}
}
}

View File

@ -29,7 +29,6 @@ using Nop.Plugin.Misc.FruitBankPlugin.Services.FileStorage;
using Nop.Services.Catalog;
using Nop.Services.Common;
using Nop.Services.Events;
using Nop.Services.Messages;
using Nop.Web.Areas.Admin.Factories;
using Nop.Web.Areas.Admin.Models.Catalog;
using Nop.Web.Areas.Admin.Models.Orders;
@ -119,7 +118,6 @@ public class PluginNopStartup : INopStartup
//services.AddScoped<IAIAPIService, OpenAIApiService>();
services.AddScoped<AICalculationService>();
services.AddScoped<PdfToImageService>();
services.AddScoped<IWorkflowMessageService, WorkflowMessageService>();
services.AddSingleton<IFileStorageProvider>(sp =>
new LocalFileStorageProvider() // Uses default wwwroot/uploads

View File

@ -204,19 +204,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
shippingConfigurationItem.ChildNodes.Insert(4, InvoiceSyncMenuItem);
// Create a new top-level menu item
var AppDownloadMenuItem = new AdminMenuItem
{
Visible = true,
SystemName = "FruitBank",
Title = await _localizationService.GetResourceAsync("Plugins.Misc.FruitBankPlugin.Menu.AppDownload"), // You can localize this with await _localizationService.GetResourceAsync("...")
IconClass = "fas fa-mobile",
Url = _adminMenu.GetMenuItemUrl("AppDownload", "Index")
//ChildNodes = [shippingsListMenuItem, createShippingMenuItem, editShippingMenuItem]
};
shippingConfigurationItem.ChildNodes.Insert(4, AppDownloadMenuItem);
var invoiceListMenuItem = new AdminMenuItem
{