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

@totvspag/ng-checkout

v0.0.8

Published

A simple Angular lib to help in checkout integration

Downloads

269

Readme

TotvsPag Checkout

This library will help you to integrate with our checkout solution. We provide a two different ways to use our solution:

Payment Service

Using payment service you can create payment link, and redirect users to a checkout page.

Embed Checkout component

With checkout component you can add the checkout form inside your application, and get notifications of payment status.

Follow the steps below check how to configure and integrate both methods.

Initial Configuration

It`s possible to configure once the checkout information.

Import the checkout module

import { CheckoutModule } from '@totvspag/ng-checkout';

Add the code below in our appModule in the imports section, and replace the token for the one you received in dev-portal. This configurations you can obtain through dev-portal.

CheckoutModule.forRoot({
      tokenApplication: 'add your tokenApplication here',
      tokenClient: 'add your tokenClient here',

      *** Possible environment configurations ***
      // environment: EnvironmentEnum.Docker  
      // environment: EnvironmentEnum.Prod  
      environment: EnvironmentEnum.Dev 
})

Generate a payment link

You can create payment links to redirect your users to a checkout page.

Import payment service and configure you checkout information.

import { PaymentService, Customer, Checkout } from '@totvspag/ng-checkout';

const customer: Customer = {
    country: 'BR',
    lastName: 'Customer last name',
    firstName: 'Customer first name',
    postalCode: '48104-2201',
    locality: 'Ann Arbor',
    district: 'Lagos',
    administrativeArea: 'MI',
    email: '[email protected]',
    street: 'some street',
    streetnumber: '99'
};

const checkout: Checkout = {
    integrationId: 'xxx', // some string that you wanna use to identify this payment
    amount: {
      totalAmount: '100',
      currency: 'BRL'
    },
    customer // the customer configuration set above
};

// call getPaymentUrl from paymentService to get a url to the checkout

// checkout = checkout information set above
// page = You can use `page` to get a url from the checkout page or null to get a url of checkout form only
const paymentUrl = this.paymentService.getPaymentUrl(checkout, 'page');

If you wanna create url using a different checkout configuration, you can pass it as a third parameter

const customConfig: {
      tokenApplication: 'custom tokenApplication here',
      tokenClient: 'custom tokenClient here',
      environment: EnvironmentEnum.Dev
}
const paymentUrl = this.paymentService.getPaymentUrl(checkout, 'page', config);

Using checkout embed component

You can add a checkout form inside your page by adding the <pay-embed-checkout> component in your page. During the payment, the component will notify payment status changes.

###TS

import { Customer, Checkout } from '@totvspag/ng-checkout';

const customer: Customer = {
    country: 'BR',
    lastName: 'Customer last name',
    firstName: 'Customer first name',
    postalCode: '48104-2201',
    locality: 'Ann Arbor',
    district: 'Lagos',
    administrativeArea: 'MI',
    email: '[email protected]',
    street: 'some street',
    streetnumber: '99'
};

const checkout: Checkout = {
    integrationId: 'xxx', // some string that you want use to identify this payment
    amount: {
      totalAmount: '100',
      currency: 'BRL'
    },
    customer // the customer configuration set above

    paymentStatusChange(paymentStatus) {
      // possible paymentStatus
      // 'init', 'running', 'success', 'error', 'expired', 'retry'        
    };

###HTML

<pay-embed-checkout 
    [checkoutInfo]="checkout" // some checkout configuration as shown above
    [config]="config" // this parameter is optional in case you want use a different configuration
    (paymentStatusChange)="paymentStatusChange($event)" >
</pay-embed-checkout>