Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@luchalupa/csobcz_payment_gateway

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luchalupa/csobcz_payment_gateway

CSOB CZ payment gateway module

  • 0.7.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ČSOB CZ payment modules npm npm type definitions

Source | Gateway documentation

Module for ČSOB CZ payment gateway, supports gateway version 1.9 (although not all features are yet implemented)

Instalation

npm install @luchalupa/csobcz_payment_gateway

Configuration

Using environment variables

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

variable namedescription
GATEWAY_URLpayment gateway address
MERCHANT_PRIVATE_KEYmerchant private key
MERCHANT_PUBLIC_KEYmerchant public key
BANK_PUBLIC_KEYbank public key
CALLBACK_URLurl called by gateway after payment
MERCHANT_IDmerchant 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
  • googlePayInit(json payload) - GooglePay payment init
  • applePayInit(json payload) - ApplePay payment init
  • oneClickInit(json payload) - OneClick 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.
  • getRedirectUrl(string payId) - returns url to gateway
  • processAppPayment("applepay" | "googlepay" type, string payId, object fingerprint) - processes google or apple payment
  • processOneClickPayment(string payId) - processes oneClick paymment

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)
	})

FAQs

Package last updated on 10 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc