Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
dist

dotnet/**/bin
dotnet/**/obj
22 changes: 22 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Repository Purpose

This repository contains a TypeScript implementation of the AliExpress SDK and its .NET port. It serves as a blueprint and reference for building AliExpress integrations in different ecosystems.

# Development Guidelines

- Ensure that every change builds and tests the .NET solution.
- Run `dotnet build` and `dotnet test` before committing.
- After making changes, add or update unit tests to maintain and improve coverage over time.

## NopCommerce Plugin Implementation Plan
- [ ] Review the provided documentation on writing NopCommerce plugins and the Visual Studio template structure to capture required conventions and extension points.
- [ ] Define the plugin's high-level architecture, including catalog synchronization flow, AliExpress API integration touchpoints, configuration settings, and background tasks.
- [ ] Scaffold a new plugin project in a dedicated root-level folder using the official template as a baseline, adapting namespaces and project metadata for AliExpress drop shipping.
- [ ] Integrate the existing AliExpress SDK into the plugin solution, establishing service abstractions for product search, catalog import, and order fulfillment.
- [ ] Implement catalog import features, including UI components for searching AliExpress products, mapping product data, and persisting selections into the NopCommerce catalog.
- [ ] Implement drop-shipping order automation, handling order placement to AliExpress, tracking statuses, and synchronizing fulfillment updates back to NopCommerce.
- [ ] Add administrative configuration pages, localization resources, and permission management required for managing the plugin within NopCommerce.
- [ ] Create automated tests, sample configuration instructions, and deployment documentation to validate and support the plugin.

Next item to action: Review the documentation resources above and mark the first step as completed once finished.

