Compare commits
No commits in common. "000f1de2dd32d048c2c6190e36c17570b2d28cdd" and "126849d9308bbb77a7abc3feeab2cd256d68e270" have entirely different histories.
000f1de2dd
...
126849d930
|
|
@ -88,7 +88,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
protected readonly IDateTimeHelper _dateTimeHelper;
|
protected readonly IDateTimeHelper _dateTimeHelper;
|
||||||
protected readonly ITaxService _taxService;
|
protected readonly ITaxService _taxService;
|
||||||
protected readonly MeasurementService _measurementService;
|
protected readonly MeasurementService _measurementService;
|
||||||
protected readonly IWorkflowMessageService _workflowMessageService;
|
|
||||||
private static readonly char[] _separator = [','];
|
private static readonly char[] _separator = [','];
|
||||||
// ... other dependencies
|
// ... other dependencies
|
||||||
|
|
||||||
|
|
@ -136,7 +135,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
IImportManager importManager,
|
IImportManager importManager,
|
||||||
IDateTimeHelper dateTimeHelper,
|
IDateTimeHelper dateTimeHelper,
|
||||||
ITaxService taxService,
|
ITaxService taxService,
|
||||||
MeasurementService measurementService, IWorkflowMessageService workflowMessageService)
|
MeasurementService measurementService)
|
||||||
{
|
{
|
||||||
_logger = new Logger<CustomOrderController>(logWriters.ToArray());
|
_logger = new Logger<CustomOrderController>(logWriters.ToArray());
|
||||||
|
|
||||||
|
|
@ -164,7 +163,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
_dateTimeHelper = dateTimeHelper;
|
_dateTimeHelper = dateTimeHelper;
|
||||||
_taxService = taxService;
|
_taxService = taxService;
|
||||||
_measurementService = measurementService;
|
_measurementService = measurementService;
|
||||||
_workflowMessageService = workflowMessageService;
|
|
||||||
// ... initialize other deps
|
// ... initialize other deps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -510,7 +508,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
OrderGuid = Guid.NewGuid(),
|
OrderGuid = Guid.NewGuid(),
|
||||||
CustomOrderNumber = "",
|
CustomOrderNumber = "",
|
||||||
CustomerId = customerId,
|
CustomerId = customerId,
|
||||||
CustomerLanguageId = customer.LanguageId ?? 2,
|
CustomerLanguageId = customer.LanguageId ?? 1,
|
||||||
CustomerTaxDisplayType = TaxDisplayType.IncludingTax,
|
CustomerTaxDisplayType = TaxDisplayType.IncludingTax,
|
||||||
CustomerIp = string.Empty,
|
CustomerIp = string.Empty,
|
||||||
OrderStatus = OrderStatus.Pending,
|
OrderStatus = OrderStatus.Pending,
|
||||||
|
|
@ -521,7 +519,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
ShippingAddressId = customer.ShippingAddressId,
|
ShippingAddressId = customer.ShippingAddressId,
|
||||||
PaymentMethodSystemName = "Payments.CheckMoneyOrder", // Default payment method
|
PaymentMethodSystemName = "Payments.CheckMoneyOrder", // Default payment method
|
||||||
CustomerCurrencyCode = "HUF", // TODO: GET Default currency - A.
|
CustomerCurrencyCode = "HUF", // TODO: GET Default currency - A.
|
||||||
CurrencyRate = 1,
|
|
||||||
OrderTotal = 0,
|
OrderTotal = 0,
|
||||||
OrderSubtotalInclTax = 0,
|
OrderSubtotalInclTax = 0,
|
||||||
OrderSubtotalExclTax = 0,
|
OrderSubtotalExclTax = 0,
|
||||||
|
|
@ -546,8 +544,7 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
{
|
{
|
||||||
//var orderDto = await _dbContext.OrderDtos.GetByIdAsync(order.Id, true);
|
//var orderDto = await _dbContext.OrderDtos.GetByIdAsync(order.Id, true);
|
||||||
//await _sendToClient.SendMeasuringNotification("Módosult a rendelés, mérjétek újra!", orderDto);
|
//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 });
|
return RedirectToAction("Edit", "Order", new { id = order.Id });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Nop.Core;
|
using Nop.Core;
|
||||||
using Nop.Core.Domain.Customers;
|
|
||||||
using Nop.Core.Domain.Orders;
|
using Nop.Core.Domain.Orders;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
using Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
||||||
using Nop.Plugin.Misc.FruitBankPlugin.Services;
|
using Nop.Plugin.Misc.FruitBankPlugin.Services;
|
||||||
|
|
@ -16,7 +15,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
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" });
|
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 billingCountry = await _countryService.GetCountryByAddressAsync(billingAddress);
|
||||||
var billingCountryCode = billingCountry?.TwoLetterIsoCode ?? "HU";
|
var billingCountryCode = billingCountry?.TwoLetterIsoCode ?? "HU";
|
||||||
|
|
||||||
|
|
@ -115,8 +107,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Areas.Admin.Controllers
|
||||||
|
|
||||||
string megjegyzes = string.Empty;
|
string megjegyzes = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create order request
|
// Create order request
|
||||||
var orderRequest = new OrderCreateRequest
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ using Nop.Plugin.Misc.FruitBankPlugin.Services.FileStorage;
|
||||||
using Nop.Services.Catalog;
|
using Nop.Services.Catalog;
|
||||||
using Nop.Services.Common;
|
using Nop.Services.Common;
|
||||||
using Nop.Services.Events;
|
using Nop.Services.Events;
|
||||||
using Nop.Services.Messages;
|
|
||||||
using Nop.Web.Areas.Admin.Factories;
|
using Nop.Web.Areas.Admin.Factories;
|
||||||
using Nop.Web.Areas.Admin.Models.Catalog;
|
using Nop.Web.Areas.Admin.Models.Catalog;
|
||||||
using Nop.Web.Areas.Admin.Models.Orders;
|
using Nop.Web.Areas.Admin.Models.Orders;
|
||||||
|
|
@ -119,7 +118,6 @@ public class PluginNopStartup : INopStartup
|
||||||
//services.AddScoped<IAIAPIService, OpenAIApiService>();
|
//services.AddScoped<IAIAPIService, OpenAIApiService>();
|
||||||
services.AddScoped<AICalculationService>();
|
services.AddScoped<AICalculationService>();
|
||||||
services.AddScoped<PdfToImageService>();
|
services.AddScoped<PdfToImageService>();
|
||||||
services.AddScoped<IWorkflowMessageService, WorkflowMessageService>();
|
|
||||||
|
|
||||||
services.AddSingleton<IFileStorageProvider>(sp =>
|
services.AddSingleton<IFileStorageProvider>(sp =>
|
||||||
new LocalFileStorageProvider() // Uses default wwwroot/uploads
|
new LocalFileStorageProvider() // Uses default wwwroot/uploads
|
||||||
|
|
|
||||||
|
|
@ -204,19 +204,6 @@ namespace Nop.Plugin.Misc.FruitBankPlugin.Services
|
||||||
|
|
||||||
shippingConfigurationItem.ChildNodes.Insert(4, InvoiceSyncMenuItem);
|
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
|
var invoiceListMenuItem = new AdminMenuItem
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue