Virtual Gateway
The Virtual Gateway simulates a bank, so you can develop and test the payment of your application without a real gateway account.
Configuration
Add it to the gateways with the path where it is shown:
.ConfigureGateways(gateways =>
{
gateways
.AddParbadVirtual()
.WithOptions(options => options.GatewayPath = "/MyVirtualGateway");
})
The path must start with /.
Enabling it
ASP.NET Core
app.UseParbadVirtualGatewayWhenDeveloping();
It is added only in the Development environment. UseParbadVirtualGateway() adds it always, and
UseParbadVirtualGatewayWhen(...) under your own condition.
ASP.NET MVC 5 and WebForms (OWIN)
var parbad = ParbadBuilder.CreateDefaultBuilder()
// configuration
.Build();
app.UseParbadVirtualGateway(parbad.Services);
Usage
var result = await _onlinePayment.RequestAsync(invoice =>
{
invoice
.SetAmount(2000)
.SetCallbackUrl(callbackUrl)
.UseAutoIncrementTrackingNumber()
.UseParbadVirtual();
});
if (result.IsSucceed)
{
return result.GatewayTransporter.TransportToGateway();
}