41 changes: 41 additions & 0 deletions AliExpressDotnetSdk.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

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}") = "dotnet", "dotnet", "{1CA53CC0-F2D2-4468-82AB-2C4BEB1B9224}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliExpressSdk", "dotnet\AliExpressSdk\AliExpressSdk.csproj", "{BA27C6F7-3935-43A5-8EDB-F26F43ED0A2C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliExpressSdk.Tests", "dotnet\AliExpressSdk.Tests\AliExpressSdk.Tests.csproj", "{5C6E9E68-3619-4C76-A976-6A6BB38BC4F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliExpressSdk.ConsoleHarness", "dotnet\AliExpressSdk.ConsoleHarness\AliExpressSdk.ConsoleHarness.csproj", "{DB6E8D4D-D753-435F-9B6D-9783966C9F3C}"
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
{BA27C6F7-3935-43A5-8EDB-F26F43ED0A2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA27C6F7-3935-43A5-8EDB-F26F43ED0A2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA27C6F7-3935-43A5-8EDB-F26F43ED0A2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA27C6F7-3935-43A5-8EDB-F26F43ED0A2C}.Release|Any CPU.Build.0 = Release|Any CPU
{5C6E9E68-3619-4C76-A976-6A6BB38BC4F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C6E9E68-3619-4C76-A976-6A6BB38BC4F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C6E9E68-3619-4C76-A976-6A6BB38BC4F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C6E9E68-3619-4C76-A976-6A6BB38BC4F2}.Release|Any CPU.Build.0 = Release|Any CPU
{DB6E8D4D-D753-435F-9B6D-9783966C9F3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DB6E8D4D-D753-435F-9B6D-9783966C9F3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB6E8D4D-D753-435F-9B6D-9783966C9F3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB6E8D4D-D753-435F-9B6D-9783966C9F3C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BA27C6F7-3935-43A5-8EDB-F26F43ED0A2C} = {1CA53CC0-F2D2-4468-82AB-2C4BEB1B9224}
{5C6E9E68-3619-4C76-A976-6A6BB38BC4F2} = {1CA53CC0-F2D2-4468-82AB-2C4BEB1B9224}
{DB6E8D4D-D753-435F-9B6D-9783966C9F3C} = {1CA53CC0-F2D2-4468-82AB-2C4BEB1B9224}
EndGlobalSection
EndGlobal
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AliExpress SDK ![npm version](https://img.shields.io/npm/v/ae_sdk?label=)
# AliExpress SDK (.NET Port) ![npm version](https://img.shields.io/npm/v/ae_sdk?label=)

![Typescript](https://img.shields.io/badge/-TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white)
![CI](https://img.shields.io/github/actions/workflow/status/moh3a/ae_sdk/main.yml?logo=githubactions&logoColor=white&label=CI)
Expand All @@ -9,11 +9,24 @@

A simple, lightweight, and fully type-safe SDK for the AliExpress Open Platform APIs. Supports System Authentication, Dropshipping, and Affiliate APIs.

This repository contains the original TypeScript implementation published to npm **and** a .NET 8 port that mirrors the same API surface for C# developers. Both implementations share the same intent: provide a pragmatic, well-tested toolkit for working with the AliExpress Open Platform.

## 🧱 Project Structure

| Folder | Description |
| ------ | ----------- |
| `src/` | TypeScript source for the npm package. |
| `dotnet/AliExpressSdk` | Core .NET SDK that ports the TypeScript features to C#. |
| `dotnet/AliExpressSdk.Tests` | xUnit test suite with Coverlet coverage collection. |
| `dotnet/AliExpressSdk.ConsoleHarness` | Console-based harness for manual and integration testing against live AliExpress APIs. |

The solution file `AliExpressDotnetSdk.sln` ties the .NET projects together for local development, automated tests, and packaging.

## 📖 Overview

AliExpress has completely migrated their services from the legacy [Taobao Open Platform](https://developers.aliexpress.com) to the new [Open Platform for International Developers](https://openservice.aliexpress.com). While this update brought significant improvements, [they have yet to release an official Node.js SDK](https://openservice.aliexpress.com/doc/doc.htm?nodeId=27493&docId=118729#/?docId=1371) for the new platform.

This unofficial SDK bridges that gap by providing a simple, consistent interface for Node.js developers to interact with AliExpress APIs.
This unofficial SDK bridges that gap by providing a simple, consistent interface for Node.js developers **and** a faithful .NET port so that teams can choose whichever stack best suits their integration requirements.

## ✨ Features

Expand Down Expand Up @@ -138,6 +151,35 @@ All API methods return a consistent response structure:
}
```

## 🧪 .NET Integration Harness

Use the console harness to exercise live API calls without having to write a bespoke application. The harness reads credentials from environment variables and accepts request parameters via command-line arguments or a JSON payload file.

```bash
export AE_APP_KEY="your_app_key"
export AE_APP_SECRET="your_app_secret"
export AE_SESSION="active_session_token"

dotnet run --project dotnet/AliExpressSdk.ConsoleHarness /auth/token/refresh refresh_token=xxxx
# or supply a payload file
dotnet run --project dotnet/AliExpressSdk.ConsoleHarness /auth/token/security/create --payload payload.json
```

Arguments passed as `key=value` are converted into request parameters. When `--payload` is supplied, the harness expects a JSON object whose properties are merged into the request.

## 🛠️ Build, Test, and Packaging

- `dotnet build AliExpressDotnetSdk.sln` builds the .NET port.
- `dotnet test AliExpressDotnetSdk.sln --collect "XPlat Code Coverage"` executes the xUnit suite and collects coverage.
- `dotnet pack dotnet/AliExpressSdk/AliExpressSdk.csproj -c Release` produces a NuGet package locally.

For automated builds, the repository includes Azure DevOps pipeline definitions:

| File | Purpose |
| ---- | ------- |
| `azure-pipelines.yml` | Restores, builds, tests, and packs the SDK, then publishes the NuGet package to the build artifact staging directory. |
| `azure-pipelines-coverage.yml` | Runs the test suite with default coverage settings and publishes both the test results and Cobertura coverage report. |

## 📚 API Examples

### System Client
Expand Down
39 changes: 39 additions & 0 deletions azure-pipelines-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
trigger: none

pool:
vmImage: 'windows-latest'

variables:
buildConfiguration: 'Debug'
dotnetSdkVersion: '8.0.x'
solution: 'AliExpressDotnetSdk.sln'

steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: '$(dotnetSdkVersion)'

- script: dotnet restore $(solution)
displayName: 'Restore solution'

- script: dotnet test $(solution) --configuration $(buildConfiguration) --logger "trx;LogFileName=TestResults.trx" --collect "XPlat Code Coverage"
displayName: 'Run tests with coverage'

- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/TestResults.trx'
searchFolder: '$(System.DefaultWorkingDirectory)'
testRunTitle: 'Coverage Tests'
failTaskOnFailedTests: true

- task: PublishCodeCoverageResults@1
displayName: 'Publish coverage report'
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.cobertura.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)'
failIfCoverageEmpty: true
47 changes: 47 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
trigger:
- main

pool:
vmImage: 'windows-latest'

variables:
buildConfiguration: 'Release'
dotnetSdkVersion: '8.0.x'
packageProject: 'dotnet/AliExpressSdk/AliExpressSdk.csproj'
solution: 'AliExpressDotnetSdk.sln'
artifactName: 'nuget-package'

steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: '$(dotnetSdkVersion)'

- script: dotnet restore $(solution)
displayName: 'Restore solution'

- script: dotnet build $(solution) --configuration $(buildConfiguration) --no-restore
displayName: 'Build solution'

- script: dotnet test $(solution) --configuration $(buildConfiguration) --no-build --logger "trx;LogFileName=TestResults.trx"
displayName: 'Run tests'

- task: PublishTestResults@2
displayName: 'Publish test results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/TestResults.trx'
searchFolder: '$(System.DefaultWorkingDirectory)'
testRunTitle: 'Unit Tests'
failTaskOnFailedTests: true

- script: dotnet pack $(packageProject) --configuration $(buildConfiguration) --no-build --output $(Build.ArtifactStagingDirectory)/nuget
displayName: 'Pack NuGet package'

- task: PublishBuildArtifacts@1
displayName: 'Publish NuGet package artifact'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget'
ArtifactName: '$(artifactName)'
publishLocation: 'Container'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AliExpressSdk\AliExpressSdk.csproj" />
</ItemGroup>

</Project>
Loading