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

angular-gladepay

v1.0.7

Published

Angular wrapper for integrating gladepay transactions

Downloads

16

Readme

ANGULAR-GLADEGPAY

This is an angular module that abstracts the complexity of making gladepay payments with Angular2+.

USAGE

1. Install the module

npm install --save angular-gladepay

2. Import the module

In your app.module.ts or any module where the component or directive would be used like so:

import { NgModule } from '@angular/core';

import { AngularGladepayModule } from 'angular-gladepay';
...

@NgModule({
  imports: [
    AngularGladepayModule.forRoot('MID'),
  ]
})

export class AppModule {}

3. Implement in your project

There are two available options

  • AngularGladepayComponent: Renders a button which when clicked loads gladepay Inline in an iframe

      <angular-gladepay
        [email]="'[email protected]'"
        [amount]="5000000"
        [payment_method]="['bank']"
        [class]="'btn btn-primary'"
        (close)="paymentCancel()"
        (callback)="paymentDone($event)"
      >
        Pay with Gladepay
      </angular-gladepay>
  • AngularGladepayDirective: A directive that loads gladepay inline in an iframe when clicked

  <button
    angular-gladepay
    [MID]="'MID'"
    [email]="'[email protected]'"
    [amount]="5000000"
    [class]="'btn btn-primary'"
    (paymentInit)="paymentInit()"
    (close)="paymentCancel()"
    (callback)="paymentDone($event)"
  >
    Pay with Gladepay
  </button>

And then in your component.ts

  import { Component, OnInit } from '@angular/core';

  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent implements OnInit {
    constructor() {}

    paymentInit() {
      console.log('Payment initialized');
    }

    paymentDone(info: any) {
      this.title = 'Payment successful';
      console.log(this.title, info);
    }

    paymentCancel() {
      console.log('payment failed');
    }

    ngOnInit() {

    }

  }

Also you can use the gladepayOptions object like so:

  <button
    angular-gladepay
    [gladepayOptions]="options"
    (paymentInit)="paymentCancel()"
    (close)="paymentCancel()"
    (callback)="paymentDone($event)"
  >
    Pay with Gladepay
  </button>

And then in your component.ts

  import { Component } from '@angular/core';
  import { GladepayOptions } from 'angular-gladepay';

  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent {
    options: GladepayOptions = {
      amount: 50000,
      email: '[email protected]',
      MID: ''
    }
    constructor() {}

    paymentInit() {
      console.log('Payment initialized');
    }

    paymentDone(info: any) {
      this.title = 'Payment successful';
      console.log(this.title, info);
    }

    paymentCancel() {
      console.log('payment failed');
    }
  }

Also, you can pass in a MID in the component and the directive, in such situation, this MID is given a higher preference over the global forRoot MID. For example, if you have this is your file

@NgModule({
  imports: [
    AngularGladepayModule.forRoot('MID',false),
  ]
})

and this in your component

  <button
    angular-gladepay
    [MID]="'MID2'"
    [email]="'[email protected]'"
    [amount]="5000"
    [class]="'btn btn-primary'"
    (paymentInit)="paymentInit()"
    (close)="paymentCancel()"
    (callback)="paymentDone($event)"
  >
    Pay with Gladepay
  </button>

Then MID2 would be used instead

OPTIONS

|Name | Type | Required | Default Value | Description | |-----------------------|----------------|---------------------|---------------------|---------------------| | amount | number | true | undefined | Amount to withdraw | email | string | true | undefined | The customer's email address. | MID | string | true | undefined | Your MID from Gladepay. Use test MID for test mode and live MID for live mode | callback | function | true | undefined | A function called when transaction is successful. Returns an object containing unique reference | metadata | object | false | {} | custom details | currency | string | false | "NGN" | Transaction currency | gladepayOptions | object | false | undefined | An object containing the gladepay options above. NOTE: The function listeners eg callback, paymentInit should not be added here | paymentInit | function | false | undefined | A function called when the payment is about to begin | onClose | function | false | undefined | A function called if the customer closes the payment window

For more information checkout gladepay's documentation

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

How can I thank you?

Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or anywhere? Spread the word!

Don't forget to follow me on twitter!

Thanks! Dansteve Adekanbi.

License

The MIT License (MIT). Please see License File for more information.