WSPay.NET is an async/sync client for WSPay API.
Using the .NET Core command-line interface (CLI)
:
dotnet add package WSPay.NET
Using the NuGet Command Line Interface (CLI)
:
nuget install WSPay.NET
Using the Package Manager Console
:
Install-Package WSPay.NET
WSPay can be configured to use Mode.Test
(default) or Mode.Prod
mode.
Using the app settings:
<appSettings>
<add key="WSPayMode" value="Test" />
<add key="WSPayRegularShopId" value="myShopId" />
<add key="WSPayRegularShopSecret" value="myShopSecret" />
<add key="WSPayTokenShopId" value="tokenShopId" />
<add key="WSPayTokenShopSecret" value="tokenShopSecret" />
</appSettings>
Using the code configuration:
WSPayConfiguration.Mode = Mode.Test;
WSPayConfiguration.RegularShop = new Shop("regularShopId", "regularShopSecret");
WSPayConfiguration.TokenShop = new Shop("tokenShopId", "tokenShopSecret");
var service = new WSPayService();
var status = await service.CheckStatusAsync(WSPayConfiguration.RegularShop, "myShoppingCartId");
// Autofac
public void RegisterWsPayServices(ContainerBuilder builder)
{
builder.RegisterType<SignatureFactory>()
.As<ISignatureFactory>()
.SingleInstance();
builder.RegisterType<RequestFactory>()
.As<IRequestFactory>()
.SingleInstance();
builder.RegisterType<WSPayApiClient>()
.As<IWSPayClient>()
.SingleInstance();
builder.RegisterType<WSPayService>()
.As<IWSPayService>()
.SingleInstance();
builder.RegisterType<FormSuccessResponse>();
builder.RegisterType<FormErrorResponse>();
}