Skip to content

Commit

Permalink
Amazon Pay C# SDK 3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Shangamesh T committed Jan 22, 2021
1 parent 6157817 commit 61ef98b
Show file tree
Hide file tree
Showing 21 changed files with 346 additions and 437 deletions.
4 changes: 2 additions & 2 deletions AmazonPay.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package >
<metadata>
<id>$id$</id>
<version>3.7.0.1</version>
<version>3.8.0</version>
<title>$title$</title>
<authors>AmazonPay</authors>
<owners>AmazonPay</owners>
<projectUrl>https://github.com/amzn/amazon-pay-sdk-csharp</projectUrl>
<iconUrl>https://images-na.ssl-images-amazon.com/images/G/01/Iris3_US/en_US/inca/images/60x38-white-x1.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>AmazonPay service. This API section enables you to programmatically retrieve shipping and payment information provided by the buyer from their Amazon account. It allows you to authorize, capture, and refund payments, enabling a variety of payments scenarios.</description>
<releaseNotes>v3.7.0.1</releaseNotes>
<releaseNotes>v3.8.0</releaseNotes>
<copyright>Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.</copyright>
<tags>AmazonPay</tags>
<dependencies>
Expand Down
176 changes: 33 additions & 143 deletions AmazonPay/AmazonPay.csproj
Original file line number Diff line number Diff line change
@@ -1,154 +1,44 @@
<?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')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A8D8E745-6C1D-4A33-B2C5-4F7C1E4FD4DF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AmazonPay</RootNamespace>
<AssemblyName>AmazonPay</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\..\GitHub\login-and-pay-with-amazon-sdk-samples\Csharp\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\lib\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\lib\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\lib\AmazonPay.xml</DocumentationFile>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>KeyFile.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<DelaySign>false</DelaySign>
<TargetFrameworks>netstandard2.0;net20</TargetFrameworks>
<Copyright>Copyright © 2017-2020</Copyright>
<Company>Amazon Pay</Company>
<Version>3.8.0</Version>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e, processorArchitecture=MSIL">
<HintPath>..\packages\Common.Logging.2.0.0\lib\2.0\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net20\Newtonsoft.Json.dll</HintPath>
</Reference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Common.Logging" Version="2.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Common.Logging" Version="3.4.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.9" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
<PackageReference Include="System.Runtime.Caching" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="3.1.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.10" />
</ItemGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>NETSTANDARD;</DefineConstants>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net20'">
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<Compile Include="AccountStatus.cs" />
<Compile Include="BillingAgreementType.cs" />
<Compile Include="Client.cs" />
<Compile Include="Constants.cs" />
<Compile Include="DelegateRequest.cs" />
<Compile Include="HttpImpl.cs" />
<Compile Include="IClient.cs" />
<Compile Include="IpnHandler.cs" />
<Compile Include="NestedJsonToDictionary.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProviderCreditRequests\GetProviderCreditReversalDetailsRequest.cs" />
<Compile Include="ProviderCreditRequests\ReverseProviderCreditRequest.cs" />
<Compile Include="RecurringPaymentRequests\AuthorizeOnBillingAgreementRequest.cs" />
<Compile Include="RecurringPaymentRequests\CloseBillingAgreementRequest.cs" />
<Compile Include="RecurringPaymentRequests\ConfirmBillingAgreementRequest.cs" />
<Compile Include="RecurringPaymentRequests\CreateOrderReferenceForIdRequest.cs" />
<Compile Include="RecurringPaymentRequests\GetBillingAgreementDetailsRequest.cs" />
<Compile Include="RecurringPaymentRequests\SetBillingAgreementDetailsRequest.cs" />
<Compile Include="RecurringPaymentRequests\ValidateBillingAgreementRequest.cs" />
<Compile Include="region.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>region.settings</DependentUpon>
</Compile>
<Compile Include="Regions.cs" />
<Compile Include="ResponseParser.cs" />
<Compile Include="Responses\AbstractResponse.cs" />
<Compile Include="Responses\AuthorizeResponse.cs" />
<Compile Include="Responses\BillingAddressDetails.cs" />
<Compile Include="Responses\BillingAgreementDetailsResponse.cs" />
<Compile Include="Responses\CancelOrderReferenceResponse.cs" />
<Compile Include="Responses\CaptureResponse.cs" />
<Compile Include="Responses\ChargebackResponse.cs" />
<Compile Include="Responses\ConfirmOrderReferenceResponse.cs" />
<Compile Include="Responses\CloseAuthorizationResponse.cs" />
<Compile Include="Responses\CloseBillingAgreementResponse.cs" />
<Compile Include="Responses\CloseOrderReferenceResponse.cs" />
<Compile Include="Responses\ConfirmBillingAgreementResponse.cs" />
<Compile Include="Responses\ErrorResponse.cs" />
<Compile Include="Responses\GetMerchantAccountStatusResponse.cs" />
<Compile Include="Responses\GetMerchantNotificationConfigurationResponse.cs" />
<Compile Include="Responses\ListOrderReferenceResponse.cs" />
<Compile Include="Responses\Operator.cs" />
<Compile Include="Responses\PaymentDetailsResponse.cs" />
<Compile Include="Responses\GetProviderCreditDetailsResponse.cs" />
<Compile Include="Responses\GetProviderCreditReversalDetailsResponse.cs" />
<Compile Include="Responses\GetServiceStatusResponse.cs" />
<Compile Include="Responses\IResponse.cs" />
<Compile Include="Responses\OrderReferenceDetailsResponse.cs" />
<Compile Include="Responses\RefundResponse.cs" />
<Compile Include="Responses\SetMerchantNotificationConfigurationResponse.cs" />
<Compile Include="Responses\ValidateBillingAgreementResponse.cs" />
<Compile Include="SanitizeData.cs" />
<Compile Include="Signature.cs" />
<Compile Include="StandardPaymentRequests\AuthorizeRequest.cs" />
<Compile Include="StandardPaymentRequests\CancelOrderReferenceRequest.cs" />
<Compile Include="StandardPaymentRequests\CaptureRequest.cs" />
<Compile Include="StandardPaymentRequests\ChargeRequest.cs" />
<Compile Include="StandardPaymentRequests\ListOrderReferenceByNextTokenRequest.cs" />
<Compile Include="StandardPaymentRequests\ListOrderReferenceRequest.cs" />
<Compile Include="StandardPaymentRequests\SetMerchantNotificationConfigurationRequest.cs" />
<Compile Include="StandardPaymentRequests\GetMerchantNotificationConfigurationRequest.cs" />
<Compile Include="StandardPaymentRequests\CloseAuthorizationRequest.cs" />
<Compile Include="StandardPaymentRequests\CloseOrderReferenceRequest.cs" />
<Compile Include="CommonRequests\Configuration.cs" />
<Compile Include="StandardPaymentRequests\ConfirmOrderReferenceRequest.cs" />
<Compile Include="StandardPaymentRequests\GetAuthorizationDetailsRequest.cs" />
<Compile Include="StandardPaymentRequests\GetCaptureDetailsRequest.cs" />
<Compile Include="StandardPaymentRequests\GetMerchantAccountStatusRequest.cs" />
<Compile Include="StandardPaymentRequests\GetOrderReferenceDetailsRequest.cs" />
<Compile Include="ProviderCreditRequests\GetProviderCreditDetailsRequest.cs" />
<Compile Include="StandardPaymentRequests\GetRefundDetailsRequest.cs" />
<Compile Include="CommonRequests\GetServiceStatusRequest.cs" />
<Compile Include="StandardPaymentRequests\RefundRequest.cs" />
<Compile Include="StandardPaymentRequests\SetOrderAttributesRequest.cs" />
<Compile Include="StandardPaymentRequests\SetOrderReferenceDetailsRequest.cs" />
<Compile Remove="Properties\**" />
<EmbeddedResource Remove="Properties\**" />
<None Remove="Properties\**" />
</ItemGroup>
<ItemGroup>
<None Include="KeyFile.snk" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.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>

