MyFatoorah 1.0.2

dotnet add package MyFatoorah --version 1.0.2                
NuGet\Install-Package MyFatoorah -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MyFatoorah" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MyFatoorah --version 1.0.2                
#r "nuget: MyFatoorah, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MyFatoorah as a Cake Addin
#addin nuget:?package=MyFatoorah&version=1.0.2

// Install MyFatoorah as a Cake Tool
#tool nuget:?package=MyFatoorah&version=1.0.2                

MyFatoorah .Net NuGet package

Guide for our .Net nuget package.

Installation

Install 'MyFatoorah' NuGet package to your project. Also you can use the following command:

dotnet add package MyFatoorah

In case you are using .NET Core framework

1- Add the following namespaces:

using MyFatoorah;

2- Configure the services:

builder.Services.AddMyFatoorah(config =>
{
    config.CountryCode = MyFatoorahCountry.KWT; //Country of your account
    config.Environment = MyFatoorahEnvironment.Test; //Test or Live
    config.ApiToken = "YOUR API TOKEN HERE";
});

In case you are using .NET framework 4.6.2 and heigher

1- Add service registration code event handler:

Add service registration code in the Application_Start event handler in the Global.asax file.

Here's an example of how you can use the AddMyFatoorah extension method in the Application_Start event handler:

using Microsoft.Extensions.DependencyInjection;
using MyFatoorah;

protected void Application_Start()
{
	// Create a new instance of the service collection
	var services = new ServiceCollection();
	// Register your services using the AddMyFatoorahSKD extension method
	services.AddMyFatoorah(config =>
	{
		config.CountryCode = MyFatoorahCountry.KWT; //Country of your account
		config.Environment = MyFatoorahEnvironment.Test; //Test or Live
		config.ApiToken = "YOUR API TOKEN HERE";
	});
	// Build the service provider
	var serviceProvider = services.BuildServiceProvider();
	// Set the default dependency resolver for MVC
	DependencyResolver.SetResolver(new MyFatoorahDependencyResolver(serviceProvider));
}

2- Add class 'MyFatoorahDependencyResolver'

public class MyFatoorahDependencyResolver : IDependencyResolver
{
	private readonly IServiceProvider _serviceProvider;

	public MyFatoorahDependencyResolver(IServiceProvider serviceProvider)
	{
		_serviceProvider = serviceProvider;
	}

	public object GetService(Type serviceType)
	{
		return _serviceProvider.GetService(serviceType);
	}

	public IEnumerable<object> GetServices(Type serviceType)
	{
		return _serviceProvider.GetServices(serviceType);
	}
}

Usage

Inject 'IMyFatoorah' service as shown in the following example:

using MyFatoorah;

public class HomeController : Controller
{
	private readonly IMyFatoorah _myFatoorah;

	//for .Net Framewrok
	public HomeController()
	{
		// Get the service provider from the DependencyResolver
		var serviceProvider = DependencyResolver.Current.GetService<IServiceProvider>();
		// Resolve the services using the interface names
		_myFatoorah = (IMyFatoorah)serviceProvider.GetService(typeof(IMyFatoorah));
	}

	//for .Net Core
	public HomeController(IMyFatoorah myFatoorah)
	{
		_myFatoorah = myFatoorah;
	}

	public async Task<ActionResult> Index()
	{
		//Get list of banks
		var banks = await _myFatoorah.List.GetBanksAsync();
		
		//Get list of currencies
		var currenciesExchanges = await _myFatoorah.List.GetCurrenciesExchangesAsync();
		
		//initiate payment
		var initiatePayment = await _myFatoorah.Payment.InitiatePaymentAsync(new InitiatePaymentRequest()
		{ 
			CurrencyIso = MyFatoorahCurrency.KWD,
			InvoiceAmount = 10
		});
		
		//execute payment
		var executePayment = await _myFatoorah.Payment.ExecutePaymentAsync(new ExecutePaymentRequest()
		{
			PaymentMethodId = 1, 
			InvoiceValue = 10
		});

		return View();
	}
}

Documentation

please visit our documentation site for more details.

documentation link.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 736 4/9/2023

We added all MyFatoorah API endpoints.