# vub-ecard

> VUB eCard extension

Latest version **1.0.0** (published 2021-11-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install vub-ecard
pnpm add vub-ecard
yarn add vub-ecard
bun add vub-ecard
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-11-24 |
| First published | 2021-11-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 32 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | For Best Clients, s.r.o. |
| Maintainers | vubbank |
| Keywords | VUB, eCard, VUB payments, VUB eCard |

## Links

- npm: https://www.npmjs.com/package/vub-ecard
- npm.io page: https://npm.io/package/vub-ecard

## Dependencies (1)

- [sha.js](https://npm.io/package/sha.js.md) ^2.4.11

## Recent versions

- 1.0.0 (latest) — 2021-11-24

## README

[![vub.sk](https://user-images.githubusercontent.com/40350798/137112594-2fdc703f-5c14-4ab1-b956-f058120f0603.png)](https://www.vub.sk/en)

# VUB eCard nodejs
Package to use [VUB eCard payment](https://www.vub.sk/en/companies-entrepreneurs/products-services/electronic-banking/ecard/) platform easily in nodejs application 

## Installation
Using npm:

```sh
npm i @forbestclients/vub-ecard
```

## Usage
In Node.js:

### Initialization
```js
const VubEcard = require('@forbestclients/vub-ecard').default;

const vub = new VubEcard('CLIENT_ID', 'STORE_KEY');
```

### Initialize with config object

The package can be initialized with several options:

```js
const VubEcard = require('@forbestclients/vub-ecard').default;

const vub = new VubEcard('CLIENT_ID', 'STORE_KEY', {
    test: true,
    currency: 978,
    transactionType: 'Auth',
    language: 'sk',
    storeType: '3d_pay_hosting'
});
```

| Option            | Default                         | Description   |
| ----------------- | ------------------------------- | ----------------------- |
| `test`            | `false`                         | Tells if you want to use production or test interface of payment gateway |
| `currency`        | 978                             | Currency ISO 4217 numeric code |
| `transactionType` | `TransactionTypes.Auth`         | Transaction type (authorization or pre-autuhorization) |
| `language`        | `Languages.SK`                  | Language used on payment gateway|
| `storeType`       | `StoreTypes.Secure3DPayHosting` | Payment model od merchant |

### Generate payment button
```js
vub.setOrder('ORD123456' /* ORDER ID */, 10.99 /* ORDER PRICE */);
vub.setCallbackSuccessUrl('http://yourpage.domain/ok');
vub.setCallbackErrorUrl('http://yourpage.domain/fail');

vub.generateForm();
```

### Change button text
```js
vub.generateForm([], {}, { value: 'proceed to payment' })
```

### Validate response
```js
vub.validateResponse(POST_DATA)
```
 Note: you can get validation errors by calling `vub.getError()`

## Package created by

[![forbestclients.com](https://www.grandus.sk/images/forbestclients.png)](https://www.grandus.sk) \
eshops, programming, consultations

---
_Source: https://npm.io/package/vub-ecard · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