<PropertyGroup Condition="'$(TargetFramework)' == 'net20'">
<DefineConstants>NETFULL</DefineConstants>
</PropertyGroup>
</Project>
6 changes: 0 additions & 6 deletions AmazonPay/AmazonPay.csproj.user

This file was deleted.

4 changes: 2 additions & 2 deletions AmazonPay/AmazonPay.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<package >
<metadata>
<id>$id$</id>
<version>3.7.0.1</version>
<version>3.8.0</version>
<title>$title$</title>
<authors>AmazonPay</authors>
<owners>AmazonPay</owners>
<projectUrl>https://github.com/amzn/amazon-pay-sdk-csharp</projectUrl>
<iconUrl>https://images-na.ssl-images-amazon.com/images/G/01/Iris3_US/en_US/inca/images/60x38-white-x1.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>AmazonPay service. This API section enables you to programmatically retrieve shipping and payment information provided by the buyer from their Amazon account. It allows you to authorize, capture, and refund payments, enabling a variety of payments scenarios.</description>
<releaseNotes>v3.7.0.1</releaseNotes>
<releaseNotes>v3.8.0</releaseNotes>
<copyright>Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.</copyright>
<tags>AmazonPay</tags>
<dependencies>
Expand Down
8 changes: 0 additions & 8 deletions AmazonPay/Client.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
using System;
using System.Reflection;
using System.Web;
using System.Net;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Security.Cryptography;
using System.Globalization;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Collections;
using System.Xml;
using Newtonsoft.Json;
using AmazonPay.StandardPaymentRequests;
using AmazonPay.Responses;
using AmazonPay.ProviderCreditRequests;
using AmazonPay.RecurringPaymentRequests;
using AmazonPay.CommonRequests;
using AmazonPay.Types;
using Common.Logging;

