Skip to content

Commit

Permalink
Migração para versão 4.00 do nop
Browse files Browse the repository at this point in the history
  • Loading branch information
rdakar committed Jul 24, 2018
1 parent c74105b commit 4da05bd
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 393 deletions.
14 changes: 14 additions & 0 deletions Components/PaymentPayUViewComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using Nop.Web.Framework.Components;

namespace NopBrasil.Plugin.Payments.PayU.Components
{
[ViewComponent(Name = "PaymentPayU")]
public class PaymentPayUViewComponent : NopViewComponent
{
public IViewComponentResult Invoke()
{
return View("~/Plugins/Payments.PayU/Views/PaymentInfo.cshtml");
}
}
}
52 changes: 24 additions & 28 deletions Controllers/PaymentPayUController.cs
Original file line number Diff line number Diff line change
@@ -1,58 +1,54 @@
using Nop.Core;
using Nop.Services.Configuration;
using Nop.Services.Payments;
using Nop.Services.Configuration;
using Nop.Web.Framework.Controllers;
using System.Collections.Generic;
using System.Web.Mvc;
using NopBrasil.Plugin.Payments.PayU.Services;
using NopBrasil.Plugin.Payments.PayU.Models;
using Nop.Web.Framework;
using Microsoft.AspNetCore.Mvc;
using Nop.Services.Security;
using Nop.Web.Framework.Mvc.Filters;

namespace NopBrasil.Plugin.Payments.PayU.Controllers
{
[Area(AreaNames.Admin)]
public class PaymentPayUController : BasePaymentController
{
private readonly ISettingService _settingService;
private readonly IWebHelper _webHelper;
private readonly IPaymentPayUService _payUService;
private readonly PayUPaymentSettings _payUPaymentSettings;
private readonly IPermissionService _permissionService;

public PaymentPayUController(ISettingService settingService, IWebHelper webHelper, IPaymentPayUService payUService, PayUPaymentSettings payUPaymentSettings)
public PaymentPayUController(ISettingService settingService, PayUPaymentSettings payUPaymentSettings, IPermissionService permissionService)
{
this._settingService = settingService;
this._webHelper = webHelper;
this._payUService = payUService;
this._payUPaymentSettings = payUPaymentSettings;
this._permissionService = permissionService;
}

[AdminAuthorize]
[ChildActionOnly]
public ActionResult Configure()
[AuthorizeAdmin]
public IActionResult Configure()
{
var model = new ConfigurationModel() { EmailPayU = _payUPaymentSettings.EmailPayU, PaymentMethodDescription = _payUPaymentSettings.PaymentMethodDescription };
return View(@"~/Plugins/Payments.PayU/Views/PaymentPayU/Configure.cshtml", model);
var model = new ConfigurationModel()
{
EmailPayU = _payUPaymentSettings.EmailPayU,
PaymentMethodDescription = _payUPaymentSettings.PaymentMethodDescription
};
return View(@"~/Plugins/Payments.PayU/Views/Configure.cshtml", model);
}

[HttpPost]
[AdminAuthorize]
[ChildActionOnly]
public ActionResult Configure(ConfigurationModel model)
[AuthorizeAdmin]
[AdminAntiForgery]
public IActionResult Configure(ConfigurationModel model)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods))
return AccessDeniedView();

if (!ModelState.IsValid)
return Configure();

_payUPaymentSettings.EmailPayU = model.EmailPayU;
_payUPaymentSettings.PaymentMethodDescription = model.PaymentMethodDescription;
_settingService.SaveSetting(_payUPaymentSettings);

return View(@"~/Plugins/Payments.PayU/Views/PaymentPayU/Configure.cshtml", model);
return View(@"~/Plugins/Payments.PayU/Views/Configure.cshtml", model);
}


[ChildActionOnly]
public ActionResult PaymentInfo() => View("~/Plugins/Payments.PayU/Views/PaymentPayU/PaymentInfo.cshtml");

public override IList<string> ValidatePaymentForm(System.Web.Mvc.FormCollection form) => new List<string>();

public override ProcessPaymentRequest GetPaymentInfo(System.Web.Mvc.FormCollection form) => new ProcessPaymentRequest();
}
}
8 changes: 0 additions & 8 deletions Description.txt

