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

@blabu.com/csobcz_payment_gateway

v0.6.0

Published

CSOB CZ payment gateway module

Downloads

10

Readme

ČSOB CZ payment modules

Source | Gateway documentation

Module for ČSOB CZ payment gateway

Instalation

npm i csobcz_payment_gateway

Configuration

Using environment variables

All keys are strings, for multiline env strings (certificates) check dotenv#rules.

|variable name | description| |--------------|------------| |GATEWAY_URL | payment gateway address| |MERCHANT_PRIVATE_KEY | merchant private key| |MERCHANT_PUBLIC_KEY | merchant public key| |BANK_PUBLIC_KEY | bank public key | |CALLBACK_URL | url called by gateway after payment| |MERCHANT_ID | merchant id from gateway provider|

Alternatively using config:

const { CSOBPaymentModule } = require('csobcz_payment_gateway');

const gateway = new CSOBPaymentModule({
  logging: ...,
  gateUrl:   ...,
  privateKey: ...,
  merchantPublicKey: ...,
  bankPublicKey: ...,
  calbackUrl: ...,
  merchantId: ...,
  payloadTemplate: {}
})

Attribute logging should be boolean or function used for debug info. By setting payloadTemplate can by overwrited more init method payload (see gateway config):

{
  "merchantId": "...",
  "payOperation":"payment",
  "payMethod":"card",
  "currency":"CZK",
  "language":"CZ",
  "returnUrl": "...",
  "returnMethod":"POST"
}

Available methods

  • status(string payId) - returns payment status
  • init(json payload) - payment init
  • reverse(string payId) - reverse payment with given payId
  • close(string payId) - close payment with given payId
  • refund(string payId, int amount) - refund payment with given payId, if amount specified given amount is refunded
  • echo(string method) - echo test, method is either GET or POST (default)
  • verifyResult(json payload) - if success returns payload else returns error, payload is json returned from gateway callback.

Extra methods

  • payOrder(json order, boolean close, json options) - wrapper for init and getRedirectUrl, close params is closePayment value, options are merged into request payload order example
{
  "id": "order1",
  "description": "Moje order",
  "items": [{
      "name": "Nákup: vasobchod.cz",
      "quantity": 1,
      "amount": 200,
      "description": "Produkt 1"
  }]
}

allowed is 1-2 items.

  • getRedirectUrl(string payId) - returns gateway url for redirection

Return values/format

All methods returns Promise when resolved is JSON payload specified in Gateway documentation only Extra methods returns custom payload. Reject is JS Error.

  • payOrder, getRedirectUrl - returned JSON
{
  "url": "https://api.platebnibrana.csob.cz/api/v1.7/payment/process/MERCHANDID/PAYID/20180504105513/KZr8D0z%2FVYFlX2fy0bs2NTafv...."
}

Example usage

const gateway = require('csobcz_payment_gateway');

gateway.echo('GET').then(result => {
  logger.log(result);
}).catch(e => {
  logger.error(e);
});