namespace AmazonPay
Expand Down
2 changes: 1 addition & 1 deletion AmazonPay/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace AmazonPay
{
public static class Constants
{
public static readonly string SDKClientVersion = "3.7.0.1";
public static readonly string SDKClientVersion = "3.8.0";
public static readonly string SDKName = "amazon-pay-sdk-csharp";
public static readonly string PaymentsServiceVersion = "2013-01-01";
public static readonly int MaxErrorRetry = 3;
Expand Down
36 changes: 30 additions & 6 deletions AmazonPay/IpnHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
using System.Collections.Specialized;
using System.IO;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Net;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using AmazonPay;
using System.Xml;
using AmazonPay.Responses;
using System.Text.RegularExpressions;
using Common.Logging;
#if NETSTANDARD
using System.Runtime.Caching;
#else
using System.Web;
#endif

namespace AmazonPay
{
Expand Down Expand Up @@ -95,11 +96,18 @@ private void IpnHandlerInit(NameValueCollection headers, string jsonMessage)
ParseRawMessage(headers, jsonMessage);
GetIpnResponseObjects();
}
}
#if NETSTANDARD
catch (InvalidDataException ex)
{
throw new InvalidDataException("Error Parsing the IPN notification", ex);
}
#else
catch (HttpParseException ex)
{
throw new HttpParseException("Error Parsing the IPN notification", ex);
}
#endif

}

Expand Down Expand Up @@ -505,6 +513,22 @@ private bool VerifyMsgMatchesSignatureWithPublicCert(byte[] data, byte[] signatu
private X509Certificate2 GetCertificate(string certPath)
{
X509Certificate2 cert = null;
#if NETSTANDARD
try
{
cert = (X509Certificate2)MemoryCache.Default.Get(string.Format(Constants.CacheKey, certPath));
}
catch (Exception ex)
{
throw new Exception("Error requesting certificate", ex);
}

if (cert == null)
{
cert = GetCertificateFromURI(certPath);
MemoryCache.Default.Set(string.Format(Constants.CacheKey, certPath), cert, new CacheItemPolicy() { AbsoluteExpiration = DateTime.UtcNow.AddDays(1.0) });
}
#else
try
{
cert = (X509Certificate2)HttpRuntime.Cache.Get(String.Format(Constants.CacheKey, certPath));
Expand All @@ -519,7 +543,7 @@ private X509Certificate2 GetCertificate(string certPath)
cert = GetCertificateFromURI(certPath);
HttpRuntime.Cache.Insert(String.Format(Constants.CacheKey, certPath), cert, null, DateTime.UtcNow.AddDays(1.0), System.Web.Caching.Cache.NoSlidingExpiration);
}

#endif
return cert;
}

Expand Down Expand Up @@ -721,7 +745,7 @@ public string GetReleaseEnvironment()
/// <returns>notificationType</returns>
public string GetNotificationType()
{
return this.notificationType.Replace(" ","");
return this.notificationType.Replace(" ", "");
}

/// <summary>
Expand Down
36 changes: 0 additions & 36 deletions AmazonPay/Properties/AssemblyInfo.cs

This file was deleted.

Loading

0 comments on commit 61ef98b

Please sign in to comment.