Skip to content

Commit

Permalink
Merge pull request #9 from appinlet/release/4.5.0
Browse files Browse the repository at this point in the history
Nop 4.5
  • Loading branch information
appinlet authored May 6, 2022
2 parents 32d99ba + 917e808 commit 15c626d
Show file tree
Hide file tree
Showing 30 changed files with 10,816 additions and 2 deletions.
Binary file not shown.
6 changes: 6 additions & 0 deletions Nop4.5/Nop.Plugin.Payments.PayGate/.vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using Nop.Web.Framework.Components;

namespace Nop.Plugin.Payments.PayGate.Components
{
[ViewComponent(Name = "PaymentPayGate")]
public class PaymentPayGateViewComponent : NopViewComponent
{
public IViewComponentResult Invoke()
{
return View("~/Plugins/Payments.PayGate/Views/PaymentInfo.cshtml");
}
}
}
4 changes: 4 additions & 0 deletions Nop4.5/Nop.Plugin.Payments.PayGate/Content/PayGate.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
form i.fa::before
{
position: static !important;
}

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions Nop4.5/Nop.Plugin.Payments.PayGate/Models/ConfigurationModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Nop.Web.Framework.Models;
using Nop.Web.Framework.Mvc.ModelBinding;

namespace Nop.Plugin.Payments.PayGate.Models
{
public record ConfigurationModel : BaseNopModel
{
public int ActiveStoreScopeConfiguration { get; set; }

[NopResourceDisplayName("Plugins.Payments.PayGate.Fields.TestMode")]
public bool TestMode { get; set; }
public bool TestMode_OverrideForStore { get; set; }

[NopResourceDisplayName("Plugins.Payments.PayGate.Fields.PayGateID")]
public string PayGateID { get; set; }
public bool PayGateID_OverrideForStore { get; set; }

[NopResourceDisplayName("Plugins.Payments.PayGate.Fields.EncryptionKey")]
public string EncryptionKey { get; set; }
public bool EncryptionKey_OverrideForStore { get; set; }

[NopResourceDisplayName("Plugins.Payments.PayGate.Fields.EnableIpn")]
public bool EnableIpn { get; set; }
public bool EnableIpn_OverrideForStore { get; set; }

[NopResourceDisplayName("Plugins.Payments.PayGate.Fields.EnableRedirect")]
public bool EnableRedirect { get; set; }
public bool EnableRedirect_OverrideForStore { get; set; }

[NopResourceDisplayName("Plugins.Payments.PayGate.Fields.UseSSL")]
public bool UseSSL { get; set; }
public bool UseSSL_OverrideForStore { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Copyright>Copyright © PayGate (Pty) Ltd</Copyright>
<Company>PayGate (Pty) Ltd</Company>
<Authors>App Inlet (Pty) Ltd</Authors>
<Version>4.50</Version>
<Description>This plugin allows paying with PayWeb v3</Description>
<PackageLicenseUrl>
</PackageLicenseUrl>
<PackageProjectUrl>https://www.paygate.co.za/</PackageProjectUrl>
<RepositoryUrl>https://developer.paygate.co.za/product/74</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
</PropertyGroup>
<ItemGroup>
<None Remove="Content\PayGate.css" />
<None Remove="logo.jpg" />
<None Remove="plugin.json" />
<None Remove="Views\Configure.cshtml" />
<None Remove="Views\PaymentInfo.cshtml" />
<None Remove="Views\_ViewImports.cshtml" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\Presentation\Nop.Web\Plugins\Payments.PayGate</OutputPath>
<OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\Presentation\Nop.Web\Plugins\Payments.PayGate\</OutputPath>
<OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
<ItemGroup>
<Content Include="Content\PayGate.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="logo.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Views\Configure.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Views\PaymentInfo.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Views\_ViewImports.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
</ItemGroup>
<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>
29 changes: 29 additions & 0 deletions Nop4.5/Nop.Plugin.Payments.PayGate/Notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Important points when developing plugins


- All views (cshtml files) and web.config file should have "Build action" set to "Content" and "Copy to output directory" set to "Copy if newer"

- When you develop a new plugin from scratch, and when a new class library is added to the solution, open its .csproj file (a main project file) in any text editor and replace its content with the following one

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\Presentation\Nop.Web\Plugins\PLUGIN_OUTPUT_DIRECTORY</OutputPath>
<OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\Presentation\Nop.Web\Plugins\PLUGIN_OUTPUT_DIRECTORY</OutputPath>
<OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="$(MSBuildProjectDirectory)\..\..\Build\ClearPluginAssemblies.proj" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
</Target>
</Project>

Replace “PLUGIN_OUTPUT_DIRECTORY” in the code above with your real plugin output directory name.

It’s not required. But this way we can use a new ASP.NET approach to add third-party references. It was introduced in .NET Core. Furthermore, references from already referenced libraries will be loaded automatically. It’s very convenient.
45 changes: 45 additions & 0 deletions Nop4.5/Nop.Plugin.Payments.PayGate/PayGateHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Text;
using Nop.Core.Domain.Payments;

namespace Nop.Plugin.Payments.PayGate
{
/// <summary>
/// Represents pagate helper
/// </summary>
public class PayGateHelper
{
/// <summary>
/// Gets a payment status
/// </summary>
/// <param name="paymentStatus">PayGate payment status</param>
/// <param name="pendingReason">PayGate pending reason</param>
/// <returns>Payment status</returns>
public static PaymentStatus GetPaymentStatus(string paymentStatus, string pendingReason)
{
var result = PaymentStatus.Pending;

return result;
}

public string CalculateMD5Hash(string input)
{

System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();

byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);

byte[] hash = md5.ComputeHash(inputBytes);

// step 2, convert byte array to hex string

StringBuilder sb = new StringBuilder();

for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();

}
}
}
Loading

0 comments on commit 15c626d

Please sign in to comment.