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

@utorgapp/deeplinks-generator

v1.0.12

Published

Provides an API for deep link generation. The links are used to onboard users with invoices to UTORG mobile app.

Downloads

28

Readme

Utorg Invoicing Deep links

Provides an API for deep link generation. The links are used to onboard users with invoices to UTORG mobile app.

Installation

npm i @utorg-invoicing/deeplinks-generator
yarn add @utorg-invoicing/deeplinks-generator

Usage

Generate deeplink with fixed crypto amount

import { generateDeepLink } from '@utorg-invoicing/deeplinks-generator'

// User pays 100 USDT (Polygon) 
generateDeepLink(
  'https://link.utorg.com/${template}/${templatePath}',
  {
    address: 'some crypto wallet address',
    externalId: 'merchant-invoice-1',
    merchantId: 'merchant id',
    paymentType: 'crypto',
    amount: 100,
    currency: 'USDT',
    chain: 'POLYGON',
    paymentCurrency: 'EUR',
    paymentMethodId: 'payment method id',
    postbackUrl: 'https://merchant.com/utorg/callback',
    email: '[email protected]',
  }
)
  .then((cryptoDeepLink) => {})
  .catch((error) => {})

Generate deeplink with fixed fiat amount

import { generateDeepLink } from '@utorg-invoicing/deeplinks-generator'

// User pays 200 EUR in USDT (Polygon) 
generateDeepLink(
  'https://link.utorg.com/${template}/${templatePath}',
  {
    address: 'some crypto wallet address',
    externalId: 'merchant-invoice-2',
    postbackUrl: 'https://merchant.com/utorg/callback',
    currency: 'USDT',
    chain: 'POLYGON',
    paymentCurrency: 'EUR',
    email: '[email protected]',
    merchantId: 'merchant id',
    paymentMethodId: 'payment method id',
    paymentType: 'fiat',
    paymentAmount: 200,
  }
)
  .then((fiatDeepLink) => {})
  .catch((error) => {})

Extract options from deep_link_value


const url = 'https://link.utorg.com/${template}/${templatePath}?deep_link_value=N4IghgtgdgLiBcBGADMgNCADmAngQWjiVQzABMyAnBcCygUwGdGQMBjACyhrwDU8AMngByAYQASAUVYg2AV2rwQfPAA0Z2HKIU8AqgBEQAXyA'
const searchParams = new URLSearchParams(new URL(url).search);
const deepLinkValue = searchParams.get('deep_link_value'); // N4IghgtgdgLiBcBGADMgNCADmAngQWjiVQzABMyAnBcCygUwGdGQMBjACyhrwDU8AMngByAYQASAUVYg2AV2rwQfPAA0Z2HKIU8AqgBEQAXyA

parseDeepLinkValue(deepLinkValue)
  .then((options) => {
    const crypto = `${options.currency} (${options.chain})`
    if (options.paymentType === 'crypto') {
        return `User pays ${options.amount} ${crypto}`
    }
    return `User pays ${options.paymentAmount} ${options.paymentCurrency} in ${crypto}`
  })
  .catch((err) => {
    console.error('deep link parsing error', err)
  })

API

generateDeepLink

async function generateDeepLink(
  baseUrl: string,
  options: DeepLinkOptions,
  attributes: Record<string, string> = {}
): Promise<string> {}

Appends compressed and encoded options string as deep_link_value query param to the baseUrl. Attributes are reserved for AppsFlyer OneLink attributes and added without compression

Rejects a promise if options are invalid

Deep link example: https://link.utorg.com/${template}/${templatePath}?deep_link_value=N4IghgtgdgLiBcBGADMgNCADmAngQWjiVQzABMyAnBcCygUwGdGQMBjACyhrwDU8AMngByAYQASAUVYg2AV2rwQfPAA0Z2HKIU8AqgBEQAXyA

  • baseUrl - https://link.utorg.com/${template}/${templatePath} where template and templatePath determine the way the link will be handled by the UTORG app. Please contact support to get the template values.
  • options - deep links options object

| | Mandatory | Type | Description | |---------------------------------|-----------|--------------------|----------------------------------------------------------------------------------------------------| | address | true | string | Crypto wallet address of a customer | | currency * | true | string | Payment crypto currency | | chain * | true | string | Payment blockchain | | paymentType | true | 'fiat' or 'crypto' | Specifies the payment amount type | | paymentAmount or amount | true | number | If paymentType is 'fiat' then paymentAmount should be passed. For 'crypto' pass amount | | externalId * | true | string | Invoice identifier prvided by merchant | | merchantId * | true | string | Merchant's identifier | | postbackUrl * | false | string | A URL for sending data via postback | | paymentCurrency * | false | string | Payment fiat currency | | email | false | string | Customer's email | | paymentMethodId * | false | string | Payment method external identifier |

 * Please contact support to get specific values

parseDeepLinkValue

function parseDeepLinkValue(deepLinkValue: string): Promise<DeepLinkOptions> {}

Parses the value of deep_link_value to an object shaped as DeepLinkOptions

Support

If any questions occur please contact us [email protected]

License

MIT