diff --git a/.github/workflows/integration-core.yml b/.github/workflows/integration-core.yml index 1291627..636e846 100644 --- a/.github/workflows/integration-core.yml +++ b/.github/workflows/integration-core.yml @@ -70,9 +70,9 @@ jobs: - name: Push nuget package to github registry uses: ./.github/workflows/composite/publish-lib with: - package_source: ${{env.github_registry_url}} + package_source: ${{ env.github_registry_url }} path: ${{ env.project_path }} - nupkg_path: ${{env.nupkg_path}} + nupkg_path: ${{ env.nupkg_path }} api_key: ${{ env.nupkg_github_secret }} publish_lib_to_nuget: @@ -87,7 +87,7 @@ jobs: - name: Push nuget package to nuget registry uses: ./.github/workflows/composite/publish-lib with: - package_source: ${{env.nuget_registry_url}} + package_source: ${{ env.nuget_registry_url }} path: ${{ env.project_path }} - nupkg_path: ${{env.nupkg_path}} + nupkg_path: ${{ env.nupkg_path }} api_key: ${{ env.nupkg_nuget_secret }} \ No newline at end of file diff --git a/.github/workflows/trendyol-integration.yml b/.github/workflows/trendyol-integration.yml index 283d454..a5abfc1 100644 --- a/.github/workflows/trendyol-integration.yml +++ b/.github/workflows/trendyol-integration.yml @@ -71,9 +71,9 @@ jobs: - name: Push nuget package to github registry uses: ./.github/workflows/composite/publish-lib with: - package_source: ${{env.github_registry_url}} + package_source: ${{ env.github_registry_url }} path: ${{ env.project_path }} - nupkg_path: ${{env.nupkg_path}} + nupkg_path: ${{ env.nupkg_path }} api_key: ${{ env.nupkg_github_secret }} publish_lib_to_nuget: @@ -88,7 +88,7 @@ jobs: - name: Push nuget package to nuget registry uses: ./.github/workflows/composite/publish-lib with: - package_source: ${{env.nuget_registry_url}} + package_source: ${{ env.nuget_registry_url }} path: ${{ env.project_path }} - nupkg_path: ${{env.nupkg_path}} + nupkg_path: ${{ env.nupkg_path }} api_key: ${{ env.nupkg_nuget_secret }} diff --git a/README.md b/README.md index fe79a62..fb74691 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ Enhance your integration workflows by leveraging the Integration Library, which - [Introduction](#introduction) - [How to install](#how-to-install) - [How to use](#how-to-use) + - [Trendyol](#trendyol) + - [Hepsiburada](#hepsiburada) ## Introduction @@ -35,6 +37,8 @@ dotnet add package Integration.Marketplaces.Trendyol --version 1.0.0 ## How to use +### Trendyol + ```c# using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration; using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Helpers; @@ -45,7 +49,7 @@ var trendyolProductIntegration = new TrendyolProductIntegration("supplierId", "a var categories = trendyolProductIntegration.GetCategoryTreeAsync(); //Get All Brands -var brands = trendyolProductIntegration.GetBrandsUrl(); +var brands = trendyolProductIntegration.GetBrandsAsync(); //Filter products var productFilter = new ProductFilterBuilder() @@ -59,4 +63,6 @@ var productFilter = new ProductFilterBuilder() .Build(); var products = trendyolProductIntegration.FilterProductsAsync(productFilter); -``` \ No newline at end of file +``` + +### Hepsiburada \ No newline at end of file diff --git a/samples/Marketplaces/TrendyolIntegrationSampleConsoleApp/Program.cs b/samples/Marketplaces/TrendyolIntegrationSampleConsoleApp/Program.cs index 115d200..b5768c5 100644 --- a/samples/Marketplaces/TrendyolIntegrationSampleConsoleApp/Program.cs +++ b/samples/Marketplaces/TrendyolIntegrationSampleConsoleApp/Program.cs @@ -7,7 +7,7 @@ var categories = trendyolProductIntegration.GetCategoryTreeAsync(); //Get All Brands -var brands = trendyolProductIntegration.GetBrandsUrl(); +var brands = trendyolProductIntegration.GetBrandsAsync(); //Filter products var productFilter = new ProductFilterBuilder() diff --git a/src/Integration.Core/BulkDto.cs b/src/Integration.Core/BulkModel.cs similarity index 54% rename from src/Integration.Core/BulkDto.cs rename to src/Integration.Core/BulkModel.cs index e40b009..cc720a9 100644 --- a/src/Integration.Core/BulkDto.cs +++ b/src/Integration.Core/BulkModel.cs @@ -1,5 +1,5 @@ namespace Integration.Core; -public class BulkDto : IDto +public class BulkModel : IRequestModel, IResponseModel { public List Items { get; set; } } \ No newline at end of file diff --git a/src/Integration.Core/IDto.cs b/src/Integration.Core/IDto.cs deleted file mode 100644 index 15dc4ba..0000000 --- a/src/Integration.Core/IDto.cs +++ /dev/null @@ -1,4 +0,0 @@ -namespace Integration.Core; -public interface IDto -{ -} \ No newline at end of file diff --git a/src/Integration.Core/IRequestModel.cs b/src/Integration.Core/IRequestModel.cs new file mode 100644 index 0000000..79e5a28 --- /dev/null +++ b/src/Integration.Core/IRequestModel.cs @@ -0,0 +1,4 @@ +namespace Integration.Core; +public class IRequestModel : IModel +{ +} \ No newline at end of file diff --git a/src/Integration.Core/IResponseModel.cs b/src/Integration.Core/IResponseModel.cs new file mode 100644 index 0000000..b218703 --- /dev/null +++ b/src/Integration.Core/IResponseModel.cs @@ -0,0 +1,4 @@ +namespace Integration.Core; +public interface IResponseModel : IModel +{ +} \ No newline at end of file diff --git a/src/Integration.Core/IntegrationBase.cs b/src/Integration.Core/IntegrationBase.cs index e948c5c..52d6ac9 100644 --- a/src/Integration.Core/IntegrationBase.cs +++ b/src/Integration.Core/IntegrationBase.cs @@ -10,7 +10,7 @@ static IntegrationBase() _httpClient = new HttpClient(); } - public async Task InvokeRequestAsync(Func> httpRequest) + public async Task InvokeRequestAsync(Func> httpRequest) where TResponse : IResponseModel { var response = await httpRequest.Invoke(_httpClient); var responseAsString = await response.Content.ReadAsStringAsync(); @@ -32,9 +32,9 @@ public async Task InvokeRequestAsync(Func InvokeRequestAsync(Func> httpRequest, IDto dto) + public async Task InvokeRequestAsync(Func> httpRequest, IRequestModel requestModel) where TResponse : IResponseModel { - var jsonData = JsonSerializer.Serialize(dto); + var jsonData = JsonSerializer.Serialize(requestModel); var requestBody = new StringContent(jsonData, Encoding.UTF8, "application/json"); var response = await httpRequest.Invoke(_httpClient, requestBody); @@ -45,9 +45,9 @@ public async Task InvokeRequestAsync(Func(responseAsString)!; } - public async Task InvokeRequestAsync(Func> httpRequest, IDto dto) + public async Task InvokeRequestAsync(Func> httpRequest, IRequestModel requestModel) { - var jsonData = JsonSerializer.Serialize(dto); + var jsonData = JsonSerializer.Serialize(requestModel); var requestBody = new StringContent(jsonData, Encoding.UTF8, "application/json"); var response = await httpRequest.Invoke(_httpClient, requestBody); diff --git a/src/Integration.Core/PaginationDto.cs b/src/Integration.Core/PaginationModel.cs similarity index 79% rename from src/Integration.Core/PaginationDto.cs rename to src/Integration.Core/PaginationModel.cs index 1e065e5..e813dcb 100644 --- a/src/Integration.Core/PaginationDto.cs +++ b/src/Integration.Core/PaginationModel.cs @@ -1,5 +1,5 @@ namespace Integration.Core; -public class PaginationDto : IDto +public class PaginationModel : IResponseModel { public int TotalElements { get; set; } public int TotalPages { get; set; } diff --git a/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/HepsiburadaIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/HepsiburadaIntegration.cs new file mode 100644 index 0000000..5c4f9ac --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/HepsiburadaIntegration.cs @@ -0,0 +1,20 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure; +public class HepsiburadaIntegrationBase : IntegrationBase +{ + public const string ProdBaseUrl = "https://mpop-sit.hepsiburada.com/"; + public const string StageBaseUrl = "https://mpop-sit.hepsiburada.com/"; + protected readonly string _username; + protected readonly string _password; + protected readonly bool _isInProduction; + + public HepsiburadaIntegrationBase(string username, string password, bool isInProduction = true) + { + _username = username ?? throw new ArgumentNullException(nameof(username)); + _password = password ?? throw new ArgumentNullException(nameof(password)); + _isInProduction = isInProduction; + } + + public string GetBaseUrl() => _isInProduction ? ProdBaseUrl : StageBaseUrl; +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/HepsiburadaProductIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/HepsiburadaProductIntegration.cs new file mode 100644 index 0000000..607379f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/HepsiburadaProductIntegration.cs @@ -0,0 +1,10 @@ +using Integration.Core; +using Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration; +using Integration.Marketplaces.Trendyol.Infrastructure; + +public class HepsiburadaProductIntegration : HepsiburadaIntegrationBase, IHepsiburadaProductIntegration, IMarketplaceIntegration +{ + public HepsiburadaProductIntegration(string username, string password, bool isInProduction = true) : base(username, password, isInProduction) + { + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/IHepsiburadaProductIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/IHepsiburadaProductIntegration.cs new file mode 100644 index 0000000..071cb60 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Infrastructure/ProductIntegration/IHepsiburadaProductIntegration.cs @@ -0,0 +1,5 @@ +namespace Integration.Marketplaces.Hepsiburada.Infrastructure.ProductIntegration; +public interface IHepsiburadaProductIntegration +{ + +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs deleted file mode 100644 index 7296caa..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Models.Category; - -namespace Integration.Marketplaces.Trendyol.Dtos.Category; -public class GetCategoryAttribute : IDto -{ - public int Id { get; set; } - public string Name { get; set; } - public string DisplayName { get; set; } - public List CategoryAttributes { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetApproveClaimLineItemsDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetApproveClaimLineItemsDto.cs deleted file mode 100644 index a879abd..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetApproveClaimLineItemsDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Integration.Core; -namespace Integration.Marketplaces.Trendyol.Dtos.Claim; -public class ApproveClaimLineItemsDto : IDto -{ - public List ClaimLineItemIdList { get; set; } - public object Params { get; set; }//TODO: Check this -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/GetShipmentPackagesDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/GetShipmentPackagesDto.cs deleted file mode 100644 index c2d6e1a..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/GetShipmentPackagesDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Integration.Core; -using PackageModel = Integration.Marketplaces.Trendyol.Models.Package.Package; - -namespace Integration.Marketplaces.Trendyol.Dtos.Package; - -public class GetShipmentPackagesDto : PaginationDto -{ - public List Contents { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiPackageByQuantityDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiPackageByQuantityDto.cs deleted file mode 100644 index ea4d00f..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiPackageByQuantityDto.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Package; -public class SplitMultiPackageByQuantityDto : IDto -{ - public List SplitPackages { get; set; } -} - -public class SplitPackages : IDto -{ - public List PackageDetails { get; set; } -} - -public class PackageDetail : IDto -{ - public int OrderLineId { get; set; } - public int Quantities { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiShipmentPackageDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiShipmentPackageDto.cs deleted file mode 100644 index b7f05ee..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiShipmentPackageDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Package; -public class SplitMultiShipmentPackageDto : IDto -{ - public List SplitGroups { get; set; } -} - -public class SplitGroup : IDto -{ - public List OrderLineIds { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageByQuantityDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageByQuantityDto.cs deleted file mode 100644 index d9f6efa..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageByQuantityDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Package; -public class SplitShipmentPackageByQuantityDto : IDto -{ - public List QuantitySplit { get; set; } -} - -public class QuantitySplit : IDto -{ - public int OrderLineId { get; set; } - public List Quantities { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageDto.cs deleted file mode 100644 index 17452e2..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Package; -public class SplitShipmentPackageDto : IDto -{ - public List OrderLineIds { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateBoxInfoDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateBoxInfoDto.cs deleted file mode 100644 index 369bec6..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateBoxInfoDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Integration.Core; - -public class UpdateBoxInfoDto : IDto -{ - public int BoxQuantity { get; set; } - public double Deci { get; set; } - public UpdateBoxInfoDto(int boxQuantity, double deci) - { - BoxQuantity = boxQuantity; - Deci = deci; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdatePackageDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdatePackageDto.cs deleted file mode 100644 index 132a4d3..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdatePackageDto.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; -namespace Integration.Marketplaces.Trendyol.Dtos.Package; -public class UpdatePackageDto : IDto -{ - public List Lines { get; set; } - public PackageStatus Status { get; set; } - public UpdatePackageParamsDto? Params { get; set; } - - public UpdatePackageDto(List lines, PackageStatus status, string? invoiceNumber) - { - Lines = lines; - Status = status; - - if (!string.IsNullOrEmpty(invoiceNumber)) - Params = new UpdatePackageParamsDto(invoiceNumber); - } -} - -public class UpdatePackageLineDto : IDto -{ - public long LineId { get; set; } - public int Quantity { get; set; } - public UpdatePackageLineDto(long lineId, int quantity) - { - LineId = lineId; - Quantity = quantity; - } -} - -public class UpdatePackageParamsDto : IDto -{ - public string InvoiceNumber { get; set; } - - public UpdatePackageParamsDto(string invoiceNumber) - { - InvoiceNumber = invoiceNumber; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateTrackingNumberDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateTrackingNumberDto.cs deleted file mode 100644 index 2b2808f..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateTrackingNumberDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Package; -public class UpdateTrackingNumberDto : IDto -{ - public string TrackingNumber { get; set; } - public UpdateTrackingNumberDto(string trackingNumber) - { - TrackingNumber = trackingNumber; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductCategoryAttributeDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductCategoryAttributeDto.cs deleted file mode 100644 index 60da3ae..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductCategoryAttributeDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Integration.Core; - -public class AddProductCategoryAttributeDto : IDto -{ - public int AttributeId { get; set; } - public int? AttributeValueId { get; set; } - public string? CustomAttributeValue { get; set; } - public AddProductCategoryAttributeDto(int attributeId, int? attributeValueId, string? customAttributeValue) - { - AttributeId = attributeId; - AttributeValueId = attributeValueId; - CustomAttributeValue = customAttributeValue; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductDto.cs deleted file mode 100644 index 5c56276..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductDto.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Models.Product; - -namespace Integration.Marketplaces.Trendyol.Dtos.Product; - -public class AddProductDto : IDto -{ - public string Barcode { get; set; } - - public string Title { get; set; } - - public string ProductMainId { get; set; } - - public int BrandId { get; set; } - - public int CategoryId { get; set; } - - public int Quantity { get; set; } - - public string StockCode { get; set; } - - public int DimensionalWeight { get; set; } - - public string Description { get; set; } - - public string CurrencyType { get; set; } - - public double ListPrice { get; set; } - - public double SalePrice { get; set; } - - public int VatRate { get; set; } - - public int CargoCompanyId { get; set; } - - public int? ShipmentAddressId { get; set; } - - public int? ReturningAddressId { get; set; } - - public int? DeliveryDuration { get; set; } - - public ProductDeliveryOption? DeliveryOption { get; set; } - - public List Images { get; set; } - - public List Attributes { get; set; } - - public AddProductDto(string barcode, string title, string productMainId, int brandId, int categoryId, int quantity, string stockCode, int dimensionalWeight, string description, string currencyType, double listPrice, double salePrice, int vatRate, int cargoCompanyId, int? shipmentAddressId, int? returningAddressId, int? deliveryDuration) - { - Barcode = barcode; - Title = title; - ProductMainId = productMainId; - BrandId = brandId; - CategoryId = categoryId; - Quantity = quantity; - StockCode = stockCode; - DimensionalWeight = dimensionalWeight; - Description = description; - CurrencyType = currencyType; - ListPrice = listPrice; - SalePrice = salePrice; - VatRate = vatRate; - CargoCompanyId = cargoCompanyId; - ShipmentAddressId = shipmentAddressId; - ReturningAddressId = returningAddressId; - DeliveryDuration = deliveryDuration; - } - - public AddProductDto SetDeliveryOption(int? deliveryDuration, string fastDeliveryType) - { - DeliveryOption = new ProductDeliveryOption(deliveryDuration, fastDeliveryType); - return this; - } - - public AddProductDto AddProductImage(string url) - { - if (!Images.Any()) - Images = new List(); - - Images.Add(new ProductImage(url)); - return this; - } - - public AddProductDto AddProductCategoryAttribute(int attributeId, int? attributeValueId, string? customAttributeValue) - { - if (!Attributes.Any()) - Attributes = new List(); - - Attributes.Add(new AddProductCategoryAttributeDto(attributeId, attributeValueId, customAttributeValue)); - return this; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/DeleteProductDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/DeleteProductDto.cs deleted file mode 100644 index a6ae8df..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/DeleteProductDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Product; - -public class DeleteProductDto : IDto -{ - public string Barcode { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetProductsDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetProductsDto.cs deleted file mode 100644 index 2cf4297..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetProductsDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Integration.Core; -using ProductModel = Integration.Marketplaces.Trendyol.Models.Product.Product; - -namespace Integration.Marketplaces.Trendyol.Dtos.Product; - -public class GetProductsDto : PaginationDto -{ - public List Contents { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateProductDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateProductDto.cs deleted file mode 100644 index 559118d..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateProductDto.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Models.Product; - -namespace Integration.Marketplaces.Trendyol.Dtos.Product; -public class UpdateProductDto : IDto -{ - public string Barcode { get; set; } - - public string Title { get; set; } - - public string ProductMainId { get; set; } - - public int BrandId { get; set; } - - public int CategoryId { get; set; } - - public int Quantity { get; set; } - - public string StockCode { get; set; } - - public int DimensionalWeight { get; set; } - - public string Description { get; set; } - - public string CurrencyType { get; set; } - - public double ListPrice { get; set; } - - public double SalePrice { get; set; } - - public int VatRate { get; set; } - - public int CargoCompanyId { get; set; } - - public int? ShipmentAddressId { get; set; } - - public int? ReturningAddressId { get; set; } - - public int? DeliveryDuration { get; set; } - - public ProductDeliveryOption? DeliveryOption { get; set; } - - public List Images { get; set; } - - public List Attributes { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Supplier/GetSupplierDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Supplier/GetSupplierDto.cs deleted file mode 100644 index de89123..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Supplier/GetSupplierDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Models.Address; -using Integration.Marketplaces.Trendyol.Models.Supplier; -namespace Integration.Marketplaces.Trendyol.Dtos.Supplier; -public class GetSupplierDto : IDto -{ - public List SupplierAddresses { get; set; } - public ShipmentAddress DefaultShipmentAddress { get; set; } - public InvoiceAddress DefaultInvoiceAddress { get; set; } - public bool DefaultReturningAddress { get; set; } //TODO check if this is correct -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/ITrendyolClaimIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/ITrendyolClaimIntegration.cs index 0c53c73..c23f82e 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/ITrendyolClaimIntegration.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/ITrendyolClaimIntegration.cs @@ -1,4 +1,12 @@ +using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Request; +using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Response; + namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration; public interface ITrendyolClaimIntegration { + public Task GetClaimsAsync(string filterQuery); + + public Task CreateClaimAsync(CreateClaimRequestModel createClaimRequestModel); + + public Task ApproveClaimLineItemsAsync(ApproveClaimLineItemsRequestModel approveClaimLineItemsRequestModel, string claimId); } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Request/ApproveClaimLineItemsRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Request/ApproveClaimLineItemsRequestModel.cs new file mode 100644 index 0000000..f23c84e --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Request/ApproveClaimLineItemsRequestModel.cs @@ -0,0 +1,7 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Request; +public class ApproveClaimLineItemsRequestModel : IRequestModel +{ + public List ClaimLineItemIdList { get; set; } + public object Params { get; set; }//TODO: Check this +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/AddClaimDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Request/CreateClaimRequestModel.cs similarity index 66% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/AddClaimDto.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Request/CreateClaimRequestModel.cs index ea6842e..a7f4b83 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/AddClaimDto.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Request/CreateClaimRequestModel.cs @@ -1,24 +1,23 @@ using Integration.Core; using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Constants; - -namespace Integration.Marketplaces.Trendyol.Dtos.Claim; -public class AddClaimDto : IDto +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Request; +public class CreateClaimRequestModel : IRequestModel { public int CustomerId { get; set; } public bool ExcludeListing { get; set; } public bool ForcePackageCreation { get; set; } public string OrderNumber { get; set; } public int ShipmentCompanyId { get; set; } - public List ClaimItems { get; set; } + public List ClaimItems { get; set; } } -public class AddClaimItemDto : IDto +public class CreateClaimClaimItemRequestModel : IRequestModel { public string Barcode { get; set; } public string CustomerNote { get; set; } public int Quantity { get; set; } public int ReasonId { get; set; } - public AddClaimItemDto(string barcode, string customerNote, int quantity, int reasonId) + public CreateClaimClaimItemRequestModel(string barcode, string customerNote, int quantity, int reasonId) { Barcode = barcode; CustomerNote = customerNote; diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Response/GetClaimsResponseModel.cs similarity index 57% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Response/GetClaimsResponseModel.cs index bd0abfc..0a0851a 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Models/Response/GetClaimsResponseModel.cs @@ -1,12 +1,11 @@ using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Claim; -public class GetClaimDto : IDto +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Response; +public class GetClaimsResponseModel : PaginationModel { - public List Content { get; set; } + public List Content { get; set; } } -public class Claim : IDto +public class GetClaimResponseModel : IResponseModel { public string Id { get; set; } public string OrderNumber { get; set; } @@ -19,12 +18,12 @@ public class Claim : IDto public string CargoSenderNumber { get; set; } public string CargoProviderName { get; set; } public int OrderShipmentPackageId { get; set; } - public ReplacementOutboundPackageInfo ReplacementOutboundPackageInfo { get; set; } - public RejectedPackageInfo RejectedPackageInfo { get; set; } - public List Items { get; set; } + public GetClaimReplacementOutboundPackageInfoResponseModel ReplacementOutboundPackageInfo { get; set; } + public GetClaimRejectedPackageInfoResponseModel RejectedPackageInfo { get; set; } + public List Items { get; set; } } -public class ReplacementOutboundPackageInfo : IDto +public class GetClaimReplacementOutboundPackageInfoResponseModel : IResponseModel { public string CargoTrackingNumber { get; set; } public string CargoProviderName { get; set; } @@ -34,7 +33,7 @@ public class ReplacementOutboundPackageInfo : IDto public List Items { get; set; } } -public class RejectedPackageInfo : IDto +public class GetClaimRejectedPackageInfoResponseModel : IResponseModel { public string CargoTrackingNumber { get; set; } public string CargoProviderName { get; set; } @@ -43,13 +42,13 @@ public class RejectedPackageInfo : IDto public List Items { get; set; } } -public class ClaimItem : IDto +public class GetClaimClaimItemResponseModel : IResponseModel { - public ClaimOrderLine OrderLine { get; set; } - public List ClaimItems { get; set; } + public GetClaimClaimOrderLineResponseModel OrderLine { get; set; } + public List ClaimItems { get; set; } } -public class ClaimOrderLine : IDto +public class GetClaimClaimOrderLineResponseModel : IResponseModel { public int Id { get; set; } public string ProductName { get; set; } @@ -63,19 +62,19 @@ public class ClaimOrderLine : IDto public string ProductCategory { get; set; } } -public class ClaimItemItem : IDto +public class GetClaimClaimItemItemResponseModel : IResponseModel { public string Id { get; set; } public long OrderLineItemId { get; set; } - public ClaimItemReason CustomerClaimItemReason { get; set; } - public ClaimItemReason TrendyolClaimItemReason { get; set; } - public ClaimItemStatus ClaimItemStatus { get; set; } + public GetClaimClaimItemReasonResponseModel CustomerClaimItemReason { get; set; } + public GetClaimClaimItemReasonResponseModel TrendyolClaimItemReason { get; set; } + public GetClaimClaimItemStatusResponseModel ClaimItemStatus { get; set; } public string Note { get; set; } public string CustomerNote { get; set; } public bool Resolved { get; set; } } -public class ClaimItemReason : IDto +public class GetClaimClaimItemReasonResponseModel : IResponseModel { public int Id { get; set; } public string Name { get; set; } @@ -83,7 +82,7 @@ public class ClaimItemReason : IDto public string Code { get; set; } } -public class ClaimItemStatus : IDto +public class GetClaimClaimItemStatusResponseModel : IResponseModel { public string Name { get; set; } } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/TrendyolClaimIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/TrendyolClaimIntegration.cs index 79ac983..7586c0e 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/TrendyolClaimIntegration.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/TrendyolClaimIntegration.cs @@ -1,28 +1,29 @@ using Integration.Core; -using Integration.Marketplaces.Trendyol.Dtos.Claim; using Integration.Marketplaces.Trendyol.Infrastructure; using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration; +using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Request; +using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Models.Response; public class TrendyolClaimIntegration : TrendyolIntegrationBase, ITrendyolClaimIntegration, IMarketplaceIntegration { - public string GetClaimsUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/claims"; - public string GetCreateClaimUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/claims/create"; - public string GetApproveClaimLineItemUrl(string claimId) => $"{GetBaseUrl}claims/{claimId}/items/approve"; + private string GetClaimsUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/claims"; + private string GetCreateClaimUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/claims/create"; + private string GetApproveClaimLineItemUrl(string claimId) => $"{GetBaseUrl}claims/{claimId}/items/approve"; public TrendyolClaimIntegration(string supplierId, string apiKey, string apiSecret, bool isInProduction, string entegratorFirm) : base(supplierId, apiKey, apiSecret, isInProduction, entegratorFirm) { } - public async Task GetClaimsAsync(string filterQuery) + public async Task GetClaimsAsync(string filterQuery) { - return await InvokeRequestAsync((client) => client.GetAsync(GetClaimsUrl() + filterQuery)); + return await InvokeRequestAsync((client) => client.GetAsync(GetClaimsUrl() + filterQuery)); } - public async Task CreateClaimAsync(AddClaimDto addClaimDto) + public async Task CreateClaimAsync(CreateClaimRequestModel createClaimRequestModel) { - return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetCreateClaimUrl(), requestBody), addClaimDto); + return await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetCreateClaimUrl(), requestBody), createClaimRequestModel); } - public async Task ApproveClaimLineItemsAsync(ApproveClaimLineItemsDto getApproveClaimLineItemsDto, string claimId) + public async Task ApproveClaimLineItemsAsync(ApproveClaimLineItemsRequestModel approveClaimLineItemsRequestModel, string claimId) { - return await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetApproveClaimLineItemUrl(claimId), requestBody), getApproveClaimLineItemsDto); + return await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetApproveClaimLineItemUrl(claimId), requestBody), approveClaimLineItemsRequestModel); } } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/ITrendyolPackageIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/ITrendyolPackageIntegration.cs index 877509f..049ef10 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/ITrendyolPackageIntegration.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/ITrendyolPackageIntegration.cs @@ -1,17 +1,18 @@ -using Integration.Marketplaces.Trendyol.Dtos.Invoice; -using Integration.Marketplaces.Trendyol.Dtos.Package; +using Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +using Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Response; + namespace Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration; public interface ITrendyolPackageIntegration { - Task GetShipmentPackagesAsync(string filterQuery); - Task UpdateTrackingNumberAsync(long shipmentPackageId, UpdateTrackingNumberDto updateTrackingNumberDto); - Task UpdatePackageAsync(long shipmentPackageId, UpdatePackageDto updatePackageDto); - Task SendInvoiceLinkAsync(AddInvoiceLinkDto addInvoiceLinkDto); - Task DeleteInvoiceLinkAsync(DeleteInvoiceLinkDto deleteInvoiceLinkDto); - Task SplitMultiPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityDto splitMultiPackageByQuantityDto); - Task SplitMultiShipmentPackageAsync(long shipmentPackageId, SplitMultiShipmentPackageDto splitMultiShipmentPackageDto); - Task SplitShipmentPackageAsync(long shipmentPackageId, SplitShipmentPackageDto splitShipmentPackageDto); - Task SplitShipmentPackageByQuantityAsync(long shipmentPackageId, SplitShipmentPackageByQuantityDto splitShipmentPackageByQuantityDto); - Task UpdateBoxInfoAsync(long shipmentPackageId, UpdateBoxInfoDto updateBoxInfoDto); + Task GetShipmentPackagesAsync(string filterQuery); + Task UpdateTrackingNumberAsync(long shipmentPackageId, UpdateTrackingNumberRequestModel updateTrackingNumberRequestModel); + Task UpdatePackageAsync(long shipmentPackageId, UpdatePackageRequestModel updatePackageRequestModel); + Task SendInvoiceLinkAsync(AddInvoiceLinkRequestModel addInvoiceLinkRequestModel); + Task DeleteInvoiceLinkAsync(DeleteInvoiceLinkRequestModel deleteInvoiceLinkRequestModel); + Task SplitMultiPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityRequestModel splitMultiPackageByQuantityRequestModel); + Task SplitMultiShipmentPackageAsync(long shipmentPackageId, SplitMultiShipmentPackageRequestModel splitMultiShipmentPackageRequestModel); + Task SplitShipmentPackageAsync(long shipmentPackageId, SplitShipmentPackageRequestModel splitShipmentPackageRequestModel); + Task SplitShipmentPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityRequestModel splitMultiPackageByQuantityRequestModel); + Task UpdateBoxInfoAsync(long shipmentPackageId, UpdateBoxInfoRequestModel updateBoxInfoRequestModel); } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/AddInvoiceLinkRequestModel.cs similarity index 51% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/AddInvoiceLinkRequestModel.cs index 9d826e9..e96226b 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/AddInvoiceLinkRequestModel.cs @@ -1,12 +1,12 @@ using Integration.Core; -namespace Integration.Marketplaces.Trendyol.Dtos.Invoice; -public class AddInvoiceLinkDto : IDto +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class AddInvoiceLinkRequestModel : IRequestModel { - public string InvoiceLink { get; set; } + public string InvoiceLink { get; set; } public int ShipmentPackageId { get; set; } public int InvoiceDateTime { get; set; } public string InvoiceNumber { get; set; } - public AddInvoiceLinkDto(string invoiceLink, int shipmentPackageId, int invoiceDateTime, string invoiceNumber) + public AddInvoiceLinkRequestModel(string invoiceLink, int shipmentPackageId, int invoiceDateTime, string invoiceNumber) { InvoiceLink = invoiceLink; ShipmentPackageId = shipmentPackageId; diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/DeleteInvoiceLinkRequestModel.cs similarity index 52% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/DeleteInvoiceLinkRequestModel.cs index 0658076..981deca 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/DeleteInvoiceLinkRequestModel.cs @@ -1,12 +1,11 @@ using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Invoice; -public class DeleteInvoiceLinkDto : IDto +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class DeleteInvoiceLinkRequestModel : IRequestModel { public int ServiceSourceId { get; set; } public int ChannelId { get; set; } public int CustomerId { get; set; } - public DeleteInvoiceLinkDto(int serviceSourceId, int channelId, int customerId) + public DeleteInvoiceLinkRequestModel(int serviceSourceId, int channelId, int customerId) { ServiceSourceId = serviceSourceId; ChannelId = channelId; diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitMultiPackageByQuantityRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitMultiPackageByQuantityRequestModel.cs new file mode 100644 index 0000000..63938d1 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitMultiPackageByQuantityRequestModel.cs @@ -0,0 +1,17 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class SplitMultiPackageByQuantityRequestModel : IRequestModel +{ + public List SplitPackages { get; set; } +} + +public class SplitMultiPackageByQuantitySplitPackageRequestModel : IRequestModel +{ + public List PackageDetails { get; set; } +} + +public class SplitMultiPackageByQuantityPackageDetailRequestModel : IRequestModel +{ + public int OrderLineId { get; set; } + public int Quantities { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitMultiShipmentPackageRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitMultiShipmentPackageRequestModel.cs new file mode 100644 index 0000000..82679b7 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitMultiShipmentPackageRequestModel.cs @@ -0,0 +1,11 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class SplitMultiShipmentPackageRequestModel : IRequestModel +{ + public List SplitGroups { get; set; } +} + +public class SplitMultiShipmentPackageSplitGroupRequestModel : IRequestModel +{ + public List OrderLineIds { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitShipmentPackageRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitShipmentPackageRequestModel.cs new file mode 100644 index 0000000..a98836a --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/SplitShipmentPackageRequestModel.cs @@ -0,0 +1,6 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class SplitShipmentPackageRequestModel : IRequestModel +{ + public List OrderLineIds { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdateBoxInfoRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdateBoxInfoRequestModel.cs new file mode 100644 index 0000000..08190a3 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdateBoxInfoRequestModel.cs @@ -0,0 +1,12 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class UpdateBoxInfoRequestModel : IRequestModel +{ + public int BoxQuantity { get; set; } + public double Deci { get; set; } + public UpdateBoxInfoRequestModel(int boxQuantity, double deci) + { + BoxQuantity = boxQuantity; + Deci = deci; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdatePackageRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdatePackageRequestModel.cs new file mode 100644 index 0000000..3c5d53c --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdatePackageRequestModel.cs @@ -0,0 +1,39 @@ +using Integration.Core; +using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class UpdatePackageRequestModel : IRequestModel +{ + public List Lines { get; set; } + public PackageStatus Status { get; set; } + public UpdatePackageParamsRequestModel? Params { get; set; } + + public UpdatePackageRequestModel(List lines, PackageStatus status, string? invoiceNumber) + { + Lines = lines; + Status = status; + + if (!string.IsNullOrEmpty(invoiceNumber)) + Params = new UpdatePackageParamsRequestModel(invoiceNumber); + } +} + +public class UpdatePackageLineRequestModel : IRequestModel +{ + public long LineId { get; set; } + public int Quantity { get; set; } + public UpdatePackageLineRequestModel(long lineId, int quantity) + { + LineId = lineId; + Quantity = quantity; + } +} + +public class UpdatePackageParamsRequestModel : IResponseModel +{ + public string InvoiceNumber { get; set; } + + public UpdatePackageParamsRequestModel(string invoiceNumber) + { + InvoiceNumber = invoiceNumber; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdateTrackingNumberRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdateTrackingNumberRequestModel.cs new file mode 100644 index 0000000..f521414 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Request/UpdateTrackingNumberRequestModel.cs @@ -0,0 +1,10 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +public class UpdateTrackingNumberRequestModel : IRequestModel +{ + public string TrackingNumber { get; set; } + public UpdateTrackingNumberRequestModel(string trackingNumber) + { + TrackingNumber = trackingNumber; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Response/GetShipmentPackagesResponseModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Response/GetShipmentPackagesResponseModel.cs new file mode 100644 index 0000000..3689b95 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Models/Response/GetShipmentPackagesResponseModel.cs @@ -0,0 +1,135 @@ +using Integration.Core; +using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; +namespace Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Response; +public class GetShipmentPackagesResponseModel : PaginationModel +{ + public List Contents { get; set; } + +} +public class GetShipmentPackagePackageFastDeliveryOptionResponseModel : IResponseModel +{ + public DeliveryOption Type { get; set; } +} +public class GetShipmentPackagePackageDiscountDetailResponseModel : IResponseModel +{ + public double LineItemPrice { get; set; } + public double LineItemDiscount { get; set; } + public double LineItemTyDiscount { get; set; } +} +public class GetShipmentPackagePackageLineResponseModel : IResponseModel +{ + public int Quantity { get; set; } + public int SalesCampaignId { get; set; } + public string ProductSize { get; set; } + public string MerchantSku { get; set; } + public string ProductName { get; set; } + public int ProductCode { get; set; } + public string ProductOrigin { get; set; } + public int MerchantId { get; set; } + public double Amount { get; set; } + public double Discount { get; set; } + public double TyDiscount { get; set; } + public List DiscountDetails { get; set; } + public List FastDeliveryOptions { get; set; } + public string CurrencyCode { get; set; } + public string ProductColor { get; set; } + public int Id { get; set; } + public string Sku { get; set; } + public int VatBaseAmount { get; set; } + public string Barcode { get; set; } + public string OrderLineItemStatusName { get; set; } + public double Price { get; set; } +} +public class GetShipmentPackageShipmentAddressResponseModel : IResponseModel +{ + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Company { get; set; } + public string Address1 { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public int CityCode { get; set; } + public string District { get; set; } + public int DistrictId { get; set; } + public string PostalCode { get; set; } + public string CountryCode { get; set; } + public int NeighborhoodId { get; set; } + public string Neighborhood { get; set; } + public object Phone { get; set; } + public string FullName { get; set; } + public string FullAddress { get; set; } +} +public class GetShipmentPackageInvoiceAddressResponseModel : IResponseModel +{ + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Company { get; set; } + public string Address1 { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string District { get; set; } + public int DistrictId { get; set; } + public string PostalCode { get; set; } + public string CountryCode { get; set; } + public int NeighborhoodId { get; set; } + public string Neighborhood { get; set; } + public object Phone { get; set; } + public string FullName { get; set; } + public string FullAddress { get; set; } + public string TaxOffice { get; set; } + public string TaxNumber { get; set; } +} +public class GetShipmentPackagesPackageHistoryResponseModel : IResponseModel +{ + public double CreatedDate { get; set; } + public PackageStatus Status { get; set; } +} +public class GetShipmentPackagePackageResponseModel : IResponseModel +{ + public GetShipmentPackageShipmentAddressResponseModel ShipmentAddress { get; set; } + public string OrderNumber { get; set; } + public double GrossAmount { get; set; } + public double TotalDiscount { get; set; } + public double TotalTyDiscount { get; set; } + public object TaxNumber { get; set; } + public GetShipmentPackageInvoiceAddressResponseModel InvoiceAddress { get; set; } + public string CustomerFirstName { get; set; } + public string CustomerEmail { get; set; } + public int CustomerId { get; set; } + public string CustomerLastName { get; set; } + public int Id { get; set; } + public long CargoTrackingNumber { get; set; } + public string CargoTrackingLink { get; set; } + public string CargoSenderNumber { get; set; } + public string CargoProviderName { get; set; } + public string Lines { get; set; } + public long OrderDate { get; set; } + public string TcIdentityNumber { get; set; } + public string CurrencyCode { get; set; } + public List PackageHistories { get; set; } + public string ShipmentPackageStatus { get; set; } + public string Status { get; set; } + public string DeliveryType { get; set; } + public int TimeSlotId { get; set; } + public string ScheduledDeliveryStoreId { get; set; } + public long EstimatedDeliveryStartDate { get; set; } + public long EstimatedDeliveryEndDate { get; set; } + public double TotalPrice { get; set; } + public string DeliveryAddressType { get; set; } + public long AgreedDeliveryDate { get; set; } + public bool AgreedDeliveryDateExtendible { get; set; } + public long ExtendedAgreedDeliveryDate { get; set; } + public long AgreedDeliveryExtensionStartDate { get; set; } + public long AgreedDeliveryExtensionEndDate { get; set; } + public string InvoiceLink { get; set; } + public bool FastDelivery { get; set; } + public string FastDeliveryType { get; set; } + public long OriginShipmentDate { get; set; } + public long LastModifiedDate { get; set; } + public bool Commercial { get; set; } + public bool DeliveredByService { get; set; } + public bool Micro { get; set; } + public bool GiftBoxRequested { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/TrendyolPackageIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/TrendyolPackageIntegration.cs index d4a5b52..7007bcf 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/TrendyolPackageIntegration.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/TrendyolPackageIntegration.cs @@ -1,88 +1,88 @@ using Integration.Core; -using Integration.Marketplaces.Trendyol.Dtos.Invoice; -using Integration.Marketplaces.Trendyol.Dtos.Package; using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration; +using Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Request; +using Integration.Marketplaces.Trendyol.Infrastructure.PackageIntegration.Models.Response; namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration; public class TrendyolPackageIntegration : TrendyolIntegrationBase, ITrendyolPackageIntegration, IMarketplaceIntegration { - public string GetShipmentPackagesUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/orders"; - public string GetUpdateTrackingNumberUrl(long shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/{shipmentPackageId}/update-tracking-number"; - public string GetUpdatePackageUrl(long shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}//shipment-packages/{shipmentPackageId}"; - public string GetAddInvoiceLinkUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/supplier-invoice-links"; - public string GetDeleteInvoiceLinkUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/supplier-invoice-links/delete"; - public string GetSplitMultiPackageByQuantityUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/split-packages"; - public string GetSplitMultiShipmentPackageUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/split"; - public string GetSplitShipmentPackageUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/multi-split"; - public string GetSplitShipmentPackageByQuantityUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/quantity-split"; - public string GetUpdateBoxInfoUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/box-info"; + private string GetShipmentPackagesUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/orders"; + private string GetUpdateTrackingNumberUrl(long shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/{shipmentPackageId}/update-tracking-number"; + private string GetUpdatePackageUrl(long shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}//shipment-packages/{shipmentPackageId}"; + private string GetAddInvoiceLinkUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/supplier-invoice-links"; + private string GetDeleteInvoiceLinkUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/supplier-invoice-links/delete"; + private string GetSplitMultiPackageByQuantityUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/split-packages"; + private string GetSplitMultiShipmentPackageUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/split"; + private string GetSplitShipmentPackageUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/multi-split"; + private string GetSplitShipmentPackageByQuantityUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/quantity-split"; + private string GetUpdateBoxInfoUrl(long _shipmentPackageId) => $"{GetBaseUrl}suppliers/{_supplierId}/shipment-packages/{_shipmentPackageId}/box-info"; public TrendyolPackageIntegration(string supplierId, string apiKey, string apiSecret, bool isInProduction, string entegratorFirm) : base(supplierId, apiKey, apiSecret, isInProduction, entegratorFirm) { } - public async Task GetShipmentPackagesAsync(string filterQuery) + public async Task GetShipmentPackagesAsync(string filterQuery) { - return await InvokeRequestAsync((client) => client.GetAsync(GetShipmentPackagesUrl() + filterQuery)); + return await InvokeRequestAsync((client) => client.GetAsync(GetShipmentPackagesUrl() + filterQuery)); } - public async Task UpdateTrackingNumberAsync(long shipmentPackageId, UpdateTrackingNumberDto updateTrackingNumberDto) + public async Task UpdateTrackingNumberAsync(long shipmentPackageId, UpdateTrackingNumberRequestModel updateTrackingNumberRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdateTrackingNumberUrl(shipmentPackageId), requestBody), updateTrackingNumberDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdateTrackingNumberUrl(shipmentPackageId), requestBody), updateTrackingNumberRequestModel); return true; } - public async Task UpdatePackageAsync(long shipmentPackageId, UpdatePackageDto updatePackageDto) + public async Task UpdatePackageAsync(long shipmentPackageId, UpdatePackageRequestModel updatePackageRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdatePackageUrl(shipmentPackageId), requestBody), updatePackageDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdatePackageUrl(shipmentPackageId), requestBody), updatePackageRequestModel); return true; } - public async Task SendInvoiceLinkAsync(AddInvoiceLinkDto addInvoiceLinkDto) + public async Task SendInvoiceLinkAsync(AddInvoiceLinkRequestModel addInvoiceLinkRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetAddInvoiceLinkUrl(), requestBody), addInvoiceLinkDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetAddInvoiceLinkUrl(), requestBody), addInvoiceLinkRequestModel); return true; } - public async Task DeleteInvoiceLinkAsync(DeleteInvoiceLinkDto deleteInvoiceLinkDto) + public async Task DeleteInvoiceLinkAsync(DeleteInvoiceLinkRequestModel deleteInvoiceLinkRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetDeleteInvoiceLinkUrl(), requestBody), deleteInvoiceLinkDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetDeleteInvoiceLinkUrl(), requestBody), deleteInvoiceLinkRequestModel); return true; } - public async Task SplitMultiPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityDto splitMultiPackageByQuantityDto) + public async Task SplitMultiPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityRequestModel splitMultiPackageByQuantityRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitMultiPackageByQuantityUrl(shipmentPackageId), requestBody), splitMultiPackageByQuantityDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitMultiPackageByQuantityUrl(shipmentPackageId), requestBody), splitMultiPackageByQuantityRequestModel); return true; } - public async Task SplitMultiShipmentPackageAsync(long shipmentPackageId, SplitMultiShipmentPackageDto splitMultiShipmentPackageDto) + public async Task SplitMultiShipmentPackageAsync(long shipmentPackageId, SplitMultiShipmentPackageRequestModel splitMultiShipmentPackageRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitMultiShipmentPackageUrl(shipmentPackageId), requestBody), splitMultiShipmentPackageDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitMultiShipmentPackageUrl(shipmentPackageId), requestBody), splitMultiShipmentPackageRequestModel); return true; } - public async Task SplitShipmentPackageAsync(long shipmentPackageId, SplitShipmentPackageDto splitShipmentPackageDto) + public async Task SplitShipmentPackageAsync(long shipmentPackageId, SplitShipmentPackageRequestModel splitShipmentPackageRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitShipmentPackageUrl(shipmentPackageId), requestBody), splitShipmentPackageDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitShipmentPackageUrl(shipmentPackageId), requestBody), splitShipmentPackageRequestModel); return true; } - public async Task SplitShipmentPackageByQuantityAsync(long shipmentPackageId, SplitShipmentPackageByQuantityDto splitShipmentPackageByQuantityDto) + public async Task SplitShipmentPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityRequestModel splitMultiPackageByQuantityRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitShipmentPackageByQuantityUrl(shipmentPackageId), requestBody), splitShipmentPackageByQuantityDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitShipmentPackageByQuantityUrl(shipmentPackageId), requestBody), splitMultiPackageByQuantityRequestModel); return true; } - public async Task UpdateBoxInfoAsync(long shipmentPackageId, UpdateBoxInfoDto updateBoxInfoDto) + public async Task UpdateBoxInfoAsync(long shipmentPackageId, UpdateBoxInfoRequestModel updateBoxInfoRequestModel) { - var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetUpdateBoxInfoUrl(shipmentPackageId), requestBody), updateBoxInfoDto); + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetUpdateBoxInfoUrl(shipmentPackageId), requestBody), updateBoxInfoRequestModel); return true; } diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs index ea3b3bd..9b8eb74 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs @@ -3,32 +3,32 @@ namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Constants; public static class Providers { - public static List GetProviders() + public static List GetProviders() { - return new List + return new List { - new Provider(41, "DHLMP", "DHL Marketplace", "951-241-77-13"), - new Provider(38, "SENDEOMP", "Sendeo Marketplace", "2910804196"), - new Provider(36, "NETMP", "NetKargo Lojistik Marketplace", "6930094440"), - new Provider(34, "MARSMP", "Mars Lojistik Marketplace", "6120538808"), - new Provider(39, "BIRGUNDEMP", "Bir Günde Kargo Marketplace", "1770545653"), - new Provider(35, "OCTOMP", "Octovan Lojistik Marketplace", "6330506845"), - new Provider(30, "BORMP", "Borusan Lojistik Marketplace", "1800038254"), - new Provider(12, "UPSMP", "UPS Kargo Marketplace", "9170014856"), - new Provider(13, "AGTMP", "AGT Marketplace", "6090414309"), - new Provider(14, "CAIMP", "Cainiao Marketplace", "0"), - new Provider(10, "MNGMP", "MNG Kargo Marketplace", "6080712084"), - new Provider(19, "PTTMP", "PTT Kargo Marketplace", "7320068060"), - new Provider(9, "SURATMP", "Sürat Kargo Marketplace", "7870233582"), - new Provider(17, "TEXMP", "Trendyol Express Marketplace", "8590921777"), - new Provider(6, "HOROZMP", "Horoz Kargo Marketplace", "4630097122"), - new Provider(20, "CEVAMP", "CEVA Marketplace", "8450298557"), - new Provider(4, "YKMP", "Yurtiçi Kargo Marketplace", "3130557669"), - new Provider(7, "ARASMP", "Aras Kargo Marketplace", "720039666") + new GetProviderResponseModel(41, "DHLMP", "DHL Marketplace", "951-241-77-13"), + new GetProviderResponseModel(38, "SENDEOMP", "Sendeo Marketplace", "2910804196"), + new GetProviderResponseModel(36, "NETMP", "NetKargo Lojistik Marketplace", "6930094440"), + new GetProviderResponseModel(34, "MARSMP", "Mars Lojistik Marketplace", "6120538808"), + new GetProviderResponseModel(39, "BIRGUNDEMP", "Bir Günde Kargo Marketplace", "1770545653"), + new GetProviderResponseModel(35, "OCTOMP", "Octovan Lojistik Marketplace", "6330506845"), + new GetProviderResponseModel(30, "BORMP", "Borusan Lojistik Marketplace", "1800038254"), + new GetProviderResponseModel(12, "UPSMP", "UPS Kargo Marketplace", "9170014856"), + new GetProviderResponseModel(13, "AGTMP", "AGT Marketplace", "6090414309"), + new GetProviderResponseModel(14, "CAIMP", "Cainiao Marketplace", "0"), + new GetProviderResponseModel(10, "MNGMP", "MNG Kargo Marketplace", "6080712084"), + new GetProviderResponseModel(19, "PTTMP", "PTT Kargo Marketplace", "7320068060"), + new GetProviderResponseModel(9, "SURATMP", "Sürat Kargo Marketplace", "7870233582"), + new GetProviderResponseModel(17, "TEXMP", "Trendyol Express Marketplace", "8590921777"), + new GetProviderResponseModel(6, "HOROZMP", "Horoz Kargo Marketplace", "4630097122"), + new GetProviderResponseModel(20, "CEVAMP", "CEVA Marketplace", "8450298557"), + new GetProviderResponseModel(4, "YKMP", "Yurtiçi Kargo Marketplace", "3130557669"), + new GetProviderResponseModel(7, "ARASMP", "Aras Kargo Marketplace", "720039666") }; } - public static Provider GetProviderById(int id) => GetProviders().First(x => x.Id == id); - public static Provider GetProviderByCode(string code) => GetProviders().First(x => x.Code == code); - public static Provider GetProviderByName(string name) => GetProviders().First(x => x.Name == name); + public static GetProviderResponseModel GetProviderById(int id) => GetProviders().First(x => x.Id == id); + public static GetProviderResponseModel GetProviderByCode(string code) => GetProviders().First(x => x.Code == code); + public static GetProviderResponseModel GetProviderByName(string name) => GetProviders().First(x => x.Name == name); } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/ITrendyolProductIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/ITrendyolProductIntegration.cs index ac301ad..5378505 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/ITrendyolProductIntegration.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/ITrendyolProductIntegration.cs @@ -1,24 +1,21 @@ using Integration.Core; -using Integration.Marketplaces.Trendyol.Dtos.Category; -using Integration.Marketplaces.Trendyol.Dtos.Product; -using Integration.Marketplaces.Trendyol.Dtos.Supplier; -using Integration.Marketplaces.Trendyol.Models.Brand; -using Integration.Marketplaces.Trendyol.Models.Category; +using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Request; +using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; using Integration.Marketplaces.Trendyol.Models.Provider; namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration; public interface ITrendyolProductIntegration { - public Task?> GetSuppliersAddressesAsync(); - public List GetProviders(); - public Task?> GetBrandsAsync(); - public Task?> GetCategoryTreeAsync(); - public Task GetCategoryAttributes(int categoryId); - public Task CreateProductsV2Async(BulkDto products); - public Task UpdateProductAsync(BulkDto products); - public Task UpdatePriceAndInventoryAsync(BulkDto products); - public Task DeleteProductsAsync(BulkDto products); - public Task GetBatchRequestResultAsync(string batchRequestId); - public Task FilterProductsAsync(string filterQuery); + public Task GetSuppliersAddressesAsync(); + public List GetProviders(); + public Task GetBrandsAsync(); + public Task GetCategoryTreeAsync(); + public Task GetCategoryAttributes(int categoryId); + public Task CreateProductsV2Async(BulkModel products); + public Task UpdateProductAsync(BulkModel products); + public Task UpdatePriceAndInventoryAsync(BulkModel products); + public Task DeleteProductsAsync(BulkModel products); + public Task GetBatchRequestResultAsync(string batchRequestId); + public Task FilterProductsAsync(string filterQuery); } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/CreateProductRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/CreateProductRequestModel.cs new file mode 100644 index 0000000..5ead53e --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/CreateProductRequestModel.cs @@ -0,0 +1,125 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Request; + +public class CreateProductRequestModel : IRequestModel +{ + public string Barcode { get; set; } + + public string Title { get; set; } + + public string ProductMainId { get; set; } + + public int BrandId { get; set; } + + public int CategoryId { get; set; } + + public int Quantity { get; set; } + + public string StockCode { get; set; } + + public int DimensionalWeight { get; set; } + + public string Description { get; set; } + + public string CurrencyType { get; set; } + + public double ListPrice { get; set; } + + public double SalePrice { get; set; } + + public int VatRate { get; set; } + + public int CargoCompanyId { get; set; } + + public int? ShipmentAddressId { get; set; } + + public int? ReturningAddressId { get; set; } + + public int? DeliveryDuration { get; set; } + + public ProductDeliveryOptionRequestModel? DeliveryOption { get; set; } + + public List Images { get; set; } + + public List Attributes { get; set; } + + public CreateProductRequestModel(string barcode, string title, string productMainId, int brandId, int categoryId, int quantity, string stockCode, int dimensionalWeight, string description, string currencyType, double listPrice, double salePrice, int vatRate, int cargoCompanyId, int? shipmentAddressId, int? returningAddressId, int? deliveryDuration) + { + Barcode = barcode; + Title = title; + ProductMainId = productMainId; + BrandId = brandId; + CategoryId = categoryId; + Quantity = quantity; + StockCode = stockCode; + DimensionalWeight = dimensionalWeight; + Description = description; + CurrencyType = currencyType; + ListPrice = listPrice; + SalePrice = salePrice; + VatRate = vatRate; + CargoCompanyId = cargoCompanyId; + ShipmentAddressId = shipmentAddressId; + ReturningAddressId = returningAddressId; + DeliveryDuration = deliveryDuration; + } + + public CreateProductRequestModel SetDeliveryOption(int? deliveryDuration, string fastDeliveryType) + { + DeliveryOption = new ProductDeliveryOptionRequestModel(deliveryDuration, fastDeliveryType); + return this; + } + + public CreateProductRequestModel AddProductImage(string url) + { + if (!Images.Any()) + Images = new List(); + + Images.Add(new ProductImageRequestModel(url)); + return this; + } + + public CreateProductRequestModel AddProductCategoryAttribute(int attributeId, int? attributeValueId, string? customAttributeValue) + { + if (!Attributes.Any()) + Attributes = new List(); + + Attributes.Add(new CreateProductCategoryAttributeRequestModel(attributeId, attributeValueId, customAttributeValue)); + return this; + } +} + +public class ProductDeliveryOptionRequestModel : IRequestModel +{ + public int? DeliveryDuration { get; set; } + public string FastDeliveryType { get; set; } + public ProductDeliveryOptionRequestModel(int? deliveryDuration, string fastDeliveryType) + { + DeliveryDuration = deliveryDuration; + FastDeliveryType = fastDeliveryType; + } +} + +public class ProductImageRequestModel : IRequestModel +{ + public string Url { get; set; } + + public ProductImageRequestModel(string url) + { + Url = url; + } +} + +public class CreateProductCategoryAttributeRequestModel : IRequestModel +{ + public int AttributeId { get; set; } + public int? AttributeValueId { get; set; } + public string? CustomAttributeValue { get; set; } + public CreateProductCategoryAttributeRequestModel(int attributeId, int? attributeValueId, string? customAttributeValue) + { + AttributeId = attributeId; + AttributeValueId = attributeValueId; + CustomAttributeValue = customAttributeValue; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/DeleteProductRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/DeleteProductRequestModel.cs new file mode 100644 index 0000000..227daf8 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/DeleteProductRequestModel.cs @@ -0,0 +1,6 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Request; +public class DeleteProductRequestModel : IRequestModel +{ + public string Barcode { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/UpdateProductRequestModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/UpdateProductRequestModel.cs new file mode 100644 index 0000000..175302a --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/UpdateProductRequestModel.cs @@ -0,0 +1,80 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Request; + +public class UpdateProductRequestModel : IRequestModel +{ + public string Barcode { get; set; } + + public string Title { get; set; } + + public string ProductMainId { get; set; } + + public int BrandId { get; set; } + + public int CategoryId { get; set; } + + public int Quantity { get; set; } + + public string StockCode { get; set; } + + public int DimensionalWeight { get; set; } + + public string Description { get; set; } + + public string CurrencyType { get; set; } + + public double ListPrice { get; set; } + + public double SalePrice { get; set; } + + public int VatRate { get; set; } + + public int CargoCompanyId { get; set; } + + public int? ShipmentAddressId { get; set; } + + public int? ReturningAddressId { get; set; } + + public int? DeliveryDuration { get; set; } + + public UpdateProductDeliveryOptionRequestModel? DeliveryOption { get; set; } + + public List Images { get; set; } + + public List Attributes { get; set; } +} + +public class UpdateProductDeliveryOptionRequestModel : IRequestModel +{ + public int? DeliveryDuration { get; set; } + public string FastDeliveryType { get; set; } + public UpdateProductDeliveryOptionRequestModel(int? deliveryDuration, string fastDeliveryType) + { + DeliveryDuration = deliveryDuration; + FastDeliveryType = fastDeliveryType; + } +} + +public class UpdateProductImageRequestModel : IRequestModel +{ + public string Url { get; set; } + + public UpdateProductImageRequestModel(string url) + { + Url = url; + } +} + +public class UpdateProductCategoryAttributeRequestModel : IRequestModel +{ + public int AttributeId { get; set; } + public int? AttributeValueId { get; set; } + public string? CustomAttributeValue { get; set; } + public UpdateProductCategoryAttributeRequestModel(int attributeId, int? attributeValueId, string? customAttributeValue) + { + AttributeId = attributeId; + AttributeValueId = attributeValueId; + CustomAttributeValue = customAttributeValue; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateStockAndPriceDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/UpdateStockAndPriceRequestModel.cs similarity index 55% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateStockAndPriceDto.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/UpdateStockAndPriceRequestModel.cs index 8dd5d15..59934a9 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateStockAndPriceDto.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Request/UpdateStockAndPriceRequestModel.cs @@ -1,8 +1,8 @@ using Integration.Core; -namespace Integration.Marketplaces.Trendyol.Dtos.Product; +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Request; -public class UpdateStockAndPriceDto : IDto +public class UpdateStockAndPriceRequestModel : IRequestModel { public string Barcode { get; set; } public int Quantity { get; set; } diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/Product.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/FilterProductsResponseModel.cs similarity index 57% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/Product.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/FilterProductsResponseModel.cs index bd45552..4047082 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/Product.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/FilterProductsResponseModel.cs @@ -1,7 +1,12 @@ using Integration.Core; -namespace Integration.Marketplaces.Trendyol.Models.Product; -public class Product : IModel +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; +public class FilterProductsResponseModel : PaginationModel, IResponseModel +{ + public List Content { get; set; } +} + +public class FilterProductResponseModel : IResponseModel { public string Id { get; set; } public bool Approved { get; set; } @@ -25,9 +30,9 @@ public class Product : IModel public int VatRate { get; set; } public double DimensionalWeight { get; set; } public string StockCode { get; set; } - public ProductDeliveryOption? DeliveryOption { get; set; } - public List Images { get; set; } - public List Attributes { get; set; } + public FilterProductDeliveryOptionResponseModel DeliveryOption { get; set; } + public List Images { get; set; } + public List Attributes { get; set; } public string PlatformListingId { get; set; } public string StockId { get; set; } public bool HasActiveCampaign { get; set; } @@ -40,4 +45,23 @@ public class Product : IModel public string Size { get; set; } public bool LockedByUnSuppliedReason { get; set; } public bool Onsale { get; set; } +} + +public class FilterProductDeliveryOptionResponseModel : IResponseModel +{ + public int DeliveryDuration { get; set; } + public string FastDeliveryType { get; set; }// TODO: Check +} + +public class FilterProductImageResponseModel : IResponseModel +{ + public string Url { get; set; } +} + +public class FilterProductAttributeResponseModel : IResponseModel +{ + public int AttributeId { get; set; } + public string AttributeName { get; set; } + public int? AttributeValueId { get; set; } + public string? AttributeValue { get; set; } } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetBatchRequestResultDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetBatchRequestResultResponseModel.cs similarity index 53% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetBatchRequestResultDto.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetBatchRequestResultResponseModel.cs index 0733778..9166e2a 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetBatchRequestResultDto.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetBatchRequestResultResponseModel.cs @@ -1,10 +1,9 @@ using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Dtos.Product; -public class GetBatchRequestResultDto : IDto +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; +public class GetBatchRequestResultResponseModel : IResponseModel { public string BatchRequestId { get; set; } - public List Items { get; set; } + public List Items { get; set; } public string Status { get; set; } public long CreationDate { get; set; } public long LastModification { get; set; } @@ -12,7 +11,7 @@ public class GetBatchRequestResultDto : IDto public int ItemCount { get; set; } } -public class GetBatchRequestResultItemDto +public class BatchRequestResultResponseModel : IResponseModel { public string Status { get; set; } } \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetBrandsResponseModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetBrandsResponseModel.cs new file mode 100644 index 0000000..804d06a --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetBrandsResponseModel.cs @@ -0,0 +1,14 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; + +public class GetBrandsResponseModel : IResponseModel +{ + public List Brands { get; set; } +} + +public class BrandResponseModel: IResponseModel +{ + public int Id { get; set; } + public string Name { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetCategoryAttributesResponseModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetCategoryAttributesResponseModel.cs new file mode 100644 index 0000000..0d95c17 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetCategoryAttributesResponseModel.cs @@ -0,0 +1,29 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; + +public class GetCategoryAttributesResponseModel : IResponseModel +{ + public int Id { get; set; } + public string Name { get; set; } + public string DisplayName { get; set; } + public List CategoryAttributes { get; set; } +} + +public class CategoryAttributeResponseModel : IResponseModel +{ + public int CategoryId { get; set; } + public int Id { get; set; } + public string Name { get; set; } + public bool Required { get; set; } + public bool AllowCustom { get; set; } + public bool Varianter { get; set; } + public bool Slicer { get; set; } + public List AttributeValues { get; set; } +} + +public class CategoryAttributeValueResponseModel : IResponseModel +{ + public int Id { get; set; } + public string Name { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetCategoryTreeResponseModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetCategoryTreeResponseModel.cs new file mode 100644 index 0000000..021e7b6 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetCategoryTreeResponseModel.cs @@ -0,0 +1,16 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; + +public class GetCategoryTreeResponseModel : IResponseModel +{ + public List Categories { get; set; } +} + +public class CategoryResponseModel : IResponseModel +{ + public int Id { get; set; } + public string Name { get; set; } + public int ParentId { get; set; } + public List SubCategories { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Provider/Provider.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetProviderResponseModel.cs similarity index 70% rename from src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Provider/Provider.cs rename to src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetProviderResponseModel.cs index c62cf5f..356b861 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Provider/Provider.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetProviderResponseModel.cs @@ -1,13 +1,13 @@ using Integration.Core; namespace Integration.Marketplaces.Trendyol.Models.Provider; -public class Provider : IModel +public class GetProviderResponseModel : IResponseModel { public int Id { get; set; } public string Code { get; set; } public string Name { get; set; } public string TaxNumber { get; set; } - public Provider(int id, string code, string name, string taxNumber) + public GetProviderResponseModel(int id, string code, string name, string taxNumber) { Id = id; Code = code; diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetSuppliersAddressesResponseModel.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetSuppliersAddressesResponseModel.cs new file mode 100644 index 0000000..3b497e7 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Models/Response/GetSuppliersAddressesResponseModel.cs @@ -0,0 +1,90 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; + +public class GetSuppliersAddressesResponseModel : IResponseModel +{ + public List SupplierAddresses { get; set; } + public DefaultShipmentAddressResponse DefaultShipmentAddress { get; set; } + public DefaultInvoiceAddressResponse DefaultInvoiceAddress { get; set; } + public DefaultReturningAddressResponse DefaultReturningAddress { get; set; } +} + +public class SupplierAddressResponse +{ + public int Id { get; set; } + + public string AddressType { get; set; } + + public string Country { get; set; } + + public string City { get; set; } + + public int CityCode { get; set; } + + public string District { get; set; } + + public int DistrictId { get; set; } + + public string PostCode { get; set; } + + public string Address { get; set; } + + public bool ReturningAddress { get; set; } + + public string FullAddress { get; set; } + + public bool ShipmentAddress { get; set; } + + public bool InvoiceAddress { get; set; } + + public bool Default { get; set; } +} + +public class DefaultShipmentAddressResponse +{ + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string? Company { get; set; } + public string Address1 { get; set; } + public string? Address2 { get; set; } + public string City { get; set; } + public int CityCode { get; set; } + public string District { get; set; } + public int DistrictId { get; set; } + public string PostalCode { get; set; } + public string CountryCode { get; set; } + public int NeighborhoodId { get; set; } + public string Neighborhood { get; set; } + public string? Phone { get; set; } + public string FullName { get; set; } + public string FullAddress { get; set; } +} + +public class DefaultInvoiceAddressResponse +{ + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string? Company { get; set; } + public string Address1 { get; set; } + public string? Address2 { get; set; } + public string City { get; set; } + public string District { get; set; } + public int DistrictId { get; set; } + public string? PostalCode { get; set; } + public string CountryCode { get; set; } + public int NeighborhoodId { get; set; } + public string Neighborhood { get; set; } + public string? Phone { get; set; } + public string FullName { get; set; } + public string FullAddress { get; set; } + public string TaxOffice { get; set; } + public string TaxNumber { get; set; } +} + +public class DefaultReturningAddressResponse +{ + public bool Present { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/TrendyolProductIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/TrendyolProductIntegration.cs index d67cb23..e64597b 100644 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/TrendyolProductIntegration.cs +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/TrendyolProductIntegration.cs @@ -1,86 +1,83 @@ using Integration.Core; -using Integration.Marketplaces.Trendyol.Dtos.Category; -using Integration.Marketplaces.Trendyol.Dtos.Product; -using Integration.Marketplaces.Trendyol.Dtos.Supplier; using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Constants; -using Integration.Marketplaces.Trendyol.Models.Brand; -using Integration.Marketplaces.Trendyol.Models.Category; +using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Request; +using Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Models.Response; using Integration.Marketplaces.Trendyol.Models.Provider; namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration; public class TrendyolProductIntegration : TrendyolIntegrationBase, ITrendyolProductIntegration, IMarketplaceIntegration { - public string GetCreateProducsUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/v2/products"; - public string GetSupplierAddressUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/addresses"; - public string GetBrandsUrl() => $"{GetBaseUrl}brands"; - public string GetCategoryTreeUrl() => $"{GetBaseUrl}product-categories"; - public string GetCategoryAttributesUrl(int categoryId) => $"{GetBaseUrl}product-categories/{categoryId}/attributes"; - public string GetUpdateProductUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/v2/products"; - public string GetUpdatePriceAndStockUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/products/price-and-inventory"; - public string GetDeleteProductUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/v2/products"; - public string GetBatchRequestResultUrl(string batchRequestId) => $"{GetBaseUrl}suppliers/{_supplierId}/products/batch-requests/{batchRequestId}"; - public string GetFilterProductsUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/products"; + private string GetCreateProducsUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/v2/products"; + private string GetSupplierAddressUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/addresses"; + private string GetBrandsUrl() => $"{GetBaseUrl}brands"; + private string GetCategoryTreeUrl() => $"{GetBaseUrl}product-categories"; + private string GetCategoryAttributesUrl(int categoryId) => $"{GetBaseUrl}product-categories/{categoryId}/attributes"; + private string GetUpdateProductUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/v2/products"; + private string GetUpdatePriceAndStockUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/products/price-and-inventory"; + private string GetDeleteProductUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/v2/products"; + private string GetBatchRequestResultUrl(string batchRequestId) => $"{GetBaseUrl}suppliers/{_supplierId}/products/batch-requests/{batchRequestId}"; + private string GetFilterProductsUrl() => $"{GetBaseUrl}suppliers/{_supplierId}/products"; public TrendyolProductIntegration(string supplierId, string apiKey, string apiSecret, bool isInProduction, string entegratorFirm) : base(supplierId, apiKey, apiSecret, isInProduction, entegratorFirm) { } - public async Task CreateProductsV2Async(BulkDto products) + public async Task CreateProductsV2Async(BulkModel products) { var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetCreateProducsUrl(), requestBody), products); return true; } - public async Task DeleteProductsAsync(BulkDto products) + public async Task DeleteProductsAsync(BulkModel products) { var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetDeleteProductUrl(), requestBody), products); return true; } - public async Task FilterProductsAsync(string filterQuery) + public async Task FilterProductsAsync(string filterQuery) { - return await InvokeRequestAsync((client) => client.GetAsync(GetFilterProductsUrl() + filterQuery)); + return await InvokeRequestAsync((client) => client.GetAsync(GetFilterProductsUrl() + filterQuery)); } - public async Task GetBatchRequestResultAsync(string batchRequestId) + public async Task GetBatchRequestResultAsync(string batchRequestId) { - return await InvokeRequestAsync((client) => client.GetAsync(GetBatchRequestResultUrl(batchRequestId))); + return await InvokeRequestAsync((client) => client.GetAsync(GetBatchRequestResultUrl(batchRequestId))); } - public async Task?> GetBrandsAsync() + public async Task GetBrandsAsync() { - return await InvokeRequestAsync>((client) => client.GetAsync(GetBrandsUrl())); + return await InvokeRequestAsync((client) => client.GetAsync(GetBrandsUrl())); } - public async Task GetCategoryAttributes(int categoryId) + public async Task GetCategoryAttributes(int categoryId) { - return await InvokeRequestAsync((client) => client.GetAsync(GetCategoryAttributesUrl(categoryId))); + return await InvokeRequestAsync((client) => client.GetAsync(GetCategoryAttributesUrl(categoryId))); } - public async Task?> GetCategoryTreeAsync() + public async Task GetCategoryTreeAsync() { - return await InvokeRequestAsync>((client) => client.GetAsync(GetCategoryTreeUrl())); + return await InvokeRequestAsync((client) => client.GetAsync(GetCategoryTreeUrl())); } - public List GetProviders() + public List GetProviders() { return Providers.GetProviders(); } - public async Task?> GetSuppliersAddressesAsync() + public async Task GetSuppliersAddressesAsync() { - return await InvokeRequestAsync>((client) => client.GetAsync(GetSupplierAddressUrl())); + return await InvokeRequestAsync((client) => client.GetAsync(GetSupplierAddressUrl())); } - public async Task UpdatePriceAndInventoryAsync(BulkDto products) + public async Task UpdatePriceAndInventoryAsync(BulkModel products) { var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdatePriceAndStockUrl(), requestBody), products); return true; } - public async Task UpdateProductAsync(BulkDto products) + public async Task UpdateProductAsync(BulkModel products) { var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdateProductUrl(), requestBody), products); diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs deleted file mode 100644 index 558a341..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Address; -public class InvoiceAddress : IModel -{ - public int Id { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string? Company { get; set; } - public string Address1 { get; set; } - public string? Address2 { get; set; } - public string City { get; set; } - public string District { get; set; } - public int DistrictId { get; set; } - public string? PostalCode { get; set; } - public string CountryCode { get; set; } - public int NeighborhoodId { get; set; } - public string Neighborhood { get; set; } - public string? Phone { get; set; } - public string FullName { get; set; } - public string FullAddress { get; set; } - public string TaxOffice { get; set; } - public string TaxNumber { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/ShipmentAddress.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/ShipmentAddress.cs deleted file mode 100644 index c877f52..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/ShipmentAddress.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Address; -public class ShipmentAddress : IModel -{ - public int Id { get; set; } - public string FirstName { get; set; } - public string LastName { get; set; } - public string? Company { get; set; } - public string Address1 { get; set; } - public string? Address2 { get; set; } - public string City { get; set; } - public int CityCode { get; set; } - public string District { get; set; } - public int DistrictId { get; set; } - public string PostalCode { get; set; } - public string CountryCode { get; set; } - public int NeighborhoodId { get; set; } - public string Neighborhood { get; set; } - public string? Phone { get; set; } - public string FullName { get; set; } - public string FullAddress { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Brand/Brand.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Brand/Brand.cs deleted file mode 100644 index 4d0572d..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Brand/Brand.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Brand; -public class Brand : IModel -{ - public int Id { get; set; } - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/Category.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/Category.cs deleted file mode 100644 index 090ba8e..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/Category.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Integration.Core; -namespace Integration.Marketplaces.Trendyol.Models.Category; -public class Category : IModel -{ - public int Id { get; set; } - public string Name { get; set; } - public int ParentId { get; set; } - public List SubCategories { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttribute.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttribute.cs deleted file mode 100644 index 476c373..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttribute.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Category; -public class CategoryAttribute : IModel -{ - public int CategoryId { get; set; } - public int Id { get; set; } - public string Name { get; set; } - public bool Required { get; set; } - public bool AllowCustom { get; set; } - public bool Varianter { get; set; } - public bool Slicer { get; set; } - public List AttributeValues { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttributeValue.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttributeValue.cs deleted file mode 100644 index 9477442..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttributeValue.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Category; -public class CategoryAttributeValue : IModel -{ - public int Id { get; set; } - public string Name { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/Package.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/Package.cs deleted file mode 100644 index bdbb2a5..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/Package.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Models.Address; -namespace Integration.Marketplaces.Trendyol.Models.Package; -public class Package : IModel -{ - public ShipmentAddress ShipmentAddress { get; set; } - public string OrderNumber { get; set; } - public double GrossAmount { get; set; } - public double TotalDiscount { get; set; } - public double TotalTyDiscount { get; set; } - public object TaxNumber { get; set; } - public InvoiceAddress InvoiceAddress { get; set; } - public string CustomerFirstName { get; set; } - public string CustomerEmail { get; set; } - public int CustomerId { get; set; } - public string CustomerLastName { get; set; } - public int Id { get; set; } - public long CargoTrackingNumber { get; set; } - public string CargoTrackingLink { get; set; } - public string CargoSenderNumber { get; set; } - public string CargoProviderName { get; set; } - public string Lines { get; set; } - public long OrderDate { get; set; } - public string TcIdentityNumber { get; set; } - public string CurrencyCode { get; set; } - public List PackageHistories { get; set; } - public string ShipmentPackageStatus { get; set; } - public string Status { get; set; } - public string DeliveryType { get; set; } - public int TimeSlotId { get; set; } - public string ScheduledDeliveryStoreId { get; set; } - public long EstimatedDeliveryStartDate { get; set; } - public long EstimatedDeliveryEndDate { get; set; } - public double TotalPrice { get; set; } - public string DeliveryAddressType { get; set; } - public long AgreedDeliveryDate { get; set; } - public bool AgreedDeliveryDateExtendible { get; set; } - public long ExtendedAgreedDeliveryDate { get; set; } - public long AgreedDeliveryExtensionStartDate { get; set; } - public long AgreedDeliveryExtensionEndDate { get; set; } - public string InvoiceLink { get; set; } - public bool FastDelivery { get; set; } - public string FastDeliveryType { get; set; } - public long OriginShipmentDate { get; set; } - public long LastModifiedDate { get; set; } - public bool Commercial { get; set; } - public bool DeliveredByService { get; set; } - public bool Micro { get; set; } - public bool GiftBoxRequested { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageDiscountDetail.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageDiscountDetail.cs deleted file mode 100644 index dd28b3f..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageDiscountDetail.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Integration.Core; - -public class PackageDiscountDetail : IModel -{ - public double LineItemPrice { get; set; } - public double LineItemDiscount { get; set; } - public double LineItemTyDiscount { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageFastDeliveryOption.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageFastDeliveryOption.cs deleted file mode 100644 index 3e68f4e..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageFastDeliveryOption.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Integration.Core; -using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; - -public class PackageFastDeliveryOption : IModel -{ - public DeliveryOption Type { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageHistory.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageHistory.cs deleted file mode 100644 index 0b115b8..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageHistory.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Package; -public class PackageHistory : IModel -{ - public string CreatedDate { get; set; } - public string Status { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageLine.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageLine.cs deleted file mode 100644 index 327e9f7..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageLine.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Integration.Core; - -public class PackageLine : IModel -{ - public int Quantity { get; set; } - public int SalesCampaignId { get; set; } - public string ProductSize { get; set; } - public string MerchantSku { get; set; } - public string ProductName { get; set; } - public int ProductCode { get; set; } - public string ProductOrigin { get; set; } - public int MerchantId { get; set; } - public double Amount { get; set; } - public double Discount { get; set; } - public double TyDiscount { get; set; } - public List DiscountDetails { get; set; } - public List FastDeliveryOptions { get; set; } - public string CurrencyCode { get; set; } - public string ProductColor { get; set; } - public int Id { get; set; } - public string Sku { get; set; } - public int VatBaseAmount { get; set; } - public string Barcode { get; set; } - public string OrderLineItemStatusName { get; set; } - public double Price { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductCategoryAttribute.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductCategoryAttribute.cs deleted file mode 100644 index 5d9dcc4..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductCategoryAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Integration.Core; - -public class ProductCategoryAttribute : IModel -{ - public int AttributeId { get; set; } - public string AttributeName { get; set; } - public int? AttributeValueId { get; set; } - public string? AttributeValue { get; set; } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductDeliveryOption.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductDeliveryOption.cs deleted file mode 100644 index 9956dbe..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductDeliveryOption.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Product; -public class ProductDeliveryOption : IModel -{ - public int? DeliveryDuration { get; set; } - public string FastDeliveryType { get; set; } - public ProductDeliveryOption(int? deliveryDuration, string fastDeliveryType) - { - DeliveryDuration = deliveryDuration; - FastDeliveryType = fastDeliveryType; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductImage.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductImage.cs deleted file mode 100644 index d3dd849..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductImage.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Product; -public class ProductImage : IModel -{ - public string Url { get; set; } - - public ProductImage(string url) - { - Url = url; - } -} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Supplier/SupplierAddress.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Supplier/SupplierAddress.cs deleted file mode 100644 index bec2592..0000000 --- a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Supplier/SupplierAddress.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Integration.Core; - -namespace Integration.Marketplaces.Trendyol.Models.Supplier; -public class SupplierAddress : IModel -{ - public int Id { get; set; } - - public string AddressType { get; set; } - - public string Country { get; set; } - - public string City { get; set; } - - public int CityCode { get; set; } - - public string District { get; set; } - - public int DistrictId { get; set; } - - public string PostCode { get; set; } - - public string Address { get; set; } - - public bool ReturningAddress { get; set; } - - public string FullAddress { get; set; } - - public bool ShipmentAddress { get; set; } - - public bool InvoiceAddress { get; set; } - - public bool Default { get; set; } -} \ No newline at end of file