This file was deleted.

4 changes: 2 additions & 2 deletions Models/ConfigurationModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Nop.Web.Framework;
using Nop.Web.Framework.Mvc;
using Nop.Web.Framework.Mvc.ModelBinding;
using Nop.Web.Framework.Mvc.Models;

namespace NopBrasil.Plugin.Payments.PayU.Models
{
Expand Down
213 changes: 66 additions & 147 deletions NopBrasil.Plugin.Payments.PayU.csproj
Original file line number Diff line number Diff line change
@@ -1,148 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D3E43FBE-F8D6-4A3A-AE66-650EBE4EF25B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NopBrasil.Plugin.Payments.PayU</RootNamespace>
<AssemblyName>NopBrasil.Plugin.Payments.PayU</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\NopCommerce\src\Presentation\Nop.Web\Plugins\Payments.PayU\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\NopCommerce\src\Presentation\Nop.Web\Plugins\Payments.PayU\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=4.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Autofac.4.4.0\lib\net45\Autofac.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\nopCommerce\src\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PayUPaymentProcessor.cs" />
<Compile Include="PayUPaymentSettings.cs" />
<Compile Include="Infrastructure\DependencyRegistrar.cs" />
<Compile Include="Services\IPaymentPayUService.cs" />
<Compile Include="Services\PaymentPayUService.cs" />
<Compile Include="Controllers\PaymentPayUController.cs" />
<Compile Include="Models\ConfigurationModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<EmbeddedResource Include="Views\PaymentPayU\Configure.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Views\PaymentPayU\PaymentInfo.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<Content Include="Content\Images\logoPagamento.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Images\nopCommerceBrasil.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\PayU.css" />
<Content Include="web.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\nopCommerce\src\Libraries\Nop.Core\Nop.Core.csproj">
<Project>{6bda8332-939f-45b7-a25e-7a797260ae59}</Project>
<Name>Nop.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\nopCommerce\src\Libraries\Nop.Data\Nop.Data.csproj">
<Project>{ccd7f2c9-6a2c-4cf0-8e89-076b8fc0f144}</Project>
<Name>Nop.Data</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\nopCommerce\src\Libraries\Nop.Services\Nop.Services.csproj">
<Project>{210541ad-f659-47da-8763-16f36c5cd2f4}</Project>
<Name>Nop.Services</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\nopCommerce\src\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj">
<Project>{75fd4163-333c-4dd5-854d-2ef294e45d94}</Project>
<Name>Nop.Web.Framework</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Description.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="logo.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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 Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<Copyright>Copyright © nopCommerce Brasil</Copyright>
<Company>nopCommerce Brasil</Company>
<Authors>nopCommerce Brasil - www.nopcommercebrasil.com - nopcommercebrasil@nopcommercebrasil.com</Authors>
<Version>1.00</Version>
<Description>Payment plugin for integration with PayU (bCash) for nopCommerce</Description>
<PackageLicenseUrl></PackageLicenseUrl>
<PackageProjectUrl>http://www.nopcommercebrasil.com/</PackageProjectUrl>
<RepositoryUrl>https://github.com/nopCommerceBrasil/NopBrasil.Plugin.Payments.PayU</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\nopCommerce400\Presentation\Nop.Web\Plugins\Payments.PayU\</OutputPath>
<OutDir>$(OutputPath)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\nopCommerce400\Presentation\Nop.Web\Plugins\Payments.PayU\</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)\..\nopCommerce400\Build\ClearPluginAssemblies.proj" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
</Target>
<ItemGroup>
<None Remove="Content\Images\logoPagamento.png" />
<None Remove="Content\Images\nopCommerceBrasil.png" />
<None Remove="Content\PayU.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>
<ItemGroup>
<Content Include="Content\Images\logoPagamento.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\Images\nopCommerceBrasil.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Content\PayU.css">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Logo.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="plugin.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\Configure.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\PaymentInfo.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Views\_ViewImports.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\nopCommerce400\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj" />
<ProjectReference Include="..\nopCommerce400\Presentation\Nop.Web\Nop.Web.csproj" />
</ItemGroup>
</Project>
Loading

0 comments on commit 4da05bd

Please sign in to comment.