npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

netpay3ds

v0.5.7

Published

Librería para implementar 3d Secure v2 en tus aplicaciones cuando integras productos de NetPay.

Downloads

48

Readme

Netpay3ds

Netpay3ds es una librería que facilita la integración de 3d Secure v2.

Quick start

Typescript

Primero, ejecuta npm install netpay3ds --save en tu aplicación. Después, en tu app:

1.- Crea el token de tarjeta utilizando la librería netpayjs tokenizar tarjeta.

2.- Implementa la librería de netpay3ds.

app.modules.ts

import { Netpay3dsModule } from 'netpay3ds';

@NgModule({
  imports: [
    Netpay3dsModule,
  ],
})

app.component.ts

import { Netpay3dsService } from 'netpay3ds';
constructor(private netpay3ds: Netpay3dsService) {}
let _this = this;
this.netpay3ds.setSandboxMode(true);
this.netpay3ds.init(function () {
  _this.netpay3ds.config(_this, {{amount}}, _this.callback);
});

callback(_this: any, referenceId: string) {
  console.log('referenceId: ' + referenceId);
  _this.charges(referenceId);
}

charges(referenceId: string) {
  console.log('charges: ' + referenceId);
}

Toma el valor de referenceId para realizar el charge.

3.- Realiza el charge acorde a la documentación.

4.- Con la información de la respuesta del charge, ejecutar la función canContinue, si es true, ejecutar el método de continue y confirm posteriormente.

let status = charge.status;
let responseCode = charge.threeDSecureResponse.responseCode;
let acsUrl = charge.threeDSecureResponse.acsUrl;
let paReq = charge.threeDSecureResponse.paReq;
let authenticationTransactionID =  charge.threeDSecureResponse.authenticationTransactionID;

let canProceed = _this.netpay3ds.canProceed({{status}}, {{responseCode}}, {{acsUrl}});
if(canProceed) {
    this.netpay3ds.proceed(_this, {{acsUrl}} , {{paReq}}, {{authenticationTransactionID}}, this.callbackProceed);
}
else {
  this.confirm(null);
}

callbackProceed(_this: any, processorTransactionId: string, status: string) {
  console.log('processorTransactionId: ' + processorTransactionId);
  if(status == 'success') {
    _this.confirm(processorTransactionId);
  }
  else {
    //Rechazar transacción, mostrar mensaje de transacción rechazada
    console.log('error');
  }
}

confirm(processorTransactionId: string) {
  console.log('confirm: ' + processorTransactionId);
}

5.- Ejecuta el servicio de confirm acorde a la documentación.

Javascript

Si deseas utilizar la librería de Javascript, sólo cambia los puntos 2 y 4 anteriores por lo siguiente:

6.- Este punto es equivalente al punto 2.
Sandbox:

<script src="https://cdn.netpay.mx/js/dev/netpay3ds.js"></script>

Live:

<script src="https://cdn.netpay.mx/js/latest/netpay3ds.js"></script>

  let _this = this;
  netpay3ds.setSandboxMode(true);
  netpay3ds.init(function () {
    netpay3ds.config(_this, {{amount}}, _this.callback);
});

  const callback = function(_this, referenceId) {
    console.log('referenceId: ' + referenceId);
    charges(referenceId);
}

  const charges = function(referenceId) {
  console.log('charges: ' + referenceId);
}

7.- Este punto es equivalente al punto 4.

  let canProceed = netpay3ds.canProceed({{status}}, {{responseCode}}, {{acsUrl}});
  console.log(canProceed);
  if(canProceed) {
  netpay3ds.proceed(_this, {{acsUrl}} , {{paReq}}, {{authenticationTransactionID}}, callbackProceed);
}
  else {
    confirm(null);
}

  const callbackProceed = function(_this, processorTransactionId, status) {
    console.log('processorTransactionId: ' + processorTransactionId);
    if(status == 'success') {
      confirm(processorTransactionId);
    }
    else {
      //Rechazar transacción, mostrar mensaje de transacción rechazada
      console.log('error');
    }
  }

  const confirm = function(processorTransactionId) {
    console.log('confirm: ' + processorTransactionId);
  }

Si tienes problemas de conflicto con jquery, puedes utilizar la siguiente versión:
Sandbox:

<script src="https://cdn.netpay.mx/js/dev/netpay3ds-noConflict.js"></script>

Live:

<script src="https://cdn.netpay.mx/js/latest/netpay3ds-noConflict.js"></script>

Further help

Para mas información envia un correo a [email protected]