From e891c78f1e9cc7c20bdd56890d22b1f17ca66f7e Mon Sep 17 00:00:00 2001 From: onurkanbakirci Date: Tue, 12 Dec 2023 12:02:16 +0300 Subject: [PATCH] first commit --- .../composite/publish-lib/action.yml | 34 ++ .github/workflows/integration.core.yml | 73 +++ .github/workflows/trendyol-integration.yml | 74 +++ .gitignore | 484 ++++++++++++++++++ Directory.Build.props | 1 + Directory.Build.targets | 1 + Integration.sln | 44 ++ LICENSE | 23 + README.md | 69 +++ src/Integration.Core/BulkDto.cs | 5 + src/Integration.Core/IDto.cs | 4 + .../IMarketplaceIntegration.cs | 4 + src/Integration.Core/IModel.cs | 4 + src/Integration.Core/Integration.Core.csproj | 13 + src/Integration.Core/IntegrationBase.cs | 60 +++ src/Integration.Core/PaginationDto.cs | 8 + ...ntegration.Marketplaces.Hepsiburada.csproj | 13 + .../Dtos/Category/GetCategoryAttribute.cs | 11 + .../Dtos/Claim/AddClaimDto.cs | 32 ++ .../Dtos/Claim/GetClaimDto.cs | 89 ++++ .../Dtos/Invoice/AddInvoiceLinkDto.cs | 16 + .../Dtos/Invoice/DeleteInvoiceLinkDto.cs | 15 + .../Dtos/Package/GetShipmentPackagesDto.cs | 8 + .../Package/SplitMultiPackageByQuantityDto.cs | 18 + .../Package/SplitMultiShipmentPackageDto.cs | 12 + .../SplitShipmentPackageByQuantityDto.cs | 13 + .../Dtos/Package/SplitShipmentPackageDto.cs | 7 + .../Dtos/Package/UpdateBoxInfoDto.cs | 12 + .../Dtos/Package/UpdatePackageDto.cs | 39 ++ .../Dtos/Package/UpdateTrackingNumberDto.cs | 11 + .../Product/AddProductCategoryAttributeDto.cs | 14 + .../Dtos/Product/AddProductDto.cs | 92 ++++ .../Dtos/Product/DeleteProductDto.cs | 8 + .../Dtos/Product/GetBatchRequestResultDto.cs | 18 + .../Dtos/Product/GetProductsDto.cs | 8 + .../Dtos/Product/UpdateProductDto.cs | 46 ++ .../Dtos/Product/UpdateStockAndPriceDto.cs | 11 + .../Dtos/Supplier/GetSupplierDto.cs | 11 + .../ClientApiAuthenticationException.cs | 7 + .../Exceptions/TooManyClientsException.cs | 7 + .../Constants/ClaimReasons.cs | 58 +++ .../ClaimIntegration/Constants/ClaimStatus.cs | 10 + .../Helpers/ClaimFilterBuilder.cs | 56 ++ .../ITrendyolClaimIntegration.cs | 4 + .../TrendyolClaimIntegration.cs | 28 + .../Constants/DeliveryOption.cs | 7 + .../Constants/OrderDirection.cs | 6 + .../Constants/OrderField.cs | 5 + .../Constants/PackageStatus.cs | 15 + .../Helpers/ShipmentFilterBuilder.cs | 76 +++ .../ITrendyolPackageIntegration.cs | 17 + .../TrendyolPackageIntegration.cs | 89 ++++ .../ProductIntegration/Constants/Providers.cs | 34 ++ .../Helpers/ProductFilterBuilder.cs | 107 ++++ .../ITrendyolProductIntegration.cs | 24 + .../TrendyolProductIntegration.cs | 89 ++++ .../Infrastructure/TrendyolIntegration.cs | 24 + .../Integration.Marketplaces.Trendyol.csproj | 17 + .../Models/Address/InvoiceAddress.cs | 24 + .../Models/Address/ShipmentAddress.cs | 23 + .../Models/Brand/Brand.cs | 8 + .../Models/Category/Category.cs | 9 + .../Models/Category/CategoryAttribute.cs | 14 + .../Models/Category/CategoryAttributeValue.cs | 8 + .../Models/Package/Package.cs | 50 ++ .../Models/Package/PackageDiscountDetail.cs | 8 + .../Package/PackageFastDeliveryOption.cs | 7 + .../Models/Package/PackageHistory.cs | 8 + .../Models/Package/PackageLine.cs | 26 + .../Models/Product/Product.cs | 43 ++ .../Product/ProductCategoryAttribute.cs | 9 + .../Models/Product/ProductDeliveryOption.cs | 13 + .../Models/Product/ProductImage.cs | 12 + .../Models/Provider/Provider.cs | 17 + .../Models/Supplier/SupplierAddress.cs | 33 ++ 75 files changed, 2397 insertions(+) create mode 100644 .github/workflows/composite/publish-lib/action.yml create mode 100644 .github/workflows/integration.core.yml create mode 100644 .github/workflows/trendyol-integration.yml create mode 100644 .gitignore create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 Integration.sln create mode 100644 LICENSE create mode 100644 README.md create mode 100644 src/Integration.Core/BulkDto.cs create mode 100644 src/Integration.Core/IDto.cs create mode 100644 src/Integration.Core/IMarketplaceIntegration.cs create mode 100644 src/Integration.Core/IModel.cs create mode 100644 src/Integration.Core/Integration.Core.csproj create mode 100644 src/Integration.Core/IntegrationBase.cs create mode 100644 src/Integration.Core/PaginationDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/AddClaimDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/GetShipmentPackagesDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiPackageByQuantityDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiShipmentPackageDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageByQuantityDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateBoxInfoDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdatePackageDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateTrackingNumberDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductCategoryAttributeDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/DeleteProductDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetBatchRequestResultDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetProductsDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateProductDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateStockAndPriceDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Supplier/GetSupplierDto.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/ClientApiAuthenticationException.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/TooManyClientsException.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimReasons.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimStatus.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Helpers/ClaimFilterBuilder.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/ITrendyolClaimIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/TrendyolClaimIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/DeliveryOption.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderDirection.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderField.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/PackageStatus.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Helpers/ShipmentFilterBuilder.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/ITrendyolPackageIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/TrendyolPackageIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Helpers/ProductFilterBuilder.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/ITrendyolProductIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/TrendyolProductIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/TrendyolIntegration.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/ShipmentAddress.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Brand/Brand.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/Category.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttribute.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttributeValue.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/Package.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageDiscountDetail.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageFastDeliveryOption.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageHistory.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageLine.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/Product.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductCategoryAttribute.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductDeliveryOption.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductImage.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Provider/Provider.cs create mode 100644 src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Supplier/SupplierAddress.cs diff --git a/.github/workflows/composite/publish-lib/action.yml b/.github/workflows/composite/publish-lib/action.yml new file mode 100644 index 0000000..b02f2b7 --- /dev/null +++ b/.github/workflows/composite/publish-lib/action.yml @@ -0,0 +1,34 @@ +name: "Publish dotnet lib" +description: "Deploy dotnet lib to registry" + +inputs: + path: + description: "Path of the project" + required: true + nupkg_path: + description: "Path of the nupkg" + required: true + source: + description: "Destination package source" + required: true + api_key: + description: "Destination package source api key" + required: true + +runs: + using: "composite" + steps: + + - name: Build the Library + shell: "bash" + run: | + cd ${{ inputs.path }} + dotnet build --configuration Release + + - name: Create nuget packages + shell: "bash" + run: dotnet pack ${{ inputs.path }} --configuration Release --no-build + + - name: Publish nuget packages + shell: "bash" + run: dotnet nuget push ${{ inputs.nupkg_path }} --source ${{inputs.source}} --api-key ${{inputs.api_key}} \ No newline at end of file diff --git a/.github/workflows/integration.core.yml b/.github/workflows/integration.core.yml new file mode 100644 index 0000000..bcaa25e --- /dev/null +++ b/.github/workflows/integration.core.yml @@ -0,0 +1,73 @@ +name: Integration.Core + +on: + workflow_dispatch: + workflow_call: + push: + branches: + - main + + paths: + - src/Integration.Core/** + - .github/workflows/integration-core.yml + - .github/workflows/composite/** + +env: + #For build process + owner: onurkanbakirci + repo: Integration + + project_path: ./src/Integration.Core/ + nupkg_path: ./src/Integration.Core/bin/Release/net8.0/Integration.Core.12.12.23.1.0.0.nupkg + nupkg_source: github + nupkg_secret: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build-lib: + name: Build Lib + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v7 + with: + dotnet-version: 8.0.0 + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: | + cd ${{env.project_path}} + dotnet build --no-restore + + test-lib: + name: Test Lib + runs-on: ubuntu-latest + needs: build-lib + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Test + run: | + + publish-lib: + name: Publish Lib + runs-on: ubuntu-latest + needs: test-lib + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - uses: ./.github/workflows/composite/publish-lib + with: + path: ${{ env.project_path }} + nupkg_path: ${{env.nupkg_path}} + source: ${{ env.nupkg_source }} + api_key: ${{ env.nupkg_secret }} \ No newline at end of file diff --git a/.github/workflows/trendyol-integration.yml b/.github/workflows/trendyol-integration.yml new file mode 100644 index 0000000..ee55d67 --- /dev/null +++ b/.github/workflows/trendyol-integration.yml @@ -0,0 +1,74 @@ +name: Integration.Marketplaces.Trendyol + +on: + workflow_dispatch: + workflow_call: + push: + branches: + - main + + paths: + - src/Integration.Core/** + - src/Marketplaces/Integration.Marketplaces.Trendyol/** + - .github/workflows/trendyol-integration.yml + - .github/workflows/composite/** + +env: + #For build process + owner: onurkanbakirci + repo: Integration + + project_path: ./src/Integration.Marketplaces.Trendyol/ + nupkg_path: ./src/Integration.Marketplaces.Trendyol/bin/Release/net8.0/Integration.Marketplaces.Trendyol.12.12.23.1.0.0.nupkg + nupkg_source: github + nupkg_secret: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build-lib: + name: Build Lib + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v7 + with: + dotnet-version: 8.0.0 + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: | + cd ${{env.project_path}} + dotnet build --no-restore + + test-lib: + name: Test Lib + runs-on: ubuntu-latest + needs: build-lib + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Test + run: | + + publish-lib: + name: Publish Lib + runs-on: ubuntu-latest + needs: test-lib + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - uses: ./.github/workflows/composite/publish-lib + with: + path: ${{ env.project_path }} + nupkg_path: ${{env.nupkg_path}} + source: ${{ env.nupkg_source }} + api_key: ${{ env.nupkg_secret }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e57f18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,484 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from `dotnet new gitignore` + +# dotenv files +.env + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml +.idea + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Vim temporary swap files +*.swp diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..03cc13c --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..03cc13c --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Integration.sln b/Integration.sln new file mode 100644 index 0000000..5400123 --- /dev/null +++ b/Integration.sln @@ -0,0 +1,44 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{8D1AC917-32E3-4579-9A06-B6190C1B9F31}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration.Core", "src\Integration.Core\Integration.Core.csproj", "{2E841AED-7444-4875-8D11-D756A01105FD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Marketplaces", "Marketplaces", "{E2F4960B-14E1-40D3-9A7B-8528FA989D0F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration.Marketplaces.Trendyol", "src\Marketplaces\Integration.Marketplaces.Trendyol\Integration.Marketplaces.Trendyol.csproj", "{437419E1-6CA7-43C5-BC45-57C61A2473A6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration.Marketplaces.Hepsiburada", "src\Marketplaces\Integration.Marketplaces.Hepsiburada\Integration.Marketplaces.Hepsiburada.csproj", "{D80122E8-72B1-4B86-A277-4FD3BAC21FB4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2E841AED-7444-4875-8D11-D756A01105FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E841AED-7444-4875-8D11-D756A01105FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E841AED-7444-4875-8D11-D756A01105FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E841AED-7444-4875-8D11-D756A01105FD}.Release|Any CPU.Build.0 = Release|Any CPU + {437419E1-6CA7-43C5-BC45-57C61A2473A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {437419E1-6CA7-43C5-BC45-57C61A2473A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {437419E1-6CA7-43C5-BC45-57C61A2473A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {437419E1-6CA7-43C5-BC45-57C61A2473A6}.Release|Any CPU.Build.0 = Release|Any CPU + {D80122E8-72B1-4B86-A277-4FD3BAC21FB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D80122E8-72B1-4B86-A277-4FD3BAC21FB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D80122E8-72B1-4B86-A277-4FD3BAC21FB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D80122E8-72B1-4B86-A277-4FD3BAC21FB4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {2E841AED-7444-4875-8D11-D756A01105FD} = {8D1AC917-32E3-4579-9A06-B6190C1B9F31} + {E2F4960B-14E1-40D3-9A7B-8528FA989D0F} = {8D1AC917-32E3-4579-9A06-B6190C1B9F31} + {437419E1-6CA7-43C5-BC45-57C61A2473A6} = {E2F4960B-14E1-40D3-9A7B-8528FA989D0F} + {D80122E8-72B1-4B86-A277-4FD3BAC21FB4} = {E2F4960B-14E1-40D3-9A7B-8528FA989D0F} + EndGlobalSection +EndGlobal diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0da94fa --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +Commercial License + +Copyright © 2023 HI-SIM Technology Engineering Industry and Trade Limited Corporation + +This software is proprietary and confidential. Any unauthorized use, reproduction, or distribution is strictly prohibited. This software is provided "as is" and without warranties of any kind, whether express or implied. + +License Terms: + +1. Permission is granted to the Licensee to use this software solely for the purposes of their commercial project, subject to the following restrictions: + +2. The Licensee may not modify, decompile, reverse engineer, disassemble, or attempt to derive the source code of the software. + +3. The Licensee may not distribute, sublicense, or otherwise make the software available to any third party. + +4. The Licensee may not use this software for any illegal or unethical purpose. + +5. This license is valid for a single commercial project. For each additional project, the Licensee must obtain a separate license. + +6. The Licensor reserves the right to terminate this license at any time if the Licensee violates any of the terms and conditions. + +7. No warranty or support is provided with this license. The Licensor is not responsible for any damages or liabilities resulting from the use of this software. + +By using this software, the Licensee agrees to be bound by these terms and conditions. For licensing inquiries or questions, please contact [your contact information]. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e083db7 --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# Integrator Project + +![Integration.Core](https://github.com/onurkanbakirci/Integration/actions/workflows/integration-core.yml/badge.svg) +![Integration.Marketplaces.Trendyol](https://github.com/onurkanbakirci/Integration/actions/workflows/trendyol-integration.yml/badge.svg) + +## Table of contents + +- [Integrator Project](#integrator-project) + - [Table of contents](#table-of-contents) + - [Introduction](#introduction) + - [Requirements](#requirements) + - [Recommendations](#recommendations) + - [Installation](#installation) + - [Configuration](#configuration) + - [Troubleshooting](#troubleshooting) + - [FAQ](#faq) + + +## Introduction + +The HISIM repo contains all source code about +hisim services such as app service, identity service, +management client service, app clients service etc. +All services are in a repo. + + +## Requirements + +This module requires the following modules: + +- [Views](https://www.drupal.org/project/views) +- [Panels](https://www.drupal.org/project/panels) + + +## Recommendations + +[Postman](https://www.postman.com): When installed, +making requests to services will be easier. + +## Installation + + +## Configuration + +1. Enable the module at Administration > Extend. +1. When creating a new field on a content type or custom entity type, choose + "Double Field" from the drop-down menu. +1. On the Field Settings form for the Double Field, define the two subfields + as you would with any other field. +1. Optionally, on the "Edit" form for the Double Field, you may choose + options for whether or not the subfields are "required". + + +## Troubleshooting + +If the menu does not display, check the following: + +- Are the "Access administration menu" and "Use the administration pages and + help" permissions enabled for the appropriate roles? +- Does html.tpl.php of your theme output the `$page_bottom` variable? + +### FAQ + +Q: I enabled "Aggregate and compress CSS files", but admin_menu.css is still +there. Is this normal? + +A: Yes, this is the intended behavior. the administration menu module only loads +its stylesheet as needed (i.e., on page requests by logged-on, administrative +users). diff --git a/src/Integration.Core/BulkDto.cs b/src/Integration.Core/BulkDto.cs new file mode 100644 index 0000000..e40b009 --- /dev/null +++ b/src/Integration.Core/BulkDto.cs @@ -0,0 +1,5 @@ +namespace Integration.Core; +public class BulkDto : IDto +{ + 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 new file mode 100644 index 0000000..15dc4ba --- /dev/null +++ b/src/Integration.Core/IDto.cs @@ -0,0 +1,4 @@ +namespace Integration.Core; +public interface IDto +{ +} \ No newline at end of file diff --git a/src/Integration.Core/IMarketplaceIntegration.cs b/src/Integration.Core/IMarketplaceIntegration.cs new file mode 100644 index 0000000..030c786 --- /dev/null +++ b/src/Integration.Core/IMarketplaceIntegration.cs @@ -0,0 +1,4 @@ +namespace Integration.Core; +public interface IMarketplaceIntegration +{ +} \ No newline at end of file diff --git a/src/Integration.Core/IModel.cs b/src/Integration.Core/IModel.cs new file mode 100644 index 0000000..5b32f6f --- /dev/null +++ b/src/Integration.Core/IModel.cs @@ -0,0 +1,4 @@ +namespace Integration.Core; +public interface IModel +{ +} \ No newline at end of file diff --git a/src/Integration.Core/Integration.Core.csproj b/src/Integration.Core/Integration.Core.csproj new file mode 100644 index 0000000..c6d2779 --- /dev/null +++ b/src/Integration.Core/Integration.Core.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + Integration.Core.12.12.23 + 1.0.0 + onurkanbakirci + onurkanbakirci + + + \ No newline at end of file diff --git a/src/Integration.Core/IntegrationBase.cs b/src/Integration.Core/IntegrationBase.cs new file mode 100644 index 0000000..e948c5c --- /dev/null +++ b/src/Integration.Core/IntegrationBase.cs @@ -0,0 +1,60 @@ +using System.Text; +using System.Text.Json; + +namespace Integration.Core; +public class IntegrationBase +{ + protected static readonly HttpClient _httpClient; + static IntegrationBase() + { + _httpClient = new HttpClient(); + } + + public async Task InvokeRequestAsync(Func> httpRequest) + { + var response = await httpRequest.Invoke(_httpClient); + var responseAsString = await response.Content.ReadAsStringAsync(); + var isSuccess = response.IsSuccessStatusCode; + if (!isSuccess) + throw new Exception(responseAsString); + + return JsonSerializer.Deserialize(responseAsString)!; + } + + public async Task InvokeRequestAsync(Func> httpRequest) + { + var response = await httpRequest.Invoke(_httpClient); + var responseAsString = await response.Content.ReadAsStringAsync(); + var isSuccess = response.IsSuccessStatusCode; + if (!isSuccess) + throw new Exception(responseAsString); + + return isSuccess; + } + + public async Task InvokeRequestAsync(Func> httpRequest, IDto dto) + { + var jsonData = JsonSerializer.Serialize(dto); + var requestBody = new StringContent(jsonData, Encoding.UTF8, "application/json"); + + var response = await httpRequest.Invoke(_httpClient, requestBody); + var responseAsString = await response.Content.ReadAsStringAsync(); + var isSuccess = response.IsSuccessStatusCode; + if (!isSuccess) + throw new Exception(responseAsString); + return JsonSerializer.Deserialize(responseAsString)!; + } + + public async Task InvokeRequestAsync(Func> httpRequest, IDto dto) + { + var jsonData = JsonSerializer.Serialize(dto); + var requestBody = new StringContent(jsonData, Encoding.UTF8, "application/json"); + + var response = await httpRequest.Invoke(_httpClient, requestBody); + var responseAsString = await response.Content.ReadAsStringAsync(); + var isSuccess = response.IsSuccessStatusCode; + if (!isSuccess) + throw new Exception(responseAsString); + return isSuccess; + } +} \ No newline at end of file diff --git a/src/Integration.Core/PaginationDto.cs b/src/Integration.Core/PaginationDto.cs new file mode 100644 index 0000000..1e065e5 --- /dev/null +++ b/src/Integration.Core/PaginationDto.cs @@ -0,0 +1,8 @@ +namespace Integration.Core; +public class PaginationDto : IDto +{ + public int TotalElements { get; set; } + public int TotalPages { get; set; } + public int Page { get; set; } + public int Size { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj new file mode 100644 index 0000000..816bebd --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Hepsiburada/Integration.Marketplaces.Hepsiburada.csproj @@ -0,0 +1,13 @@ + + + + + + + + net8.0 + enable + enable + + + diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs new file mode 100644 index 0000000..7296caa --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Category/GetCategoryAttribute.cs @@ -0,0 +1,11 @@ +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/AddClaimDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/AddClaimDto.cs new file mode 100644 index 0000000..ea6842e --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/AddClaimDto.cs @@ -0,0 +1,32 @@ +using Integration.Core; +using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Constants; + +namespace Integration.Marketplaces.Trendyol.Dtos.Claim; +public class AddClaimDto : IDto +{ + 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 class AddClaimItemDto : IDto +{ + 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) + { + Barcode = barcode; + CustomerNote = customerNote; + Quantity = quantity; + + if (ClaimReasons.GetClaimReasonById(reasonId) is null) + throw new Exception($"Claim reason id {reasonId} is not valid."); + + ReasonId = reasonId; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs new file mode 100644 index 0000000..bd0abfc --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Claim/GetClaimDto.cs @@ -0,0 +1,89 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Dtos.Claim; +public class GetClaimDto : IDto +{ + public List Content { get; set; } +} + +public class Claim : IDto +{ + public string Id { get; set; } + public string OrderNumber { get; set; } + public long OrderDate { get; set; } + public string CustomerFirstName { get; set; } + public string CustomerLastName { get; set; } + public long ClaimDate { get; set; } + public string CargoTrackingNumber { get; set; } + public string CargoTrackingLink { get; set; } + 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 class ReplacementOutboundPackageInfo : IDto +{ + public string CargoTrackingNumber { get; set; } + public string CargoProviderName { get; set; } + public string CargoSenderNumber { get; set; } + public string CargoTrackingLink { get; set; } + public int Packageid { get; set; } + public List Items { get; set; } +} + +public class RejectedPackageInfo : IDto +{ + public string CargoTrackingNumber { get; set; } + public string CargoProviderName { get; set; } + public string CargoTrackingLink { get; set; } + public int Packageid { get; set; } + public List Items { get; set; } +} + +public class ClaimItem : IDto +{ + public ClaimOrderLine OrderLine { get; set; } + public List ClaimItems { get; set; } +} + +public class ClaimOrderLine : IDto +{ + public int Id { get; set; } + public string ProductName { get; set; } + public string Barcode { get; set; } + public string MerchantSku { get; set; } + public string ProductColor { get; set; } + public string ProductSize { get; set; } + public double Price { get; set; } + public int VatBaseAmount { get; set; } + public int SalesCampaignId { get; set; } + public string ProductCategory { get; set; } +} + +public class ClaimItemItem : IDto +{ + 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 string Note { get; set; } + public string CustomerNote { get; set; } + public bool Resolved { get; set; } +} + +public class ClaimItemReason : IDto +{ + public int Id { get; set; } + public string Name { get; set; } + public int ExternalReasonId { get; set; } + public string Code { get; set; } +} + +public class ClaimItemStatus : IDto +{ + public string Name { get; set; } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs new file mode 100644 index 0000000..9d826e9 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/AddInvoiceLinkDto.cs @@ -0,0 +1,16 @@ +using Integration.Core; +namespace Integration.Marketplaces.Trendyol.Dtos.Invoice; +public class AddInvoiceLinkDto : IDto +{ + 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) + { + InvoiceLink = invoiceLink; + ShipmentPackageId = shipmentPackageId; + InvoiceDateTime = invoiceDateTime; + InvoiceNumber = invoiceNumber; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs new file mode 100644 index 0000000..0658076 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Invoice/DeleteInvoiceLinkDto.cs @@ -0,0 +1,15 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Dtos.Invoice; +public class DeleteInvoiceLinkDto : IDto +{ + public int ServiceSourceId { get; set; } + public int ChannelId { get; set; } + public int CustomerId { get; set; } + public DeleteInvoiceLinkDto(int serviceSourceId, int channelId, int customerId) + { + ServiceSourceId = serviceSourceId; + ChannelId = channelId; + CustomerId = customerId; + } +} \ 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 new file mode 100644 index 0000000..0d83077 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/GetShipmentPackagesDto.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..ea4d00f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiPackageByQuantityDto.cs @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000..b7f05ee --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitMultiShipmentPackageDto.cs @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..d9f6efa --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageByQuantityDto.cs @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..17452e2 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/SplitShipmentPackageDto.cs @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000..369bec6 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateBoxInfoDto.cs @@ -0,0 +1,12 @@ +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 new file mode 100644 index 0000000..132a4d3 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdatePackageDto.cs @@ -0,0 +1,39 @@ +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 new file mode 100644 index 0000000..2b2808f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Package/UpdateTrackingNumberDto.cs @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..60da3ae --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductCategoryAttributeDto.cs @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000..5c56276 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/AddProductDto.cs @@ -0,0 +1,92 @@ +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 new file mode 100644 index 0000000..a6ae8df --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/DeleteProductDto.cs @@ -0,0 +1,8 @@ +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/GetBatchRequestResultDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetBatchRequestResultDto.cs new file mode 100644 index 0000000..0733778 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetBatchRequestResultDto.cs @@ -0,0 +1,18 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Dtos.Product; +public class GetBatchRequestResultDto : IDto +{ + public string BatchRequestId { get; set; } + public List Items { get; set; } + public string Status { get; set; } + public long CreationDate { get; set; } + public long LastModification { get; set; } + public string SourceType { get; set; } + public int ItemCount { get; set; } +} + +public class GetBatchRequestResultItemDto +{ + public string Status { 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 new file mode 100644 index 0000000..0291851 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/GetProductsDto.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..559118d --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateProductDto.cs @@ -0,0 +1,46 @@ +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/Product/UpdateStockAndPriceDto.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateStockAndPriceDto.cs new file mode 100644 index 0000000..8dd5d15 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Product/UpdateStockAndPriceDto.cs @@ -0,0 +1,11 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Dtos.Product; + +public class UpdateStockAndPriceDto : IDto +{ + public string Barcode { get; set; } + public int Quantity { get; set; } + public double SalePrice { get; set; } + public double ListPrice { 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 new file mode 100644 index 0000000..de89123 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Dtos/Supplier/GetSupplierDto.cs @@ -0,0 +1,11 @@ +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/Exceptions/ClientApiAuthenticationException.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/ClientApiAuthenticationException.cs new file mode 100644 index 0000000..2baddde --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/ClientApiAuthenticationException.cs @@ -0,0 +1,7 @@ +namespace Integration.Marketplaces.Trendyol.Exceptions; +public class ClientApiAuthenticationException : Exception +{ + public ClientApiAuthenticationException(string message) : base(message) + { + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/TooManyClientsException.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/TooManyClientsException.cs new file mode 100644 index 0000000..5072563 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Exceptions/TooManyClientsException.cs @@ -0,0 +1,7 @@ +namespace Integration.Marketplaces.Trendyol.Exceptions; +public class TooManyClientsException : Exception +{ + public TooManyClientsException(string message) : base(message) + { + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimReasons.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimReasons.cs new file mode 100644 index 0000000..310857d --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimReasons.cs @@ -0,0 +1,58 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Constants; +public static class ClaimReasons +{ + public static List GetClaimReasons() + { + return new List + { + new ClaimReason(51, "Sebep Yok", "Trendyol"), + new ClaimReason(101, "Depo Kayıp", "Trendyol"), + new ClaimReason(151, "Çapraz Hatalı", "Trendyol"), + new ClaimReason(201, "Müşteri İade Kayıp", "Trendyol"), + new ClaimReason(251, "Modelini beğenmedim", "Müşteri"), + new ClaimReason(301, "Kusurlu ürün gönderildi", "Müşteri"), + new ClaimReason(351, "Yanlış ürün gönderildi", "Müşteri"), + new ClaimReason(401, "Vazgeçtim", "Müşteri"), + new ClaimReason(451, "Diğer", "Müşteri"), + new ClaimReason(501, "Bedeni küçük geldi", "Müşteri"), + new ClaimReason(551, "Bedeni büyük geldi", "Müşteri"), + new ClaimReason(651, "Ürün belirtilen özelliklere sahip değil", "Müşteri"), + new ClaimReason(701, "Yanlış sipariş verdim", "Müşteri"), + new ClaimReason(751, "Diğer - Fraud Kaynaklı", "Trendyol"), + new ClaimReason(1651, "Kalitesini beğenmedim", "Müşteri"), + new ClaimReason(1701, "Kargo Teslimatı Gecikmesi", "Trendyol"), + new ClaimReason(2000, "Cezalı Onay", "Trendyol"), + new ClaimReason(2001, "Cezasız Onay", "Trendyol"), + new ClaimReason(2002, "Teknik Servis Desteği Gerekiyor", "Trendyol"), + new ClaimReason(2003, "Kullanılmış Ürün Sebepli Red", "Trendyol"), + new ClaimReason(2004, "Hijyenik Sebepli Red", "Trendyol"), + new ClaimReason(2005, "Analiz sonucu üretimden kaynaklı sorun yok", "Trendyol"), + new ClaimReason(2006, "Analiz Değişim", "Trendyol"), + new ClaimReason(2007, "Analiz Tamirat", "Trendyol"), + new ClaimReason(2008, "Üründe adet/aksesuar eksiği", "Trendyol"), + new ClaimReason(2009, "Firmaya ait olmayan ürün", "Trendyol"), + new ClaimReason(2010, "Tekrar Sevk", "Trendyol"), + new ClaimReason(2011, "Satıcı Tarafından Aksiyona Çekilen", "Trendyol"), + new ClaimReason(2012, "İade Süresi Geçmiş", "Trendyol"), + new ClaimReason(2013, "Ürün Müşteride", "Trendyol"), + new ClaimReason(2014, "Analize Gönder", "Trendyol"), + new ClaimReason(2015, "Teslim edilemeyen gönderi", "Trendyol"), + new ClaimReason(2030, "Daha iyi bir fiyat mevcut", "Müşteri"), + + }; + } + + public static ClaimReason GetClaimReasonById(int id) => GetClaimReasons().First(x => x.Id == id); +} +public class ClaimReason +{ + public int Id { get; set; } + public string Description { get; set; } + public string Issuer { get; set; } + public ClaimReason(int id, string description, string issuer) + { + Id = id; + Description = description; + Issuer = issuer; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimStatus.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimStatus.cs new file mode 100644 index 0000000..8f9e6e0 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Constants/ClaimStatus.cs @@ -0,0 +1,10 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Constants; +public enum ClaimStatus +{ + Created, + WaitingInAction, + Unresolved, + ReturnRejected, + ReturnAccepted, + Cancelled +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Helpers/ClaimFilterBuilder.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Helpers/ClaimFilterBuilder.cs new file mode 100644 index 0000000..8fd9de0 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/Helpers/ClaimFilterBuilder.cs @@ -0,0 +1,56 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration.Helpers; +public class ClaimFilterBuilder +{ + private string _filterQuery; + public ClaimFilterBuilder() + { + _filterQuery = string.Empty; + } + + public ClaimFilterBuilder AddClaimIds(List claimIds) + { + _filterQuery += $"claimIds={string.Join(",", claimIds)}&"; + return this; + } + + public ClaimFilterBuilder AddClaimItemStatus(string status) + { + _filterQuery += $"claimItemStatus={status}&"; + return this; + } + + public ClaimFilterBuilder AddStartDate(long startDate) + { + _filterQuery += $"startDate={startDate}&"; + return this; + } + + public ClaimFilterBuilder AddEndDate(long endDate) + { + _filterQuery += $"endDate={endDate}&"; + return this; + } + + public ClaimFilterBuilder AddOrderNumber(string orderNumber) + { + _filterQuery += $"orderNumber={orderNumber}&"; + return this; + } + + public ClaimFilterBuilder AddSize(int size) + { + _filterQuery += $"size={size}&"; + return this; + } + + public ClaimFilterBuilder AddPage(int page) + { + _filterQuery += $"page={page}&"; + return this; + } + + public string Build() + { + return _filterQuery.Remove(_filterQuery.Length - 1); + } +} \ 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 new file mode 100644 index 0000000..0c53c73 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/ITrendyolClaimIntegration.cs @@ -0,0 +1,4 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration; +public interface ITrendyolClaimIntegration +{ +} \ 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 new file mode 100644 index 0000000..a22de3f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ClaimIntegration/TrendyolClaimIntegration.cs @@ -0,0 +1,28 @@ +using Integration.Core; +using Integration.Marketplaces.Trendyol.Dtos.Claim; +using Integration.Marketplaces.Trendyol.Infrastructure; +using Integration.Marketplaces.Trendyol.Infrastructure.ClaimIntegration; + +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"; + public TrendyolClaimIntegration(string supplierId, string apiKey, string apiSecret, bool isInProduction, string entegratorFirm) : base(supplierId, apiKey, apiSecret, isInProduction, entegratorFirm) + { + } + public async Task GetClaimsAsync(string filterQuery) + { + return await InvokeRequestAsync((client) => client.GetAsync(GetClaimsUrl() + filterQuery)); + } + + public async Task<> CreateClaimAsync(AddClaimDto addClaimDto) + { + return await InvokeRequestAsync<>((client, requestBody) => client.PostAsync(GetCreateClaimUrl(), requestBody), addClaimDto); + } + + public async Task<> ApproveClaimLineItemsAsync(string claimId) + { + return await InvokeRequestAsync<>((client) => client.PostAsync(GetApproveClaimLineItemUrl(claimId), )); + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/DeliveryOption.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/DeliveryOption.cs new file mode 100644 index 0000000..90a9f43 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/DeliveryOption.cs @@ -0,0 +1,7 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; +public enum DeliveryOption +{ + SameDayShipping, + TodayDelivery, + FastDelivery +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderDirection.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderDirection.cs new file mode 100644 index 0000000..b5f7706 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderDirection.cs @@ -0,0 +1,6 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; +public enum OrderByDirection +{ + ASC, + DESC +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderField.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderField.cs new file mode 100644 index 0000000..cbadeb8 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/OrderField.cs @@ -0,0 +1,5 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; +public enum OrderField +{ + PackageLastModifiedDate +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/PackageStatus.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/PackageStatus.cs new file mode 100644 index 0000000..5de1da0 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Constants/PackageStatus.cs @@ -0,0 +1,15 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; +public enum PackageStatus +{ + Created, + Picking, + Invoiced, + Shipped, + Cancelled, + Delivered, + UnDelivered, + Returned, + Repack, + UnPacked, + UnSupplied +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Helpers/ShipmentFilterBuilder.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Helpers/ShipmentFilterBuilder.cs new file mode 100644 index 0000000..c781a6a --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/Helpers/ShipmentFilterBuilder.cs @@ -0,0 +1,76 @@ +using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Constants; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration.Helpers; +public class ShipmentFilterBuilder +{ + private string _filterQuery; + public ShipmentFilterBuilder() + { + _filterQuery = string.Empty; + } + + public ShipmentFilterBuilder AddStartDate(long startDate) + { + _filterQuery += $"startDate={startDate}&"; + return this; + } + public ShipmentFilterBuilder AddEndDate(long endDate) + { + _filterQuery += $"endDate={endDate}&"; + return this; + } + + public ShipmentFilterBuilder AddPage(int page) + { + _filterQuery += $"page={page}&"; + return this; + } + + public ShipmentFilterBuilder AddSize(int size) + { + if (size > 200) + throw new Exception("Page must be less than 2500"); + _filterQuery += $"size={size}&"; + return this; + } + public ShipmentFilterBuilder AddSupplierId(long supplierId) + { + _filterQuery += $"supplierId={supplierId}&"; + return this; + } + + public ShipmentFilterBuilder AddOrderNumber(string orderNumber) + { + _filterQuery += $"orderNumber={orderNumber}&"; + return this; + } + + public ShipmentFilterBuilder AddStatus(PackageStatus status) + { + _filterQuery += $"status={status}&"; + return this; + } + + public ShipmentFilterBuilder AddOrderByField(OrderField orderByField) + { + _filterQuery += $"orderByField={orderByField}&"; + return this; + } + + public ShipmentFilterBuilder AddOrderByDirection(OrderByDirection orderByDirection) + { + _filterQuery += $"orderByDirection={orderByDirection}&"; + return this; + } + + public ShipmentFilterBuilder AddShipmentPackageIds(List shipmentPackageIds) + { + _filterQuery += $"shipmentPackageIds={string.Join(",", shipmentPackageIds)}&"; + return this; + } + + public string Build() + { + return _filterQuery.Remove(_filterQuery.Length - 1); + } +} \ 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 new file mode 100644 index 0000000..877509f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/ITrendyolPackageIntegration.cs @@ -0,0 +1,17 @@ +using Integration.Marketplaces.Trendyol.Dtos.Invoice; +using Integration.Marketplaces.Trendyol.Dtos.Package; +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); +} \ 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 new file mode 100644 index 0000000..d4a5b52 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/PackageIntegration/TrendyolPackageIntegration.cs @@ -0,0 +1,89 @@ +using Integration.Core; +using Integration.Marketplaces.Trendyol.Dtos.Invoice; +using Integration.Marketplaces.Trendyol.Dtos.Package; +using Integration.Marketplaces.Trendyol.Infrastructure.OrderIntegration; + +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"; + public TrendyolPackageIntegration(string supplierId, string apiKey, string apiSecret, bool isInProduction, string entegratorFirm) : base(supplierId, apiKey, apiSecret, isInProduction, entegratorFirm) + { + } + + public async Task GetShipmentPackagesAsync(string filterQuery) + { + return await InvokeRequestAsync((client) => client.GetAsync(GetShipmentPackagesUrl() + filterQuery)); + } + + public async Task UpdateTrackingNumberAsync(long shipmentPackageId, UpdateTrackingNumberDto updateTrackingNumberDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdateTrackingNumberUrl(shipmentPackageId), requestBody), updateTrackingNumberDto); + + return true; + } + + public async Task UpdatePackageAsync(long shipmentPackageId, UpdatePackageDto updatePackageDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdatePackageUrl(shipmentPackageId), requestBody), updatePackageDto); + + return true; + } + + public async Task SendInvoiceLinkAsync(AddInvoiceLinkDto addInvoiceLinkDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetAddInvoiceLinkUrl(), requestBody), addInvoiceLinkDto); + + return true; + } + + public async Task DeleteInvoiceLinkAsync(DeleteInvoiceLinkDto deleteInvoiceLinkDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetDeleteInvoiceLinkUrl(), requestBody), deleteInvoiceLinkDto); + + return true; + } + + public async Task SplitMultiPackageByQuantityAsync(long shipmentPackageId, SplitMultiPackageByQuantityDto splitMultiPackageByQuantityDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitMultiPackageByQuantityUrl(shipmentPackageId), requestBody), splitMultiPackageByQuantityDto); + + return true; + } + public async Task SplitMultiShipmentPackageAsync(long shipmentPackageId, SplitMultiShipmentPackageDto splitMultiShipmentPackageDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitMultiShipmentPackageUrl(shipmentPackageId), requestBody), splitMultiShipmentPackageDto); + + return true; + } + + public async Task SplitShipmentPackageAsync(long shipmentPackageId, SplitShipmentPackageDto splitShipmentPackageDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitShipmentPackageUrl(shipmentPackageId), requestBody), splitShipmentPackageDto); + + return true; + } + + public async Task SplitShipmentPackageByQuantityAsync(long shipmentPackageId, SplitShipmentPackageByQuantityDto splitShipmentPackageByQuantityDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetSplitShipmentPackageByQuantityUrl(shipmentPackageId), requestBody), splitShipmentPackageByQuantityDto); + + return true; + } + + public async Task UpdateBoxInfoAsync(long shipmentPackageId, UpdateBoxInfoDto updateBoxInfoDto) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetUpdateBoxInfoUrl(shipmentPackageId), requestBody), updateBoxInfoDto); + + return true; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs new file mode 100644 index 0000000..ea3b3bd --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Constants/Providers.cs @@ -0,0 +1,34 @@ +using Integration.Marketplaces.Trendyol.Models.Provider; + +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Constants; +public static class Providers +{ + public static List GetProviders() + { + 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") + }; + } + + 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); +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Helpers/ProductFilterBuilder.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Helpers/ProductFilterBuilder.cs new file mode 100644 index 0000000..a6046b4 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/Helpers/ProductFilterBuilder.cs @@ -0,0 +1,107 @@ +namespace Integration.Marketplaces.Trendyol.Infrastructure.ProductIntegration.Helpers; +public class ProductFilterBuilder +{ + private string _filterQuery; + public ProductFilterBuilder() + { + _filterQuery = string.Empty; + } + + public ProductFilterBuilder AddApprovalStatus(bool status) + { + _filterQuery += $"approvalStatus={status}&"; + return this; + } + + public ProductFilterBuilder AddBarcode(string barcode) + { + _filterQuery += $"barcode={barcode}&"; + return this; + } + + public ProductFilterBuilder AddStartDate(long startDate) + { + _filterQuery += $"startDate={startDate}&"; + return this; + } + + public ProductFilterBuilder AddEndDate(long endDate) + { + _filterQuery += $"endDate={endDate}&"; + return this; + } + + public ProductFilterBuilder AddPage(int page) + { + if (page > 2500) + throw new Exception("Page must be less than 2500"); + _filterQuery += $"page={page}&"; + return this; + } + + public ProductFilterBuilder AddSize(string dateQueryType) + { + _filterQuery += $"dateQueryType={dateQueryType}&"; + return this; + } + + + public ProductFilterBuilder AddSize(int size) + { + _filterQuery += $"size={size}&"; + return this; + } + + public ProductFilterBuilder AddSupplierId(long supplierId) + { + _filterQuery += $"supplierId={supplierId}&"; + return this; + } + + public ProductFilterBuilder AddStockCode(string stockCode) + { + _filterQuery += $"stockCode={stockCode}&"; + return this; + } + + public ProductFilterBuilder AddArchived(bool archived) + { + _filterQuery += $"archived={archived}&"; + return this; + } + + public ProductFilterBuilder AddProductMainId(string productMainId) + { + _filterQuery += $"productMainId={productMainId}&"; + return this; + } + + public ProductFilterBuilder AddOnSale(bool onSale) + { + _filterQuery += $"onSale={onSale}&"; + return this; + } + + public ProductFilterBuilder AddRejected(bool rejected) + { + _filterQuery += $"rejected={rejected}&"; + return this; + } + + public ProductFilterBuilder AddBlacklisted(bool blacklisted) + { + _filterQuery += $"blacklisted={blacklisted}&"; + return this; + } + + public ProductFilterBuilder AddBrandIds(List brandIds) + { + _filterQuery += $"brandIds={string.Join(",", brandIds)}&"; + return this; + } + + public string Build() + { + return _filterQuery.Remove(_filterQuery.Length - 1); + } +} \ 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 new file mode 100644 index 0000000..ac301ad --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/ITrendyolProductIntegration.cs @@ -0,0 +1,24 @@ +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.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); +} \ 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 new file mode 100644 index 0000000..d67cb23 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/ProductIntegration/TrendyolProductIntegration.cs @@ -0,0 +1,89 @@ +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.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"; + public TrendyolProductIntegration(string supplierId, string apiKey, string apiSecret, bool isInProduction, string entegratorFirm) : base(supplierId, apiKey, apiSecret, isInProduction, entegratorFirm) + { + } + + public async Task CreateProductsV2Async(BulkDto products) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetCreateProducsUrl(), requestBody), products); + + return true; + } + + public async Task DeleteProductsAsync(BulkDto products) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PostAsync(GetDeleteProductUrl(), requestBody), products); + + return true; + } + + public async Task FilterProductsAsync(string filterQuery) + { + return await InvokeRequestAsync((client) => client.GetAsync(GetFilterProductsUrl() + filterQuery)); + } + + public async Task GetBatchRequestResultAsync(string batchRequestId) + { + return await InvokeRequestAsync((client) => client.GetAsync(GetBatchRequestResultUrl(batchRequestId))); + } + + public async Task?> GetBrandsAsync() + { + return await InvokeRequestAsync>((client) => client.GetAsync(GetBrandsUrl())); + } + + public async Task GetCategoryAttributes(int categoryId) + { + return await InvokeRequestAsync((client) => client.GetAsync(GetCategoryAttributesUrl(categoryId))); + } + + public async Task?> GetCategoryTreeAsync() + { + return await InvokeRequestAsync>((client) => client.GetAsync(GetCategoryTreeUrl())); + } + + public List GetProviders() + { + return Providers.GetProviders(); + } + + public async Task?> GetSuppliersAddressesAsync() + { + return await InvokeRequestAsync>((client) => client.GetAsync(GetSupplierAddressUrl())); + } + + public async Task UpdatePriceAndInventoryAsync(BulkDto products) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdatePriceAndStockUrl(), requestBody), products); + + return true; + } + + public async Task UpdateProductAsync(BulkDto products) + { + var response = await InvokeRequestAsync((client, requestBody) => client.PutAsync(GetUpdateProductUrl(), requestBody), products); + + return true; + } +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/TrendyolIntegration.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/TrendyolIntegration.cs new file mode 100644 index 0000000..c59c967 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Infrastructure/TrendyolIntegration.cs @@ -0,0 +1,24 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Infrastructure; +public class TrendyolIntegrationBase : IntegrationBase +{ + public const string ProdBaseUrl = "https://api.trendyol.com/sapigw/"; + public const string StageBaseUrl = "https://stageapi.trendyol.com/stagesapigw/"; + protected readonly string _supplierId; + protected readonly string _apiKey; + protected readonly string _apiSecret; + protected readonly string _entegratorFirm; + protected readonly bool _isInProduction; + + public TrendyolIntegrationBase(string supplierId, string apiKey, string apiSecret, bool isInProduction = true, string entegratorFirm = "SelfIntegration") + { + _supplierId = supplierId ?? throw new ArgumentNullException(nameof(supplierId)); + _apiKey = apiKey ?? throw new ArgumentNullException(nameof(apiKey)); + _apiSecret = apiSecret ?? throw new ArgumentNullException(nameof(apiSecret)); + _isInProduction = isInProduction; + _entegratorFirm = entegratorFirm; + } + + public string GetBaseUrl() => _isInProduction ? ProdBaseUrl : StageBaseUrl; +} \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj b/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj new file mode 100644 index 0000000..5b6056d --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Integration.Marketplaces.Trendyol.csproj @@ -0,0 +1,17 @@ + + + + + + + + net8.0 + enable + enable + Integration.Marketplaces.Trendyol.12.12.23 + 1.0.0 + onurkanbakirci + onurkanbakirci + + + \ No newline at end of file diff --git a/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs new file mode 100644 index 0000000..558a341 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/InvoiceAddress.cs @@ -0,0 +1,24 @@ +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 new file mode 100644 index 0000000..c877f52 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Address/ShipmentAddress.cs @@ -0,0 +1,23 @@ +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 new file mode 100644 index 0000000..4d0572d --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Brand/Brand.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..090ba8e --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/Category.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..476c373 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttribute.cs @@ -0,0 +1,14 @@ +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 new file mode 100644 index 0000000..9477442 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Category/CategoryAttributeValue.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..bdbb2a5 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/Package.cs @@ -0,0 +1,50 @@ +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 new file mode 100644 index 0000000..dd28b3f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageDiscountDetail.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..3e68f4e --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageFastDeliveryOption.cs @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000..0b115b8 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageHistory.cs @@ -0,0 +1,8 @@ +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 new file mode 100644 index 0000000..327e9f7 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Package/PackageLine.cs @@ -0,0 +1,26 @@ +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/Product.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/Product.cs new file mode 100644 index 0000000..bd45552 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/Product.cs @@ -0,0 +1,43 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Models.Product; +public class Product : IModel +{ + public string Id { get; set; } + public bool Approved { get; set; } + public bool Archived { get; set; } + public int ProductCode { get; set; } + public string BatchRequestId { get; set; } + public int SupplierId { get; set; } + public long CreateDateTime { get; set; } + public long LastUpdateDate { get; set; } + public string Gender { get; set; } + public string Brand { get; set; } + public string Barcode { get; set; } + public string Title { get; set; } + public string CategoryName { get; set; } + public string ProductMainId { get; set; } + public string Description { get; set; } + public string StockUnitType { get; set; } + public int Quantity { get; set; } + public double ListPrice { get; set; } + public double SalePrice { get; set; } + 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 string PlatformListingId { get; set; } + public string StockId { get; set; } + public bool HasActiveCampaign { get; set; } + public bool Locked { get; set; } + public int ProductContentId { get; set; } + public int PimCategoryId { get; set; } + public int BrandId { get; set; } + public int Version { get; set; } + public string Color { get; set; } + public string Size { get; set; } + public bool LockedByUnSuppliedReason { get; set; } + public bool Onsale { 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 new file mode 100644 index 0000000..5d9dcc4 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductCategoryAttribute.cs @@ -0,0 +1,9 @@ +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 new file mode 100644 index 0000000..9956dbe --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductDeliveryOption.cs @@ -0,0 +1,13 @@ +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 new file mode 100644 index 0000000..d3dd849 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Product/ProductImage.cs @@ -0,0 +1,12 @@ +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/Provider/Provider.cs b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Provider/Provider.cs new file mode 100644 index 0000000..c62cf5f --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Provider/Provider.cs @@ -0,0 +1,17 @@ +using Integration.Core; + +namespace Integration.Marketplaces.Trendyol.Models.Provider; +public class Provider : IModel +{ + 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) + { + Id = id; + Code = code; + Name = name; + TaxNumber = taxNumber; + } +} \ 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 new file mode 100644 index 0000000..bec2592 --- /dev/null +++ b/src/Marketplaces/Integration.Marketplaces.Trendyol/Models/Supplier/SupplierAddress.cs @@ -0,0 +1,33 @@ +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