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

@bigbinary/neeto-payments-frontend

v3.0.25

Published

To manage payments across the neeto products.

Downloads

3,837

Readme

neeto-payments-nano

The neeto-payments-nano manages payments across neeto products. The nano exports the @bigbinary/neeto-payments-frontend NPM package and neeto-payments-engine Rails engine for development.

Contents

  1. Development with Host Application
  2. Instructions for Publishing

Development with Host Application

Engine

The engine is used to manage payments across neeto products.

Installation

  1. Add this line to your application's Gemfile:

    source "NEETO_GEM_SERVER_URL" do
       # ..existing gems
    
       gem 'neeto-payments-engine'
    end
  2. And then execute:

    bundle install
  3. Add this line to your application's config/routes.rb file:

    mount NeetoPaymentsEngine::Engine, at: '/payments'
  4. Configure the following environment variables.

    APP_URL=#Application URL
    STRIPE_PUBLISHABLE_KEY='pk_test_fnFiGXjRkMXnLkueiNKJidGU00V83aRC0V'
    STRIPE_SECRET_KEY='sk_test_eyKnYYoSDcvojBAiFoDv3QJQ00z0yOlt89'

    NB: Replace APP_URL environment variable value with the host application's base URL without a trailing slash for example: https://app.neetocal.net. Stripe environment variables values are test mode keys.

  5. Run the following command to subscribe Stripe webhooks events.

    bundle exec rails neeto_payments_engine:stripe:webhooks:subscribe
    • After successful subscription, the above command will return the list of events subscribed and the details of environment variable.
    • Sample output
        *** Successfully subscribed for webhooks ***
        Please add the following environment variable
        STRIPE_WEBHOOK_SECRET='whsec_06LHs3IOmLOgEzXDm3otErje8I4Q15ME'
        ==============================================
        Subscribed events: [
           "account.updated",
           "payment_intent.payment_failed",
           "payment_intent.processing",
           "payment_intent.succeeded",
           "charge.refund.updated",
           "charge.refunded"
        ]
    • Add the returned environment variable and its value.
  6. Add the following secret values to config/secrets.yml.

    host: <%= ENV['APP_URL'] || ENV['HEROKU_APP_URL'] %>
    stripe:
      publishable_key: <%= ENV['STRIPE_PUBLISHABLE_KEY'] %>
      secret_key: <%= ENV['STRIPE_SECRET_KEY'] %>
      webhooks:
        secret: <%= ENV['STRIPE_WEBHOOK_SECRET'] %>
  7. Add the following line to application's config/initializer/neeto_payments_engine.rb file. Replace the holdable_class value with a model name where you want to associate your Stripe account in the host application.

    NeetoPaymentsEngine.holdable_class = "Organization"
  8. Add the following association to the model you defined as holdable_class in step 7.

    has_one :stripe_integration, class_name: "::NeetoPaymentsEngine::Stripe::Account", foreign_key: :holdable_id
  9. Add the following association to the chargeable model. The chargeable model is the model in the host application which needs to charge for its service. For example Meeting model in neetoCal where meeting service is a chargeable one.

    has_one :charge, as: :chargeable, class_name: "::NeetoPaymentsEngine::Stripe::Charge", dependent: :destroy
  10. Add the following association to the payable model.

    has_one :payment, as: :payable, class_name: "::NeetoPaymentsEngine::Stripe::Transaction", dependent: :destroy
  11. Add the following queue to your sidekiq config file config/sidekiq.yml

    queues:
      - payment # For neeto-payments-engine

Usage

You can learn more about setup and usage here:

  1. Services
  2. Stripe integration
  3. Razorpay integration
  4. Stripe payment
  5. Razorpay payment

Frontend package

Installation

  1. Install the latest neeto-payments-frontend package using the below command:
    yarn add @bigbinary/neeto-payments-frontend
  2. neeto-payments-frontend has a few peer dependencies that are required for the proper functioning of the package. Install all the peer dependencies using the below command:
    yarn add @bigbinary/[email protected] @bigbinary/[email protected] @bigbinary/[email protected] @bigbinary/[email protected] @bigbinary/[email protected] @honeybadger-io/[email protected] @honeybadger-io/[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected]

Instructions for development

Check the Frontend package development guide for step-by-step instructions to develop the frontend package.

Components

1. Dashboard (source code)

Props

  • holdableId: To specify the ID of the entity that holds the stripe account. This is an optional prop. If the value is not specified, the current organization ID is taken as the default value while querying for transactions.
  • payableEntityColumns: To specify the columns from the payable entity which need to be additionally displayed. It is an optional prop that defaults to [] if not specified.
  • tabs: To specify the tabs to be displayed in the payments dashboard. It is an optional parameter.
  • headerProps: To specify the props to be passed to the neetoUI Header component used in the Dashboard.

Configuration

  • Refer to the Dashboard section for detailed information on the available configurations for the Dashboard component.

Usage

import React, { useState } from "react";
import { Dashboard } from "@bigbinary/neeto-payments-frontend";

const App = () => {
  const headerProps = {
    className: "w-80",
    // Your header properties
  };

  return (
    <Dashboard
      tabs={["all", "successful"]}
      headerProps={headerProps}
    />
  );
};

export default App;

2. PaymentKindRestrictionAlert (source code)

Props

  • isOpen: To specify whether the Stripe connect restriction alert should be opened or closed.
  • paymentKind: To specify the type of Stripe payment kind for rendering related content to alert either as "standard" or "platform". If Stripe Standard is connected the alert shall forbid Stripe Platform connect and vice versa.
  • onClose: Handler function that is triggered when the disconnect button is clicked.

Usage

import React, { useState } from "react";
import { PaymentKindRestrictionAlert } from "@bigbinary/neeto-payments-frontend";

const App = () => {
  const [isStripePlatformConnectedAlertOpen, setIsStripePlatformConnectedAlertOpen] = useState(false);

  return (
    <PaymentKindRestrictionAlert
      isOpen={isStripePlatformConnectedAlertOpen}
      paymentKind="standard"
      onClose={() => setIsStripePlatformConnectedAlertOpen(false)}
    />
  );
};

export default App;

4. PayoutsDashboard (source code)

Props

  • payoutsPageRoute: The route for the payouts page.
  • isPlatformEnabled: Indicates whether the platform is enabled or not.

Usage

import React from "react";
import { PayoutsDashboard } from "@bigbinary/neeto-payments-frontend";

const App = () => {
  return (
    <PayoutsDashboard
      isPlatformEnabled
      payoutsPageRoute={routes.admin.payment.stripePayouts.show}
    />
  );
};

export default App;

Hooks

1. useStripePromise (source code)

  • This hook is used to generate the stripePromise object to be passed to the stripe <Elements> context. The useStripePromise hook takes a stripe account identifier as input and returns a Promise.
  • Usage in neetoForm.

:memo: Note: STRIPE_PUBLISHABLE_KEY environment variable must be present for this hook to work.

Usage

  const stripeAccountIdentifier = "acct_1Mtqtz2e5McIywz4";
  const stripePromise = useStripePromise(stripeAccountIdentifier);
  ...
  <Elements stripe={stripePromise}>
    <CardElement />
  </Elements>

Functions

1. buildStripeTransactionLink (source code)

  • This function is used to generate the stripe transaction link from payment identifier.

Parameters

  1. identifier: The payment identifier.
  2. isLive: Specifying whether or not the environment is live. It defaults to true.

Usage

const transactionLink = buildStripeTransactionLink(
  "pi_3MqWX92fKivMPpZ11EPmOBBR",
  false
);

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.