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

@coindirect/payments

v1.2.34

Published

Coindirect Merchant React Payments SDK

Downloads

58

Readme

Coindirect Payments

Coindirect Merchant React Payments SDK

NPM JavaScript Style Guide

Install

yarn add @coindirect/payments

or

npm install --save @coindirect/payments

Local instalation

npm install
cd /example
npm install

Note: If NPM install fails, you can change 'link' to 'file' in package.json from the example folder.

Overview

This library is used to create payment forms in React for Coindirect.

Go the Coindirect's Merchant Portal for the admin functionality.

Properties

Each in addition to the properties below, each Component has an optional uuid property.

If none is supplied, it will attempt to fetch it from (in order of precedence):

  • the url (like ?uuid={uuid})
  • the session storage.

Payout

Used to initiate pay-out.

| Prop | Type | | :------------------- | :--------- | | confirmPayoutSuccess | () => null | | confirmPayoutFailure | () => null |

PayoutComplete

On pay-out sucessfully completed.

| Prop | Type | | :----------- | :---------------------- | | successPayin | (paymentStatus) => null | | failurePayin | () => null |

Payin

Used to initiate pay-in.

| Prop | Type | | :----------- | :---------------------- | | successPayin | (paymentStatus) => null | | failurePayin | () => null |

Address

Used to display wallet details in the pay-in flow.

| Prop | Type | | :------------ | :---------------------- | | confirm | imageUrl: string | | copy | imageUrl: string | | paymentStatus | (paymentStatus) => null |

Channel

Used to display wallet details in the channel payment flow.

| Prop | Type | | :--------- | :--------------- | | infoIcon | imageUrl: string | | walletIcon | imageUrl: string | | logo | imageUrl: string |

PaymentInProgess

Used to display "in-progress" in the pay-in flow.

| Prop | Type | | :------------ | :---------------------- | | paymentStatus | (paymentStatus) => null |

PayinComplete

On pay-in sucessfully completed.

| Prop | Type | | :------------ | :---------------------- | | paymentStatus | (paymentStatus) => null |

Note on styling

Every class name is prefixed with .cdp--

You can simply overwrite the styling by importing the same classnames in a css file after this line:

import '@coindirect/payments/src/index.css'

Or you could create your own theme.

Sample usage

import React, { Component } from 'react'
import {
  Payout,
  Payin,
  Address,
  PaymentInProgess,
  PayinComplete,
  PayoutComplete,
  ChannelAddress
} from '@coindirect/payments'
import '@coindirect/payments/src/index.css'
import { Switch, Route } from 'react-router-dom'
import { Redirect, withRouter } from 'react-router'
import copy from './copy.svg'
import confirm from './confirm.svg'
import info from './info.svg'
import wallet from './wallet.svg'
import coindirect from './coindirect.svg'

class App extends Component {
  handleConfirmPayout = () => {
    this.props.history.push('confirm')
  }

  paymentStatus = (status) => {
    if (status === 'PROCESSING' && !window.location.pathname.includes('seen')) {
      this.props.history.push('seen')
    } else if (
      status === 'COMPLETE' &&
      !window.location.pathname.includes('done')
    ) {
      this.props.history.push('done')
    }
  }

  handleFailedPayout = () => {
    console.log('Payment Failed')
  }

  handleConfirmPayin = (status) => {
    if (status === 'PENDING') {
      this.props.history.push('address')
    }
  }

  handleFailurePayin = () => {
    console.log('handle failure payin')
  }

  render() {
    return (
      <div className='App'>
        <Switch>
          {/* Payout Routes */}
          <Route exact path='/payout'>
            <Payout
              confirmPayoutSuccess={this.handleConfirmPayout}
              confirmPayoutFailure={this.handleFailedPayout}
            />
          </Route>
          <Route exact path='/confirm' component={() => <PayoutComplete />} />

          {/* Payin Routes */}
          <Route exact path='/payin'>
            <Payin
              successPayin={this.handleConfirmPayin}
              failurePayin={this.handleFailurePayin}
            />
          </Route>
          <Route
            exact
            path='/address'
            component={() => (
              <Address
                paymentStatus={this.paymentStatus}
                copy={copy}
                confirm={confirm}
              />
            )}
          />
          <Route
            exact
            path='/channel'
            component={() => (
              <ChannelAddress
                infoIcon={copy}
                walletIcon={wallet}
                logo={coindirect}
              />
            )}
          />
          <Route
            exact
            path='/seen'
            component={() => (
              <PaymentInProgess paymentStatus={this.paymentStatus} />
            )}
          />
          <Route
            exact
            path='/done'
            component={() => (
              <PayinComplete paymentStatus={this.paymentStatus} />
            )}
          />

          <Redirect from='/' to='/payout' />
        </Switch>
      </div>
    )
  }
}

export default withRouter(App)