Skip to content

Latest commit

 

History

History
109 lines (80 loc) · 3.02 KB

README.md

File metadata and controls

109 lines (80 loc) · 3.02 KB

PuntoPagos-SDK

This development is in a very early stage, please use it at your own risk and feel free to improve it and send Pull Requests.

Installation

To install you must:

  • Install from nuget PM> Install-Package PuntoPagos-SDK
  • Configure this sdk by code or config file, view Configuration
  • Use.

Configuration

By Code

You can configure and use this SDK to create a new instance of the class PuntoPago and calling the following order independent methods:

var puntoPagoSdk = new PuntoPago().SetKey("Key").SetSecretCode("SecretCode").SetEnvironment(EnvironmentForPuntoPago.Sandbox).CreateTransaction();

By Config file

If you prefer, you can configure this Sdk by config file, addings this keys of AppSetting

    <add key ="PuntoPago-Secret" value="YOU SECRET CODE" />
    <add key ="PuntoPago-Key" value="YOU KEY" />
    <add key="PuntoPago-Environment" value="" /><!--Values: Sandbox or Production--/>

Log

By default this Sdk use Log4Net for logger, but you can set you favorite logs system, calling to SetLog method of class PuntoPago. You need extends ILog interface located in Acid.PuntoPagos.Sdk.Interfaces.ILog

var puntoPagoSdk = new PuntoPago().SetLog(you instance of log);

Sample Usage

Create Transaction

var puntoPago = new PuntoPago().CreateTransaction();

var createTransactionDto = puntoPago.CreateTransaction(new CreateTransactionRequestDto(100, 123121));

//Redirect to 
createTransactionDto.ProcessUrl

Notification Transaction

var puntoPago = new PuntoPago().CreateTransaction();
//request is the WebRequest 
var notificationTransactionDto = puntoPago.NotificationTransaction(request);

//Returns if the result of transacction.
notificationTransactionDto.IsTransactionSuccessful();

//Returns response for Punto Pagos
notificationTransactionDto.GenerateResponse();

Check Status Transaction

var puntoPago = new PuntoPago().CreateTransaction();
//
var checkTransactionRequestDto = puntoPago.CheckStatusTransaction(new CheckTransactionRequestDto(100, Transaction Client Id, "Token of Punto Pago"));

//Returns if the result of transacction.
checkTransactionRequestDto.IsTransactionSuccessful();

Test Data

Gateway Payload Expected Result
Transbank Visa / 4051885600446623 / CVV: 123 / exp: any Success
Transbank Mastercard / 5186059559590568 / CVV: 123 / exp: any Failure

TODO

  • Create Wiki

Credits

Alejandro Labra

Special Thanks

Thanks to dvinales for not suing us, and imella for by knowledge.