Prides.Payments.NetCore
0.0.21
dotnet add package Prides.Payments.NetCore --version 0.0.21
NuGet\Install-Package Prides.Payments.NetCore -Version 0.0.21
<PackageReference Include="Prides.Payments.NetCore" Version="0.0.21" />
<PackageVersion Include="Prides.Payments.NetCore" Version="0.0.21" />
<PackageReference Include="Prides.Payments.NetCore" />
paket add Prides.Payments.NetCore --version 0.0.21
#r "nuget: Prides.Payments.NetCore, 0.0.21"
#:package Prides.Payments.NetCore@0.0.21
#addin nuget:?package=Prides.Payments.NetCore&version=0.0.21
#tool nuget:?package=Prides.Payments.NetCore&version=0.0.21
Spanish Documentation
Implementación Nugget
Este documento proporciona instrucciones para implementar los métodos Crear Orden, Validar, Revalidar y EventHandler en una aplicación .NET Core 3.1 o superior.
Configuración del archivo appsettings.json
Antes de implementar los métodos, asegúrate de tener la siguiente configuración en tu archivo appsettings.json
"PridesPayment": {
"URL": "http://", // Solicitar Valor a Prides
"Secret": "T7683A8A-424E-4D6E-A151-8B5D8D81680D", // Solicitar Valor a Prides
"Expiration": "2024-01-01T00:00:00", // Este valor no se debe de tocar
"Token": "" // Este valor debe estar vacío
}
Implementación del Método Crear Orden
Pasos método Crear Orden:
Inyección de Dependencias: Asegúrate de que tu controlador o clase tenga la interfaz IConfiguration inyectada en el constructor:
private readonly IConfiguration _configuration;
public ConstructorController(IConfiguration configuration)
{
_configuration = configuration;
}
Creación de Objeto TransactionData:
Crea un objeto TransactionData con los datos relevantes para la transacción:
TransactionData transactionData = new TransactionData()
{
Amount = 1000, // Monto de la transacción
ExternalTransactionId = "", // Número de Factura del desarrollador (Opcional)
Customer = "01-0390-0322", // Número de Cédula del Cliente (Obligatorio)
PhoneNumber = "45032345" // Número de Teléfono del Cliente (Opcional)
};
Llamada al Método Crear:
Utiliza el servicio Orden para llamar al método Crear, pasando el objeto transactionData y la configuración _configuration:
var respuesta = await Orden.Crear(transactionData, _configuration);
Descripción de los Campos de TransactionData
- Amount: El monto de la transacción
(Obligatorio). - ExternalTransactionId: El número de factura
(Opcional. - Customer: El número de cédula del cliente
(Obligatorio). - PhoneNumber: El número de teléfono del cliente
(Opcional).
Implementación del Método Validar
Implementar el método Validar:
private readonly IConfiguration _configuration;
public ConstructorController(IConfiguration configuration)
{
_configuration = configuration;
}
TransactionData transactionDataV = new TransactionData()
{
TransactionId = "2A00000004", // Dato devuelto por el Crear Orden
Customer = "1-0390-0322", // Número de Cédula del Cliente (Opcional)
ReferenceNumber = "20240514200000004" // Número de Referencia del Banco (Opcional)
};
var resultado1 = await Orden.Validar(transactionDataV, _configuration);
Descripción de los Campos de TransactionData
- TransactionId: El identificador de la transacción devuelto por el método Crear Orden
(Obligatorio). - Customer: El número de cédula del cliente
(Obligatorio). - ReferenceNumber: El número de referencia del banco
(Opcional).
Implementación del Método Revalidar
Para implementar el método Revalidar, sigue estos pasos:
private readonly IConfiguration _configuration;
public ConstructorController(IConfiguration configuration)
{
_configuration = configuration;
}
TransactionData transactionDataRV = new TransactionData()
{
ReferenceNumber = "20240514200000004", // Número de Referencia del Banco (Opcional)
TransactionId = "2A00000004", // Dato devuelto por el Crear Orden (Obligatorio)
Customer = "01-0390-0322" // Número de Cédula del Cliente (Obligatorio)
};
var resultado2 = await Orden.Revalidar(transactionDataRV, _configuration);
Descripción de los Campos de TransactionData
- TransactionId: El identificador de la transacción devuelto por el método Crear Orden
(Obligatorio). - Customer: El número de cédula del cliente
(Obligatorio). - ReferenceNumber: El número de referencia del banco
(Opcional).
Implementación del Método EventHandler
Versión BackgroundService para API
Configura el servicio en Program.cs para abrir el BackgroundService:
builder.Services.AddHostedService<QueueActive>();
Crea la siguiente clase donde se implementa el delegate:
public class QueueActive : BackgroundService
{
private readonly IConfiguration _configuration;
public QueueActive(IConfiguration configuration)
{
_configuration = configuration;
}
protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
stoppingToken.ThrowIfCancellationRequested();
QueueReceive _queueReceive = new QueueReceive(_configuration);
_queueReceive.OnQueueRead += Metodo;
return Task.CompletedTask;
}
public override void Dispose()
{
base.Dispose();
}
private void Metodo(string mensaje)
{
System.Console.WriteLine($"Handling event: {mensaje}");
}
}
Descripción de los Campos y Métodos
QueueActive: Clase que hereda de BackgroundService y maneja la lógica del EventHandler.
ExecuteAsync: Método sobrecargado para ejecutar la lógica en segundo plano.
Metodo: Método que se ejecuta cuando se recibe un mensaje en la cola, donde se puede implementar la lógica de negocio.
English Documentation
Nugget implementation
This document provides instructions for implementing the CreateOrder, Validate, Revalidate, and EventHandler methods in a .NET Core 3.1 or higher application.
Configuration of the appsettings.json file
Before implementing the methods, make sure you have the following settings in your appsettings.json file:
json
"PridesPayment": {
"URL": "http://", // Request Value from Prides
"Secret": "T7683A8A-424E-4D6E-A151-8B5D8D81680D", // Request Value from Prides
"Expiration": "2024-01-01T00:00:00", // This value should not be touched
"Token": "" // This value must be empty
}
Implementation of the Create Order Method
Follow the following steps to implement the Create Order method:
Dependency Injection: Make sure your controller or class has the IConfiguration interface injected into the constructor:
private readonly IConfiguration _configuration;
public ConstructorController(IConfiguration configuration) { _configuration = configuration; } TransactionData Object Creation: Create a TransactionData object with the relevant data for the transaction:
TransactionData transactionData = new TransactionData() { Amount = 1000, // Transaction amount ExternalTransactionId = "", // Invoice Number (Not necessary) Customer = "01-0390-0322", // Customer ID Number (Not necessary) PhoneNumber = "45032345" // Customer's Phone Number (Not necessary) }; Create Method Call: Use the Order service to call the Create method, passing the transactionData object and the _configuration configuration:
var response = await Order.Create(transactionData, _configuration);
Description of TransactionData Fields
Amount: The amount of the transaction.
ExternalTransactionId: The invoice number (optional).
Customer: The customer's ID number (optional).
PhoneNumber: The customer's phone number (optional).
Implementation of the Validate Method
To implement the Validate method, follow these steps:
private readonly IConfiguration _configuration;
public ConstructorController(IConfiguration configuration) { _configuration = configuration; }
TransactionData transactionDataV = new TransactionData() { TransactionId = "2A00000004", // Data returned by the Create Order Customer = "1-0390-0322", // Customer ID Number (Not necessary) ReferenceNumber = "20240514200000004" // Bank Reference Number (Not necessary) };
var result1 = await Order.Validate(transactionDataV, _configuration);
Description of TransactionData Fields
TransactionId: The transaction identifier returned by the Create Order method.
Customer: The customer's ID number (optional).
ReferenceNumber: The bank reference number (optional).
Implementation of the Revalidate Method
To implement the Revalidate method, follow these steps:
private readonly IConfiguration _configuration;
public ConstructorController(IConfiguration configuration) { _configuration = configuration; }
TransactionData transactionDataRV = new TransactionData() { ReferenceNumber = "20240514200000004", // Bank Reference Number TransactionId = "2A00000004", // Data returned by the Create Order Customer = "01-0390-0322" // Customer ID Number (Not necessary) };
var result2 = await Order.Revalidate(transactionDataRV, _configuration);
Description of TransactionData Fields
ReferenceNumber: The bank reference number.
TransactionId: The transaction identifier returned by the Create Order method.
Customer: The customer's ID number (optional).
EventHandler Method Implementation
To implement the EventHandler method, follow these steps:
Configure the service in Program.cs to open the BackgroundService:
builder.Services.AddHostedService<QueueActive>(); Create the following class where the delegate is implemented:
public class QueueActive : BackgroundService { private readonly IConfiguration _configuration;
public QueueActive(IConfiguration configuration) { _configuration = configuration; }
protected override Task ExecuteAsync(CancellationToken stoppingToken) { stoppingToken.ThrowIfCancellationRequested(); QueueReceive _queueReceive = new QueueReceive(_configuration); _queueReceive.OnQueueRead += Method; return Task.CompletedTask; }
public override void Dispose() { base.Dispose(); }
private void Method(string message) { System.Console.WriteLine($"Handling event: {message}"); } } Description of Fields and Methods QueueActive: Class that inherits from BackgroundService and handles the EventHandler logic. ExecuteAsync: Overloaded method to execute logic in the background. Method: Method that is executed when a message is received in the queue, where the business logic.
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
- Polly (>= 8.4.0)
- RabbitMQ.Client (>= 6.8.1)
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 |
|---|---|---|
| 0.0.21 | 166 | 8/5/2024 |
| 0.0.20 | 130 | 8/5/2024 |
| 0.0.19 | 147 | 8/5/2024 |
| 0.0.18 | 130 | 8/5/2024 |
| 0.0.17 | 176 | 6/21/2024 |
| 0.0.16 | 205 | 6/19/2024 |
| 0.0.15 | 156 | 6/19/2024 |
| 0.0.14 | 154 | 6/19/2024 |
| 0.0.13 | 179 | 6/19/2024 |
| 0.0.12 | 169 | 6/19/2024 |
| 0.0.11 | 173 | 6/19/2024 |
| 0.0.10 | 166 | 6/19/2024 |
| 0.0.9 | 174 | 6/19/2024 |
| 0.0.8 | 166 | 6/17/2024 |
| 0.0.7 | 167 | 6/13/2024 |
| 0.0.6 | 171 | 6/13/2024 |
| 0.0.5 | 169 | 6/13/2024 |
| 0.0.4 | 170 | 6/13/2024 |
| 0.0.3 | 165 | 6/6/2024 |
| 0.0.2 | 179 | 6/3/2024 |