Skip to content

blank-development/wspay-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WSPay.NET

NuGet

WSPay.NET is an async/sync client for WSPay API.

Installation

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

Configuration

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");

Usage

var service = new WSPayService();
var status = await service.CheckStatusAsync(WSPayConfiguration.RegularShop, "myShoppingCartId");

Register services for DI

// 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>();
}

About

WSPay.Net is an async/sync client for WSPay API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages