Skip to content

Commit

Permalink
Merge pull request #37 from skuvault-integrations/GUARD-2824-Magento-…
Browse files Browse the repository at this point in the history
…API-Relative-Path

GUARD-2824 Magento API Relative Path
  • Loading branch information
maxim-saltanov-skuvault authored Mar 30, 2023
2 parents 7850dc6 + 1b42297 commit a04e4d2
Show file tree
Hide file tree
Showing 64 changed files with 816 additions and 1,490 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ src/packages/
src/.vs
[Rr]elease*/
_ReSharper*/
.idea/
_dotCover*/
_dotMemory*/
_dotTrace*/
Expand Down
2 changes: 1 addition & 1 deletion src/Global/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@

// 2.9.0.0 - magento 2 supported, 9 build, 0 subversion (includes significant features and codechanges)

[ assembly : AssemblyVersion( "2.18.5.0" ) ]
[ assembly : AssemblyVersion( "2.19.0.0" ) ]
32 changes: 32 additions & 0 deletions src/MagentoAccess/ExceptionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Net;

namespace MagentoAccess
{
/// <summary>
/// Contains extensions provided methods for definitions of specific types of errors
/// </summary>
internal static class ExceptionExtensions
{
/// <summary>
/// Checks whether an exception is a Magento redirect-specific exception.
/// </summary>
/// <param name="exception"></param>
/// <returns></returns>
public static bool IsMagentoPermanentRedirectException( this Exception exception )
{
return exception is PermanentRedirectException || exception?.InnerException is PermanentRedirectException;
}

/// <summary>
/// Checks whether an exception is a http 308 redirect-specific exception.
/// </summary>
/// <param name="exception"></param>
/// <returns></returns>
public static bool IsHttp308PermanentRedirectException( this Exception exception )
{
return exception?.InnerException is WebException
&& ( int )( ( HttpWebResponse )( ( WebException )exception.InnerException ).Response ).StatusCode == 308;
}
}
}
18 changes: 8 additions & 10 deletions src/MagentoAccess/IMagentoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MagentoAccess.Misc;
using MagentoAccess.Models.CreateOrders;
using MagentoAccess.Models.CreateProducts;
using MagentoAccess.Models.DeleteProducts;
Expand Down Expand Up @@ -39,21 +38,20 @@ public interface IMagentoService

Task< IEnumerable< Product > > FillProductsDetailsAsync( IEnumerable< Product > products, CancellationToken token, Mark mark = null );

Task< IEnumerable< PingSoapInfo > > DetermineMagentoVersionAsync( CancellationToken token, Mark mark = null );

MagentoService.SaveAccessToken AfterGettingToken { get; set; }

Func< string > AdditionalLogInfo { get; set; }

Task< PingSoapInfo > DetermineMagentoVersionAndSetupServiceAsync( CancellationToken token, Mark mark = null );
Task< IEnumerable< PingSoapInfo > > DetermineMagentoVersionAsync( Mark mark, CancellationToken token );
Task< PingSoapInfo > DetermineMagentoVersionAndSetupServiceAsync( Mark mark, CancellationToken token );

Task< bool > InitAsync( bool supressExc = false );
Task InitAsync( bool suppressException = false );

bool IsRestAPIUsed { get; set; }

/// <summary>
/// This property can be used by the client to monitor the last access library's network activity time.
/// </summary>
DateTime LastActivityTime { get; }

/// <summary>
/// This property can be used by the client to monitor the last access library's network activity time.
/// </summary>
DateTime LastActivityTime { get; }
}
}
15 changes: 8 additions & 7 deletions src/MagentoAccess/MagentoAccess.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<Compile Include="..\Global\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ExceptionExtensions.cs" />
<Compile Include="Misc\Cache.cs" />
<Compile Include="Misc\ICreateCallInfoExtensions.cs" />
<Compile Include="Misc\MagentoStoreVersion.cs" />
Expand Down Expand Up @@ -242,7 +243,6 @@
<Compile Include="Services\Rest\v2x\MagentoServiceLowLevel_Orders.cs" />
<Compile Include="Services\Rest\v2x\MagentoServiceLowLevel.cs" />
<Compile Include="Services\Rest\v2x\MagentoServiceLowLevelSoap_v_2_1_0_0_ce_Factory.cs" />
<Compile Include="Services\Rest\v2x\Repository\ActionPolicies.cs" />
<Compile Include="Services\Rest\v2x\Repository\BaseRepository.cs" />
<Compile Include="Services\Rest\v2x\Repository\ISalesOrderRepositoryV1.cs" />
<Compile Include="Services\Rest\v2x\Repository\IIntegrationAdminTokenRepository.cs" />
Expand Down Expand Up @@ -301,6 +301,7 @@
<Compile Include="Services\Soap\IMagentoServiceLowLevelSoap.cs" />
<Compile Include="Services\Soap\IMagentoServiceLowLevelSoapFactory.cs" />
<Compile Include="Services\Soap\CustomBehavior.cs" />
<Compile Include="Services\Soap\MagentoServiceLowLevelSoapBase.cs" />
<Compile Include="Services\Soap\MagentoServiceLowLevelSoapCustomMessageEncoder.cs" />
<Compile Include="Services\Soap\MagentoServiceLowLevelSoapParametrisedFactory.cs" />
<Compile Include="Services\Soap\StatusChecker.cs" />
Expand Down Expand Up @@ -2707,11 +2708,11 @@
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
6 changes: 6 additions & 0 deletions src/MagentoAccess/MagentoException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,10 @@ public MagentoCommonException( string message, Exception exception, [ CallerMemb
{
}
}

/// <summary>
/// Magento access library redirect-specific exception
/// This exception indicates that the resource requested has been moved or not exist
/// </summary>
public sealed class PermanentRedirectException : Exception { }
}
Loading

0 comments on commit a04e4d2

Please sign in to comment.