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

ngx-binoxus-pay

v0.2.1

Published

Une bibliothèque permettant de collecter le paiement par différents moyens : **Carte de paiement [ Débit | Crédit. ]**, **Bin-Wallet** , **Mobile Money**

Downloads

67

Readme

NgxBinoxusPay

Description

Cette bibliothèque vous permet de collecter le paiement par différents moyens : Carte de paiement [ Débit | Crédit. ], Bin-Wallet , Mobile Money. Vous devez avoir un compte marchand dans https://pay.binoxus.com, Où vous trouverez vos coordonnées d'authentification.

Installation

  npm install ngx-binoxus-pay

Les étapes

L'utilisation de la bibliothèque est très simple, il suffit de suivre les étapes suivantes :

  • L'initialiser le paiement du côté serveur
  • Récupérer le systemRef et le token
  • Faire passer ces informations dans le composant NgxBin-ngx-binoxuspay
  • Mettre votre logique en attendant le callback de retour de paiement
  • Le callback de retour peut être de type IBinoxusPayOnResponse ou IBinoxusPayOnError en cas d'erreurs inattendue

Initialisation de paiement

Pour commencer, initialiser le paiement du côté serveur, vous aurez la réponse contenant des données telles que :

  • bin_status| Type EApiResponseStatusCode | Le status de l'opération d'initialisation, si c'est BIN000, l'opération a réussi, sinon, quelque chose s'est mal passée;
  • system_ref | L'identifiant du paiement dans le système;
  • customer_ref | L'identifiant de votre paiement;
    • token | Le token à utiliser lors de l'appel du composant [ NgxBin-ngx-binoxuspay ] de paiement;

Callback de retour de paiement

Lorsque le paiement est enclenché, la bibliothèque reste en attente du statut final du paiement-ci. Ainsi, à la fin du paiement la bibliothèque retourne un callback du type IBinoxusPayOnResponse:

  • amount | Type : Double | Montant du paiement;
  • currency | Type : String | Devise du paiement;
  • binStatus | Statut de l'opération de paiement (BIN000 : l'opération a réussi, mais il faut vérifier le paymentStatus afin de s'assurer que le paiement a réussi , à partir de : BIN001, l'opération à échoué ) | Chaîne de caractère
    • paymentStatus | type : IPaymentStatus | Statut de l'opération de paiement (APPROVED ou FAIL) | Chaîne de caractère
  • customRef| Types : String | L'identifiant de votre paiement;
  • title | Types : String | Le titre correspondant au status de paiement;
  • systemRef | Types : String | L'identifiant du paiement dans Binoxus Pay;

Callback d'erreur de traitement

Lors du traitement, il peut survenir certains types d'erreurs telles que, certains paramètres pour le paiement manquantes. Le format de retour attendu est le suivant :

  • message | Chaîne de caractère : décrivant la raison de l'échec;
  • title | Chaîne de caractère : le titre de l'échec;

Utilisation

En resumé, la bibliothèque s'utilise par le biais d'un appel appel du composant angular [ NgxBin-ngx-binoxuspay ] :


      // app.component.ts
      import { Component, } from '@angular/core';
      import { IBinoxusPayResponse, NgxBinoxuspayComponent,EApiResponseStatusCode,
      IBinoxusPayBody,IBinoxusPayConfigs } from 'ngx-binoxus-pay';


      @Component({
        selector: 'app-root',
        standalone: true,
        imports: [
          NgxBinoxuspayComponent
        ],
        templateUrl: './app.component.html',
        styleUrl: './app.component.css'
      })
      export class AppComponent {

        paymentBody:IBinoxusPayBody = {
          systemRef: ""
        };

        paymentConfig:IBinoxusPayConfigs = {
          token:'token here'
        }

        canPay:boolean = false;
        startPayment() {

          // INITIALISATION DU PAIEMENT


          // À PARTIR DE LA REPONSE, RECUPÉRER systemRef et token
          // PASSER CES INFORMATION DANS paymentBody et paymentConfig
          this.paymentBody  = {
            systemRef:'systemRef here !'
          };
          this.paymentConfig  = {
            token:'token here !'
          };

          // OUVREZ MAINTENANT LE COMPOSANT DE PAIEMENT
          this.canPay = true;
        }

        paymentResponseFx(response:IBinoxusPayResponse){
          console.log('Payment Response:', response)
          if((response as IBinoxusPayResponse).onResponse) {
            if(response.onResponse.bin_status == EApiResponseStatusCode.BIN000
                && response.onResponse.payment_status == 'APPROVED') {
                // PAYMENT SUCCEED

            } else {
              // PAYMENT FAIL

            }
          } else if((response as IBinoxusPayResponse).onError) {
            // PAYMENT FAIL

          } else {
            // UN HANDLED OPERATION
          }

        }
  <!-- app.component.html -->

  @if(canPay) {
    <NgxBin-ngx-binoxuspay 
        (paymentResponse)="paymentResponseFx($event)" 
          [paymentConfig]="paymentConfig" 
            [paymentBody]="paymentBody"></NgxBin-ngx-binoxuspay>
  }